summaryrefslogtreecommitdiffstats
path: root/drivers/gles3/shaders
diff options
context:
space:
mode:
authorPatrick <patrick.exner1@web.de>2023-08-30 14:59:06 +0200
committerPatrick <patrick.exner1@web.de>2023-08-30 15:32:18 +0200
commitc98ab5aba32827a9c084db480de16dc9ccaa3477 (patch)
tree7201d4541df40642af98e1b08126d34870e7c153 /drivers/gles3/shaders
parentd2f76e87869b892d7992696e0b381c5afebe3d0d (diff)
downloadredot-engine-c98ab5aba32827a9c084db480de16dc9ccaa3477.tar.gz
Add option to use world coordinates in canvas item shader
By using the render mode `world_vertex_coords` you can automatically use the vertex coordinates in world space
Diffstat (limited to 'drivers/gles3/shaders')
-rw-r--r--drivers/gles3/shaders/canvas.glsl6
1 files changed, 5 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