Parcourir la source

Determine BufferGeometry attribute numItems automatically.

Tapio Vierros il y a 12 ans
Parent
commit
9ba0ec41da
2 fichiers modifiés avec 12 ajouts et 0 suppressions
  1. 6 0
      src/renderers/WebGLRenderer.js
  2. 6 0
      src/renderers/WebGLRenderer2.js

+ 6 - 0
src/renderers/WebGLRenderer.js

@@ -1150,6 +1150,12 @@ 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 );

+ 6 - 0
src/renderers/WebGLRenderer2.js

@@ -462,6 +462,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			attribute = geometry.attributes[ a ];
 
+			if ( attribute.numItems === undefined ) {
+
+				attribute.numItems = attribute.array.length;
+
+			}
+
 			attribute.buffer = renderer.createBuffer();
 
 			if ( a === "index" ) {