提交 80876074 编写于 作者: Z zz85

Prevent BufferGeometry custom attributes's array from being deleted by setting...

Prevent BufferGeometry custom attributes's array from being deleted by setting geometry.attributes.name.dynamic = true
上级 f3106269
......@@ -138,7 +138,7 @@
var radius = 200;
geometry = new THREE.BufferGeometry();
geometry.dynamic = true;
// geometry.dynamic = true;
geometry.attributes = {
position: {
......@@ -154,7 +154,8 @@
size: {
itemSize: 1,
array: new Float32Array( particles ),
numItems: particles * 1
numItems: particles * 1,
dynamic: true
},
}
......@@ -166,7 +167,6 @@
sphere = new THREE.ParticleSystem( geometry, shaderMaterial );
sphere.dynamic = true;
//sphere.sortParticles = true;
var color = new THREE.Color( 0xffaa00 );;
......
......@@ -3244,29 +3244,27 @@ THREE.WebGLRenderer = function ( parameters ) {
attributeItem = attributes[ attributeName ];
if ( ! attributeItem.needsUpdate ) continue;
if ( attributeItem.needsUpdate ) {
if ( attributeName === 'index' ) {
if ( attributeName === 'index' ) {
_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, attributeItem.buffer );
_gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, attributeItem.array, hint );
_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, attributeItem.buffer );
_gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, attributeItem.array, hint );
} else {
_gl.bindBuffer( _gl.ARRAY_BUFFER, attributeItem.buffer );
_gl.bufferData( _gl.ARRAY_BUFFER, attributeItem.array, hint );
} else {
}
_gl.bindBuffer( _gl.ARRAY_BUFFER, attributeItem.buffer );
_gl.bufferData( _gl.ARRAY_BUFFER, attributeItem.array, hint );
attributeItem.needsUpdate = false;
}
}
attributeItem.needsUpdate = false;
if ( dispose ) {
}
for ( var i in geometry.attributes ) {
if ( dispose && ! attributeItem.dynamic ) {
delete geometry.attributes[ i ].array;
delete attributeItem.array;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册