Planeshift
psEffect Class Reference

The effect class. More...

#include <pseffect.h>

Public Member Functions

size_t AddAnchor (psEffectAnchor *anchor)
 Adds an effect anchor to this effect. More...
 
psEffectClone () const
 Clones the effect. More...
 
psEffectAnchorCreateAnchor (const csString &type)
 Creates an effect anchor given a type string. More...
 
psEffectAnchorFindAnchor (const csString &anchorName) const
 Finds an effect anchor of the given name. More...
 
psEffectObjFindObj (const csString &objName) const
 Finds an effect obj of the given name. More...
 
psEffectAnchorGetAnchor (size_t idx) const
 Returns the effect anchor at the given index. More...
 
size_t GetAnchorCount () const
 Returns the number of effect anchors in this effect. More...
 
float GetAnimLength () const
 Returns the animation length of the effect. More...
 
int GetKillTime () const
 Returns the time after which this effect will be killed. More...
 
psEffectObjTextableGetMainTextObj () const
 
const csString & GetName () const
 Gets the name of the effect. More...
 
psEffectObjGetObj (size_t idx) const
 Returns the effect obj at the given index. More...
 
size_t GetObjCount () const
 Returns the number of effect objs in this effect. More...
 
unsigned int GetUniqueID () const
 Returns the uniqueID of this effect. More...
 
void Hide ()
 Hides the effect. More...
 
bool IsVisible ()
 Returns visibility value. More...
 
bool Load (iDocumentNode *node, iView *parentView, psEffect2DRenderer *renderer2d, iLoaderContext *ldr_context)
 Loads the effect from an xml node. More...
 
 psEffect ()
 Constructor. More...
 
unsigned int Render (iSectorList *sectors, const csVector3 &offset, iMeshWrapper *attachPos, iMeshWrapper *attachTarget, const csVector3 &up, const unsigned int uniqueIDOverride=0, bool rotateWithMesh=false)
 Renders the effect. More...
 
unsigned int Render (iSector *sector, const csVector3 &offset, iMeshWrapper *attachPos, iMeshWrapper *attachTarget, const csVector3 &up, const unsigned int uniqueIDOverride=0)
 Renders the effect. More...
 
bool SetFrameParamScalings (const float *scale)
 Set the scalings for each frame parameter. More...
 
void SetKillTime (const int newKillTime)
 Sets the time after which this effect will be killed. More...
 
void SetScaling (float scale, float aspect)
 Some effects use these scaling parameters to scale the object. More...
 
void Show ()
 Shows the effect. More...
 
bool Update (csTicks elapsed)
 Updates the spell effect – called every frame. More...
 
 ~psEffect ()
 Destructor. More...
 

Detailed Description

The effect class.

Definition at line 51 of file pseffect.h.

Constructor & Destructor Documentation

psEffect::psEffect ( )

Constructor.

psEffect::~psEffect ( )

Destructor.

Member Function Documentation

size_t psEffect::AddAnchor ( psEffectAnchor anchor)

Adds an effect anchor to this effect.

Parameters
anchora valid effect anchor.
Returns
the index of the effect anchor; Can be accessed with GetAnchor(index)
psEffect* psEffect::Clone ( ) const

Clones the effect.

psEffectAnchor* psEffect::CreateAnchor ( const csString &  type)

Creates an effect anchor given a type string.

Parameters
typea string identifying the type of the anchor. Possible types are:
  • basic
  • spline
  • socket
Returns
the effect anchor if successfull, 0 otherwise.
psEffectAnchor* psEffect::FindAnchor ( const csString &  anchorName) const

Finds an effect anchor of the given name.

Parameters
anchorNamethe name of the anchor to find
Returns
the anchor if it's found, 0 otherwise
psEffectObj* psEffect::FindObj ( const csString &  objName) const

Finds an effect obj of the given name.

Parameters
objNamethe name of the obj to find
Returns
the obj if it's found, 0 otherwise
psEffectAnchor* psEffect::GetAnchor ( size_t  idx) const

Returns the effect anchor at the given index.

Parameters
idxthe index of the anchor to grab
Returns
the effect anchor at the given index
size_t psEffect::GetAnchorCount ( ) const

Returns the number of effect anchors in this effect.

Returns
the effect anchor count
float psEffect::GetAnimLength ( ) const

Returns the animation length of the effect.

Returns
the animation length (max anim length of effect objs)
int psEffect::GetKillTime ( ) const

Returns the time after which this effect will be killed.

psEffectObjTextable* psEffect::GetMainTextObj ( ) const
Todo:
comment this
const csString& psEffect::GetName ( ) const

Gets the name of the effect.

Returns
the name of the effect
psEffectObj* psEffect::GetObj ( size_t  idx) const

Returns the effect obj at the given index.

Parameters
idxthe index of the obj to grab
Returns
the effect obj at the given index
size_t psEffect::GetObjCount ( ) const

Returns the number of effect objs in this effect.

Returns
the effect obj count
unsigned int psEffect::GetUniqueID ( ) const

Returns the uniqueID of this effect.

Returns
the uniqueID of the effect
void psEffect::Hide ( )

Hides the effect.

bool psEffect::IsVisible ( )

Returns visibility value.

bool psEffect::Load ( iDocumentNode *  node,
iView *  parentView,
psEffect2DRenderer renderer2d,
iLoaderContext *  ldr_context 
)

Loads the effect from an xml node.

Parameters
nodean xml node containing the effect, must be valid.
parentViewthe CS viewport that views the effect.
renderer2dthe 2D renderer.
ldr_contextthe current loader context.
Returns
true on success, false otherwise.
unsigned int psEffect::Render ( iSectorList *  sectors,
const csVector3 &  offset,
iMeshWrapper *  attachPos,
iMeshWrapper *  attachTarget,
const csVector3 &  up,
const unsigned int  uniqueIDOverride = 0,
bool  rotateWithMesh = false 
)

Renders the effect.

Parameters
sectorsthe starting sectors of the effect
offsetthe offset of the position of the effect
attachPosthe object to attach the effect to, 0 for 0,0,0
attachTargetthe target of the effect
upthe base up vector of the effect
uniqueIDOverrideoverrides the unique ID of the effect (for things like group effects)
rotateWithMeshShould the effect rotate with the mesh.
Returns
0 on failure, a unique ID on success
unsigned int psEffect::Render ( iSector *  sector,
const csVector3 &  offset,
iMeshWrapper *  attachPos,
iMeshWrapper *  attachTarget,
const csVector3 &  up,
const unsigned int  uniqueIDOverride = 0 
)

Renders the effect.

Parameters
sectorthe starting sector of the effect
offsetthe offset of the position of the effect
attachPosthe object to attoch the effect to, 0 for 0,0,0
attachTargetthe target of the effect, 0 for
upthe base up vector of the effect
uniqueIDOverrideoverrides the unique ID of the effect (for things like group effects)
Returns
0 on failure, a unique ID on success
bool psEffect::SetFrameParamScalings ( const float scale)

Set the scalings for each frame parameter.

void psEffect::SetKillTime ( const int  newKillTime)

Sets the time after which this effect will be killed.

Parameters
newKillTimenew time in ms
Note
the actual kill time may still vary due to fixed times in effects
void psEffect::SetScaling ( float  scale,
float  aspect 
)

Some effects use these scaling parameters to scale the object.

void psEffect::Show ( )

Shows the effect.

bool psEffect::Update ( csTicks  elapsed)

Updates the spell effect – called every frame.

Parameters
elapsedthe ticks elapsed since last update
Returns
false if the obj is useless and can be removed

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