summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-09-19 09:03:18 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-09-19 09:03:18 +0200
commit9a1b4f338b3ea4bf7c3e9746669a43fd1e5560d7 (patch)
tree809cb5923894b7e3e8ed9e375d1638c134e5db89 /drivers
parent8dfc3f1864c7c372c203769326378093e1083218 (diff)
parentc98ab5aba32827a9c084db480de16dc9ccaa3477 (diff)
downloadredot-engine-9a1b4f338b3ea4bf7c3e9746669a43fd1e5560d7.tar.gz
Merge pull request #81160 from paddy-exe/canvas-uv-world-space
Add render mode to use world coordinates in canvas item shader
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles3/shaders/canvas.glsl6
-rw-r--r--drivers/gles3/storage/material_storage.cpp1
2 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl
index e47e3ae9a3..ce8fe25625 100644
--- a/drivers/gles3/shaders/canvas.glsl
+++ b/drivers/gles3/shaders/canvas.glsl
@@ -199,6 +199,10 @@ void main() {
#ifdef USE_POINT_SIZE
float point_size = 1.0;
#endif
+
+#ifdef USE_WORLD_VERTEX_COORDS
+ vertex = (model_matrix * vec4(vertex, 0.0, 1.0)).xy;
+#endif
{
#CODE : VERTEX
}
@@ -207,7 +211,7 @@ void main() {
pixel_size_interp = abs(read_draw_data_dst_rect.zw) * vertex_base;
#endif
-#if !defined(SKIP_TRANSFORM_USED)
+#if !defined(SKIP_TRANSFORM_USED) && !defined(USE_WORLD_VERTEX_COORDS)
vertex = (model_matrix * vec4(vertex, 0.0, 1.0)).xy;
#endif
diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp
index 600672b7ef..a594813ed0 100644
--- a/drivers/gles3/storage/material_storage.cpp
+++ b/drivers/gles3/storage/material_storage.cpp
@@ -1184,6 +1184,7 @@ MaterialStorage::MaterialStorage() {
actions.render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
actions.render_mode_defines["unshaded"] = "#define MODE_UNSHADED\n";
actions.render_mode_defines["light_only"] = "#define MODE_LIGHT_ONLY\n";
+ actions.render_mode_defines["world_vertex_coords"] = "#define USE_WORLD_VERTEX_COORDS\n";
actions.global_buffer_array_variable = "global_shader_uniforms";