Explorar o código

BufferGeometry: Removed remaining numItems usage.

Mr.doob %!s(int64=11) %!d(string=hai) anos
pai
achega
edf14d2e6a

+ 4 - 4
examples/js/loaders/UTF8Loader.js

@@ -98,10 +98,10 @@ THREE.UTF8Loader.BufferGeometryCreator.prototype.create = function ( attribArray
 
 	var attributes = geometry.attributes;
 
-	attributes[ "index" ]    = { itemSize: 1, array: indexArray, numItems: indexArray.length };
-	attributes[ "position" ] = { itemSize: 3, array: positionArray, numItems: positionArray.length };
-	attributes[ "normal" ]   = { itemSize: 3, array: normalArray, numItems: normalArray.length };
-	attributes[ "uv" ] 		 = { itemSize: 2, array: uvArray, numItems: uvArray.length };
+	attributes[ "index" ]    = { itemSize: 1, array: indexArray };
+	attributes[ "position" ] = { itemSize: 3, array: positionArray };
+	attributes[ "normal" ]   = { itemSize: 3, array: normalArray };
+	attributes[ "uv" ] 		 = { itemSize: 2, array: uvArray };
 
 	// create offsets
 	// (all triangles should fit in a single chunk)

+ 5 - 5
examples/js/loaders/ctm/CTMLoader.js

@@ -417,24 +417,24 @@ THREE.CTMLoader.prototype.createModelBuffers = function ( file, callback ) {
 		// attributes
 		var attributes = scope.attributes;
 
-		attributes[ "index" ]    = { itemSize: 1, array: vertexIndexArray16, numItems: vertexIndexArray16.length };
-		attributes[ "position" ] = { itemSize: 3, array: vertexPositionArray, numItems: vertexPositionArray.length };
+		attributes[ "index" ]    = { itemSize: 1, array: vertexIndexArray16 };
+		attributes[ "position" ] = { itemSize: 3, array: vertexPositionArray };
 
 		if ( vertexNormalArray !== undefined ) {
 
-			attributes[ "normal" ] = { itemSize: 3, array: vertexNormalArray, numItems: vertexNormalArray.length };
+			attributes[ "normal" ] = { itemSize: 3, array: vertexNormalArray };
 
 		}
 
 		if ( vertexUvArray !== undefined ) {
 
-			attributes[ "uv" ] = { itemSize: 2, array: vertexUvArray, numItems: vertexUvArray.length };
+			attributes[ "uv" ] = { itemSize: 2, array: vertexUvArray };
 
 		}
 
 		if ( vertexColorArray !== undefined ) {
 
-			attributes[ "color" ]  = { itemSize: 4, array: vertexColorArray, numItems: vertexColorArray.length };
+			attributes[ "color" ]  = { itemSize: 4, array: vertexColorArray };
 
 		}
 

+ 0 - 1
src/core/BufferGeometry.js

@@ -581,7 +581,6 @@ THREE.BufferGeometry.prototype = {
 			var attribute = {
 
 				itemSize: sourceAttr.itemSize,
-				numItems: sourceAttr.numItems,
 				array: null
 
 			};

+ 7 - 13
src/renderers/WebGLRenderer.js

@@ -1073,12 +1073,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			attribute = geometry.attributes[ a ];
 
-			if ( attribute.numItems === undefined ) {
-
-				attribute.numItems = attribute.array.length;
-
-			}
-
 			attribute.buffer = _gl.createBuffer();
 
 			_gl.bindBuffer( type, attribute.buffer );
@@ -2706,11 +2700,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				// render non-indexed triangles
 
-				_gl.drawArrays( _gl.TRIANGLES, 0, position.numItems / 3 );
+				_gl.drawArrays( _gl.TRIANGLES, 0, position.array.length / 3 );
 
 				_this.info.render.calls ++;
-				_this.info.render.vertices += position.numItems / 3;
-				_this.info.render.faces += position.numItems / 3 / 3;
+				_this.info.render.vertices += position.array.length / 3;
+				_this.info.render.faces += position.array.length / 3 / 3;
 
 			}
 
@@ -2758,10 +2752,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			// render particles
 
-			_gl.drawArrays( _gl.POINTS, 0, position.numItems / 3 );
+			_gl.drawArrays( _gl.POINTS, 0, position.array.length / 3 );
 
 			_this.info.render.calls ++;
-			_this.info.render.points += position.numItems / 3;
+			_this.info.render.points += position.array.length / 3;
 
 		} else if ( object instanceof THREE.Line ) {
 
@@ -2818,9 +2812,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				var position = geometryAttributes[ "position" ];
 
-				_gl.drawArrays( primitives, 0, position.numItems / 3 );
+				_gl.drawArrays( primitives, 0, position.array.length / 3 );
 				_this.info.render.calls ++;
-				_this.info.render.points += position.numItems;
+				_this.info.render.points += position.array.length;
 			}