瀏覽代碼

Fixed TeapotBufferGeometry.

Mr.doob 10 年之前
父節點
當前提交
b7818a43c5
共有 2 個文件被更改,包括 7 次插入7 次删除
  1. 5 5
      examples/js/geometries/TeapotBufferGeometry.js
  2. 2 2
      examples/webgl_buffergeometry_teapot.html

+ 5 - 5
examples/js/geometries/TeapotBufferGeometry.js

@@ -26,7 +26,7 @@
  *
  * Note that the bottom (the last four patches) is not flat - blame Frank Crow, not me.
  *
- * The teapot should normally be rendered as a double sided object, since for some 
+ * The teapot should normally be rendered as a double sided object, since for some
  * patches both sides can be seen, e.g., the gap around the lid and inside the spout.
  *
  * Segments 'n' determines the number of triangles output.
@@ -505,13 +505,13 @@ THREE.TeapotBufferGeometry = function ( size, segments, bottom, lid, body, fitLi
 	var notDegenerate = function ( vtx1, vtx2, vtx3 ) {
 
 		// if any vertex matches, return false
-		return ! ( ( ( vertices[ vtx1 * 3 ]     === vertices[ vtx2 * 3 ] ) && 
+		return ! ( ( ( vertices[ vtx1 * 3 ]     === vertices[ vtx2 * 3 ] ) &&
 					 ( vertices[ vtx1 * 3 + 1 ] === vertices[ vtx2 * 3 + 1 ] ) &&
 					 ( vertices[ vtx1 * 3 + 2 ] === vertices[ vtx2 * 3 + 2 ] ) ) ||
-				   ( ( vertices[ vtx1 * 3 ]     === vertices[ vtx3 * 3 ] ) && 
+				   ( ( vertices[ vtx1 * 3 ]     === vertices[ vtx3 * 3 ] ) &&
 					 ( vertices[ vtx1 * 3 + 1 ] === vertices[ vtx3 * 3 + 1 ] ) &&
 					 ( vertices[ vtx1 * 3 + 2 ] === vertices[ vtx3 * 3 + 2 ] ) ) ||
-				   ( ( vertices[ vtx2 * 3 ]     === vertices[ vtx3 * 3 ] ) && 
+				   ( ( vertices[ vtx2 * 3 ]     === vertices[ vtx3 * 3 ] ) &&
 					 ( vertices[ vtx2 * 3 + 1 ] === vertices[ vtx3 * 3 + 1 ] ) &&
 					 ( vertices[ vtx2 * 3 + 2 ] === vertices[ vtx3 * 3 + 2 ] ) ) );
 
@@ -721,7 +721,7 @@ THREE.TeapotBufferGeometry = function ( size, segments, bottom, lid, body, fitLi
 
 	}
 
-	this.addAttribute( 'index', new THREE.IndexBufferAttribute( indices, 1 ) );
+	this.addIndex( new THREE.BufferAttribute( indices, 1 ) );
 	this.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
 	this.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );
 	this.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) );

+ 2 - 2
examples/webgl_buffergeometry_teapot.html

@@ -161,7 +161,7 @@
 				// skybox scene - keep camera centered here
 				sceneCube = new THREE.Scene();
 				sceneCube.add( skybox );
-				
+
 				// scene itself
 				scene = new THREE.Scene();
 
@@ -364,7 +364,7 @@
 
 					teapot.geometry.dispose();
 					scene.remove( teapot );
-					
+
 				}
 
 				var teapotGeometry = new THREE.TeapotBufferGeometry( teapotSize,