1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

Draw node animation for items (#15930)

This commit is contained in:
cx384 2025-04-04 18:47:11 +02:00 committed by GitHub
parent 1db5a2f950
commit a6d4cd7c15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 117 additions and 74 deletions

View file

@ -151,6 +151,28 @@ struct TileLayer
bool has_color = false;
};
// Stores information for drawing an animated tile
struct AnimationInfo {
AnimationInfo() = default;
AnimationInfo(const TileLayer &tile) :
m_frame_length_ms(tile.animation_frame_length_ms),
m_frame_count(tile.animation_frame_count),
m_frames(tile.frames)
{};
void updateTexture(video::SMaterial &material, float animation_time);
private:
u16 m_frame = 0; // last animation frame
u16 m_frame_length_ms = 0;
u16 m_frame_count = 1;
/// @note not owned by this struct
std::vector<FrameSpec> *m_frames = nullptr;
};
enum class TileRotation: u8 {
None,
R90,