Planeshift
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

psEffectAnchor Class Reference

Effect anchors provide a base location / anchor point for all effect objs. More...

#include <pseffectanchor.h>

List of all members.

Public Types

enum  DIR_TYPE { DT_NONE = 0, DT_ORIGIN, DT_TARGET, DT_COUNT }

Public Member Functions

size_t AddKeyFrame (float time)
 Creates a new keyframe and attaches it to this movable.
virtual psEffectAnchorClone () const
 Clones the effect anchor.
void CloneBase (psEffectAnchor *newAnchor) const
 Convenience function to clone the base member variables.
virtual bool Create (const csVector3 &offset, iMeshWrapper *posAttach, bool rotateWithMesh=false)
 Creates the effect anchor.
void FillInLerps ()
 Interpolates keyFrame actions for ones that weren't specified in each keyframe.
float GetAnimGetSize ()
 Gets the animation length of the effect anchor.
const char * GetDirectionType () const
 Gets the direction type of this anchor.
psEffectAnchorKeyFrameGetKeyFrame (size_t idx) const
 Returns the keyframe at the given index.
size_t GetKeyFrameCount () const
 Returns the number of keyframes in this anchor.
iMeshWrapper * GetMesh () const
 Returns the mesh that's associated with this effect anchor (almost always a nullmesh).
const csString & GetName () const
 Returns the name of this effect anchor.
bool IsReady () const
 Check to see if this anchor is ready.
virtual bool Load (iDocumentNode *node)
 Loads the effect anchors from an xml node.
 psEffectAnchor ()
void SetAnimLength (float newAnimLength)
 Sets the animation length of the effect anchor.
void SetDirectionType (const char *newDir)
 Sets the direction type of this anchor.
void SetName (const csString &newName)
 Sets the name of this effect anchor.
virtual void SetPosition (const csVector3 &basePos, iSectorList *sectors, const csMatrix3 &transf)
 Sets a new position for the effect anchor.
virtual void SetPosition (const csVector3 &basePos, iSector *sector, const csMatrix3 &transf)
 Sets a new position for the effect anchor.
virtual void SetRotBase (const csMatrix3 &newRotBase)
 Sets the base rotation matrix of the effect anchor.
void SetTarget (const csVector3 &newTarget, const csMatrix3 &transf)
 Sets the target of the effect anchor.
void TransformOffset (csVector3 &offset)
 Transforms the offset according to the mesh's settings, like abs_dir, etc.
virtual bool Update (csTicks elapsed)
 Updates the effect anchor -- called every frame.
virtual ~psEffectAnchor ()

Protected Member Functions

size_t FindKeyFrameByTime (float time) const
 Finds the index of the keyFrame at the specified time.
bool FindNextKeyFrameWithAction (size_t startFrame, size_t action, size_t &index) const
 Finds the next key frame where the specific action is specified.
float lerp (float f1, float f2, float t1, float t2, float t)
 Linear interpolation function for a floating point.
csVector3 lerpVec (const csVector3 &v1, const csVector3 &v2, float t1, float t2, float t)
 Linear interpolation function for a 3D vector.

Protected Attributes

float animLength
 The amount of time this anchor has been alive (gets reset on loop).
size_t currKeyFrame
int dir
 What type of direction does this movable have.
csRef< iEngine > engine
 Reference to CS's iEngine.
bool isReady
csRef
< psEffectAnchorKeyFrameGroup
keyFrames
 The next keyframe the anchor will be on.
float life
 A unique name identifying this anchor.
csMatrix3 matBase
 The length of each loop of this anchor.
csRef< iMeshWrapper > mesh
 The mesh that makes up this anchor.
csString name
size_t nextKeyFrame
 The current keyframe the anchor is on.
csVector3 objBasePos
 Base pos for the effect anchor, this is used for things like the variable offset from the anchoring mesh.
csVector3 objEffectPos
 The base transform matrix of this anchor.
csVector3 objOffset
 The complete offset, this gets modified by the position action, generally.
csVector3 objTargetOffset
 Stores the delta to the effect target.
csMatrix3 posTransf
bool rotateWithMesh
 Whether the anchor should rotate with the mesh. This is so effects can stay aligned, e.g. flame sword.
csVector3 target
 Stores the target of the effect.
csMatrix3 targetTransf

Detailed Description

Effect anchors provide a base location / anchor point for all effect objs.

Definition at line 191 of file pseffectanchor.h.


Member Enumeration Documentation

Enumerator:
DT_NONE 
DT_ORIGIN 
DT_TARGET 
DT_COUNT 

Definition at line 385 of file pseffectanchor.h.


Constructor & Destructor Documentation

psEffectAnchor::psEffectAnchor ( )
virtual psEffectAnchor::~psEffectAnchor ( ) [virtual]

Member Function Documentation

