mirror of
https://github.com/photonstorm/phaser
synced 2024-11-25 14:10:42 +00:00
Added Spine runtime setBlendMode monkey patch to avoid batch flushing
This commit is contained in:
parent
f36a0e5cac
commit
3b46296c07
1 changed files with 22 additions and 0 deletions
|
@ -139,6 +139,28 @@ var SpinePlugin = new Class({
|
||||||
bootWebGL: function ()
|
bootWebGL: function ()
|
||||||
{
|
{
|
||||||
this.sceneRenderer = new Spine.webgl.SceneRenderer(this.renderer.canvas, this.gl, true);
|
this.sceneRenderer = new Spine.webgl.SceneRenderer(this.renderer.canvas, this.gl, true);
|
||||||
|
|
||||||
|
// Monkeypatch the Spine setBlendMode functions, or batching is destroyed
|
||||||
|
|
||||||
|
var setBlendMode = function (srcBlend, dstBlend)
|
||||||
|
{
|
||||||
|
if (srcBlend !== this.srcBlend || dstBlend !== this.dstBlend)
|
||||||
|
{
|
||||||
|
var gl = this.context.gl;
|
||||||
|
|
||||||
|
this.srcBlend = srcBlend;
|
||||||
|
this.dstBlend = dstBlend;
|
||||||
|
|
||||||
|
if (this.isDrawing)
|
||||||
|
{
|
||||||
|
this.flush();
|
||||||
|
gl.blendFunc(this.srcBlend, this.dstBlend);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.sceneRenderer.batcher.setBlendMode = setBlendMode;
|
||||||
|
this.sceneRenderer.shapes.setBlendMode = setBlendMode;
|
||||||
},
|
},
|
||||||
|
|
||||||
getAtlasWebGL: function (key)
|
getAtlasWebGL: function (key)
|
||||||
|
|
Loading…
Reference in a new issue