Added ColorMatrix

This commit is contained in:
Richard Davey 2023-02-15 18:50:44 +00:00
parent 2d58ee2453
commit 720417c3dd
3 changed files with 12 additions and 4 deletions

View file

@ -112,6 +112,8 @@ var PipelineManager = new Class({
this.postPipelineClasses = new CustomMap([
[ 'BloomFX', FX.Bloom ],
[ 'BlurFX', FX.Blur ],
[ 'CircleFX', FX.Circle ],
[ 'ColorMatrixFX', FX.ColorMatrix ],
[ 'GlowFX', FX.Glow ],
[ 'GradientFX', FX.Gradient ],
[ 'PixelateFX', FX.Pixelate ],

View file

@ -67,7 +67,7 @@ var FXPipeline = new Class({
this.shine = new FX.Shine(game);
this.gradient = new FX.Gradient(game);
// This is a sparse array
// This array is intentionally sparse. Do not adjust.
this.fxHandlers = [];
this.fxHandlers[FX_CONST.GLOW] = this.onGlow;
@ -248,11 +248,15 @@ var FXPipeline = new Class({
this.copySprite(this.target, this.source);
},
onColorMatrix: function (config, width, height)
onColorMatrix: function (config)
{
this.copySprite(this.source, this.target, true, true, false, config);
this.setShader(this.colorMatrixShader);
this.copySprite(this.target, this.source);
this.set1i('uMainSampler', 0);
this.set1fv('uColorMatrix', config.getData());
this.set1f('uAlpha', config.alpha);
this.runDraw();
}
});

View file

@ -12,6 +12,8 @@ var FX = {
Bloom: require('./BloomFXPipeline'),
Blur: require('./BlurFXPipeline'),
Circle: require('./CircleFXPipeline'),
ColorMatrix: require('./ColorMatrixFXPipeline'),
Glow: require('./GlowFXPipeline'),
Gradient: require('./GradientFXPipeline'),
Pixelate: require('./PixelateFXPipeline'),