size_t psEffectAnchor::AddKeyFrame ( float  time)

Creates a new keyframe and attaches it to this movable.

Parameters:
timeThe time of this new keyFrame.
Returns:
the index where the new keyframe can be reached using GetKeyFrame(index).
virtual psEffectAnchor* psEffectAnchor::Clone ( ) const [virtual]

Clones the effect anchor.

This will almost always be overloaded.

Reimplemented in psEffectAnchorBasic, psEffectAnchorSocket, and psEffectAnchorSpline.

void psEffectAnchor::CloneBase ( psEffectAnchor newAnchor) const

Convenience function to clone the base member variables.

Parameters:
newAnchorreference to the new anchor that will contain the cloned variables
virtual bool psEffectAnchor::Create ( const csVector3 &  offset,
iMeshWrapper *  posAttach,
bool  rotateWithMesh = false 
) [virtual]

Creates the effect anchor.

Parameters:
offsetthe offset of the position of the obj.
posAttachthe mesh to attach this anchor to.
rotateWithMeshRotate the anchor with the mesh.
Returns:
true on success.

Reimplemented in psEffectAnchorBasic, psEffectAnchorSocket, and psEffectAnchorSpline.

void psEffectAnchor::FillInLerps ( )

Interpolates keyFrame actions for ones that weren't specified in each keyframe.

size_t psEffectAnchor::FindKeyFrameByTime ( float  time) const [protected]

Finds the index of the keyFrame at the specified time.

Parameters:
timeThe time to lookup.
Returns:
The index of the keyFrame at the specified time.
bool psEffectAnchor::FindNextKeyFrameWithAction ( size_t  startFrame,
size_t  action,
size_t &  index 
) const [protected]

Finds the next key frame where the specific action is specified.

Parameters:
startFrameThe first frame to start looking.
actionThe action to look for.
indexA container to store the index of the found key frame.
Returns:
true if it found one and the index is stored, false otherwise.
float psEffectAnchor::GetAnimGetSize ( ) [inline]

Gets the animation length of the effect anchor.

Returns:
the animation length.

Definition at line 362 of file pseffectanchor.h.

const char* psEffectAnchor::GetDirectionType ( ) const

Gets the direction type of this anchor.

Returns:
the direction type (none, origin, target).
psEffectAnchorKeyFrame* psEffectAnchor::GetKeyFrame ( size_t  idx) const [inline]

Returns the keyframe at the given index.

Parameters:
idxThe index of the keyframe to grab.
Returns:
The keyframe at the given index.

Definition at line 328 of file pseffectanchor.h.

size_t psEffectAnchor::GetKeyFrameCount ( ) const [inline]

Returns the number of keyframes in this anchor.

Returns:
The keyFrame count.

Definition at line 317 of file pseffectanchor.h.

iMeshWrapper* psEffectAnchor::GetMesh ( ) const [inline]

Returns the mesh that's associated with this effect anchor (almost always a nullmesh).

Returns:
Generally returns either a nullmesh or 0.

Definition at line 290 of file pseffectanchor.h.

const csString& psEffectAnchor::GetName ( ) const [inline]

Returns the name of this effect anchor.

Returns:
The name of this effect anchor.

Definition at line 270 of file pseffectanchor.h.

bool psEffectAnchor::IsReady ( ) const [inline]

Check to see if this anchor is ready.

Returns:
true if it's ready.

Definition at line 380 of file pseffectanchor.h.

float psEffectAnchor::lerp ( float  f1,
float  f2,
float  t1,
float  t2,
float  t 
) [inline, protected]

Linear interpolation function for a floating point.

Definition at line 468 of file pseffectanchor.h.

csVector3 psEffectAnchor::lerpVec ( const csVector3 &  v1,
const csVector3 &  v2,
float  t1,
float  t2,
float  t 
) [inline, protected]

Linear interpolation function for a 3D vector.

Definition at line 477 of file pseffectanchor.h.

virtual bool psEffectAnchor::Load ( iDocumentNode *  node) [virtual]

Loads the effect anchors from an xml node.

Parameters:
nodethe xml node containing the effect anchor, must be valid.
Returns:
true on success, false otherwise.

Reimplemented in psEffectAnchorBasic, psEffectAnchorSocket, and psEffectAnchorSpline.

void psEffectAnchor::SetAnimLength ( float  newAnimLength) [inline]

Sets the animation length of the effect anchor.

Parameters:
newAnimLengththe new animation length.

Definition at line 352 of file pseffectanchor.h.

void psEffectAnchor::SetDirectionType ( const char *  newDir)

Sets the direction type of this anchor.

Parameters:
newDirthe new direction type (none, origin, target).
void psEffectAnchor::SetName ( const csString &  newName) [inline]

Sets the name of this effect anchor.

Parameters:
newNameThe new name of the anchor.

