diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index 44ed52d..f319f18 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -17,7 +17,7 @@ * @memberof PIXI * @param renderer {WebGLRenderer} The renderer this sprite batch works for. */ -function ParticleBuffer(gl, properties, size) +function ParticleBuffer(gl, properties, dynamicPropertyFlags, size) { /** * the current WebGL drawing context @@ -40,7 +40,7 @@ this.vertByteSize = this.vertSize * 4; /** - * The number of images in the SpriteBatch before it flushes. + * The number of particles the buffer can hold * * @member {number} */ @@ -64,7 +64,7 @@ { var property = properties[i]; - if(property.dynamic) + if(dynamicPropertyFlags[i]) { this.dynamicProperties.push(property); } diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index 44ed52d..f319f18 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -17,7 +17,7 @@ * @memberof PIXI * @param renderer {WebGLRenderer} The renderer this sprite batch works for. */ -function ParticleBuffer(gl, properties, size) +function ParticleBuffer(gl, properties, dynamicPropertyFlags, size) { /** * the current WebGL drawing context @@ -40,7 +40,7 @@ this.vertByteSize = this.vertSize * 4; /** - * The number of images in the SpriteBatch before it flushes. + * The number of particles the buffer can hold * * @member {number} */ @@ -64,7 +64,7 @@ { var property = properties[i]; - if(property.dynamic) + if(dynamicPropertyFlags[i]) { this.dynamicProperties.push(property); } diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 47dc445..bf40314 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -94,7 +94,6 @@ // verticesData { attribute:this.shader.attributes.aVertexPosition, - dynamic:false, size:2, uploadFunction:this.uploadVertices, offset:0 @@ -102,7 +101,6 @@ // positionData { attribute:this.shader.attributes.aPositionCoord, - dynamic:true, size:2, uploadFunction:this.uploadPosition, offset:0 @@ -110,7 +108,6 @@ // rotationData { attribute:this.shader.attributes.aRotation, - dynamic:false, size:1, uploadFunction:this.uploadRotation, offset:0 @@ -118,7 +115,6 @@ // uvsData { attribute:this.shader.attributes.aTextureCoord, - dynamic:false, size:2, uploadFunction:this.uploadUvs, offset:0 @@ -126,7 +122,6 @@ // alphaData { attribute:this.shader.attributes.aColor, - dynamic:false, size:1, uploadFunction:this.uploadAlpha, offset:0 @@ -194,7 +189,7 @@ gl.uniform1f(this.shader.uniforms.uAlpha._location, container.worldAlpha); - // if this variable is true then we will upload the static contents as well as the dynamic contens + // if this variable is true then we will upload the static contents as well as the dynamic contents var uploadStatic = container._updateStatic; // make sure the texture is bound.. @@ -208,7 +203,7 @@ return; } - if(!this.properties[0].dynamic || !this.properties[3].dynamic) + if(!container._properties[0] || !container._properties[3]) { uploadStatic = true; } @@ -237,6 +232,7 @@ if(uploadStatic) { buffer.uploadStatic(children, i, amount); + container._updateStatic = false; } // bind the buffer @@ -246,8 +242,6 @@ gl.drawElements(gl.TRIANGLES, amount * 6, gl.UNSIGNED_SHORT, 0); this.renderer.drawCount++; } - - container._updateStatic = false; }; /** @@ -261,17 +255,12 @@ buffers = [], size = container._maxSize, batchSize = container._batchSize, + dynamicPropertyFlags = container._properties, i; - // update the properties to match the state of the container.. - for (i = 0; i < container._properties.length; i++) - { - this.properties[i].dynamic = container._properties[i]; - } - for (i = 0; i < size; i += batchSize) { - buffers.push( new ParticleBuffer(gl, this.properties, batchSize, this.shader) ); + buffers.push(new ParticleBuffer(gl, this.properties, dynamicPropertyFlags, this.size)); } return buffers;