提交 26b36b38 编写于 作者: M Mr.doob

Merge branch 'auto-buffer-size' of git://github.com/tapio/three.js into dev

......@@ -84,23 +84,19 @@
geometry.attributes = {
index: {
itemSize: 1,
array: new Uint16Array( triangles * 3 ),
numItems: triangles * 3
array: new Uint16Array( triangles * 3 )
},
position: {
itemSize: 3,
array: new Float32Array( triangles * 3 * 3 ),
numItems: triangles * 3 * 3
array: new Float32Array( triangles * 3 * 3 )
},
normal: {
itemSize: 3,
array: new Float32Array( triangles * 3 * 3 ),
numItems: triangles * 3 * 3
array: new Float32Array( triangles * 3 * 3 )
},
color: {
itemSize: 3,
array: new Float32Array( triangles * 3 * 3 ),
numItems: triangles * 3 * 3
array: new Float32Array( triangles * 3 * 3 )
}
}
......
......@@ -143,18 +143,15 @@
position: {
itemSize: 3,
array: new Float32Array( particles * 3 ),
numItems: particles * 3
array: new Float32Array( particles * 3 )
},
customColor: {
itemSize: 3,
array: new Float32Array( particles * 3 ),
numItems: particles * 3
array: new Float32Array( particles * 3 )
},
size: {
itemSize: 1,
array: new Float32Array( particles ),
numItems: particles * 1,
dynamic: true
},
......
......@@ -72,13 +72,11 @@
geometry.attributes = {
position: {
itemSize: 3,
array: new Float32Array(segments * 3),
numItems: segments * 3
array: new Float32Array(segments * 3)
},
color: {
itemSize: 3,
array: new Float32Array(segments * 3),
numItems: segments * 3
array: new Float32Array(segments * 3)
}
};
......
......@@ -73,13 +73,11 @@
position: {
itemSize: 3,
array: new Float32Array( particles * 3 ),
numItems: particles * 3
array: new Float32Array( particles * 3 )
},
color: {
itemSize: 3,
array: new Float32Array( particles * 3 ),
numItems: particles * 3
array: new Float32Array( particles * 3 )
}
}
......
......@@ -187,8 +187,7 @@ THREE.BufferGeometry.prototype = {
this.attributes[ "normal" ] = {
itemSize: 3,
array: new Float32Array( nVertexElements ),
numItems: nVertexElements
array: new Float32Array( nVertexElements )
};
......@@ -371,8 +370,7 @@ THREE.BufferGeometry.prototype = {
this.attributes[ "tangent" ] = {
itemSize: 4,
array: new Float32Array( nTangentElements ),
numItems: nTangentElements
array: new Float32Array( nTangentElements )
};
......
......@@ -1070,6 +1070,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 );
......
......@@ -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" ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册