mirror of
https://github.com/photonstorm/phaser
synced 2025-02-17 22:48:34 +00:00
Added SKIP_CHECK blend mode const and moved setBlendMode to handle it in the main loop
This commit is contained in:
parent
daf8216369
commit
6770113aa0
1 changed files with 7 additions and 25 deletions
|
@ -456,32 +456,9 @@ var WebGLRenderer = new Class({
|
||||||
{
|
{
|
||||||
var child = list[index];
|
var child = list[index];
|
||||||
|
|
||||||
// Setting blend mode if needed
|
if (child.blendMode !== this.blendMode)
|
||||||
var renderer = this.currentRenderer;
|
|
||||||
var newBlendMode = child.blendMode;
|
|
||||||
|
|
||||||
if (this.blendMode !== newBlendMode)
|
|
||||||
{
|
{
|
||||||
if (renderer)
|
this.setBlendMode(child.blendMode);
|
||||||
{
|
|
||||||
renderer.flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
var blend = this.blendModes[newBlendMode].func;
|
|
||||||
|
|
||||||
gl.enable(gl.BLEND);
|
|
||||||
gl.blendEquation(this.blendModes[newBlendMode].equation);
|
|
||||||
|
|
||||||
if (blend.length > 2)
|
|
||||||
{
|
|
||||||
gl.blendFuncSeparate(blend[0], blend[1], blend[2], blend[3]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gl.blendFunc(blend[0], blend[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.blendMode = newBlendMode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// drawing child
|
// drawing child
|
||||||
|
@ -558,6 +535,11 @@ var WebGLRenderer = new Class({
|
||||||
|
|
||||||
setBlendMode: function (newBlendMode)
|
setBlendMode: function (newBlendMode)
|
||||||
{
|
{
|
||||||
|
if (newBlendMode === BlendModes.SKIP_CHECK)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var gl = this.gl;
|
var gl = this.gl;
|
||||||
var renderer = this.currentRenderer;
|
var renderer = this.currentRenderer;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue