diff --git a/src/core/renderers/webgl/filters/FXAAFilter.js b/src/core/renderers/webgl/filters/FXAAFilter.js index 594d264..4e24487 100644 --- a/src/core/renderers/webgl/filters/FXAAFilter.js +++ b/src/core/renderers/webgl/filters/FXAAFilter.js @@ -15,14 +15,15 @@ var fs = require('fs'); AbstractFilter.call(this, - // fragment shader - fs.readFileSync(__dirname + '/FXAA.frag', 'utf8'), - // vertex shader - fs.readFileSync(__dirname + '/FXAA.vert', 'utf8'), - // uniforms - { - resolution:{ type: 'v2', value:{ x: 1, y: 1 }}, - }); + // fragment shader + fs.readFileSync(__dirname + '/FXAA.frag', 'utf8'), + // vertex shader + fs.readFileSync(__dirname + '/FXAA.vert', 'utf8'), + // uniforms + { + resolution: { type: 'v2', value: { x: 1, y: 1 } } + } + ); /** Basic FXAA implementation based on the code on geeks3d.com with the diff --git a/src/core/renderers/webgl/filters/FXAAFilter.js b/src/core/renderers/webgl/filters/FXAAFilter.js index 594d264..4e24487 100644 --- a/src/core/renderers/webgl/filters/FXAAFilter.js +++ b/src/core/renderers/webgl/filters/FXAAFilter.js @@ -15,14 +15,15 @@ var fs = require('fs'); AbstractFilter.call(this, - // fragment shader - fs.readFileSync(__dirname + '/FXAA.frag', 'utf8'), - // vertex shader - fs.readFileSync(__dirname + '/FXAA.vert', 'utf8'), - // uniforms - { - resolution:{ type: 'v2', value:{ x: 1, y: 1 }}, - }); + // fragment shader + fs.readFileSync(__dirname + '/FXAA.frag', 'utf8'), + // vertex shader + fs.readFileSync(__dirname + '/FXAA.vert', 'utf8'), + // uniforms + { + resolution: { type: 'v2', value: { x: 1, y: 1 } } + } + ); /** Basic FXAA implementation based on the code on geeks3d.com with the diff --git a/src/core/renderers/webgl/filters/SpriteMaskFilter.js b/src/core/renderers/webgl/filters/SpriteMaskFilter.js index 0f8849c..d97e797 100644 --- a/src/core/renderers/webgl/filters/SpriteMaskFilter.js +++ b/src/core/renderers/webgl/filters/SpriteMaskFilter.js @@ -17,51 +17,52 @@ //TODO move this code out to a frag and vert file. AbstractFilter.call(this, - // vertex shader - [ - 'attribute vec2 aVertexPosition;', - 'attribute vec2 aTextureCoord;', - 'attribute vec4 aColor;', + // vertex shader + [ + 'attribute vec2 aVertexPosition;', + 'attribute vec2 aTextureCoord;', + 'attribute vec4 aColor;', - 'uniform mat3 projectionMatrix;', - 'uniform mat3 otherMatrix;', + 'uniform mat3 projectionMatrix;', + 'uniform mat3 otherMatrix;', - 'varying vec2 vMaskCoord;', - 'varying vec2 vTextureCoord;', - 'varying vec4 vColor;', + 'varying vec2 vMaskCoord;', + 'varying vec2 vTextureCoord;', + 'varying vec4 vColor;', - 'void main(void)', - '{', - ' gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);', - ' vTextureCoord = aTextureCoord;', - ' vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;', - ' vColor = vec4(aColor.rgb * aColor.a, aColor.a);', - '}' - ].join('\n'), - // fragment shader - [ - 'precision lowp float;', + 'void main(void)', + '{', + ' gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);', + ' vTextureCoord = aTextureCoord;', + ' vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;', + ' vColor = vec4(aColor.rgb * aColor.a, aColor.a);', + '}' + ].join('\n'), + // fragment shader + [ + 'precision lowp float;', - 'varying vec2 vMaskCoord;', - 'varying vec2 vTextureCoord;', - 'varying vec4 vColor;', + 'varying vec2 vMaskCoord;', + 'varying vec2 vTextureCoord;', + 'varying vec4 vColor;', - 'uniform sampler2D uSampler;', - 'uniform sampler2D mask;', + 'uniform sampler2D uSampler;', + 'uniform sampler2D mask;', - 'void main(void)', - '{', - ' vec4 original = texture2D(uSampler, vTextureCoord);', - ' vec4 masky = texture2D(mask, vMaskCoord);', - ' original *= (masky.r * masky.a);', - ' gl_FragColor = original;', - '}' - ].join('\n'), - // uniforms - { - mask: { type: 'sampler2D', value: sprite.texture }, - otherMatrix: { type: 'mat3', value: maskMatrix.toArray(true) } - }); + 'void main(void)', + '{', + ' vec4 original = texture2D(uSampler, vTextureCoord);', + ' vec4 masky = texture2D(mask, vMaskCoord);', + ' original *= (masky.r * masky.a);', + ' gl_FragColor = original;', + '}' + ].join('\n'), + // uniforms + { + mask: { type: 'sampler2D', value: sprite.texture }, + otherMatrix: { type: 'mat3', value: maskMatrix.toArray(true) } + } + ); this.maskSprite = sprite; this.maskMatrix = maskMatrix; diff --git a/src/core/renderers/webgl/filters/FXAAFilter.js b/src/core/renderers/webgl/filters/FXAAFilter.js index 594d264..4e24487 100644 --- a/src/core/renderers/webgl/filters/FXAAFilter.js +++ b/src/core/renderers/webgl/filters/FXAAFilter.js @@ -15,14 +15,15 @@ var fs = require('fs'); AbstractFilter.call(this, - // fragment shader - fs.readFileSync(__dirname + '/FXAA.frag', 'utf8'), - // vertex shader - fs.readFileSync(__dirname + '/FXAA.vert', 'utf8'), - // uniforms - { - resolution:{ type: 'v2', value:{ x: 1, y: 1 }}, - }); + // fragment shader + fs.readFileSync(__dirname + '/FXAA.frag', 'utf8'), + // vertex shader + fs.readFileSync(__dirname + '/FXAA.vert', 'utf8'), + // uniforms + { + resolution: { type: 'v2', value: { x: 1, y: 1 } } + } + ); /** Basic FXAA implementation based on the code on geeks3d.com with the diff --git a/src/core/renderers/webgl/filters/SpriteMaskFilter.js b/src/core/renderers/webgl/filters/SpriteMaskFilter.js index 0f8849c..d97e797 100644 --- a/src/core/renderers/webgl/filters/SpriteMaskFilter.js +++ b/src/core/renderers/webgl/filters/SpriteMaskFilter.js @@ -17,51 +17,52 @@ //TODO move this code out to a frag and vert file. AbstractFilter.call(this, - // vertex shader - [ - 'attribute vec2 aVertexPosition;', - 'attribute vec2 aTextureCoord;', - 'attribute vec4 aColor;', + // vertex shader + [ + 'attribute vec2 aVertexPosition;', + 'attribute vec2 aTextureCoord;', + 'attribute vec4 aColor;', - 'uniform mat3 projectionMatrix;', - 'uniform mat3 otherMatrix;', + 'uniform mat3 projectionMatrix;', + 'uniform mat3 otherMatrix;', - 'varying vec2 vMaskCoord;', - 'varying vec2 vTextureCoord;', - 'varying vec4 vColor;', + 'varying vec2 vMaskCoord;', + 'varying vec2 vTextureCoord;', + 'varying vec4 vColor;', - 'void main(void)', - '{', - ' gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);', - ' vTextureCoord = aTextureCoord;', - ' vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;', - ' vColor = vec4(aColor.rgb * aColor.a, aColor.a);', - '}' - ].join('\n'), - // fragment shader - [ - 'precision lowp float;', + 'void main(void)', + '{', + ' gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);', + ' vTextureCoord = aTextureCoord;', + ' vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;', + ' vColor = vec4(aColor.rgb * aColor.a, aColor.a);', + '}' + ].join('\n'), + // fragment shader + [ + 'precision lowp float;', - 'varying vec2 vMaskCoord;', - 'varying vec2 vTextureCoord;', - 'varying vec4 vColor;', + 'varying vec2 vMaskCoord;', + 'varying vec2 vTextureCoord;', + 'varying vec4 vColor;', - 'uniform sampler2D uSampler;', - 'uniform sampler2D mask;', + 'uniform sampler2D uSampler;', + 'uniform sampler2D mask;', - 'void main(void)', - '{', - ' vec4 original = texture2D(uSampler, vTextureCoord);', - ' vec4 masky = texture2D(mask, vMaskCoord);', - ' original *= (masky.r * masky.a);', - ' gl_FragColor = original;', - '}' - ].join('\n'), - // uniforms - { - mask: { type: 'sampler2D', value: sprite.texture }, - otherMatrix: { type: 'mat3', value: maskMatrix.toArray(true) } - }); + 'void main(void)', + '{', + ' vec4 original = texture2D(uSampler, vTextureCoord);', + ' vec4 masky = texture2D(mask, vMaskCoord);', + ' original *= (masky.r * masky.a);', + ' gl_FragColor = original;', + '}' + ].join('\n'), + // uniforms + { + mask: { type: 'sampler2D', value: sprite.texture }, + otherMatrix: { type: 'mat3', value: maskMatrix.toArray(true) } + } + ); this.maskSprite = sprite; this.maskMatrix = maskMatrix; diff --git a/src/core/renderers/webgl/managers/FilterManager.js b/src/core/renderers/webgl/managers/FilterManager.js index bfca3f0..2c9f371 100644 --- a/src/core/renderers/webgl/managers/FilterManager.js +++ b/src/core/renderers/webgl/managers/FilterManager.js @@ -80,15 +80,15 @@ var texture = this.getRenderTarget(); - this.renderer.setRenderTarget( texture ); + this.renderer.setRenderTarget(texture); // clear the texture.. texture.clear(); // TODO get rid of object creation! this.filterStack.push({ - renderTarget:texture, - filter:filters, + renderTarget: texture, + filter: filters }); }; diff --git a/src/core/renderers/webgl/filters/FXAAFilter.js b/src/core/renderers/webgl/filters/FXAAFilter.js index 594d264..4e24487 100644 --- a/src/core/renderers/webgl/filters/FXAAFilter.js +++ b/src/core/renderers/webgl/filters/FXAAFilter.js @@ -15,14 +15,15 @@ var fs = require('fs'); AbstractFilter.call(this, - // fragment shader - fs.readFileSync(__dirname + '/FXAA.frag', 'utf8'), - // vertex shader - fs.readFileSync(__dirname + '/FXAA.vert', 'utf8'), - // uniforms - { - resolution:{ type: 'v2', value:{ x: 1, y: 1 }}, - }); + // fragment shader + fs.readFileSync(__dirname + '/FXAA.frag', 'utf8'), + // vertex shader + fs.readFileSync(__dirname + '/FXAA.vert', 'utf8'), + // uniforms + { + resolution: { type: 'v2', value: { x: 1, y: 1 } } + } + ); /** Basic FXAA implementation based on the code on geeks3d.com with the diff --git a/src/core/renderers/webgl/filters/SpriteMaskFilter.js b/src/core/renderers/webgl/filters/SpriteMaskFilter.js index 0f8849c..d97e797 100644 --- a/src/core/renderers/webgl/filters/SpriteMaskFilter.js +++ b/src/core/renderers/webgl/filters/SpriteMaskFilter.js @@ -17,51 +17,52 @@ //TODO move this code out to a frag and vert file. AbstractFilter.call(this, - // vertex shader - [ - 'attribute vec2 aVertexPosition;', - 'attribute vec2 aTextureCoord;', - 'attribute vec4 aColor;', + // vertex shader + [ + 'attribute vec2 aVertexPosition;', + 'attribute vec2 aTextureCoord;', + 'attribute vec4 aColor;', - 'uniform mat3 projectionMatrix;', - 'uniform mat3 otherMatrix;', + 'uniform mat3 projectionMatrix;', + 'uniform mat3 otherMatrix;', - 'varying vec2 vMaskCoord;', - 'varying vec2 vTextureCoord;', - 'varying vec4 vColor;', + 'varying vec2 vMaskCoord;', + 'varying vec2 vTextureCoord;', + 'varying vec4 vColor;', - 'void main(void)', - '{', - ' gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);', - ' vTextureCoord = aTextureCoord;', - ' vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;', - ' vColor = vec4(aColor.rgb * aColor.a, aColor.a);', - '}' - ].join('\n'), - // fragment shader - [ - 'precision lowp float;', + 'void main(void)', + '{', + ' gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);', + ' vTextureCoord = aTextureCoord;', + ' vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;', + ' vColor = vec4(aColor.rgb * aColor.a, aColor.a);', + '}' + ].join('\n'), + // fragment shader + [ + 'precision lowp float;', - 'varying vec2 vMaskCoord;', - 'varying vec2 vTextureCoord;', - 'varying vec4 vColor;', + 'varying vec2 vMaskCoord;', + 'varying vec2 vTextureCoord;', + 'varying vec4 vColor;', - 'uniform sampler2D uSampler;', - 'uniform sampler2D mask;', + 'uniform sampler2D uSampler;', + 'uniform sampler2D mask;', - 'void main(void)', - '{', - ' vec4 original = texture2D(uSampler, vTextureCoord);', - ' vec4 masky = texture2D(mask, vMaskCoord);', - ' original *= (masky.r * masky.a);', - ' gl_FragColor = original;', - '}' - ].join('\n'), - // uniforms - { - mask: { type: 'sampler2D', value: sprite.texture }, - otherMatrix: { type: 'mat3', value: maskMatrix.toArray(true) } - }); + 'void main(void)', + '{', + ' vec4 original = texture2D(uSampler, vTextureCoord);', + ' vec4 masky = texture2D(mask, vMaskCoord);', + ' original *= (masky.r * masky.a);', + ' gl_FragColor = original;', + '}' + ].join('\n'), + // uniforms + { + mask: { type: 'sampler2D', value: sprite.texture }, + otherMatrix: { type: 'mat3', value: maskMatrix.toArray(true) } + } + ); this.maskSprite = sprite; this.maskMatrix = maskMatrix; diff --git a/src/core/renderers/webgl/managers/FilterManager.js b/src/core/renderers/webgl/managers/FilterManager.js index bfca3f0..2c9f371 100644 --- a/src/core/renderers/webgl/managers/FilterManager.js +++ b/src/core/renderers/webgl/managers/FilterManager.js @@ -80,15 +80,15 @@ var texture = this.getRenderTarget(); - this.renderer.setRenderTarget( texture ); + this.renderer.setRenderTarget(texture); // clear the texture.. texture.clear(); // TODO get rid of object creation! this.filterStack.push({ - renderTarget:texture, - filter:filters, + renderTarget: texture, + filter: filters }); }; diff --git a/src/core/sprites/Sprite.js b/src/core/sprites/Sprite.js index ffa12c8..de88ea8 100644 --- a/src/core/sprites/Sprite.js +++ b/src/core/sprites/Sprite.js @@ -177,7 +177,7 @@ } } } - }, + } }); /** diff --git a/src/core/renderers/webgl/filters/FXAAFilter.js b/src/core/renderers/webgl/filters/FXAAFilter.js index 594d264..4e24487 100644 --- a/src/core/renderers/webgl/filters/FXAAFilter.js +++ b/src/core/renderers/webgl/filters/FXAAFilter.js @@ -15,14 +15,15 @@ var fs = require('fs'); AbstractFilter.call(this, - // fragment shader - fs.readFileSync(__dirname + '/FXAA.frag', 'utf8'), - // vertex shader - fs.readFileSync(__dirname + '/FXAA.vert', 'utf8'), - // uniforms - { - resolution:{ type: 'v2', value:{ x: 1, y: 1 }}, - }); + // fragment shader + fs.readFileSync(__dirname + '/FXAA.frag', 'utf8'), + // vertex shader + fs.readFileSync(__dirname + '/FXAA.vert', 'utf8'), + // uniforms + { + resolution: { type: 'v2', value: { x: 1, y: 1 } } + } + ); /** Basic FXAA implementation based on the code on geeks3d.com with the diff --git a/src/core/renderers/webgl/filters/SpriteMaskFilter.js b/src/core/renderers/webgl/filters/SpriteMaskFilter.js index 0f8849c..d97e797 100644 --- a/src/core/renderers/webgl/filters/SpriteMaskFilter.js +++ b/src/core/renderers/webgl/filters/SpriteMaskFilter.js @@ -17,51 +17,52 @@ //TODO move this code out to a frag and vert file. AbstractFilter.call(this, - // vertex shader - [ - 'attribute vec2 aVertexPosition;', - 'attribute vec2 aTextureCoord;', - 'attribute vec4 aColor;', + // vertex shader + [ + 'attribute vec2 aVertexPosition;', + 'attribute vec2 aTextureCoord;', + 'attribute vec4 aColor;', - 'uniform mat3 projectionMatrix;', - 'uniform mat3 otherMatrix;', + 'uniform mat3 projectionMatrix;', + 'uniform mat3 otherMatrix;', - 'varying vec2 vMaskCoord;', - 'varying vec2 vTextureCoord;', - 'varying vec4 vColor;', + 'varying vec2 vMaskCoord;', + 'varying vec2 vTextureCoord;', + 'varying vec4 vColor;', - 'void main(void)', - '{', - ' gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);', - ' vTextureCoord = aTextureCoord;', - ' vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;', - ' vColor = vec4(aColor.rgb * aColor.a, aColor.a);', - '}' - ].join('\n'), - // fragment shader - [ - 'precision lowp float;', + 'void main(void)', + '{', + ' gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);', + ' vTextureCoord = aTextureCoord;', + ' vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;', + ' vColor = vec4(aColor.rgb * aColor.a, aColor.a);', + '}' + ].join('\n'), + // fragment shader + [ + 'precision lowp float;', - 'varying vec2 vMaskCoord;', - 'varying vec2 vTextureCoord;', - 'varying vec4 vColor;', + 'varying vec2 vMaskCoord;', + 'varying vec2 vTextureCoord;', + 'varying vec4 vColor;', - 'uniform sampler2D uSampler;', - 'uniform sampler2D mask;', + 'uniform sampler2D uSampler;', + 'uniform sampler2D mask;', - 'void main(void)', - '{', - ' vec4 original = texture2D(uSampler, vTextureCoord);', - ' vec4 masky = texture2D(mask, vMaskCoord);', - ' original *= (masky.r * masky.a);', - ' gl_FragColor = original;', - '}' - ].join('\n'), - // uniforms - { - mask: { type: 'sampler2D', value: sprite.texture }, - otherMatrix: { type: 'mat3', value: maskMatrix.toArray(true) } - }); + 'void main(void)', + '{', + ' vec4 original = texture2D(uSampler, vTextureCoord);', + ' vec4 masky = texture2D(mask, vMaskCoord);', + ' original *= (masky.r * masky.a);', + ' gl_FragColor = original;', + '}' + ].join('\n'), + // uniforms + { + mask: { type: 'sampler2D', value: sprite.texture }, + otherMatrix: { type: 'mat3', value: maskMatrix.toArray(true) } + } + ); this.maskSprite = sprite; this.maskMatrix = maskMatrix; diff --git a/src/core/renderers/webgl/managers/FilterManager.js b/src/core/renderers/webgl/managers/FilterManager.js index bfca3f0..2c9f371 100644 --- a/src/core/renderers/webgl/managers/FilterManager.js +++ b/src/core/renderers/webgl/managers/FilterManager.js @@ -80,15 +80,15 @@ var texture = this.getRenderTarget(); - this.renderer.setRenderTarget( texture ); + this.renderer.setRenderTarget(texture); // clear the texture.. texture.clear(); // TODO get rid of object creation! this.filterStack.push({ - renderTarget:texture, - filter:filters, + renderTarget: texture, + filter: filters }); }; diff --git a/src/core/sprites/Sprite.js b/src/core/sprites/Sprite.js index ffa12c8..de88ea8 100644 --- a/src/core/sprites/Sprite.js +++ b/src/core/sprites/Sprite.js @@ -177,7 +177,7 @@ } } } - }, + } }); /** diff --git a/src/filters/tiltshift/TiltShiftFilter.js b/src/filters/tiltshift/TiltShiftFilter.js index 94b8cdb..24359a8 100644 --- a/src/filters/tiltshift/TiltShiftFilter.js +++ b/src/filters/tiltshift/TiltShiftFilter.js @@ -104,5 +104,5 @@ { this.tiltShiftXFilter.end = this.tiltShiftYFilter.end = value; } - }, + } });