Skip to content

Commit

Permalink
Fixed the vectors used in the BlurX and BlurY filters (thanks @nickryall
Browse files Browse the repository at this point in the history
  • Loading branch information
photonstorm committed Apr 11, 2014
1 parent 77f8e5e commit 3d7ca63
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 30 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ Phaser 2.0.3

Phaser is a fast, free and fun open source game framework for making desktop and mobile browser HTML5 games. It uses [Pixi.js](https://github.com/GoodBoyDigital/pixi.js/) internally for fast 2D Canvas and WebGL rendering.

Version: 2.0.3 "Allorallen" - Released: -in development-
Version: 2.0.3 "Allorallen" - Released: 11th April 2014

By Richard Davey, [Photon Storm](http://www.photonstorm.com)

[![Build Status](https://travis-ci.org/photonstorm/phaser.png?branch=dev)](https://travis-ci.org/photonstorm/phaser)

* View the [Official Website](http://phaser.io)
* Follow on [Twitter](https://twitter.com/photonstorm)
* Join the [Forum](http://www.html5gamedevs.com/forum/14-phaser/)
Expand All @@ -21,6 +19,7 @@ By Richard Davey, [Photon Storm](http://www.photonstorm.com)

[Subscribe to our new Phaser Newsletter](https://confirmsubscription.com/h/r/369DE48E3E86AF1E). We'll email you when new versions are released as well as send you our regular Phaser game making magazine.

[![Build Status](https://travis-ci.org/photonstorm/phaser.png?branch=dev)](https://travis-ci.org/photonstorm/phaser)
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/photonstorm/phaser/trend.png)](https://bitdeli.com/free "Bitdeli Badge")


Expand Down Expand Up @@ -60,7 +59,7 @@ There is also an [un-official Getting Started Guide](http://www.antonoffplus.com
Change Log
----------

Version 2.0.3 - "Allorallen" - -in development-
Version 2.0.3 - "Allorallen" - 11th April 2014

Updates

Expand Down Expand Up @@ -159,6 +158,7 @@ Bug Fixes
* Group.removeBetween now properly iterates through the children.
* P2.World had a type in the restitution method title. Now fixed.
* Objects with an InputHandler now deactivate it when the object is removed from a Group but not destroyed (fix #672)
* Fixed the vectors used in the BlurX and BlurY filters (thanks @nickryall, fix #668)


p2.js v0.5.0
Expand Down
28 changes: 15 additions & 13 deletions filters/BlurX.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,27 @@ Phaser.Filter.BlurX = function (game) {

"precision mediump float;",
"varying vec2 vTextureCoord;",
"varying float vColor;",
"varying vec4 vColor;",
"uniform float blur;",
"uniform sampler2D uSampler;",

"void main(void) {",
"vec4 sum = vec4(0.0);",

"sum += texture2D(uSampler, vec2(vTextureCoord.x - 4.0*blur, vTextureCoord.y)) * 0.05;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x - 3.0*blur, vTextureCoord.y)) * 0.09;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x - 2.0*blur, vTextureCoord.y)) * 0.12;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x - blur, vTextureCoord.y)) * 0.15;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x + blur, vTextureCoord.y)) * 0.15;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x + 2.0*blur, vTextureCoord.y)) * 0.12;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x + 3.0*blur, vTextureCoord.y)) * 0.09;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x + 4.0*blur, vTextureCoord.y)) * 0.05;",
"vec4 sum = vec4(0.0);",

"gl_FragColor = sum;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x - 4.0*blur, vTextureCoord.y)) * 0.05;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x - 3.0*blur, vTextureCoord.y)) * 0.09;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x - 2.0*blur, vTextureCoord.y)) * 0.12;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x - blur, vTextureCoord.y)) * 0.15;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x + blur, vTextureCoord.y)) * 0.15;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x + 2.0*blur, vTextureCoord.y)) * 0.12;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x + 3.0*blur, vTextureCoord.y)) * 0.09;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x + 4.0*blur, vTextureCoord.y)) * 0.05;",

"}"
"gl_FragColor = sum;",

"}"
];

};
Expand All @@ -45,6 +46,7 @@ Object.defineProperty(Phaser.Filter.BlurX.prototype, 'blur', {
},

set: function(value) {
this.dirty = true;
this.uniforms.blur.value = (1/7000) * value;
}

Expand Down
28 changes: 15 additions & 13 deletions filters/BlurY.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,27 @@ Phaser.Filter.BlurY = function (game) {

"precision mediump float;",
"varying vec2 vTextureCoord;",
"varying float vColor;",
"varying vec4 vColor;",
"uniform float blur;",
"uniform sampler2D uSampler;",

"void main(void) {",
"vec4 sum = vec4(0.0);",

"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 4.0*blur)) * 0.05;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 3.0*blur)) * 0.09;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 2.0*blur)) * 0.12;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - blur)) * 0.15;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + blur)) * 0.15;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 2.0*blur)) * 0.12;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 3.0*blur)) * 0.09;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 4.0*blur)) * 0.05;",
"vec4 sum = vec4(0.0);",

"gl_FragColor = sum;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 4.0*blur)) * 0.05;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 3.0*blur)) * 0.09;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 2.0*blur)) * 0.12;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - blur)) * 0.15;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + blur)) * 0.15;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 2.0*blur)) * 0.12;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 3.0*blur)) * 0.09;",
"sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 4.0*blur)) * 0.05;",

"}"
"gl_FragColor = sum;",

"}"

];

Expand All @@ -46,6 +47,7 @@ Object.defineProperty(Phaser.Filter.BlurY.prototype, 'blur', {
},

set: function(value) {
this.dirty = true;
this.uniforms.blur.value = (1/7000) * value;
}

Expand Down

0 comments on commit 3d7ca63

Please sign in to comment.