diff options
author | sfan5 <sfan5@live.de> | 2021-05-08 20:18:29 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-05-11 21:15:39 +0200 |
commit | 69c70dd319532f7860f211f4a527a902b0386e49 (patch) | |
tree | 7ddfab40bd2f5c0bf7e50572e494bc41bf65388c /client/shaders/nodes_shader/opengl_vertex.glsl | |
parent | 2443f1e2351d641d82597525e937792cce15be1e (diff) | |
download | minetest-69c70dd319532f7860f211f4a527a902b0386e49.tar.gz minetest-69c70dd319532f7860f211f4a527a902b0386e49.tar.bz2 minetest-69c70dd319532f7860f211f4a527a902b0386e49.zip |
Fix swapped vertex colors on GLES2
Diffstat (limited to 'client/shaders/nodes_shader/opengl_vertex.glsl')
-rw-r--r-- | client/shaders/nodes_shader/opengl_vertex.glsl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/client/shaders/nodes_shader/opengl_vertex.glsl b/client/shaders/nodes_shader/opengl_vertex.glsl index c68df4a8e..1a4840d35 100644 --- a/client/shaders/nodes_shader/opengl_vertex.glsl +++ b/client/shaders/nodes_shader/opengl_vertex.glsl @@ -146,10 +146,14 @@ void main(void) // 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; +#ifdef GL_ES + vec4 color = inVertexColor.bgra; +#else + vec4 color = inVertexColor; +#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 + + float nightRatio = 1.0 - color.a; + color.rgb = color.rgb * (color.a * dayLight.rgb + nightRatio * artificialLight.rgb) * 2.0; color.a = 1.0; |