Definition at line 280 of file pseffectanchor.h.

virtual void psEffectAnchor::SetPosition ( const csVector3 &  basePos,
iSectorList *  sectors,
const csMatrix3 &  transf 
) [virtual]

Sets a new position for the effect anchor.

Parameters:
basePosThe new position of the anchor.
sectorsThe new sectors of the anchor.
transfThe transform of the position.

Reimplemented in psEffectAnchorSocket.

virtual void psEffectAnchor::SetPosition ( const csVector3 &  basePos,
iSector *  sector,
const csMatrix3 &  transf 
) [virtual]

Sets a new position for the effect anchor.

Parameters:
basePosThe new position of the anchor.
sectorThe new sector of the anchor
transfThe transform of the position.

Reimplemented in psEffectAnchorSocket.

virtual void psEffectAnchor::SetRotBase ( const csMatrix3 &  newRotBase) [inline, virtual]

Sets the base rotation matrix of the effect anchor.

Parameters:
newRotBaseThe base rotation matrix.

Reimplemented in psEffectAnchorSocket.

Definition at line 300 of file pseffectanchor.h.

void psEffectAnchor::SetTarget ( const csVector3 &  newTarget,
const csMatrix3 &  transf 
) [inline]

Sets the target of the effect anchor.

Parameters:
newTargetThe new target.
transfThe transform of the target.

Definition at line 259 of file pseffectanchor.h.

void psEffectAnchor::TransformOffset ( csVector3 &  offset)

Transforms the offset according to the mesh's settings, like abs_dir, etc.

Parameters:
offsetthe vector to be transformed.
virtual bool psEffectAnchor::Update ( csTicks  elapsed) [virtual]

Updates the effect anchor -- called every frame.

Parameters:
elapsedthe ticks elapsed since last update.
Returns:
false if the anchor is useless and can be removed by its parent effect.

Reimplemented in psEffectAnchorBasic, psEffectAnchorSocket, and psEffectAnchorSpline.


Member Data Documentation

The amount of time this anchor has been alive (gets reset on loop).

Definition at line 422 of file pseffectanchor.h.

size_t psEffectAnchor::currKeyFrame [protected]

Definition at line 456 of file pseffectanchor.h.

int psEffectAnchor::dir [protected]

What type of direction does this movable have.

Definition at line 451 of file pseffectanchor.h.

csRef<iEngine> psEffectAnchor::engine [protected]

Reference to CS's iEngine.

Definition at line 463 of file pseffectanchor.h.

bool psEffectAnchor::isReady [protected]

Definition at line 465 of file pseffectanchor.h.

The next keyframe the anchor will be on.

Stores the keyframes of this anchor (this is shared between all anchor of this type).

Definition at line 460 of file pseffectanchor.h.

A unique name identifying this anchor.

Definition at line 421 of file pseffectanchor.h.

csMatrix3 psEffectAnchor::matBase [protected]

The length of each loop of this anchor.

Definition at line 424 of file pseffectanchor.h.

csRef<iMeshWrapper> psEffectAnchor::mesh [protected]

The mesh that makes up this anchor.

Definition at line 448 of file pseffectanchor.h.

csString psEffectAnchor::name [protected]

Definition at line 419 of file pseffectanchor.h.

size_t psEffectAnchor::nextKeyFrame [protected]

The current keyframe the anchor is on.

Definition at line 457 of file pseffectanchor.h.

csVector3 psEffectAnchor::objBasePos [protected]

Base pos for the effect anchor, this is used for things like the variable offset from the anchoring mesh.

Definition at line 434 of file pseffectanchor.h.

csVector3 psEffectAnchor::objEffectPos [protected]

The base transform matrix of this anchor.

objEffectPos is pretty much the position of the effect, (that's not a requirement though). It's the only position vector that can be modified externally (by the effect after creation) and this one shouldn't be modified by the effect anchor in any way.

Definition at line 431 of file pseffectanchor.h.

csVector3 psEffectAnchor::objOffset [protected]

The complete offset, this gets modified by the position action, generally.

Definition at line 440 of file pseffectanchor.h.

csVector3 psEffectAnchor::objTargetOffset [protected]

Stores the delta to the effect target.

Definition at line 437 of file pseffectanchor.h.

csMatrix3 psEffectAnchor::posTransf [protected]

Definition at line 441 of file pseffectanchor.h.

Whether the anchor should rotate with the mesh. This is so effects can stay aligned, e.g. flame sword.

Definition at line 454 of file pseffectanchor.h.

csVector3 psEffectAnchor::target [protected]

Stores the target of the effect.

Definition at line 444 of file pseffectanchor.h.

csMatrix3 psEffectAnchor::targetTransf [protected]

Definition at line 445 of file pseffectanchor.h.


The documentation for this class was generated from the following file: