Prechádzať zdrojové kódy

Cube tweaks reverted. It was yet again a left-handed to right-handed problem.
Would be nice if everyone in the internets used the same coordinate system :P

Mr.doob 15 rokov pred
rodič
commit
0bc79b591b

+ 9 - 9
examples/geometry_vr.html

@@ -65,18 +65,18 @@
 				wireframe = new THREE.MeshBasicMaterial( { color: 0xffffff, opacity: 0, wireframe: true } );
 
 				var context = texture_placeholder.getContext( '2d' );
-				context.fillStyle = 'rgba( 200, 200, 200, 1 )';
+				context.fillStyle = 'rgb( 200, 200, 200 )';
 				context.fillRect( 0, 0, texture_placeholder.width, texture_placeholder.height );
 
 				var materials = [];
-				materials.push( [ loadTexture( 'textures/skymap_px.jpg' ), wireframe ] );
-				materials.push( [ loadTexture( 'textures/skymap_nx.jpg' ), wireframe ] );
-				materials.push( [ loadTexture( 'textures/skymap_py.jpg' ), wireframe ] );
-				materials.push( [ loadTexture( 'textures/skymap_ny.jpg' ), wireframe ] );
-				materials.push( [ loadTexture( 'textures/skymap_pz.jpg' ), wireframe ] );
-				materials.push( [ loadTexture( 'textures/skymap_nz.jpg' ), wireframe ] );
-
-				mesh = new THREE.Mesh( new Cube( 100, 100, 100, 7, 7, materials, true ), new THREE.MeshFaceMaterial() );
+				materials.push( [ loadTexture( 'textures/skymap_px.jpg' ), wireframe ] ); // right
+				materials.push( [ loadTexture( 'textures/skymap_nx.jpg' ), wireframe ] ); // left
+				materials.push( [ loadTexture( 'textures/skymap_py.jpg' ), wireframe ] ); // top
+				materials.push( [ loadTexture( 'textures/skymap_ny.jpg' ), wireframe ] ); // bottom
+				materials.push( [ loadTexture( 'textures/skymap_pz.jpg' ), wireframe ] ); // back
+				materials.push( [ loadTexture( 'textures/skymap_nz.jpg' ), wireframe ] ); // front
+
+				mesh = new THREE.Mesh( new Cube( 300, 300, 300, 7, 7, materials, true ), new THREE.MeshFaceMaterial() );
 				mesh.overdraw = true;
 				scene.addObject( mesh );
 

+ 3 - 3
examples/materials_cubemap_sky.html

@@ -92,9 +92,9 @@
 				}
 
 				var r = "textures/skymap_";
-				var urls = [ r + "right1024.jpg", r + "left1024.jpg", 
-					 r + "top1024.jpg", r + "bottom1024.jpg", 
-					 r + "front1024.jpg", r + "back1024.jpg" ];
+				var urls = [ r + "px.jpg", r + "nx.jpg", 
+					 r + "py.jpg", r + "ny.jpg", 
+					 r + "pz.jpg", r + "nz.jpg" ];
 
 				var images = loadImageArray( urls );
 				var material = new THREE.MeshBasicMaterial( { color: 0xffffff, env_map: new THREE.TextureCube( images ) } );

+ 3 - 3
src/extras/primitives/Cube.js

@@ -11,7 +11,7 @@ var Cube = function ( width, height, depth, segments_width, segments_height, mat
 	width_half = width / 2,
 	height_half = height / 2,
 	depth_half = depth / 2,
-	flip = flipped !== undefined ? - 1 : 1;
+	flip = flipped ? - 1 : 1;
 
 	if ( materials !== undefined ) {
 
@@ -41,8 +41,8 @@ var Cube = function ( width, height, depth, segments_width, segments_height, mat
 	buildPlane( 'z', 'y',   1 * flip, - 1, depth, height, - width_half, this.materials[ 1 ] ); // left
 	buildPlane( 'x', 'z', - 1 * flip, - 1, width, depth, height_half, this.materials[ 2 ] ); // top
 	buildPlane( 'x', 'z', - 1 * flip,   1, width, depth, - height_half, this.materials[ 3 ] ); // bottom
-	buildPlane( 'x', 'y',   1 * flip, - 1, width, height, depth_half, this.materials[ 4 ] ); // front
-	buildPlane( 'x', 'y', - 1 * flip, - 1, width, height, - depth_half, this.materials[ 5 ] ); // back
+	buildPlane( 'x', 'y',   1 * flip, - 1, width, height, depth_half, this.materials[ 4 ] ); // back
+	buildPlane( 'x', 'y', - 1 * flip, - 1, width, height, - depth_half, this.materials[ 5 ] ); // front
 
 	function buildPlane( u, v, udir, vdir, width, height, depth, material ) {