Skip to content

Instantly share code, notes, and snippets.

@Andrey2470T
Created July 12, 2023 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Andrey2470T/5a2b4af215f65306dfbaeae1a47e132e to your computer and use it in GitHub Desktop.
Save Andrey2470T/5a2b4af215f65306dfbaeae1a47e132e to your computer and use it in GitHub Desktop.
// Unfinished code of the future animation support for this type
v2f ll_corner_coords(0.0f, 0.0f);
v2f ur_corner_coords(1.0f, 1.0f);
if (params.animation.type != TAT_NONE)
{
core::dimension2du tex_size = mat.getTexture(0)->getSize();
v2u32 frame_size;
params.animation.determineParams(tex_size, nullptr, nullptr, &frame_size);
ll_corner_coords = params.animation.getTextureCoords(tex_size, current_animation_frame);
ur_corner_coords = v2f(
ll_corner_coords.X + (f32)frame_size.X / tex_size.Width,
ll_corner_coords.Y + (f32)frame_size.Y / tex_size.Height
);
}
v2f center_tcoords = (ll_corner_coords + ur_corner_coords) / 2.0f;
v2f shift(ll_corner_coords.X - center_tcoords.X, 0.0f);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment