提交 c7cd3273 编写于 作者: M Mr.doob

Cleaned up spline editor example.

上级 4de44644
...@@ -82,33 +82,29 @@ ...@@ -82,33 +82,29 @@
var planeGeometry = new THREE.PlaneGeometry( 2000, 2000, 20, 20 ); var planeGeometry = new THREE.PlaneGeometry( 2000, 2000, 20, 20 );
planeGeometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) ); planeGeometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
var planeMaterials = [ new THREE.MeshBasicMaterial( { var planeMaterial = new THREE.MeshBasicMaterial( { color: 0xeeeeee } );
color: 0xeeeeee,
opacity: 0.5 var plane = new THREE.Mesh( planeGeometry, planeMaterial );
} ), new THREE.MeshBasicMaterial( {
color: 0x405040,
wireframe: true,
opacity: 0.2,
transparent: true
} ) ];
var plane = THREE.SceneUtils.createMultiMaterialObject( planeGeometry, planeMaterials );
plane.position.y = -200; plane.position.y = -200;
plane.children[ 0 ].castShadow = false; plane.receiveShadow = true;
plane.children[ 0 ].receiveShadow = true;
scene.add( plane ); scene.add( plane );
var helper = new THREE.GridHelper( 1000, 100 );
helper.position.y = - 199;
helper.material.opacity = 0.25;
helper.material.transparent = true;
scene.add( helper );
var axis = new THREE.AxisHelper(); var axis = new THREE.AxisHelper();
axis.position.set( -500, -500, -500 ); axis.position.set( -500, -500, -500 );
scene.add( axis ); scene.add( axis );
renderer = new THREE.WebGLRenderer( { renderer = new THREE.WebGLRenderer( { antialias: true } );
antialias: true
} );
renderer.setClearColor( 0xf0f0f0 ); renderer.setClearColor( 0xf0f0f0 );
renderer.setSize( window.innerWidth, window.innerHeight ); renderer.setSize( window.innerWidth, window.innerHeight );
renderer.shadowMapEnabled = true; renderer.shadowMap.enabled = true;
renderer.shadowMapSoft = true;
container.appendChild( renderer.domElement ); container.appendChild( renderer.domElement );
var info = document.createElement( 'div' ); var info = document.createElement( 'div' );
info.style.position = 'absolute'; info.style.position = 'absolute';
info.style.top = '10px'; info.style.top = '10px';
...@@ -130,6 +126,7 @@ ...@@ -130,6 +126,7 @@
container.appendChild( info ); container.appendChild( info );
container.appendChild( options ); container.appendChild( options );
stats = new Stats(); stats = new Stats();
stats.domElement.style.position = 'absolute'; stats.domElement.style.position = 'absolute';
stats.domElement.style.top = '0px'; stats.domElement.style.top = '0px';
...@@ -170,7 +167,7 @@ ...@@ -170,7 +167,7 @@
} ); } );
var dragcontrols = new THREE.DragControls( camera, splineHelperObjects, renderer.domElement ); // var dragcontrols = new THREE.DragControls( camera, splineHelperObjects, renderer.domElement ); //
dragcontrols.on( 'hoveron', function( e ) { dragcontrols.on( 'hoveron', function( e ) {
...@@ -259,6 +256,7 @@ ...@@ -259,6 +256,7 @@
opacity: 0.35, opacity: 0.35,
linewidth: 2 linewidth: 2
} ) ); } ) );
curve.mesh.castShadow = true;
splines.uniform = curve; splines.uniform = curve;
curve = new THREE.CatmullRomCurve3( positions ); curve = new THREE.CatmullRomCurve3( positions );
...@@ -268,6 +266,7 @@ ...@@ -268,6 +266,7 @@
opacity: 0.35, opacity: 0.35,
linewidth: 2 linewidth: 2
} ) ); } ) );
curve.mesh.castShadow = true;
splines.centripetal = curve; splines.centripetal = curve;
curve = new THREE.CatmullRomCurve3( positions ); curve = new THREE.CatmullRomCurve3( positions );
...@@ -277,6 +276,7 @@ ...@@ -277,6 +276,7 @@
opacity: 0.35, opacity: 0.35,
linewidth: 2 linewidth: 2
} ) ); } ) );
curve.mesh.castShadow = true;
splines.chordal = curve; splines.chordal = curve;
for ( var k in splines ) { for ( var k in splines ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册