diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index e5dfa63..af644fe 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -27,8 +27,9 @@ { Container.call(this); - - this._properties = properties || [false, true, false, false, false];; + // set properties to be dynamic (true) / static (false) + // TODO this could be easier to understand! + this._properties = properties || [false, true, false, false, false]; this._size = size || 15000; this._buffers = null; this._updateStatic = false; diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index e5dfa63..af644fe 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -27,8 +27,9 @@ { Container.call(this); - - this._properties = properties || [false, true, false, false, false];; + // set properties to be dynamic (true) / static (false) + // TODO this could be easier to understand! + this._properties = properties || [false, true, false, false, false]; this._size = size || 15000; this._buffers = null; this._updateStatic = false; diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index 8bad65d..e33f4f4 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -17,7 +17,7 @@ * @namespace PIXI * @param renderer {WebGLRenderer} The renderer this sprite batch works for. */ -function ParticleBuffer(gl, properties, size, shader ) +function ParticleBuffer(gl, properties, size) { this.gl = gl; @@ -45,8 +45,10 @@ this.dynamicProperties = []; this.staticProperties = []; - for (var i = 0; i < properties.length; i++) { + for (var i = 0; i < properties.length; i++) + { var property = properties[i]; + if(property.dynamic) { this.dynamicProperties.push(property); @@ -55,7 +57,7 @@ { this.staticProperties.push(property); } - }; + } this.staticStride = 0; this.staticBuffer = null; @@ -124,7 +126,7 @@ }; -ParticleBuffer.prototype.uploadDynamic = function(children, startIndex, amount, uploadStatic) +ParticleBuffer.prototype.uploadDynamic = function(children, startIndex, amount) { var gl = this.gl; @@ -136,9 +138,9 @@ gl.bindBuffer(gl.ARRAY_BUFFER, this.dynamicBuffer); gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.dynamicData); -} +}; -ParticleBuffer.prototype.uploadStatic = function(children, startIndex, amount, uploadStatic) +ParticleBuffer.prototype.uploadStatic = function(children, startIndex, amount) { var gl = this.gl; @@ -150,7 +152,7 @@ gl.bindBuffer(gl.ARRAY_BUFFER, this.staticBuffer); gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.staticData); -} +}; /** * Starts a new sprite batch. diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index e5dfa63..af644fe 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -27,8 +27,9 @@ { Container.call(this); - - this._properties = properties || [false, true, false, false, false];; + // set properties to be dynamic (true) / static (false) + // TODO this could be easier to understand! + this._properties = properties || [false, true, false, false, false]; this._size = size || 15000; this._buffers = null; this._updateStatic = false; diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index 8bad65d..e33f4f4 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -17,7 +17,7 @@ * @namespace PIXI * @param renderer {WebGLRenderer} The renderer this sprite batch works for. */ -function ParticleBuffer(gl, properties, size, shader ) +function ParticleBuffer(gl, properties, size) { this.gl = gl; @@ -45,8 +45,10 @@ this.dynamicProperties = []; this.staticProperties = []; - for (var i = 0; i < properties.length; i++) { + for (var i = 0; i < properties.length; i++) + { var property = properties[i]; + if(property.dynamic) { this.dynamicProperties.push(property); @@ -55,7 +57,7 @@ { this.staticProperties.push(property); } - }; + } this.staticStride = 0; this.staticBuffer = null; @@ -124,7 +126,7 @@ }; -ParticleBuffer.prototype.uploadDynamic = function(children, startIndex, amount, uploadStatic) +ParticleBuffer.prototype.uploadDynamic = function(children, startIndex, amount) { var gl = this.gl; @@ -136,9 +138,9 @@ gl.bindBuffer(gl.ARRAY_BUFFER, this.dynamicBuffer); gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.dynamicData); -} +}; -ParticleBuffer.prototype.uploadStatic = function(children, startIndex, amount, uploadStatic) +ParticleBuffer.prototype.uploadStatic = function(children, startIndex, amount) { var gl = this.gl; @@ -150,7 +152,7 @@ gl.bindBuffer(gl.ARRAY_BUFFER, this.staticBuffer); gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.staticData); -} +}; /** * Starts a new sprite batch. diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index b8c7c21..8c48ffb 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -249,17 +249,18 @@ ParticleRenderer.prototype.generateBuffers = function ( container ) { - var gl = this.renderer.gl; - var buffers = []; - var size = container._size; + var gl = this.renderer.gl, + buffers = [], + size = container._size, + i; // update the properties to match the state of the container.. - for (var i = 0; i < container._properties.length; i++) + for (i = 0; i < container._properties.length; i++) { this.properties[i].dynamic = container._properties[i]; } - for (var i = 0; i < size; i += this.size) + for (i = 0; i < size; i += this.size) { buffers.push( new ParticleBuffer(gl, this.properties, this.size, this.shader) ); }