Mr.doob 11 lat temu
rodzic
commit
bb277d166e
3 zmienionych plików z 5 dodań i 98 usunięć
  1. 0 1
      examples/index.html
  2. 0 92
      examples/js/wip/PlaneGeometryB.js
  3. 5 5
      src/core/Projector.js

+ 0 - 1
examples/index.html

@@ -305,7 +305,6 @@
 				"canvas_geometry_shapes",
 				"canvas_geometry_terrain",
 				"canvas_geometry_text",
-				"canvas_geometry2_sandbox",
 				"canvas_interactive_cubes",
 				"canvas_interactive_cubes_tween",
 				"canvas_interactive_lines",

+ 0 - 92
examples/js/wip/PlaneGeometryB.js

@@ -1,92 +0,0 @@
-/**
- * @author mrdoob / http://mrdoob.com/
- * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as
- */
-
-THREE.PlaneGeometryB = function ( width, height, widthSegments, heightSegments ) {
-
-	THREE.BufferGeometry.call( this );
-
-	this.width = width;
-	this.height = height;
-
-	this.widthSegments = widthSegments || 1;
-	this.heightSegments = heightSegments || 1;
-
-	var width_half = width / 2;
-	var height_half = height / 2;
-
-	var gridX = this.widthSegments;
-	var gridY = this.heightSegments;
-
-	var gridX1 = gridX + 1;
-	var gridY1 = gridY + 1;
-
-	var segment_width = this.width / gridX;
-	var segment_height = this.height / gridY;
-
-	var vertices = new Float32Array( gridX1 * gridY1 * 3 );
-	var normals = new Float32Array( gridX1 * gridY1 * 3 );
-	var uvs = new Float32Array( gridX1 * gridY1 * 2 );
-
-	var offset = 0;
-	var offset2 = 0;
-
-	for ( var iy = 0; iy < gridY1; iy ++ ) {
-
-		var y = iy * segment_height - height_half;
-
-		for ( var ix = 0; ix < gridX1; ix ++ ) {
-
-			var x = ix * segment_width - width_half;
-
-			vertices[ offset     ] = x;
-			vertices[ offset + 1 ] = - y;
-
-			normals[ offset + 2 ] = 1;
-
-			uvs[ offset2 ] = ix / gridX;
-			uvs[ offset2 + 1 ] = iy / gridY;
-
-			offset += 3;
-			offset2 += 2;
-
-		}
-
-	}
-
-	var indices = new Uint16Array( gridX * gridY * 6 );
-
-	var offset = 0;
-
-	for ( var iy = 0; iy < gridY; iy ++ ) {
-
-		for ( var ix = 0; ix < gridX; ix ++ ) {
-
-			var a = ix + gridX1 * iy;
-			var b = ix + gridX1 * ( iy + 1 );
-			var c = ( ix + 1 ) + gridX1 * ( iy + 1 );
-			var d = ( ix + 1 ) + gridX1 * iy;
-
-			indices[ offset     ] = a;
-			indices[ offset + 1 ] = b;
-			indices[ offset + 2 ] = d;
-
-			indices[ offset + 3 ] = b;
-			indices[ offset + 4 ] = c;
-			indices[ offset + 5 ] = d;
-
-			offset += 6;
-
-		}
-
-	}
-
-	this.attributes[ 'index' ] = { array: indices, itemSize: 1 };
-	this.attributes[ 'position' ] = { array: vertices, itemSize: 3 };
-	this.attributes[ 'normal' ] = { array: normals, itemSize: 3 };
-	this.attributes[ 'uv' ] = { array: uvs, itemSize: 2 };
-
-};
-
-THREE.PlaneGeometryB.prototype = Object.create( THREE.BufferGeometry.prototype );

+ 5 - 5
src/core/Projector.js

@@ -303,7 +303,7 @@ THREE.Projector = function () {
 
 	this.projectScene = function ( scene, camera, sortObjects, sortElements ) {
 
-		var object, geometry, vertices, faces, face, faceVertexNormals, faceVertexUvs, uvs,
+		var object, geometry, vertices, faces, face, faceVertexNormals, faceVertexUvs,
 		isFaceMaterial, objectMaterials;
 
 		_faceCount = 0;
@@ -537,13 +537,13 @@ THREE.Projector = function () {
 
 						_face.vertexNormalsLength = faceVertexNormals.length;
 
-						uvs = faceVertexUvs[ f ];
+						var vertexUvs = faceVertexUvs[ f ];
 
-						if ( uvs !== undefined ) {
+						if ( vertexUvs !== undefined ) {
 
-							for ( var u = 0, ul = uvs.length; u < ul; u ++ ) {
+							for ( var u = 0; u < 3; u ++ ) {
 
-								_face.uvs[ u ].copy( uvs[ u ] );
+								_face.uvs[ u ].copy( vertexUvs[ u ] );
 
 							}