diff --git a/dist/Spine-v2.2.0.c3addon b/dist/Spine-v2.2.0.c3addon new file mode 100644 index 0000000..e934c46 Binary files /dev/null and b/dist/Spine-v2.2.0.c3addon differ diff --git a/src/addon.json b/src/addon.json index 288129e..90f9405 100755 --- a/src/addon.json +++ b/src/addon.json @@ -3,7 +3,7 @@ "type": "plugin", "name": "Spine", "id": "Gritsenko_Spine", - "version": "2.1.0", + "version": "2.2.0", "author": "Mikal and Igor Gritsenko", "website": "https://gritsenko.github.io/c3_spine_plugin", "documentation": "https://gritsenko.github.io/c3_spine_plugin", diff --git a/src/c3runtime/spine-draw.js b/src/c3runtime/spine-draw.js index 4de7e04..665e6ef 100644 --- a/src/c3runtime/spine-draw.js +++ b/src/c3runtime/spine-draw.js @@ -227,6 +227,9 @@ class SpineBatch { gl.enable(gl.BLEND); gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); + // Disable scissor (may be set by C3 renderer) + gl.disable(gl.SCISSOR_TEST); + gl.bindTexture(gl.TEXTURE_2D, null); gl.bindBuffer(gl.ARRAY_BUFFER, null); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null); @@ -347,7 +350,7 @@ class SpineBatch { // @ts-ignore if (!globalThis.spineBatcher) { - console.log('[Spine] SpineBatcher init, 2.1.0, Spine 4.0.x compatible'); + console.log('[Spine] SpineBatcher init, 2.2.0, Spine 4.0.x compatible'); // @ts-ignore globalThis.spineBatcher = new SpineBatch(); } \ No newline at end of file diff --git a/src/c3runtime/spine-gl-cache.js b/src/c3runtime/spine-gl-cache.js index a121d2e..96c136c 100644 --- a/src/c3runtime/spine-gl-cache.js +++ b/src/c3runtime/spine-gl-cache.js @@ -15,6 +15,8 @@ class SpineGLCache { this._oldViewport = null; this._isWebGL2 = isWebGL2; this._gl = gl; + this._scissor = null; + this._scissorBox = null; } store() { @@ -49,6 +51,8 @@ class SpineGLCache { this._oldElement = gl.getParameter(gl.ELEMENT_ARRAY_BUFFER_BINDING); this._oldClearColor = gl.getParameter(gl.COLOR_CLEAR_VALUE); this._oldViewport = gl.getParameter(gl.VIEWPORT); + this._scissor = gl.getParameter(gl.SCISSOR_TEST); + if (this._scissor) this._scissorBox = gl.getParameter(gl.SCISSOR_BOX); } restore() { @@ -73,7 +77,9 @@ class SpineGLCache { gl.clearColor(this._oldClearColor[0],this._oldClearColor[1],this._oldClearColor[2],this._oldClearColor[3]) gl.enable(gl.BLEND); gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); - gl.viewport(this._oldViewport[0],this._oldViewport[1],this._oldViewport[2],this._oldViewport[3]); + gl.viewport(this._oldViewport[0],this._oldViewport[1],this._oldViewport[2],this._oldViewport[3]); + if (this._scissor) gl.enable(gl.SCISSOR_TEST); + if (this._scissor) gl.scissor(this._scissorBox[0],this._scissorBox[1],this._scissorBox[2],this._scissorBox[3]); } // Save C3 webgl context, may be able to reduce some diff --git a/src/plugin.js b/src/plugin.js index 7c1374c..857f932 100755 --- a/src/plugin.js +++ b/src/plugin.js @@ -3,7 +3,7 @@ const C3 = self.C3; const PLUGIN_ID = "Gritsenko_Spine"; - const PLUGIN_VERSION = "2.1.0"; + const PLUGIN_VERSION = "2.2.0"; const PLUGIN_CATEGORY = "general"; const PLUGIN_CLASS = SDK.Plugins.Gritsenko_Spine = class SpinePlugin extends SDK.IPluginBase { @@ -29,6 +29,7 @@ this._info.AddCommonAppearanceACEs(); this._info.AddCommonZOrderACEs(); this._info.AddCommonSizeACEs(); + this._info.SetSupportsColor(true); this._info.SetIsTiled(false); this._info.SetIsSingleGlobal(false); this._info.SetIsDeprecated(false);