wavelength 1.0.0
Loading...
Searching...
No Matches
rndlightanim.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 "os/binstream.h"
9#include "os/prnstream.h"
10#include "rnd/rndanimatable.h"
11#include "rnd/rndlight.h"
12
20public:
22 static constexpr int kCopyShareKeys = 2;
23
31 explicit RndLightAnim(const char *pszName);
32
39 ~RndLightAnim() override;
40
48 float EndFrame() override;
49
57 void ListAnimObjects(std::list<RndObject *> &objects) override;
58
69 int SetFrameSelf(float fFrame) override;
70
78 void DumpText(PrnStream &stream) override;
79
87 void Save(BinStream &stream) override;
88
100 void Replace(RndObject *pFrom, RndObject *pTo) override;
101
109 const char *ClassName() const override {
110 return sClassName;
111 }
112
124 void Copy(const RndObject *pSource, int nFlags) override;
125
136 void Load(BinStream &stream) override;
137
146 static RndObject *New(const char *pszName) {
147 return new RndLightAnim(pszName);
148 }
149
156 static const char *sClassName;
157
164 static int sRev;
165
166protected:
176
186
187private:
188 RndLight *mLight;
189 std::vector<Key<Color>> mDiffuseKeys;
190 RndLightAnim *mKeysOwner;
191};
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 DumpText(PrnStream &stream) override
Write a description of the animation and its base.
void ListAnimObjects(std::list< RndObject * > &objects) override
Add the light to a list, then the objects of the children.
void Copy(const RndObject *pSource, int nFlags) override
Copy another animation and its base.
RndLightAnim(const char *pszName)
Construct an animation of nothing without keys.
~RndLightAnim() override
Drop the references on the light and the keys owner.
const char * ClassName() const override
Report the class name.
Definition rndlightanim.h:109
void AcquireRefs()
Take references on the light and the keys owner.
static const char * sClassName
The class name a .rnd file writes, LightAnim.
Definition rndlightanim.h:156
void Replace(RndObject *pFrom, RndObject *pTo) override
Replace the light or the keys owner with another object.
void Save(BinStream &stream) override
Write the animation and its base.
static int sRev
The format version Save() writes and Load() accepts.
Definition rndlightanim.h:164
int SetFrameSelf(float fFrame) override
Set the colour of the light from the keys of the keys owner.
void Load(BinStream &stream) override
Read what Save() wrote, or an earlier version of it.
void ReleaseRefs()
Drop the references on the light and the keys owner.
static RndObject * New(const char *pszName)
Create an animation.
Definition rndlightanim.h:146
float EndFrame() override
Report the frame of the last colour key of the keys owner.
static constexpr int kCopyShareKeys
The bit of the Copy() flags that shares the source's keys rather than copying them.
Definition rndlightanim.h:22
Light, placed by its transform.
Definition rndlight.h:16
RndObject(const char *pszName)
Construct an object and register it under a name.