20 #ifndef PS_EFFECT_ANCHOR_HEADER    21 #define PS_EFFECT_ANCHOR_HEADER    23 #include <csutil/csstring.h>    24 #include <csutil/array.h>    25 #include <csutil/bitarray.h>    26 #include <csutil/leakguard.h>    27 #include <csutil/parray.h>    28 #include <csutil/refcount.h>    29 #include <iutil/virtclk.h>    30 #include <imesh/object.h>    35 struct iMeshFactoryWrapper;
   100                 return "To Target Z";
   121     csPDelArray<psEffectAnchorKeyFrame> keyFrames;
   134         return keyFrames.GetSize();
   145         return keyFrames[idx];
   156         return keyFrames[idx];
   166         keyFrames.Push(keyFrame);
   176         keyFrames.DeleteIndex(idx);
   184         keyFrames.DeleteAll();
   203     virtual bool Load(iDocumentNode* node);
   213     virtual bool Create(
const csVector3 &offset, iMeshWrapper* posAttach, 
bool rotateWithMesh = 
false);
   221     virtual bool Update(csTicks elapsed);
   242     virtual void SetPosition(
const csVector3 &basePos, iSector* sector, 
const csMatrix3 &transf);
   251     virtual void SetPosition(
const csVector3 &basePos, iSectorList* sectors, 
const csMatrix3 &transf);
   259     void SetTarget(
const csVector3 &newTarget, 
const csMatrix3 &transf)
   262         targetTransf = transf;
   302         matBase = newRotBase;
   310     void TransformOffset(csVector3 &offset);
   319         return keyFrames->GetSize();
   330         return keyFrames->Get(idx);
   338     const char* GetDirectionType() 
const;
   345     void SetDirectionType(
const char* newDir);
   354         animLength = newAnimLength;
   373     size_t AddKeyFrame(
float time);
   407     size_t FindKeyFrameByTime(
float time) 
const;
   417     bool FindNextKeyFrameWithAction(
size_t startFrame, 
size_t action, 
size_t &index) 
const;
   468     inline float lerp(
float f1, 
float f2, 
float t1, 
float t2, 
float t)
   473         return f1 + (f2-f1)*(t-t1)/(t2-t1);
   477     inline csVector3 
lerpVec(
const csVector3 &v1, 
const csVector3 &v2, 
float t1, 
float t2, 
float t)
   482         return v1 + (v2-v1)*(t-t1)/(t2-t1);
 
Stores data for a specific effect anchor keyframe. 
 
bool IsActionSet(size_t idx)
 
csRef< iMeshWrapper > mesh
The mesh that makes up this anchor. 
 
bool rotateWithMesh
Whether the anchor should rotate with the mesh. This is so effects can stay aligned, e.g. flame sword. 
 
csRef< iEngine > engine
Reference to CS's iEngine. 
 
csVector3 target
Stores the target of the effect. 
 
void SetTarget(const csVector3 &newTarget, const csMatrix3 &transf)
Sets the target of the effect anchor. 
 
Effect anchor KeyFrame group. 
 
void SetName(const csString &newName)
Sets the name of this effect anchor. 
 
csBitArray specAction
keep track of which actions were specified for which 
 
csRef< psEffectAnchorKeyFrameGroup > keyFrames
The next keyframe the anchor will be on. 
 
float GetAnimGetSize()
Gets the animation length of the effect anchor. 
 
size_t GetSize() const 
Returns the number of keyframes in the group. 
 
void Push(psEffectAnchorKeyFrame *keyFrame)
Pushes a keyframe onto the group. 
 
float animLength
The amount of time this anchor has been alive (gets reset on loop). 
 
bool IsReady() const 
Check to see if this anchor is ready. 
 
csVector3 objTargetOffset
Stores the delta to the effect target. 
 
void SetupFirstFrame()
Sets up this keyframe for the special case of being the first key frame in the group. 
 
void SetDefaults()
Applies default values to this anchor keyframe. 
 
iMeshWrapper * GetMesh() const 
Returns the mesh that's associated with this effect anchor (almost always a nullmesh). 
 
float life
A unique name identifying this anchor. 
 
~psEffectAnchorKeyFrame()
 
csVector3 objOffset
The complete offset, this gets modified by the position action, generally. 
 
int dir
What type of direction does this movable have. 
 
psEffectAnchorKeyFrame * Get(size_t idx) const 
Returns the keyframe at the given index. 
 
const csString & GetName() const 
Returns the name of this effect anchor. 
 
psEffectAnchorKeyFrame * GetKeyFrame(size_t idx) const 
Returns the keyframe at the given index. 
 
csVector3 objBasePos
Base pos for the effect anchor, this is used for things like the variable offset from the anchoring m...
 
const char * GetActionName(size_t idx)
 
size_t GetKeyFrameCount() const 
Returns the number of keyframes in this anchor. 
 
float lerp(float f1, float f2, float t1, float t2, float t)
Linear interpolation function for a floating point. 
 
void SetAnimLength(float newAnimLength)
Sets the animation length of the effect anchor. 
 
csMatrix3 matBase
The length of each loop of this anchor. 
 
void DeleteAll()
Deletes all of the keyframes in this group. 
 
void DeleteIndex(size_t idx)
Deletes the keyframe at the given index. 
 
float time
this is the time of the keyframe animation (in seconds) 
 
csVector3 objEffectPos
The base transform matrix of this anchor. 
 
virtual void SetRotBase(const csMatrix3 &newRotBase)
Sets the base rotation matrix of the effect anchor. 
 
csVector3 lerpVec(const csVector3 &v1, const csVector3 &v2, float t1, float t2, float t)
Linear interpolation function for a 3D vector. 
 
size_t nextKeyFrame
The current keyframe the anchor is on. 
 
Effect anchors provide a base location / anchor point for all effect objs.