20 #ifndef PS_EFFECT_HEADER 21 #define PS_EFFECT_HEADER 23 #include <iutil/document.h> 24 #include <csutil/csstring.h> 25 #include <csutil/array.h> 26 #include <csgeom/matrix3.h> 27 #include <iengine/movable.h> 28 #include <csutil/ref.h> 29 #include <csutil/scf.h> 30 #include <iutil/virtclk.h> 31 #include <iengine/movable.h> 32 #include <iengine/objwatch.h> 33 #include <csutil/parray.h> 36 struct iLoaderContext;
96 iLoaderContext* ldr_context);
110 unsigned int Render(iSectorList* sectors,
const csVector3 &offset, iMeshWrapper* attachPos,
111 iMeshWrapper* attachTarget,
const csVector3 &up,
const unsigned int uniqueIDOverride = 0,
112 bool rotateWithMesh =
false);
125 unsigned int Render(iSector* sector,
const csVector3 &offset, iMeshWrapper* attachPos,
126 iMeshWrapper* attachTarget,
const csVector3 &up,
const unsigned int uniqueIDOverride = 0);
134 bool Update(csTicks elapsed);
224 const csString &
GetName()
const;
255 class psEffectMovableListener :
public scfImplementation1<psEffectMovableListener,iMovableListener>
263 psEffectMovableListener()
264 : scfImplementationType(
this)
267 movableChanged =
false;
271 virtual ~psEffectMovableListener() {}
276 virtual void MovableChanged(iMovable* movable)
278 movableChanged =
true;
279 this->movable = movable;
285 virtual void MovableDestroyed(iMovable* )
289 movableChanged =
false;
297 bool IsMovableDead()
const 310 bool GrabNewData(iSectorList* &newSectors, csVector3 &newPos, csMatrix3 &newTransf)
312 if(!movableChanged || !movable)
315 newPos = movable->GetFullPosition();
316 newSectors = movable->GetSectors();
317 newTransf = movable->GetFullTransform().GetT2O();
319 movableChanged =
false;
330 bool GrabNewData(csVector3 &newPos, csMatrix3 &newTransf)
332 if(!movableChanged || !movable)
335 newPos = movable->GetFullPosition();
336 newTransf = movable->GetFullTransform().GetT2O();
337 movableChanged =
false;
341 csVector3 GetPosition()
344 return movable->GetFullPosition();
346 return csVector3(0, 0, 0);
350 csRef<psEffectMovableListener> positionListener;
351 csRef<psEffectMovableListener> targetListener;
354 unsigned int uniqueID;
357 csPDelArray<psEffectAnchor> effectAnchors;
358 csPDelArray<psEffectObj> effectObjs;
psEffectObj * FindObj(const csString &objName) const
Finds an effect obj of the given name.
psEffect * Clone() const
Clones the effect.
psEffectAnchor * GetAnchor(size_t idx) const
Returns the effect anchor at the given index.
bool Update(csTicks elapsed)
Updates the spell effect – called every frame.
The manager of all 2D effect elements.
int GetKillTime() const
Returns the time after which this effect will be killed.
size_t GetObjCount() const
Returns the number of effect objs in this effect.
unsigned int GetUniqueID() const
Returns the uniqueID of this effect.
void Hide()
Hides the effect.
psEffectAnchor * CreateAnchor(const csString &type)
Creates an effect anchor given a type string.
psEffectAnchor * FindAnchor(const csString &anchorName) const
Finds an effect anchor of the given name.
size_t GetAnchorCount() const
Returns the number of effect anchors in this effect.
void SetKillTime(const int newKillTime)
Sets the time after which this effect will be killed.
psEffectObj * GetObj(size_t idx) const
Returns the effect obj at the given index.
bool Load(iDocumentNode *node, iView *parentView, psEffect2DRenderer *renderer2d, iLoaderContext *ldr_context)
Loads the effect from an xml node.
psEffectObjTextable * GetMainTextObj() const
An effect is not much more than a collection of effect objects.
const csString & GetName() const
Gets the name of the effect.
void Show()
Shows the effect.
void SetScaling(float scale, float aspect)
Some effects use these scaling parameters to scale the object.
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.
bool SetFrameParamScalings(const float *scale)
Set the scalings for each frame parameter.
bool IsVisible()
Returns visibility value.
float GetAnimLength() const
Returns the animation length of the effect.
Effect anchors provide a base location / anchor point for all effect objs.
size_t AddAnchor(psEffectAnchor *anchor)
Adds an effect anchor to this effect.