wavelength 1.0.0
Loading...
Searching...
No Matches
rndmeshanim.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4#include <vector>
5
6#include "math/color.h"
7#include "math/key.h"
8#include "math/vector2.h"
9#include "math/vector3.h"
10#include "rnd/rndanimatable.h"
11#include "rnd/rndmesh.h"
12
20class RndMeshAnim : public RndAnimatable {
21public:
23 static constexpr int kCopyShareKeys = 0x40;
24
32 explicit RndMeshAnim(const char *pszName);
33
40 ~RndMeshAnim() override;
41
49 float EndFrame() override;
50
58 void ListAnimObjects(std::list<RndObject *> &objects) override;
59
70 int SetFrameSelf(float fFrame) override;
71
81 void DumpText(PrnStream &stream) override;
82
90 void Save(BinStream &stream) override;
91
102 void Replace(RndObject *pFrom, RndObject *pTo) override;
103
111 const char *ClassName() const override {
112 return sClassName;
113 }
114
126 void Copy(const RndObject *pSource, int nFlags) override;
127
135 void Load(BinStream &stream) override;
136
144 void SetMesh(RndMesh *pMesh);
145
154 static RndObject *New(const char *pszName) {
155 return new RndMeshAnim(pszName);
156 }
157
164 static const char *sClassName;
165
172 static int sRev;
173
176 return mKeysOwner;
177 }
178
180 const std::vector<Key<std::vector<Vector3>>> &GetVertPointsKeys() const {
181 return mVertPointsKeys;
182 }
183
185 std::vector<Key<std::vector<Vector3>>> &GetVertPointsKeys() {
186 return mVertPointsKeys;
187 }
188
189protected:
199
209
210private:
211 RndMesh *mMesh;
212 std::vector<Key<std::vector<Vector3>>> mVertPointsKeys;
213 std::vector<Key<std::vector<Vector2>>> mVertTexsKeys;
214 std::vector<Key<std::vector<Color>>> mVertColorsKeys;
215 RndMeshAnim *mKeysOwner;
216};
Stream of raw bytes, the base of the memory, file, and network streams.
Definition binstream.h:22
Text output stream.
Definition prnstream.h:16
RndAnimatable()
Construct an animatable at frame 0 without children or filters.
Definition rndanimatable.h:600
void SetMesh(RndMesh *pMesh)
Set the mesh the animation drives.
RndMeshAnim * GetKeysOwner() const
Definition rndmeshanim.h:175
void ReleaseRefs()
Drop the references on the mesh and the keys owner.
std::vector< Key< std::vector< Vector3 > > > & GetVertPointsKeys()
Definition rndmeshanim.h:185
RndMeshAnim(const char *pszName)
Construct an animation of nothing without keys.
~RndMeshAnim() override
Drop the references on the mesh and the keys owner.
void ListAnimObjects(std::list< RndObject * > &objects) override
Add the mesh to a list, then the objects of the children.
const char * ClassName() const override
Report the class name.
Definition rndmeshanim.h:111
void Copy(const RndObject *pSource, int nFlags) override
Copy another animation and its base.
void Load(BinStream &stream) override
Read what Save() wrote.
void Save(BinStream &stream) override
Write the animation and its base.
static constexpr int kCopyShareKeys
The bit of the Copy() flags that shares the source's keys rather than copying them.
Definition rndmeshanim.h:23
static RndObject * New(const char *pszName)
Create an animation.
Definition rndmeshanim.h:154
void AcquireRefs()
Take references on the mesh and the keys owner.
float EndFrame() override
Report the last frame of any key.
int SetFrameSelf(float fFrame) override
Apply a frame to the vertices of the mesh's geometry, then rebuild the parts that changed.
static int sRev
The format version Save() writes and Load() accepts.
Definition rndmeshanim.h:172
void Replace(RndObject *pFrom, RndObject *pTo) override
Replace a referenced object with another.
void DumpText(PrnStream &stream) override
Write a description of the animation and its base.
const std::vector< Key< std::vector< Vector3 > > > & GetVertPointsKeys() const
Definition rndmeshanim.h:180
static const char * sClassName
The class name a .rnd file writes, MeshAnim.
Definition rndmeshanim.h:164
Triangle mesh with a material.
Definition rndmesh.h:31
RndObject(const char *pszName)
Construct an object and register it under a name.