resonance 1.0.1
Loading...
Searching...
No Matches
particlesysanim.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4
5#include "os/hxstr.h"
6#include "rnd/animatable.h"
7#include "rnd/keychannel.h"
8#include "rnd/manager.h"
9
10namespace Rnd {
11class Dbg;
12class Object;
13class ParticleSys;
14class Stream;
15} // namespace Rnd
16
17namespace Rnd {
18
48public:
50 enum { kSerialVersion = 1 };
51
59 enum { kCopyShareKeys = 0x80 };
60
70 ParticleSysAnim(const HxStr &name);
71
77
88 virtual void DumpText(Dbg &sink);
89
100 virtual void Save(Stream &stream);
101
110 virtual void Replace(Object *pFrom, Object *pTo);
111
119 virtual const HxStr &ClassName() const;
120
134 virtual void Copy(const Object *pSource, unsigned nFlags);
135
146 virtual void Load(Stream &stream);
147
159 virtual float FilteredFrameEnd();
160
161protected:
180 virtual void SetFrameSelf(float flFrame);
181
192 void SetParticleSys(ParticleSys *pParticleSys);
193
206
207private:
216 void ClearKeys();
217
226 void AddRefObjects();
227
236 void ReleaseObjects();
237
238 // No class derives from Rnd::ParticleSysAnim and no access from outside it is recovered, so
239 // every member is private. The order below is the recovered offset order, and each member is
240 // pinned by the text dump, which reads all six.
241
242 // System this animation drives. SetFrameSelf() returns without doing anything when it is null.
243 ParticleSys *mParticleSys; // +0x18
244 // Channel that drives the spawn colour at the low end of its range.
245 std::list<ColorKey> mStartColorKeys; // +0x1c
246 // Channel that drives the spawn colour at the high end of its range.
247 std::list<ColorKey> mEndColorKeys; // +0x20
248 // Channel that drives the emission rate.
249 std::list<FloatKey> mEmitRateKeys; // +0x24
250 // Animation whose channels this one reads, itself for an animation that owns its keys.
251 ParticleSysAnim *mFramesOwner; // +0x28
252 // Scale the emission rate channel is multiplied by.
253 float mEmitRateRatio; // +0x2c
254};
255
269 try {
270 return new ParticleSysAnim(name);
271 } catch (...) {
272 return nullptr;
273 }
274}
275
289
297
312
313} // namespace Rnd
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Animatable()
Construct an animatable with no children, no filters, and a zero frame.
Sink that the engine formats its diagnostic and failure text into.
Definition dbg.h:33
Base of every object the renderer can load, resolve by name, and serialise.
Definition object.h:43
Keyframed animation of one Rnd::ParticleSys.
Definition particlesysanim.h:47
virtual void DumpText(Dbg &sink)
Write the animation to the engine text sink.
virtual void Replace(Object *pFrom, Object *pTo)
Replace one object reference with another.
void SetParticleSys(ParticleSys *pParticleSys)
Make a particle system the one this animation drives.
virtual float FilteredFrameEnd()
Report the last frame this animation runs to.
virtual void Save(Stream &stream)
Serialise the animation.
virtual void Copy(const Object *pSource, unsigned nFlags)
Copy another animation over this one.
virtual ~ParticleSysAnim()
virtual void SetFrameSelf(float flFrame)
Animate the system to a frame.
void SetFramesOwner(ParticleSysAnim *pOwner)
Make another animation the one whose keyframes drive this one.
@ kSerialVersion
Definition particlesysanim.h:50
virtual const HxStr & ClassName() const
Return the registered class name, "ParticleSysAnim".
virtual void Load(Stream &stream)
Load the animation.
ParticleSysAnim(const HxStr &name)
Construct an animation with no channels and no system that owns its own frames.
@ kCopyShareKeys
Definition particlesysanim.h:59
Emitter that spawns, integrates, and draws a population of particles.
Definition particlesys.h:60
Byte stream that every renderer object serialises itself through.
Definition stream.h:31
The rendering engine.
Definition animhelper.h:3
void RegisterParticleSysAnimClass()
Register the "ParticleSysAnim" class with Rnd::Manager.
Definition particlesysanim.h:309
Manager TheManager
The renderer's object registry.
Object * CreateRegisteredParticleSysAnim(const HxStr &name)
Build a particle system animation for the registered "ParticleSysAnim" class.
ParticleSysAnim * NewParticleSysAnim(const HxStr &name)
Allocate and construct a particle system animation.
Definition particlesysanim.h:268
HxStr g_particleSysAnimClassName
Registered class name of Rnd::ParticleSysAnim, the string "ParticleSysAnim".