Fix RGB order in shaders on GLES

master
Maksim 2020-12-10 18:11:32 +01:00
parent be92607581
commit 03194a3e40
2 changed files with 9 additions and 4 deletions

View File

@ -82,11 +82,12 @@ float disp_z;
// the brightness, so now we have to multiply these
// colors with the color of the incoming light.
// The pre-baked colors are halved to prevent overflow.
vec4 color;
vec4 color = inVertexColor;
#if GL_ES
color.xyz = color.zyx; // swap RGB order
#endif
// The alpha gives the ratio of sunlight in the incoming light.
float nightRatio = 1.0 - inVertexColor.a;
color.rgb = inVertexColor.rgb * (inVertexColor.a * dayLight.rgb +
nightRatio * artificialLight.rgb) * 2.0;
color.rgb *= 2.0 * mix(artificialLight.rgb, dayLight.rgb, color.a);
color.a = 1.0;
// Emphase blue a bit in darker places

View File

@ -12,5 +12,9 @@ void main(void)
varTexCoord = inTexCoord0.xy;
gl_Position = mWorldViewProj * inVertexPosition;
eyeVec = -(mWorldView * inVertexPosition).xyz;
#if GL_ES
varColor = inVertexColor.bgra;
#else
varColor = inVertexColor;
#endif
}