diff --git a/examples/geometry/primitives/ClickCube.js b/examples/geometry/primitives/ClickCube.js index acb7af1e..e90c325d 100644 --- a/examples/geometry/primitives/ClickCube.js +++ b/examples/geometry/primitives/ClickCube.js @@ -2,9 +2,9 @@ * @author mr.doob / http://mrdoob.com/ */ -var ClickCube = function (width, height, depth, onSelect) { +var ClickCube = function ( width, height, depth, onSelect ) { - THREE.Geometry.call(this); + THREE.Geometry.call( this ); var scope = this, width_half = width / 2, @@ -21,21 +21,23 @@ var ClickCube = function (width, height, depth, onSelect) { v( -width_half, height_half, depth_half ); f4( 0, 1, 2, 3 ); - + f4( 4, 7, 6, 5 ); f4( 0, 4, 5, 1 ); f4( 2, 6, 7, 3 ); f4( 1, 5, 6, 2 ); f4( 4, 0, 3, 7 ); - function v(x, y, z) { + function v( x, y, z ) { scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) ); } - function f4(a, b, c, d) { + function f4( a, b, c, d ) { + var f = new THREE.SelectableFace4( a, b, c, d, onSelect ); - scope.faces.push(f); + scope.faces.push( f ); + } this.computeCentroids(); diff --git a/examples/geometry/primitives/Sphere.js b/examples/geometry/primitives/Sphere.js index b311342a..2df17179 100644 --- a/examples/geometry/primitives/Sphere.js +++ b/examples/geometry/primitives/Sphere.js @@ -70,36 +70,47 @@ var Sphere = function ( radius, segments_width, segments_height, smooth ) { var aP4uv = new THREE.UV( 1 - fI0, fJ1 ); if ( j < ( aVtc.length - 1 ) ) { - n1 = this.vertices[aP1].position.clone(); - n2 = this.vertices[aP2].position.clone(); - n3 = this.vertices[aP3].position.clone(); - n1.normalize(); - n2.normalize(); - n3.normalize(); - if ( smooth ) - this.faces.push( new THREE.Face3( aP1, aP2, aP3, [new THREE.Vector3(n1.x,n1.y,n1.z), new THREE.Vector3(n2.x,n2.y,n2.z), new THREE.Vector3(n3.x,n3.y,n3.z)] ) ); - else - this.faces.push( new THREE.Face3( aP1, aP2, aP3 ) ); - + n1 = this.vertices[ aP1 ].position.clone(); + n2 = this.vertices[ aP2 ].position.clone(); + n3 = this.vertices[ aP3 ].position.clone(); + n1.normalize(); + n2.normalize(); + n3.normalize(); + + if ( smooth ) { + + this.faces.push( new THREE.Face3( aP1, aP2, aP3, [ new THREE.Vector3( n1.x, n1.y, n1.z ), new THREE.Vector3( n2.x, n2.y, n2.z ), new THREE.Vector3( n3.x, n3.y, n3.z ) ] ) ); + + } else { + + this.faces.push( new THREE.Face3( aP1, aP2, aP3 ) ); + + } + this.uvs.push( [ aP1uv, aP2uv, aP3uv ] ); } if ( j > 1 ) { - n1 = this.vertices[aP1].position.clone(); - n2 = this.vertices[aP3].position.clone(); - n3 = this.vertices[aP4].position.clone(); - n1.normalize(); - n2.normalize(); - n3.normalize(); + n1 = this.vertices[aP1].position.clone(); + n2 = this.vertices[aP3].position.clone(); + n3 = this.vertices[aP4].position.clone(); + n1.normalize(); + n2.normalize(); + n3.normalize(); + + if ( smooth ) { + + this.faces.push( new THREE.Face3( aP1, aP3, aP4, [ new THREE.Vector3( n1.x, n1.y, n1.z ), new THREE.Vector3( n2.x, n2.y, n2.z ), new THREE.Vector3( n3.x, n3.y, n3.z ) ] ) ); + + } else { + + this.faces.push( new THREE.Face3( aP1, aP3, aP4 ) ); + + } - if ( smooth ) - this.faces.push( new THREE.Face3( aP1, aP3, aP4, [new THREE.Vector3(n1.x,n1.y,n1.z), new THREE.Vector3(n2.x,n2.y,n2.z), new THREE.Vector3(n3.x,n3.y,n3.z)] ) ); - else - this.faces.push( new THREE.Face3( aP1, aP3, aP4 ) ); - this.uvs.push( [ aP1uv, aP3uv, aP4uv ] ); } diff --git a/examples/geometry_earth.html b/examples/geometry_earth.html index 90b31b50..6baac7c7 100644 --- a/examples/geometry_earth.html +++ b/examples/geometry_earth.html @@ -65,7 +65,7 @@ container = document.getElementById( 'container' ); - camera = new THREE.Camera( 60, SCREEN_WIDTH / SCREEN_HEIGHT, 0.0001, 10000 ); + camera = new THREE.Camera( 60, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 10000 ); camera.position.z = 500; scene = new THREE.Scene(); @@ -81,12 +81,12 @@ renderer = new THREE.CanvasRenderer(); renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT ); - container.appendChild(renderer.domElement); + container.appendChild( renderer.domElement ); stats = new Stats(); stats.domElement.style.position = 'absolute'; stats.domElement.style.top = '0px'; - container.appendChild(stats.domElement); + container.appendChild( stats.domElement ); document.addEventListener('mousemove', onDocumentMouseMove, false); diff --git a/examples/geometry_terrain.html b/examples/geometry_terrain.html index 1dd44541..160d7033 100644 --- a/examples/geometry_terrain.html +++ b/examples/geometry_terrain.html @@ -34,6 +34,7 @@