mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-02 05:39:07 +08:00
Merge remote-tracking branch 'EsotericSoftware/3.6' into 3.6
This commit is contained in:
commit
0d5360feaa
@ -62,7 +62,7 @@
|
|||||||
* Added support for clipping.
|
* Added support for clipping.
|
||||||
* SkeletonRenderer now combines the displayed color of the Node (cascaded from all parents) with the skeleton color for tinting.
|
* SkeletonRenderer now combines the displayed color of the Node (cascaded from all parents) with the skeleton color for tinting.
|
||||||
* Added support for vertex effects. See `RaptorExample.cpp`.
|
* Added support for vertex effects. See `RaptorExample.cpp`.
|
||||||
* Added ETC1 support, thanks @halx99!
|
* Added ETC1 alpha support, thanks @halx99! Does not work when two color tint is enabled.
|
||||||
|
|
||||||
### Cocos2d-Objc
|
### Cocos2d-Objc
|
||||||
* Fixed renderer to work with 3.6 changes
|
* Fixed renderer to work with 3.6 changes
|
||||||
|
|||||||
@ -68,10 +68,15 @@ void SkeletonRenderer::initialize () {
|
|||||||
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
||||||
setOpacityModifyRGB(true);
|
setOpacityModifyRGB(true);
|
||||||
|
|
||||||
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP));
|
setupGLProgramState(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::setupGLProgramState () {
|
void SkeletonRenderer::setupGLProgramState (bool twoColorTintEnabled) {
|
||||||
|
if (twoColorTintEnabled) {
|
||||||
|
setGLProgramState(SkeletonTwoColorBatch::getInstance()->getTwoColorTintProgramState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Texture2D *texture = nullptr;
|
Texture2D *texture = nullptr;
|
||||||
for (int i = 0, n = _skeleton->slotsCount; i < n; i++) {
|
for (int i = 0, n = _skeleton->slotsCount; i < n; i++) {
|
||||||
spSlot* slot = _skeleton->drawOrder[i];
|
spSlot* slot = _skeleton->drawOrder[i];
|
||||||
@ -95,7 +100,6 @@ void SkeletonRenderer::setupGLProgramState () {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP, texture));
|
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP, texture));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -737,10 +741,7 @@ bool SkeletonRenderer::setAttachment (const std::string& slotName, const char* a
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::setTwoColorTint(bool enabled) {
|
void SkeletonRenderer::setTwoColorTint(bool enabled) {
|
||||||
if (enabled)
|
setupGLProgramState(enabled);
|
||||||
setGLProgramState(SkeletonTwoColorBatch::getInstance()->getTwoColorTintProgramState());
|
|
||||||
else
|
|
||||||
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonRenderer::isTwoColorTint() {
|
bool SkeletonRenderer::isTwoColorTint() {
|
||||||
|
|||||||
@ -124,11 +124,12 @@ CC_CONSTRUCTOR_ACCESS:
|
|||||||
void initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
|
void initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
|
||||||
|
|
||||||
virtual void initialize ();
|
virtual void initialize ();
|
||||||
void setupGLProgramState();
|
|
||||||
protected:
|
protected:
|
||||||
void setSkeletonData (spSkeletonData* skeletonData, bool ownsSkeletonData);
|
void setSkeletonData (spSkeletonData* skeletonData, bool ownsSkeletonData);
|
||||||
virtual AttachmentVertices* getAttachmentVertices (spRegionAttachment* attachment) const;
|
virtual AttachmentVertices* getAttachmentVertices (spRegionAttachment* attachment) const;
|
||||||
virtual AttachmentVertices* getAttachmentVertices (spMeshAttachment* attachment) const;
|
virtual AttachmentVertices* getAttachmentVertices (spMeshAttachment* attachment) const;
|
||||||
|
void setupGLProgramState(bool twoColorTintEnabled);
|
||||||
|
|
||||||
bool _ownsSkeletonData;
|
bool _ownsSkeletonData;
|
||||||
spAtlas* _atlas;
|
spAtlas* _atlas;
|
||||||
|
|||||||
@ -66,6 +66,7 @@ namespace Spine {
|
|||||||
translateMix = data.translateMix;
|
translateMix = data.translateMix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Applies the constraint to the constrained bones.</summary>
|
||||||
public void Apply () {
|
public void Apply () {
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
@ -95,8 +96,8 @@ namespace Spine {
|
|||||||
if (setupLength == 0) setupLength = 0.000000001f;
|
if (setupLength == 0) setupLength = 0.000000001f;
|
||||||
float x = setupLength * bone.a, y = setupLength * bone.c;
|
float x = setupLength * bone.a, y = setupLength * bone.c;
|
||||||
float length = (float)Math.Sqrt(x * x + y * y);
|
float length = (float)Math.Sqrt(x * x + y * y);
|
||||||
if (scale) lengths.Items[i] = setupLength;
|
if (scale) lengths.Items[i] = length;
|
||||||
spaces.Items[++i] = (lengthSpacing ? Math.Max(0, setupLength + spacing) : spacing) * length / setupLength;
|
spaces.Items[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length / setupLength;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 1; i < spacesCount; i++)
|
for (int i = 1; i < spacesCount; i++)
|
||||||
|
|||||||
4
spine-ts/build/spine-all.d.ts
vendored
4
spine-ts/build/spine-all.d.ts
vendored
@ -1517,7 +1517,9 @@ declare module spine.webgl {
|
|||||||
static SAMPLER: string;
|
static SAMPLER: string;
|
||||||
private context;
|
private context;
|
||||||
private vs;
|
private vs;
|
||||||
|
private vsSource;
|
||||||
private fs;
|
private fs;
|
||||||
|
private fsSource;
|
||||||
private program;
|
private program;
|
||||||
private tmp2x2;
|
private tmp2x2;
|
||||||
private tmp3x3;
|
private tmp3x3;
|
||||||
@ -1525,6 +1527,8 @@ declare module spine.webgl {
|
|||||||
getProgram(): WebGLProgram;
|
getProgram(): WebGLProgram;
|
||||||
getVertexShader(): string;
|
getVertexShader(): string;
|
||||||
getFragmentShader(): string;
|
getFragmentShader(): string;
|
||||||
|
getVertexShaderSource(): string;
|
||||||
|
getFragmentSource(): string;
|
||||||
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, vertexShader: string, fragmentShader: string);
|
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, vertexShader: string, fragmentShader: string);
|
||||||
private compile();
|
private compile();
|
||||||
private compileShader(type, source);
|
private compileShader(type, source);
|
||||||
|
|||||||
@ -8136,6 +8136,8 @@ var spine;
|
|||||||
this.tmp2x2 = new Float32Array(2 * 2);
|
this.tmp2x2 = new Float32Array(2 * 2);
|
||||||
this.tmp3x3 = new Float32Array(3 * 3);
|
this.tmp3x3 = new Float32Array(3 * 3);
|
||||||
this.tmp4x4 = new Float32Array(4 * 4);
|
this.tmp4x4 = new Float32Array(4 * 4);
|
||||||
|
this.vsSource = vertexShader;
|
||||||
|
this.fsSource = fragmentShader;
|
||||||
this.context = context instanceof webgl.ManagedWebGLRenderingContext ? context : new webgl.ManagedWebGLRenderingContext(context);
|
this.context = context instanceof webgl.ManagedWebGLRenderingContext ? context : new webgl.ManagedWebGLRenderingContext(context);
|
||||||
this.context.addRestorable(this);
|
this.context.addRestorable(this);
|
||||||
this.compile();
|
this.compile();
|
||||||
@ -8143,6 +8145,8 @@ var spine;
|
|||||||
Shader.prototype.getProgram = function () { return this.program; };
|
Shader.prototype.getProgram = function () { return this.program; };
|
||||||
Shader.prototype.getVertexShader = function () { return this.vertexShader; };
|
Shader.prototype.getVertexShader = function () { return this.vertexShader; };
|
||||||
Shader.prototype.getFragmentShader = function () { return this.fragmentShader; };
|
Shader.prototype.getFragmentShader = function () { return this.fragmentShader; };
|
||||||
|
Shader.prototype.getVertexShaderSource = function () { return this.vsSource; };
|
||||||
|
Shader.prototype.getFragmentSource = function () { return this.fsSource; };
|
||||||
Shader.prototype.compile = function () {
|
Shader.prototype.compile = function () {
|
||||||
var gl = this.context.gl;
|
var gl = this.context.gl;
|
||||||
try {
|
try {
|
||||||
@ -8258,7 +8262,7 @@ var spine;
|
|||||||
};
|
};
|
||||||
Shader.newTwoColoredTextured = function (context) {
|
Shader.newTwoColoredTextured = function (context) {
|
||||||
var vs = "\n\t\t\t\tattribute vec4 " + Shader.POSITION + ";\n\t\t\t\tattribute vec4 " + Shader.COLOR + ";\n\t\t\t\tattribute vec4 " + Shader.COLOR2 + ";\n\t\t\t\tattribute vec2 " + Shader.TEXCOORDS + ";\n\t\t\t\tuniform mat4 " + Shader.MVP_MATRIX + ";\n\t\t\t\tvarying vec4 v_light;\n\t\t\t\tvarying vec4 v_dark;\n\t\t\t\tvarying vec2 v_texCoords;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tv_light = " + Shader.COLOR + ";\n\t\t\t\t\tv_dark = " + Shader.COLOR2 + ";\n\t\t\t\t\tv_texCoords = " + Shader.TEXCOORDS + ";\n\t\t\t\t\tgl_Position = " + Shader.MVP_MATRIX + " * " + Shader.POSITION + ";\n\t\t\t\t}\n\t\t\t";
|
var vs = "\n\t\t\t\tattribute vec4 " + Shader.POSITION + ";\n\t\t\t\tattribute vec4 " + Shader.COLOR + ";\n\t\t\t\tattribute vec4 " + Shader.COLOR2 + ";\n\t\t\t\tattribute vec2 " + Shader.TEXCOORDS + ";\n\t\t\t\tuniform mat4 " + Shader.MVP_MATRIX + ";\n\t\t\t\tvarying vec4 v_light;\n\t\t\t\tvarying vec4 v_dark;\n\t\t\t\tvarying vec2 v_texCoords;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tv_light = " + Shader.COLOR + ";\n\t\t\t\t\tv_dark = " + Shader.COLOR2 + ";\n\t\t\t\t\tv_texCoords = " + Shader.TEXCOORDS + ";\n\t\t\t\t\tgl_Position = " + Shader.MVP_MATRIX + " * " + Shader.POSITION + ";\n\t\t\t\t}\n\t\t\t";
|
||||||
var fs = "\n\t\t\t\t#ifdef GL_ES\n\t\t\t\t\t#define LOWP lowp\n\t\t\t\t\tprecision mediump float;\n\t\t\t\t#else\n\t\t\t\t\t#define LOWP\n\t\t\t\t#endif\n\t\t\t\tvarying LOWP vec4 v_light;\n\t\t\t\tvarying LOWP vec4 v_dark;\n\t\t\t\tvarying vec2 v_texCoords;\n\t\t\t\tuniform sampler2D u_texture;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tvec4 texColor = texture2D(u_texture, v_texCoords);\n\t\t\t\t\tfloat alpha = texColor.a * v_light.a;\n\t\t\t\t\tgl_FragColor.a = alpha;\n\t\t\t\t\tgl_FragColor.rgb = (1.0 - texColor.rgb) * v_dark.rgb * alpha + texColor.rgb * v_light.rgb;\n\t\t\t\t}\n\t\t\t";
|
var fs = "\n\t\t\t\t#ifdef GL_ES\n\t\t\t\t\t#define LOWP lowp\n\t\t\t\t\tprecision mediump float;\n\t\t\t\t#else\n\t\t\t\t\t#define LOWP\n\t\t\t\t#endif\n\t\t\t\tvarying LOWP vec4 v_light;\n\t\t\t\tvarying LOWP vec4 v_dark;\n\t\t\t\tvarying vec2 v_texCoords;\n\t\t\t\tuniform sampler2D u_texture;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tvec4 texColor = texture2D(u_texture, v_texCoords);\n\t\t\t\t\tgl_FragColor.a = texColor.a * v_light.a;\n\t\t\t\t\tgl_FragColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;\n\t\t\t\t}\n\t\t\t";
|
||||||
return new Shader(context, vs, fs);
|
return new Shader(context, vs, fs);
|
||||||
};
|
};
|
||||||
Shader.newColored = function (context) {
|
Shader.newColored = function (context) {
|
||||||
@ -8893,9 +8897,18 @@ var spine;
|
|||||||
}
|
}
|
||||||
var darkColor = this.tempColor2;
|
var darkColor = this.tempColor2;
|
||||||
if (slot.darkColor == null)
|
if (slot.darkColor == null)
|
||||||
darkColor.set(0, 0, 0, 1);
|
darkColor.set(0, 0, 0, 1.0);
|
||||||
else
|
else {
|
||||||
darkColor.setFromColor(slot.darkColor);
|
if (premultipliedAlpha) {
|
||||||
|
darkColor.r = slot.darkColor.r * finalColor.a;
|
||||||
|
darkColor.g = slot.darkColor.g * finalColor.a;
|
||||||
|
darkColor.b = slot.darkColor.b * finalColor.a;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
darkColor.setFromColor(slot.darkColor);
|
||||||
|
}
|
||||||
|
darkColor.a = premultipliedAlpha ? 1.0 : 0.0;
|
||||||
|
}
|
||||||
var slotBlendMode = slot.data.blendMode;
|
var slotBlendMode = slot.data.blendMode;
|
||||||
if (slotBlendMode != blendMode) {
|
if (slotBlendMode != blendMode) {
|
||||||
blendMode = slotBlendMode;
|
blendMode = slotBlendMode;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
3076
spine-ts/build/spine-webgl.d.ts
vendored
3076
spine-ts/build/spine-webgl.d.ts
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
4
spine-ts/build/spine-widget.d.ts
vendored
4
spine-ts/build/spine-widget.d.ts
vendored
@ -1486,7 +1486,9 @@ declare module spine.webgl {
|
|||||||
static SAMPLER: string;
|
static SAMPLER: string;
|
||||||
private context;
|
private context;
|
||||||
private vs;
|
private vs;
|
||||||
|
private vsSource;
|
||||||
private fs;
|
private fs;
|
||||||
|
private fsSource;
|
||||||
private program;
|
private program;
|
||||||
private tmp2x2;
|
private tmp2x2;
|
||||||
private tmp3x3;
|
private tmp3x3;
|
||||||
@ -1494,6 +1496,8 @@ declare module spine.webgl {
|
|||||||
getProgram(): WebGLProgram;
|
getProgram(): WebGLProgram;
|
||||||
getVertexShader(): string;
|
getVertexShader(): string;
|
||||||
getFragmentShader(): string;
|
getFragmentShader(): string;
|
||||||
|
getVertexShaderSource(): string;
|
||||||
|
getFragmentSource(): string;
|
||||||
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, vertexShader: string, fragmentShader: string);
|
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, vertexShader: string, fragmentShader: string);
|
||||||
private compile();
|
private compile();
|
||||||
private compileShader(type, source);
|
private compileShader(type, source);
|
||||||
|
|||||||
@ -7881,6 +7881,8 @@ var spine;
|
|||||||
this.tmp2x2 = new Float32Array(2 * 2);
|
this.tmp2x2 = new Float32Array(2 * 2);
|
||||||
this.tmp3x3 = new Float32Array(3 * 3);
|
this.tmp3x3 = new Float32Array(3 * 3);
|
||||||
this.tmp4x4 = new Float32Array(4 * 4);
|
this.tmp4x4 = new Float32Array(4 * 4);
|
||||||
|
this.vsSource = vertexShader;
|
||||||
|
this.fsSource = fragmentShader;
|
||||||
this.context = context instanceof webgl.ManagedWebGLRenderingContext ? context : new webgl.ManagedWebGLRenderingContext(context);
|
this.context = context instanceof webgl.ManagedWebGLRenderingContext ? context : new webgl.ManagedWebGLRenderingContext(context);
|
||||||
this.context.addRestorable(this);
|
this.context.addRestorable(this);
|
||||||
this.compile();
|
this.compile();
|
||||||
@ -7888,6 +7890,8 @@ var spine;
|
|||||||
Shader.prototype.getProgram = function () { return this.program; };
|
Shader.prototype.getProgram = function () { return this.program; };
|
||||||
Shader.prototype.getVertexShader = function () { return this.vertexShader; };
|
Shader.prototype.getVertexShader = function () { return this.vertexShader; };
|
||||||
Shader.prototype.getFragmentShader = function () { return this.fragmentShader; };
|
Shader.prototype.getFragmentShader = function () { return this.fragmentShader; };
|
||||||
|
Shader.prototype.getVertexShaderSource = function () { return this.vsSource; };
|
||||||
|
Shader.prototype.getFragmentSource = function () { return this.fsSource; };
|
||||||
Shader.prototype.compile = function () {
|
Shader.prototype.compile = function () {
|
||||||
var gl = this.context.gl;
|
var gl = this.context.gl;
|
||||||
try {
|
try {
|
||||||
@ -8003,7 +8007,7 @@ var spine;
|
|||||||
};
|
};
|
||||||
Shader.newTwoColoredTextured = function (context) {
|
Shader.newTwoColoredTextured = function (context) {
|
||||||
var vs = "\n\t\t\t\tattribute vec4 " + Shader.POSITION + ";\n\t\t\t\tattribute vec4 " + Shader.COLOR + ";\n\t\t\t\tattribute vec4 " + Shader.COLOR2 + ";\n\t\t\t\tattribute vec2 " + Shader.TEXCOORDS + ";\n\t\t\t\tuniform mat4 " + Shader.MVP_MATRIX + ";\n\t\t\t\tvarying vec4 v_light;\n\t\t\t\tvarying vec4 v_dark;\n\t\t\t\tvarying vec2 v_texCoords;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tv_light = " + Shader.COLOR + ";\n\t\t\t\t\tv_dark = " + Shader.COLOR2 + ";\n\t\t\t\t\tv_texCoords = " + Shader.TEXCOORDS + ";\n\t\t\t\t\tgl_Position = " + Shader.MVP_MATRIX + " * " + Shader.POSITION + ";\n\t\t\t\t}\n\t\t\t";
|
var vs = "\n\t\t\t\tattribute vec4 " + Shader.POSITION + ";\n\t\t\t\tattribute vec4 " + Shader.COLOR + ";\n\t\t\t\tattribute vec4 " + Shader.COLOR2 + ";\n\t\t\t\tattribute vec2 " + Shader.TEXCOORDS + ";\n\t\t\t\tuniform mat4 " + Shader.MVP_MATRIX + ";\n\t\t\t\tvarying vec4 v_light;\n\t\t\t\tvarying vec4 v_dark;\n\t\t\t\tvarying vec2 v_texCoords;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tv_light = " + Shader.COLOR + ";\n\t\t\t\t\tv_dark = " + Shader.COLOR2 + ";\n\t\t\t\t\tv_texCoords = " + Shader.TEXCOORDS + ";\n\t\t\t\t\tgl_Position = " + Shader.MVP_MATRIX + " * " + Shader.POSITION + ";\n\t\t\t\t}\n\t\t\t";
|
||||||
var fs = "\n\t\t\t\t#ifdef GL_ES\n\t\t\t\t\t#define LOWP lowp\n\t\t\t\t\tprecision mediump float;\n\t\t\t\t#else\n\t\t\t\t\t#define LOWP\n\t\t\t\t#endif\n\t\t\t\tvarying LOWP vec4 v_light;\n\t\t\t\tvarying LOWP vec4 v_dark;\n\t\t\t\tvarying vec2 v_texCoords;\n\t\t\t\tuniform sampler2D u_texture;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tvec4 texColor = texture2D(u_texture, v_texCoords);\n\t\t\t\t\tfloat alpha = texColor.a * v_light.a;\n\t\t\t\t\tgl_FragColor.a = alpha;\n\t\t\t\t\tgl_FragColor.rgb = (1.0 - texColor.rgb) * v_dark.rgb * alpha + texColor.rgb * v_light.rgb;\n\t\t\t\t}\n\t\t\t";
|
var fs = "\n\t\t\t\t#ifdef GL_ES\n\t\t\t\t\t#define LOWP lowp\n\t\t\t\t\tprecision mediump float;\n\t\t\t\t#else\n\t\t\t\t\t#define LOWP\n\t\t\t\t#endif\n\t\t\t\tvarying LOWP vec4 v_light;\n\t\t\t\tvarying LOWP vec4 v_dark;\n\t\t\t\tvarying vec2 v_texCoords;\n\t\t\t\tuniform sampler2D u_texture;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tvec4 texColor = texture2D(u_texture, v_texCoords);\n\t\t\t\t\tgl_FragColor.a = texColor.a * v_light.a;\n\t\t\t\t\tgl_FragColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;\n\t\t\t\t}\n\t\t\t";
|
||||||
return new Shader(context, vs, fs);
|
return new Shader(context, vs, fs);
|
||||||
};
|
};
|
||||||
Shader.newColored = function (context) {
|
Shader.newColored = function (context) {
|
||||||
@ -8638,9 +8642,18 @@ var spine;
|
|||||||
}
|
}
|
||||||
var darkColor = this.tempColor2;
|
var darkColor = this.tempColor2;
|
||||||
if (slot.darkColor == null)
|
if (slot.darkColor == null)
|
||||||
darkColor.set(0, 0, 0, 1);
|
darkColor.set(0, 0, 0, 1.0);
|
||||||
else
|
else {
|
||||||
darkColor.setFromColor(slot.darkColor);
|
if (premultipliedAlpha) {
|
||||||
|
darkColor.r = slot.darkColor.r * finalColor.a;
|
||||||
|
darkColor.g = slot.darkColor.g * finalColor.a;
|
||||||
|
darkColor.b = slot.darkColor.b * finalColor.a;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
darkColor.setFromColor(slot.darkColor);
|
||||||
|
}
|
||||||
|
darkColor.a = premultipliedAlpha ? 1.0 : 0.0;
|
||||||
|
}
|
||||||
var slotBlendMode = slot.data.blendMode;
|
var slotBlendMode = slot.data.blendMode;
|
||||||
if (slotBlendMode != blendMode) {
|
if (slotBlendMode != blendMode) {
|
||||||
blendMode = slotBlendMode;
|
blendMode = slotBlendMode;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -253,9 +253,8 @@ module spine.webgl {
|
|||||||
|
|
||||||
void main () {
|
void main () {
|
||||||
vec4 texColor = texture2D(u_texture, v_texCoords);
|
vec4 texColor = texture2D(u_texture, v_texCoords);
|
||||||
float alpha = texColor.a * v_light.a;
|
gl_FragColor.a = texColor.a * v_light.a;
|
||||||
gl_FragColor.a = alpha;
|
gl_FragColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;
|
||||||
gl_FragColor.rgb = (1.0 - texColor.rgb) * v_dark.rgb * alpha + texColor.rgb * v_light.rgb;
|
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@ -122,8 +122,18 @@ module spine.webgl {
|
|||||||
finalColor.b *= finalColor.a;
|
finalColor.b *= finalColor.a;
|
||||||
}
|
}
|
||||||
let darkColor = this.tempColor2;
|
let darkColor = this.tempColor2;
|
||||||
if (slot.darkColor == null) darkColor.set(0, 0, 0, 1);
|
if (slot.darkColor == null)
|
||||||
else darkColor.setFromColor(slot.darkColor);
|
darkColor.set(0, 0, 0, 1.0);
|
||||||
|
else {
|
||||||
|
if (premultipliedAlpha) {
|
||||||
|
darkColor.r = slot.darkColor.r * finalColor.a;
|
||||||
|
darkColor.g = slot.darkColor.g * finalColor.a;
|
||||||
|
darkColor.b = slot.darkColor.b * finalColor.a;
|
||||||
|
} else {
|
||||||
|
darkColor.setFromColor(slot.darkColor);
|
||||||
|
}
|
||||||
|
darkColor.a = premultipliedAlpha ? 1.0 : 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
let slotBlendMode = slot.data.blendMode;
|
let slotBlendMode = slot.data.blendMode;
|
||||||
if (slotBlendMode != blendMode) {
|
if (slotBlendMode != blendMode) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user