Skip to content

Commit

Permalink
Merge pull request #53233 from metinc/fix-animated-sprite-precision-e…
Browse files Browse the repository at this point in the history
…rror
  • Loading branch information
akien-mga authored Oct 5, 2021
2 parents 4e85135 + edcb7b8 commit bd7bea2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scene/2d/canvas_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void CanvasItemMaterial::_update_shader() {
code += "\t\tparticle_frame = mod(particle_frame, particle_total_frames);\n";
code += "\t}";
code += "\tUV /= vec2(h_frames, v_frames);\n";
code += "\tUV += vec2(mod(particle_frame, h_frames) / h_frames, floor(particle_frame / h_frames) / v_frames);\n";
code += "\tUV += vec2(mod(particle_frame, h_frames) / h_frames, floor((particle_frame + 0.5) / h_frames) / v_frames);\n";
code += "}\n";
}

Expand Down
2 changes: 1 addition & 1 deletion scene/resources/material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ void SpatialMaterial::_update_shader() {
code += "\t\tparticle_frame = mod(particle_frame, particle_total_frames);\n";
code += "\t}";
code += "\tUV /= vec2(h_frames, v_frames);\n";
code += "\tUV += vec2(mod(particle_frame, h_frames) / h_frames, floor(particle_frame / h_frames) / v_frames);\n";
code += "\tUV += vec2(mod(particle_frame, h_frames) / h_frames, floor((particle_frame + 0.5) / h_frames) / v_frames);\n";
} break;
}

Expand Down

0 comments on commit bd7bea2

Please sign in to comment.