summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorMetin Celik <metincelik88@gmail.com>2021-09-29 20:32:37 +0200
committerMetin Celik <metincelik88@gmail.com>2021-09-29 20:32:37 +0200
commita238dc8bbe1311cc318656408ecbe83895b35924 (patch)
treef403912db9a3223353aac5848a08e55a2a5bbe45 /scene
parent2fc31fdfca29753977b36180e6aab9c28e84cddc (diff)
Add half frame to floor()
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/canvas_item_material.cpp2
-rw-r--r--scene/resources/material.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/scene/resources/canvas_item_material.cpp b/scene/resources/canvas_item_material.cpp
index fa95ab0e79..b291724c4c 100644
--- a/scene/resources/canvas_item_material.cpp
+++ b/scene/resources/canvas_item_material.cpp
@@ -135,7 +135,7 @@ void CanvasItemMaterial::_update_shader() {
code += " particle_frame = mod(particle_frame, particle_total_frames);\n";
code += " }";
code += " UV /= vec2(h_frames, v_frames);\n";
- code += " UV += vec2(mod(particle_frame, h_frames) / h_frames, floor(particle_frame / h_frames) / v_frames);\n";
+ code += " UV += vec2(mod(particle_frame, h_frames) / h_frames, floor((particle_frame + 0.5) / h_frames) / v_frames);\n";
code += "}\n";
}
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 3a6af3afb0..8a7eb7cb81 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -815,7 +815,7 @@ void BaseMaterial3D::_update_shader() {
code += " particle_frame = mod(particle_frame, particle_total_frames);\n";
code += " }";
code += " UV /= vec2(h_frames, v_frames);\n";
- code += " UV += vec2(mod(particle_frame, h_frames) / h_frames, floor(particle_frame / h_frames) / v_frames);\n";
+ code += " UV += vec2(mod(particle_frame, h_frames) / h_frames, floor((particle_frame + 0.5) / h_frames) / v_frames);\n";
} break;
case BILLBOARD_MAX:
break; // Internal value, skip.