Planeshift
psEffectManager Class Reference

#include <pseffectmanager.h>

Public Member Functions

void AddEffect (const char *name, psEffect *effect)
 
unsigned int AttachLight (const char *name, const csVector3 &pos, float radius, const csColor &colour, iMeshWrapper *mw)
 
void Clear ()
 Clears all effects. More...
 
bool DeleteEffect (unsigned int effectID)
 Deletes an effect. More...
 
void DetachLight (unsigned int lightID)
 
psEffectFindEffect (unsigned int ID) const
 Gets the effect with the given ID. More...
 
psEffectFindEffect (const csString &name) const
 Finds an effect by the given name. More...
 
psEffect2DRendererGet2DRenderer () const
 
csHash< psEffect *, csString >::GlobalIterator GetEffectsIterator ()
 Gets a global iterator that will iterate over all effect factories. More...
 
iView * GetView () const
 
csPtr< iThreadReturn > LoadEffects (const csString &fileName, iView *parentView)
 Loads one or more gfx effects from a file. More...
 
bool LoadFromDirectory (const csString &path, bool includeSubDirs, iView *parentView)
 Loads all effect files that can be found in a directory path. More...
 
bool LoadFromEffectsList (const csString &fileName, iView *parentView)
 Loads the effect files listed in the given effects list. More...
 
 psEffectManager (iObjectRegistry *objReg)
 
void Render2D (iGraphics3D *g3d, iGraphics2D *g2d)
 
unsigned int RenderEffect (const csString &effectName, const csVector3 &offset, iMeshWrapper *attachPos, iMeshWrapper *attachTarget=0, const csVector3 &up=csVector3(0, 1, 0), const unsigned int uniqueIDOverride=0, bool rotateWithMesh=false, const float *scale=NULL)
 Begins rendering of an effect that is attached to an iMeshWrapper. More...
 
unsigned int RenderEffect (const csString &effectName, iSector *sector, const csVector3 &pos, iMeshWrapper *attachTarget, const csVector3 &up=csVector3(0, 1, 0), const unsigned int uniqueIDOverride=0, const float *scale=NULL)
 Begins rendering an effect that isn't attached to anything. More...
 
unsigned int RenderEffect (const csString &effectName, iSectorList *sectors, const csVector3 &pos, iMeshWrapper *attachTarget=0, const csVector3 &up=csVector3(0, 1, 0), const unsigned int uniqueIDOverride=0, const float *scale=NULL)
 Begins rendering an effect that isn't attached to anything. More...
 
void ShowEffect (unsigned int id, bool value=true)
 Hide or Show the effect. More...
 
void Update (csTicks elapsed=0)
 Updates the spell effects (should be called every frame). More...
 
virtual ~psEffectManager ()
 

Detailed Description

Definition at line 88 of file pseffectmanager.h.

Constructor & Destructor Documentation

psEffectManager::psEffectManager ( iObjectRegistry *  objReg)
virtual psEffectManager::~psEffectManager ( )
virtual

Member Function Documentation

void psEffectManager::AddEffect ( const char *  name,
psEffect effect 
)
unsigned int psEffectManager::AttachLight ( const char *  name,
const csVector3 &  pos,
float  radius,
const csColor &  colour,
iMeshWrapper *  mw 
)
void psEffectManager::Clear ( )

Clears all effects.

bool psEffectManager::DeleteEffect ( unsigned int  effectID)

Deletes an effect.

Parameters
effectIDthe unique ID of the effect (as returned by RenderEffect())
Returns
true if the effect manager no longer contains an effect by that ID, false if there was a problem
void psEffectManager::DetachLight ( unsigned int  lightID)
psEffect* psEffectManager::FindEffect ( unsigned int  ID) const

Gets the effect with the given ID.

Parameters
IDthe id of the effect (the value returned by RenderEffect)
Returns
a reference to the effect, 0 if the effect could not be found
psEffect* psEffectManager::FindEffect ( const csString &  name) const

Finds an effect by the given name.

Parameters
namethe name of the effect to find
Returns
the effect if it found it, null if not
psEffect2DRenderer* psEffectManager::Get2DRenderer ( ) const
inline

Definition at line 236 of file pseffectmanager.h.

csHash<psEffect*, csString>::GlobalIterator psEffectManager::GetEffectsIterator ( )

Gets a global iterator that will iterate over all effect factories.

Returns
the iterator.
iView* psEffectManager::GetView ( ) const
inline

Definition at line 229 of file pseffectmanager.h.

csPtr<iThreadReturn> psEffectManager::LoadEffects ( const csString &  fileName,
iView *  parentView 
)

Loads one or more gfx effects from a file.

Parameters
fileNamethe vfs path to the file that holds the spell effect
parentViewthe CS viewport that views the effects
Returns
true on success, false otherwise
bool psEffectManager::LoadFromDirectory ( const csString &  path,
bool  includeSubDirs,
iView *  parentView 
)

Loads all effect files that can be found in a directory path.

Parameters
pathThe vfs path to search.
includeSubDirsIf True, it will extend its search into subdirectories.
parentViewThe CS viewport that views the effects.
Returns
True on success, false otherwise.
bool psEffectManager::LoadFromEffectsList ( const csString &  fileName,
iView *  parentView 
)

Loads the effect files listed in the given effects list.

Parameters
fileNamethe vfs path to the file that holds the effects list
parentViewthe CS viewport that views the effects
Returns
true on success, false otherwise
void psEffectManager::Render2D ( iGraphics3D *  g3d,
iGraphics2D *  g2d 
)
unsigned int psEffectManager::RenderEffect ( const csString &  effectName,
const csVector3 &  offset,
iMeshWrapper *  attachPos,
iMeshWrapper *  attachTarget = 0,
const csVector3 &  up = csVector3(0, 1, 0),
const unsigned int  uniqueIDOverride = 0,
bool  rotateWithMesh = false,
const float scale = NULL 
)

Begins rendering of an effect that is attached to an iMeshWrapper.

Parameters
effectNamethe name of the effect to render
offsetthe position offset of the effect from the attached object
attachPosthe object to attach the effect to
attachTargetthe target of the effect, 0 assumes that the target is the same as the attachPos
upthe base up vector of the effect
uniqueIDOverrideoverrides the unique ID of the effect (for things like group effects)
rotateWithMeshRotate with the mesh.
scaleinput to the scale params for effects
Returns
0 on failure, a unique ID of the effect otherwise
unsigned int psEffectManager::RenderEffect ( const csString &  effectName,
iSector *  sector,
const csVector3 &  pos,
iMeshWrapper *  attachTarget,
const csVector3 &  up = csVector3(0, 1, 0),
const unsigned int  uniqueIDOverride = 0,
const float scale = NULL 
)

Begins rendering an effect that isn't attached to anything.

Parameters
effectNamethe name of the effect to render
sectorthe starting sector of the new effect
posthe position of the new effect
attachTargetthe target of the effect, 0 assumes that the target is the same as the offset
upthe base up vector of the effect
uniqueIDOverrideoverrides the unique ID of the effect (for things like group effects)
scaleinput to the scale params for effects
Returns
0 on failure, a unique ID of the effect otherwise
unsigned int psEffectManager::RenderEffect ( const csString &  effectName,
iSectorList *  sectors,
const csVector3 &  pos,
iMeshWrapper *  attachTarget = 0,
const csVector3 &  up = csVector3(0, 1, 0),
const unsigned int  uniqueIDOverride = 0,
const float scale = NULL 
)

Begins rendering an effect that isn't attached to anything.

Parameters
effectNamethe name of the effect to render
sectorsthe sectors the new effect is in
posthe position of the new effect
attachTargetthe target of the effect, 0 assumes that the target is the same as the offset
upthe base up vector of the effect
uniqueIDOverrideoverrides the unique ID of the effect (for things like group effects)
scaleinput to the scale params for effects
Returns
0 on failure, a unique ID of the effect otherwise
void psEffectManager::ShowEffect ( unsigned int  id,
bool  value = true 
)

Hide or Show the effect.

Parameters
ideffect ID
valueshow or hide
void psEffectManager::Update ( csTicks  elapsed = 0)

Updates the spell effects (should be called every frame).

Parameters
elapsedthe time in ms that has elapsed

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