diff options
author | Rob Blanckaert <basicer@basicer.com> | 2024-04-24 21:41:18 -0700 |
---|---|---|
committer | Rob Blanckaert <basicer@basicer.com> | 2024-04-25 06:56:02 -0700 |
commit | ffe0b869f5c55b1b74d5c9b65a39d0dc81ba3d4e (patch) | |
tree | a48d3643b305d3f5ef8a668d45a747d14dfb1bf3 /drivers/gles3/shaders | |
parent | 780e1a50408360cf0cf93c0b55b59e9d7b4ad0b1 (diff) | |
download | redot-engine-ffe0b869f5c55b1b74d5c9b65a39d0dc81ba3d4e.tar.gz |
Add LIGHT_VERTEX to fragment shader
Adds a new variable to the fragment shader to specify
the vertex position used when calculating lighting.
Diffstat (limited to 'drivers/gles3/shaders')
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 36bbca8728..1973eb56c2 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -1511,10 +1511,24 @@ void main() { float alpha_antialiasing_edge = 0.0; vec2 alpha_texture_coordinate = vec2(0.0, 0.0); #endif // ALPHA_ANTIALIASING_EDGE_USED + +#ifdef LIGHT_VERTEX_USED + vec3 light_vertex = vertex; +#endif //LIGHT_VERTEX_USED + { #CODE : FRAGMENT } +#ifdef LIGHT_VERTEX_USED + vertex = light_vertex; +#ifdef USE_MULTIVIEW + view = -normalize(vertex - eye_offset); +#else + view = -normalize(vertex); +#endif //USE_MULTIVIEW +#endif //LIGHT_VERTEX_USED + #ifndef USE_SHADOW_TO_OPACITY #if defined(ALPHA_SCISSOR_USED) |