在three.js中正确渲染LatheGeometry

时间:2017-07-16 15:25:05

标签: javascript 3d three.js

我正在开展一个小方案,我不知道如何在three.js中正确渲染LatheGeometry形状。我已尝试过其他形状,我可以毫不费力地操纵它们。这是我的代码(几乎是文档中的首发示例):

    var scene = new THREE.Scene();
    var points = [];
    for ( var i = 0; i < 10; i ++ ) {
        points.push( new THREE.Vector2( Math.sin( i * 0.2 ) * 10 + 5, ( i - 5 ) * 2 ) );
    }
    var geometry = new THREE.LatheBufferGeometry( points );
    var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
    var lathe = new THREE.Mesh( geometry, material );

    var camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 1000 );

    var renderer = new THREE.WebGLRenderer();
    renderer.setSize( window.innerWidth, window.innerHeight );
    document.body.appendChild( renderer.domElement );

    scene.add( lathe );


    camera.position.z = 5;

0 个答案:

没有答案