浏览代码

Determine BufferGeometry attribute numItems automatically.

Tapio Vierros 12 年之前
父节点
当前提交
9ba0ec41da
共有 2 个文件被更改,包括 12 次插入0 次删除
  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 ];
 			attribute = geometry.attributes[ a ];
 
 
+			if ( attribute.numItems === undefined ) {
+
+				attribute.numItems = attribute.array.length;
+
+			}
+
 			attribute.buffer = _gl.createBuffer();
 			attribute.buffer = _gl.createBuffer();
 
 
 			_gl.bindBuffer( type, attribute.buffer );
 			_gl.bindBuffer( type, attribute.buffer );

+ 6 - 0
src/renderers/WebGLRenderer2.js

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