WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
Loading...
Searching...
No Matches
TextureAnim.cpp
Go to the documentation of this file.
1#include "TextureAnim.h"
2
3#include <glad/gl.h>
4
5void TextureAnim::calc(ssize_t anim, size_t time)
6{
7 if (trans.uses(anim))
8 {
9 tval = trans.getValue(anim, time);
10 }
11 if (rot.uses(anim))
12 {
13 rval = rot.getValue(anim, time);
14 }
15 if (scale.uses(anim))
16 {
17 sval = scale.getValue(anim, time);
18 }
19}
20
21void TextureAnim::setup(ssize_t anim)
22{
23 glLoadIdentity();
24 if (trans.uses(anim))
25 {
26 glTranslatef(tval.x, tval.y, tval.z);
27 }
28 if (rot.uses(anim))
29 {
30 glRotatef(rval.x, 0, 0, 1); // this is wrong, I have no idea what I'm doing here ;)
31 }
32 if (scale.uses(anim))
33 {
34 glScalef(sval.x, sval.y, sval.z);
35 }
36}
37
38void TextureAnim::init(GameFile* f, ModelTexAnimDef& mta, std::vector<uint32>& global)
39{
40 trans.init(mta.trans, f, global);
41 rot.init(mta.rot, f, global);
42 scale.init(mta.scale, f, global);
43}
T getValue(ssize_t anim, size_t time)
Definition animated.h:178
void init(AnimationBlock &b, GameFile *f, std::vector< uint32 > &gs)
Definition animated.h:264
bool uses(ssize_t anim) const
Definition animated.h:171
Abstract base class representing a file within the game data archive.
Definition GameFile.h:12
Animated< glm::vec3 > rot
Definition TextureAnim.h:10
void calc(ssize_t anim, size_t time)
Compute the transform at the given animation frame.
Animated< glm::vec3 > scale
Animation tracks for translation, rotation, and scale.
Definition TextureAnim.h:10
glm::vec3 rval
Definition TextureAnim.h:12
void setup(ssize_t anim)
Apply the current texture transform to the OpenGL matrix stack.
Animated< glm::vec3 > trans
Definition TextureAnim.h:10
glm::vec3 sval
Current computed values.
Definition TextureAnim.h:12
void init(GameFile *f, ModelTexAnimDef &mta, std::vector< uint32 > &global)
Initialise from an M2 texture animation definition.
glm::vec3 tval
Definition TextureAnim.h:12
AnimationBlock rot
AnimationBlock trans
AnimationBlock scale