diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 9f96bde..00e9fdc 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -115,6 +115,7 @@ */ ParticleContainer.prototype.updateTransform = function () { + // TODO don't need to! this.displayObjectUpdateTransform(); // PIXI.Container.prototype.updateTransform.call( this ); diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 9f96bde..00e9fdc 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -115,6 +115,7 @@ */ ParticleContainer.prototype.updateTransform = function () { + // TODO don't need to! this.displayObjectUpdateTransform(); // PIXI.Container.prototype.updateTransform.call( this ); diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 91f8705..122e539 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -196,6 +196,8 @@ var m = container.worldTransform.copy( this.tempMatrix ); m.prepend( this.renderer.currentRenderTarget.projectionMatrix ); gl.uniformMatrix3fv(this.shader.uniforms.projectionMatrix._location, false, m.toArray(true)); + 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 var uploadStatic = container._updateStatic; diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 9f96bde..00e9fdc 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -115,6 +115,7 @@ */ ParticleContainer.prototype.updateTransform = function () { + // TODO don't need to! this.displayObjectUpdateTransform(); // PIXI.Container.prototype.updateTransform.call( this ); diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 91f8705..122e539 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -196,6 +196,8 @@ var m = container.worldTransform.copy( this.tempMatrix ); m.prepend( this.renderer.currentRenderTarget.projectionMatrix ); gl.uniformMatrix3fv(this.shader.uniforms.projectionMatrix._location, false, m.toArray(true)); + 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 var uploadStatic = container._updateStatic; diff --git a/src/core/particles/webgl/ParticleShader.js b/src/core/particles/webgl/ParticleShader.js index 5bf9313..23f6904 100644 --- a/src/core/particles/webgl/ParticleShader.js +++ b/src/core/particles/webgl/ParticleShader.js @@ -46,13 +46,16 @@ 'varying float vColor;', 'uniform sampler2D uSampler;', + 'uniform float uAlpha;', 'void main(void){', - ' gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;', + ' gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor * uAlpha ;', '}' ].join('\n'), // custom uniforms - null, + { + uAlpha: { type: '1f', value: 1 } + }, // custom attributes { aPositionCoord: 0,