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

Examples that used Torus_bin now use TorusGeometry.

上级 7c7d4428
......@@ -105,6 +105,12 @@
}
// Torus
mesh = new THREE.Mesh( new THREE.TorusGeometry( 100, 25, 15, 30 ), new THREE.MeshLambertMaterial( { color: 0xffffff } ) );
mesh.overdraw = true;
scene.addObject( mesh );
// Lights
var ambient = new THREE.AmbientLight( 0x101010 );
......@@ -163,27 +169,8 @@
bcanvas.addEventListener("click", toggleCanvas, false);
bwebgl.addEventListener("click", toggleWebGL, false);
//var loader = new THREE.JSONLoader();
//loader.load( { model: "obj/torus/Torus_slim.js", callback: function( geometry ) { createMesh( geometry ) } } );
var loader = new THREE.BinaryLoader();
loader.load( { model: "obj/torus/Torus_bin.js", callback: function( geometry ) { createMesh( geometry ) } } );
}
function createMesh( geometry ) {
zmesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0xffffff } ) );
zmesh.position.x = zmesh.position.y = zmesh.position.z = 0;
zmesh.scale.x = zmesh.scale.y = zmesh.scale.z = 100;
zmesh.overdraw = true;
zmesh.updateMatrix();
scene.addObject( zmesh );
}
function onDocumentMouseMove( event ) {
mouseX = ( event.clientX - windowHalfX );
......@@ -215,7 +202,7 @@
if ( i%3 == 1 )
scene.objects[i].rotation.x += 0.05;
scene.objects[i].rotation.z += 0.05;
else if ( i%3 == 2 )
......@@ -223,7 +210,7 @@
else if ( i%3 == 0 )
scene.objects[i].rotation.z += 0.05;
scene.objects[i].rotation.x += 0.05;
}
......
<Files *.js>
SetOutputFilter DEFLATE
</Files>
此差异已折叠。
// Converted from: ../../examples/obj/torus/Torus.obj
// vertices: 576
// faces: 576
// materials: 1
//
// Generated with OBJ -> Three.js converter
// http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
var model = {
"version" : 1,
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "(null)"
}],
"buffers": "Torus_bin.bin"
};
postMessage( model );
close();
此差异已折叠。
......@@ -156,8 +156,7 @@
quad.position.z = -100;
sceneRTT.addObject( quad );
var loader = new THREE.BinaryLoader();
loader.load( { model: "obj/torus/Torus_bin.js", callback: function( geometry ) { createMesh( geometry, sceneRTT ) } } );
createMesh( new THREE.TorusGeometry( 100, 25, 15, 30 ), sceneRTT );
quad = new THREE.Mesh( plane, materialScreen );
quad.position.z = -100;
......@@ -205,14 +204,14 @@
zmesh1.position.x = 0;
zmesh1.position.y = 0;
zmesh1.position.z = 100;
zmesh1.scale.x = zmesh1.scale.y = zmesh1.scale.z = 150;
zmesh1.scale.x = zmesh1.scale.y = zmesh1.scale.z = 1.5;
xscene.addObject( zmesh1 );
zmesh2 = new THREE.Mesh( geometry, mat2 );
zmesh2.position.x = 0;
zmesh2.position.y = 150;
zmesh2.position.z = 100;
zmesh2.scale.x = zmesh2.scale.y = zmesh2.scale.z = 75;
zmesh2.scale.x = zmesh2.scale.y = zmesh2.scale.z = 0.75;
xscene.addObject( zmesh2 );
}
......@@ -244,11 +243,8 @@
if ( zmesh1 && zmesh2 ) {
zmesh1.rotation.x = 1.57;
zmesh1.rotation.z = time;
zmesh2.rotation.z = 1.57;
zmesh2.rotation.y = -time;
zmesh1.rotation.y = - time;
zmesh2.rotation.y = - time + Math.PI / 2;
}
......
......@@ -133,7 +133,7 @@ THREE.Vector2.prototype = {
return this.divideScalar( this.length() );
},
distanceTo: function ( v ) {
return Math.sqrt( this.distanceToSquared( v ) );
......@@ -154,18 +154,6 @@ THREE.Vector2.prototype = {
},
// deprecated: same as normalize
unit: function () {
return this.normalize();
},
// danger, works only on numbers which are exactly the same
// (which may be not what is expected thanks to floating point precision)
// (should be probably using some tiny epsilon instead of equality)
equals: function( v ) {
return ( ( v.x == this.x ) && ( v.y == this.y ) );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册