diff options
author | clayjohn <claynjohn@gmail.com> | 2024-09-20 17:43:33 -0700 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2024-09-20 17:43:33 -0700 |
commit | e75900e1ad1a2c699829335ad3be27b4e01afec1 (patch) | |
tree | 4dca0990db6365524316f4178d89ec577852826b /drivers | |
parent | 621cadcf651b93757d5dbf8969023ae62a16f1a4 (diff) | |
download | redot-engine-e75900e1ad1a2c699829335ad3be27b4e01afec1.tar.gz |
Calculate pixel snap in canvas space instead of world space
This ensures that you are actually snapping to pixels in the viewport and not an arbitrary amount
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gles3/shaders/canvas.glsl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl index e358230747..76881c8032 100644 --- a/drivers/gles3/shaders/canvas.glsl +++ b/drivers/gles3/shaders/canvas.glsl @@ -262,6 +262,8 @@ void main() { color_interp = color; + vertex = (canvas_transform * vec4(vertex, 0.0, 1.0)).xy; + if (use_pixel_snap) { vertex = floor(vertex + 0.5); // precision issue on some hardware creates artifacts within texture @@ -269,8 +271,6 @@ void main() { uv += 1e-5; } - vertex = (canvas_transform * vec4(vertex, 0.0, 1.0)).xy; - vertex_interp = vertex; uv_interp = uv; |