Xesenix Posted November 2, 2016 Share Posted November 2, 2016 var Colorize = function (game) { Phaser.Filter.call(this, game); this.uniforms.uColor= { type: '3f', value: { r: 0.5, g: 0.5, b: 0.5} }; this.fragmentSrc = [ "precision mediump float;", "uniform float uColor;", "void main(void) {", "gl_FragColor.r = uColor.r;", "gl_FragColor.g = uColor.g;", "gl_FragColor.b = uColor.b;", "gl_FragColor.a = 1.0;", "}" ]; }; It works if i pass each color channel as separate value but i can find combination of type and data structure that would do the same in single object Link to comment Share on other sites More sharing options...
rich Posted November 2, 2016 Share Posted November 2, 2016 uniforms.example1 = { type: '1f', value: 1.0 }; uniforms.example2 = { type: '2f', value: { x: 0.0, y: 0.0 }}; uniforms.example3 = { type: '3f', value: { x: 0.0, y: 0.0, z: 0.0 }}; fragmentSrc = [ "precision mediump float;", "uniform float example1;", "uniform vec2 example2;", "uniform vec3 example3;", ... Like this Xesenix 1 Link to comment Share on other sites More sharing options...
Xesenix Posted November 2, 2016 Author Share Posted November 2, 2016 Thank you i wonder what i have made wrong before i thought i have tested this combination. Link to comment Share on other sites More sharing options...
Recommended Posts