forked from Mirrorlandia_minetest/minetest
Fix swapped vertex colors on GLES2
This commit is contained in:
parent
2443f1e235
commit
69c70dd319
@ -3,5 +3,9 @@ varying lowp vec4 varColor;
|
|||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
gl_Position = mWorldViewProj * inVertexPosition;
|
gl_Position = mWorldViewProj * inVertexPosition;
|
||||||
|
#ifdef GL_ES
|
||||||
|
varColor = inVertexColor.bgra;
|
||||||
|
#else
|
||||||
varColor = inVertexColor;
|
varColor = inVertexColor;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -7,5 +7,9 @@ void main(void)
|
|||||||
{
|
{
|
||||||
varTexCoord = inTexCoord0.st;
|
varTexCoord = inTexCoord0.st;
|
||||||
gl_Position = mWorldViewProj * inVertexPosition;
|
gl_Position = mWorldViewProj * inVertexPosition;
|
||||||
|
#ifdef GL_ES
|
||||||
|
varColor = inVertexColor.bgra;
|
||||||
|
#else
|
||||||
varColor = inVertexColor;
|
varColor = inVertexColor;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -146,10 +146,14 @@ void main(void)
|
|||||||
// the brightness, so now we have to multiply these
|
// the brightness, so now we have to multiply these
|
||||||
// colors with the color of the incoming light.
|
// colors with the color of the incoming light.
|
||||||
// The pre-baked colors are halved to prevent overflow.
|
// The pre-baked colors are halved to prevent overflow.
|
||||||
vec4 color;
|
#ifdef GL_ES
|
||||||
|
vec4 color = inVertexColor.bgra;
|
||||||
|
#else
|
||||||
|
vec4 color = inVertexColor;
|
||||||
|
#endif
|
||||||
// The alpha gives the ratio of sunlight in the incoming light.
|
// The alpha gives the ratio of sunlight in the incoming light.
|
||||||
float nightRatio = 1.0 - inVertexColor.a;
|
float nightRatio = 1.0 - color.a;
|
||||||
color.rgb = inVertexColor.rgb * (inVertexColor.a * dayLight.rgb +
|
color.rgb = color.rgb * (color.a * dayLight.rgb +
|
||||||
nightRatio * artificialLight.rgb) * 2.0;
|
nightRatio * artificialLight.rgb) * 2.0;
|
||||||
color.a = 1.0;
|
color.a = 1.0;
|
||||||
|
|
||||||
|
@ -49,5 +49,9 @@ void main(void)
|
|||||||
: directional_ambient(normalize(inVertexNormal));
|
: directional_ambient(normalize(inVertexNormal));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef GL_ES
|
||||||
|
varColor = inVertexColor.bgra;
|
||||||
|
#else
|
||||||
varColor = inVertexColor;
|
varColor = inVertexColor;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -6,5 +6,9 @@ void main(void)
|
|||||||
varTexCoord = inTexCoord0.st;
|
varTexCoord = inTexCoord0.st;
|
||||||
gl_Position = mWorldViewProj * inVertexPosition;
|
gl_Position = mWorldViewProj * inVertexPosition;
|
||||||
|
|
||||||
|
#ifdef GL_ES
|
||||||
|
varColor = inVertexColor.bgra;
|
||||||
|
#else
|
||||||
varColor = inVertexColor;
|
varColor = inVertexColor;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user