Nebula
Loading...
Searching...
No Matches
emitterattrs.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
12#include "core/types.h"
14#include "math/vec4.h"
15
16//------------------------------------------------------------------------------
17namespace Particles
18{
20{
21public:
41
54
63
71
95
99 void SetFloat(FloatAttr key, float value);
101 float GetFloat(FloatAttr key) const;
103 void SetBool(BoolAttr key, bool value);
105 bool GetBool(BoolAttr key) const;
107 void SetInt(IntAttr key, int value);
109 int GetInt(IntAttr key) const;
111 void SetVec4(Float4Attr key, const Math::vec4& value);
113 const Math::vec4& GetVec4(Float4Attr key) const;
115 void SetEnvelope(EnvelopeAttr key, const EnvelopeCurve& value);
117 const EnvelopeCurve& GetEnvelope(EnvelopeAttr key) const;
118
119private:
123
129
139};
140
141//------------------------------------------------------------------------------
144inline void
146{
147 this->floatValues[key] = value;
148}
149
150//------------------------------------------------------------------------------
153inline float
155{
156 return this->floatValues[key];
157}
158
159//------------------------------------------------------------------------------
162inline void
164{
165 switch (key)
166 {
167 case Looping:
168 this->boolAttributes.looping = value;
169 break;
171 this->boolAttributes.randomizeRotation = value;
172 break;
173 case StretchToStart:
174 this->boolAttributes.stretchToStart = value;
175 break;
177 this->boolAttributes.renderOldestFirst = value;
178 break;
179 case ViewAngleFade:
180 this->boolAttributes.viewAngleFade = value;
181 break;
182 case Billboard:
183 this->boolAttributes.billboard = value;
184 break;
185 default: n_error("unhandled enum"); break;
186 };
187}
188
189//------------------------------------------------------------------------------
192inline bool
194{
195 switch (key)
196 {
197 case Looping:
198 return this->boolAttributes.looping;
201 case StretchToStart:
202 return this->boolAttributes.stretchToStart;
205 case ViewAngleFade:
206 return this->boolAttributes.viewAngleFade;
207 case Billboard:
208 return this->boolAttributes.billboard;
209 default: n_error("unhandled enum"); break;
210 };
211 return false;
212}
213
214//------------------------------------------------------------------------------
217inline void
219{
220 switch (key)
221 {
222 case StretchDetail:
223 this->intAttributes.stretchDetail = value;
224 break;
225 case AnimPhases:
226 this->intAttributes.stretchDetail = value;
227 break;
228 default: n_error("unhandled enum"); break;
229 };
230}
231
232//------------------------------------------------------------------------------
235inline int
237{
238 switch (key)
239 {
240 case StretchDetail:
241 return this->intAttributes.stretchDetail;
242 case AnimPhases:
243 return this->intAttributes.stretchDetail;
244 default: n_error("unhandled enum"); break;
245 };
246 return 0;
247}
248
249//------------------------------------------------------------------------------
252inline void
254{
255 this->vec4Values[key] = value;
256}
257
258//------------------------------------------------------------------------------
261inline const Math::vec4&
263{
264 return this->vec4Values[key];
265}
266
267//------------------------------------------------------------------------------
270inline void
272{
273 this->envelopeValues[key] = value;
274}
275
276//------------------------------------------------------------------------------
279inline const EnvelopeCurve&
281{
282 return this->envelopeValues[key];
283}
284
285} // namespace Particles
286//------------------------------------------------------------------------------
287
A container for particle emitter attributes.
Definition emitterattrs.h:20
void SetInt(IntAttr key, int value)
set int attribute
Definition emitterattrs.h:218
bool GetBool(BoolAttr key) const
get bool attribute
Definition emitterattrs.h:193
struct Particles::EmitterAttrs::IntAttributes intAttributes
void SetEnvelope(EnvelopeAttr key, const EnvelopeCurve &value)
set envelope attribute
Definition emitterattrs.h:271
float GetFloat(FloatAttr key) const
get float attribute
Definition emitterattrs.h:154
void SetFloat(FloatAttr key, float value)
set float attribute
Definition emitterattrs.h:145
void SetVec4(Float4Attr key, const Math::vec4 &value)
set vec4 attribute
Definition emitterattrs.h:253
EnvelopeCurve envelopeValues[NumEnvelopeAttrs]
Definition emitterattrs.h:122
FloatAttr
scalar attributes
Definition emitterattrs.h:24
@ ActivityDistance
Definition emitterattrs.h:26
@ TextureTile
Definition emitterattrs.h:36
@ StartRotationMin
Definition emitterattrs.h:27
@ StartDelay
Definition emitterattrs.h:35
@ PhasesPerSecond
Definition emitterattrs.h:37
@ RotationRandomize
Definition emitterattrs.h:32
@ Gravity
Definition emitterattrs.h:29
@ VelocityRandomize
Definition emitterattrs.h:31
@ EmissionDuration
Definition emitterattrs.h:25
@ NumFloatAttrs
Definition emitterattrs.h:39
@ SizeRandomize
Definition emitterattrs.h:33
@ ParticleStretch
Definition emitterattrs.h:30
@ PrecalcTime
Definition emitterattrs.h:34
@ StartRotationMax
Definition emitterattrs.h:28
const Math::vec4 & GetVec4(Float4Attr key) const
get vec4 attribute
Definition emitterattrs.h:262
IntAttr
integer attributes
Definition emitterattrs.h:57
@ StretchDetail
Definition emitterattrs.h:58
@ AnimPhases
Definition emitterattrs.h:59
@ NumIntAttrs
Definition emitterattrs.h:61
Float4Attr
vec4 attributes
Definition emitterattrs.h:66
@ NumFloat4Attrs
Definition emitterattrs.h:69
@ WindDirection
Definition emitterattrs.h:67
const EnvelopeCurve & GetEnvelope(EnvelopeAttr key) const
get envelope attribute
Definition emitterattrs.h:280
void SetBool(BoolAttr key, bool value)
set bool attribute
Definition emitterattrs.h:163
float floatValues[NumFloatAttrs]
Definition emitterattrs.h:121
struct Particles::EmitterAttrs::BoolAttributes boolAttributes
EmitterAttrs()
constructor
Definition emitterattrs.cc:15
int GetInt(IntAttr key) const
get int attribute
Definition emitterattrs.h:236
BoolAttr
boolean attributes
Definition emitterattrs.h:44
@ NumBoolAttrs
Definition emitterattrs.h:52
@ Billboard
Definition emitterattrs.h:50
@ RenderOldestFirst
Definition emitterattrs.h:48
@ ViewAngleFade
Definition emitterattrs.h:49
@ StretchToStart
Definition emitterattrs.h:47
@ Looping
Definition emitterattrs.h:45
@ RandomizeRotation
Definition emitterattrs.h:46
EnvelopeAttr
scalar envelope attributes
Definition emitterattrs.h:74
@ LifeTime
Definition emitterattrs.h:80
@ RotationVelocity
Definition emitterattrs.h:82
@ Size
Definition emitterattrs.h:83
@ Alignment0
Definition emitterattrs.h:91
@ Blue
Definition emitterattrs.h:77
@ Alpha
Definition emitterattrs.h:78
@ Green
Definition emitterattrs.h:76
@ Red
Definition emitterattrs.h:75
@ Mass
Definition emitterattrs.h:88
@ SpreadMin
Definition emitterattrs.h:84
@ AirResistance
Definition emitterattrs.h:86
@ VelocityFactor
Definition emitterattrs.h:87
@ TimeManipulator
Definition emitterattrs.h:89
@ NumEnvelopeAttrs
Definition emitterattrs.h:93
@ EmissionFrequency
Definition emitterattrs.h:79
@ StartVelocity
Definition emitterattrs.h:81
@ SpreadMax
Definition emitterattrs.h:85
Math::vec4 vec4Values[NumFloat4Attrs]
Definition emitterattrs.h:120
An Attack/Sustain/Release envelope curve class with optional sine/cosine modulation.
Definition envelopecurve.h:20
void __cdecl n_error(const char *msg,...)
This function is called when a serious situation is encountered which requires abortion of the applic...
Definition debug.cc:138
Particle context controls playing and enabling/disabling of particle emitters inside a model.
Definition modelnode.h:37
A 4D vector.
Definition vec4.h:24
Definition emitterattrs.h:131
bool stretchToStart
Definition emitterattrs.h:134
bool randomizeRotation
Definition emitterattrs.h:133
bool viewAngleFade
Definition emitterattrs.h:136
bool billboard
Definition emitterattrs.h:137
bool looping
Definition emitterattrs.h:132
bool renderOldestFirst
Definition emitterattrs.h:135
Definition emitterattrs.h:125
uint stretchDetail
Definition emitterattrs.h:126
uint animPhases
Definition emitterattrs.h:127
unsigned int uint
Definition types.h:31