mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 22:52:14 +00:00
Fixed the vectors used in the BlurX and BlurY filters (thanks @nickryall, fix #668)
This commit is contained in:
parent
77f8e5eefc
commit
3d7ca639c3
3 changed files with 34 additions and 30 deletions
|
@ -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/)
|
||||
|
@ -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")
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -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;",
|
||||
|
||||
"}"
|
||||
];
|
||||
|
||||
};
|
||||
|
@ -45,6 +46,7 @@ Object.defineProperty(Phaser.Filter.BlurX.prototype, 'blur', {
|
|||
},
|
||||
|
||||
set: function(value) {
|
||||
this.dirty = true;
|
||||
this.uniforms.blur.value = (1/7000) * value;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;",
|
||||
|
||||
"}"
|
||||
|
||||
];
|
||||
|
||||
|
@ -46,6 +47,7 @@ Object.defineProperty(Phaser.Filter.BlurY.prototype, 'blur', {
|
|||
},
|
||||
|
||||
set: function(value) {
|
||||
this.dirty = true;
|
||||
this.uniforms.blur.value = (1/7000) * value;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue