mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 22:18:29 +00:00
Added onPreCopy
This commit is contained in:
parent
8272e1b319
commit
6c00b5cfc4
1 changed files with 13 additions and 18 deletions
|
@ -439,12 +439,15 @@ var SpriteFXPipeline = new Class({
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
onPreDrawSprite: function (target)
|
||||||
|
{
|
||||||
|
},
|
||||||
|
|
||||||
drawSprite: function (target, clear)
|
drawSprite: function (target, clear)
|
||||||
{
|
{
|
||||||
if (clear === undefined) { clear = false; }
|
if (clear === undefined) { clear = false; }
|
||||||
|
|
||||||
// window.spector.setMarker('drawSprite');
|
|
||||||
|
|
||||||
var gl = this.gl;
|
var gl = this.gl;
|
||||||
var data = this.spriteData;
|
var data = this.spriteData;
|
||||||
|
|
||||||
|
@ -452,6 +455,8 @@ var SpriteFXPipeline = new Class({
|
||||||
|
|
||||||
this.set1i('uMainSampler', 0);
|
this.set1i('uMainSampler', 0);
|
||||||
|
|
||||||
|
this.onPreDrawSprite(target);
|
||||||
|
|
||||||
this.renderer.setTextureZero(data.texture);
|
this.renderer.setTextureZero(data.texture);
|
||||||
|
|
||||||
gl.viewport(0, 0, this.renderer.width, this.renderer.height);
|
gl.viewport(0, 0, this.renderer.width, this.renderer.height);
|
||||||
|
@ -478,8 +483,6 @@ var SpriteFXPipeline = new Class({
|
||||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
||||||
|
|
||||||
this.renderer.clearTextureZero();
|
this.renderer.clearTextureZero();
|
||||||
|
|
||||||
// window.spector.clearMarker();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getFrameFromSize: function (size)
|
getFrameFromSize: function (size)
|
||||||
|
@ -523,6 +526,11 @@ var SpriteFXPipeline = new Class({
|
||||||
this.drawToGame(target);
|
this.drawToGame(target);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
onPreCopy: function (source, target)
|
||||||
|
{
|
||||||
|
},
|
||||||
|
|
||||||
// Draws source to target using the copyShader (which you override in your pipeline)
|
// Draws source to target using the copyShader (which you override in your pipeline)
|
||||||
copyFrame: function (source, target, clear, clearAlpha, eraseMode)
|
copyFrame: function (source, target, clear, clearAlpha, eraseMode)
|
||||||
{
|
{
|
||||||
|
@ -530,8 +538,6 @@ var SpriteFXPipeline = new Class({
|
||||||
if (clearAlpha === undefined) { clearAlpha = true; }
|
if (clearAlpha === undefined) { clearAlpha = true; }
|
||||||
if (eraseMode === undefined) { eraseMode = false; }
|
if (eraseMode === undefined) { eraseMode = false; }
|
||||||
|
|
||||||
// window.spector.setMarker('CF' + this.copies);
|
|
||||||
|
|
||||||
var gl = this.gl;
|
var gl = this.gl;
|
||||||
|
|
||||||
this.currentShader = this.copyShader;
|
this.currentShader = this.copyShader;
|
||||||
|
@ -540,14 +546,9 @@ var SpriteFXPipeline = new Class({
|
||||||
|
|
||||||
this.copyShader.bind(wasBound, false);
|
this.copyShader.bind(wasBound, false);
|
||||||
|
|
||||||
// Need to invoke a callback that sets uniforms?
|
|
||||||
|
|
||||||
this.onPreRender();
|
|
||||||
|
|
||||||
this.set1i('uMainSampler', 0);
|
this.set1i('uMainSampler', 0);
|
||||||
|
|
||||||
// this.set1f('uStrength', 1);
|
this.onPreCopy(source, target);
|
||||||
// this.set3fv('uColor', [ 1, 1, 1 ]);
|
|
||||||
|
|
||||||
gl.activeTexture(gl.TEXTURE0);
|
gl.activeTexture(gl.TEXTURE0);
|
||||||
gl.bindTexture(gl.TEXTURE_2D, source.texture);
|
gl.bindTexture(gl.TEXTURE_2D, source.texture);
|
||||||
|
@ -599,8 +600,6 @@ var SpriteFXPipeline = new Class({
|
||||||
|
|
||||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
||||||
gl.bindTexture(gl.TEXTURE_2D, null);
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
||||||
|
|
||||||
// window.spector.clearMarker();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -626,8 +625,6 @@ var SpriteFXPipeline = new Class({
|
||||||
var gl = this.gl;
|
var gl = this.gl;
|
||||||
var renderer = this.renderer;
|
var renderer = this.renderer;
|
||||||
|
|
||||||
// window.spector.setMarker('ToGame');
|
|
||||||
|
|
||||||
this.currentShader = null;
|
this.currentShader = null;
|
||||||
|
|
||||||
if (useCopyShader)
|
if (useCopyShader)
|
||||||
|
@ -680,8 +677,6 @@ var SpriteFXPipeline = new Class({
|
||||||
|
|
||||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
||||||
gl.bindTexture(gl.TEXTURE_2D, null);
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
||||||
|
|
||||||
// window.spector.clearMarker();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue