20 #ifndef PS_EFFECT_OBJ_HEADER 21 #define PS_EFFECT_OBJ_HEADER 23 #include <csgfx/shadervar.h> 24 #include <csutil/csstring.h> 25 #include <csutil/array.h> 26 #include <csutil/bitarray.h> 27 #include <csutil/parray.h> 28 #include <csutil/refcount.h> 29 #include <csutil/leakguard.h> 30 #include <iutil/virtclk.h> 31 #include <imesh/object.h> 32 #include <ivideo/rendermesh.h> 33 #include <csgeom/matrix3.h> 34 #include <csgeom/vector3.h> 40 struct iMeshFactoryWrapper;
43 struct iLoaderContext;
121 csPDelArray<psEffectObjKeyFrame> keyFrames;
134 return keyFrames.GetSize();
145 return keyFrames[idx];
156 return keyFrames[idx];
166 keyFrames.Push(keyFrame);
176 keyFrames.DeleteIndex(idx);
184 keyFrames.DeleteAll();
190 csPtr<psEffectObjKeyFrameGroup> Clone()
const;
198 bool SetFrameParamScalings(
const float* scale);
220 virtual bool Load(iDocumentNode* node, iLoaderContext* ldr_context);
228 virtual bool Render(
const csVector3 &up);
233 virtual bool SetScaling(
float scale,
float aspect);
241 virtual bool SetFrameParamScalings(
const float* scale);
249 virtual bool Update(csTicks elapsed);
278 virtual void Show(
bool value);
297 killTime = newKillTime;
307 if(dir == DT_TO_TARGET)
308 matBase = newRotBase;
319 matBase = newPosTransf;
330 matBase = newTargetTransf;
413 void SetAnimationScaling(
float s);
432 return keyFrames->GetSize();
443 return keyFrames->Get(idx);
475 size_t FindKeyFrameByTime(csTicks
time)
const;
485 bool FindNextKeyFrameWithAction(
size_t startFrame,
size_t action,
size_t &index)
const;
498 csMatrix3 BuildRotMatrix(
const csVector3 &up)
const;
556 inline float lerp(
float f1,
float f2,
float factor)
564 return f1 + (f2-f1)*factor;
568 inline csVector3
lerpVec(
const csVector3 &v1,
const csVector3 &v2,
float factor)
576 return v1 + (v2-v1)*factor;
588 if(autoScale & SCALING_FRAMES)
592 else if(autoScale & SCALING_LOOP)
597 return ((
float)(t-t1)/(
float)(t2-t1));
602 #define LERP_KEY(action,factor) \ 603 lerp(keyFrames->Get(currKeyFrame)->actions[psEffectObjKeyFrame::action], \ 604 keyFrames->Get(nextKeyFrame)->actions[psEffectObjKeyFrame::action], \ 607 #define LERP_VEC_KEY(action,factor) \ 608 lerpVec(keyFrames->Get(currKeyFrame)->vecActions[psEffectObjKeyFrame::action - psEffectObjKeyFrame::KA_COUNT], \ 609 keyFrames->Get(nextKeyFrame)->vecActions[psEffectObjKeyFrame::action - psEffectObjKeyFrame::KA_COUNT], \ 612 #define LERP_FACTOR \ 613 lerpFactor(keyFrames->Get(currKeyFrame)->time, \ 614 keyFrames->Get(nextKeyFrame)->time, \ size_t GetKeyFrameCount() const
Returns the number of keyframes in this obj.
size_t GetSize() const
Returns the number of keyframes in the group.
csRef< iShaderVarStringSet > stringSet
psEffectObjKeyFrame * GetKeyFrame(size_t idx) const
Returns the keyframe at the given index.
csBitArray specAction
keep track of which actions were specified for which
The manager of all 2D effect elements.
void DeleteIndex(size_t idx)
Deletes the keyframe at the given index.
csVector3 vecActions[KA_VEC_COUNT-KA_COUNT]
csVector3 lerpVec(const csVector3 &v1, const csVector3 &v2, float factor)
csRef< psEffectObjKeyFrameGroup > keyFrames
psEffectObjKeyFrame * Get(size_t idx) const
Returns the keyframe at the given index.
int useScale[KA_VEC_COUNT]
If set upon load the actions are scaled after cloning. 0 no scaling, 1=scale1, 2=scale2, 3=scale3.
CS::Graphics::RenderPriority GetRenderPriority() const
Get the priority for rendering the mesh.
int GetDirection() const
Get the direction.
int GetKillTime() const
Gets the time left that the effect obj has to live.
Effect objects KeyFrame group.
csRef< iMeshWrapper > mesh
void SetRotBase(const csMatrix3 &newRotBase)
Sets the base rotation matrix of the effect obj.
Stores data for a specific effect object keyframe.
csTicks time
this is the time of the keyframe animation (in milliseconds)
csRef< iMeshFactoryWrapper > meshFact
void Push(psEffectObjKeyFrame *keyFrame)
Pushes a keyframe onto the group.
unsigned int GetMixMode() const
Get the mixmode for rendering the mesh.
An effect is not much more than a collection of effect objects.
void SetKillTime(int newKillTime)
Sets the new time left that the effect obj has to live.
float GetAnimLength() const
Accessor function to get the animation length of this effect obj.
void SetTarget(const csMatrix3 &newTargetTransf)
Sets the target rotation of the effect obj.
csRef< iStringSet > globalStringSet
csString GetName() const
Gets the name of this effect obj.
const csString & GetAnchorName() const
Gets the name of the anchor that this effect obj is attached to.
void SetAnchorName(const csString &anchor)
Sets the name of the anchor that this effect obj is attached to.
void DeleteAll()
Deletes all of the keyframes in this group.
void SetPosition(const csMatrix3 &newPosTransf)
Sets the position rotation of the effect obj.
bool SetParamScalings(const float *scale)
Adjust each parameter that have the use_scale property set with this scale.
float lerpFactor(csTicks t1, csTicks t2, csTicks t)
CS::Graphics::RenderPriority priority
float GetBirth() const
Get the birth.
csZBufMode GetZBufMode() const
Get the zbuf mode for rendering the mesh.
csRef< iCollection > effectsCollection
region to store the CS objects
float lerp(float f1, float f2, float factor)
csRef< iMeshWrapper > anchorMesh
Effect anchors provide a base location / anchor point for all effect objs.
psEffect2DRenderer * renderer2d