mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[libgdx] Ported new tint black shader. See #1003. @nathansweet please have a look.
This commit is contained in:
parent
221372e409
commit
2c45dd2f1e
@ -240,6 +240,7 @@ public class SkeletonRenderer {
|
||||
if (vertexEffect != null) vertexEffect.begin(skeleton);
|
||||
|
||||
boolean premultipliedAlpha = this.premultipliedAlpha;
|
||||
int darkPremultipliedAlpha = (premultipliedAlpha ? 255 : 0) << 24;
|
||||
BlendMode blendMode = null;
|
||||
int verticesLength = 0;
|
||||
float[] vertices = null, uvs = null;
|
||||
@ -293,9 +294,9 @@ public class SkeletonRenderer {
|
||||
| (int)(r * lightColor.r * color.r * multiplier));
|
||||
Color darkColor = slot.getDarkColor();
|
||||
if (darkColor == null) darkColor = Color.BLACK;
|
||||
float dark = NumberUtils.intToFloatColor( //
|
||||
((int)(b * darkColor.b * color.b * multiplier) << 16) //
|
||||
| ((int)(g * darkColor.g * color.g * multiplier) << 8) //
|
||||
float dark = darkColor == null ? 0 : NumberUtils.intToFloatColor(darkPremultipliedAlpha //
|
||||
| (int)(b * darkColor.b * color.b * multiplier) << 16 //
|
||||
| (int)(g * darkColor.g * color.g * multiplier) << 8 //
|
||||
| (int)(r * darkColor.r * color.r * multiplier));
|
||||
|
||||
BlendMode slotBlendMode = slot.data.getBlendMode();
|
||||
|
||||
@ -219,7 +219,7 @@ public class TwoColorPolygonBatch {
|
||||
+ "{\n" //
|
||||
+ " vec4 texColor = texture2D(u_texture, v_texCoords);\n" //
|
||||
+ " gl_FragColor.a = texColor.a * v_light.a;\n" //
|
||||
+ " gl_FragColor.rgb = (1.0 - texColor.rgb) * v_dark * gl_FragColor.a + texColor.rgb * v_light.rgb;\n" //
|
||||
+ " gl_FragColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;\n" //
|
||||
+ "}";
|
||||
|
||||
ShaderProgram shader = new ShaderProgram(vertexShader, fragmentShader);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user