Eris::Entity Class Reference

Entity encapsulates the state and tracking of one game entity; this includes it's location in the containership tree (graph?), it's name and unique and id, and so on. More...

#include <Entity.h>

List of all members.

Public Types

typedef std::map< std::string,
Atlas::Message::Element > 
AttrMap
typedef sigc::slot< void,
const std::string &, const
Atlas::Message::Element & > 
AttrChangedSlot

Public Member Functions

 Entity (const std::string &id, TypeInfo *ty, View *vw)
virtual void shutdown ()
unsigned int numContained () const
EntitygetContained (unsigned int index) const
const Atlas::Message::Element & valueOfAttr (const std::string &attr) const
bool hasAttr (const std::string &p) const
sigc::connection observe (const std::string &attr, const AttrChangedSlot &aslot)
 setup an observer so that the specified slot is fired when the named attribue's value changes
const std::string & getId () const
 retrieve the unique entity ID
const std::string & getName () const
float getStamp () const
 access the current time-stamp of the entity
TypeInfogetType () const
ViewgetView () const
EntitygetLocation () const
 the containing entity, or null if this is a top-level visible entity.
WFMath::Point< 3 > getPosition () const
 Returns the Entity's position inside it's parent in the parent's local system coordinates.
const AttrMap & getAttributes () const
bool isMoving () const
 Test if this entity has a non-zero velocity vector.
WFMath::Point< 3 > getPredictedPos () const
 Retrieve the predicted position of this entity, based on it's velocity and acceleration.
WFMath::Vector< 3 > getPredictedVelocity () const
 Retrieve the current predicted velocity of an entity.
WFMath::Point< 3 > getViewPosition () const
 retreive this Entity's position in view coordinates.
WFMath::Quaternion getViewOrientation () const
 retreive this Entity's orientation in view coordinates.
const WFMath::Vector< 3 > & getVelocity (void) const
 Returns the entity's velocity as last set explicitely.
const WFMath::Quaternion & getOrientation (void) const
 Returns the entity's orientation as last set explicitely.
const WFMath::AxisBox< 3 > & getBBox (void) const
 Returns the entity's bounding box in the entity's local system coordinates.
bool hasBBox () const
const TaskArray & getTasks () const
TypeInfoArray getUseOperations () const
 Get a list of operations supported by this entity (tool) If the entity does no provide an operations list, this will return an empty array.
bool hasChild (const std::string &eid) const
bool isVisible () const
 determine if this entity is visible.
template<class C>
toLocationCoords (const C &c) const
template<class C>
fromLocationCoords (const C &c) const
WFMath::Vector< 3 > toLocationCoords (const WFMath::Vector< 3 > &v) const
WFMath::Vector< 3 > fromLocationCoords (const WFMath::Vector< 3 > &v) const

Public Attributes

sigc::signal< void, Entity * > ChildAdded
sigc::signal< void, Entity * > ChildRemoved
sigc::signal< void, Entity * > LocationChanged
 emitted when our location changes.
sigc::signal< void, const
StringSet & > 
Changed
 Emitted when one or more attributes change.
sigc::signal< void > Moved
 Emitted when then entity's position, orientation or velocity change.
sigc::signal< void, bool > Moving
 Emitted when an entity starts or stops moving (as determined by the 'inMotion' method.
sigc::signal< void, const
Atlas::Objects::Root & > 
Say
 Emitted with the entity speaks.
sigc::signal< void, const
std::string & > 
Emote
 Emitted when this entity emits an imgainary operation (also known as an emote.
sigc::signal< void, const
Atlas::Objects::Operation::RootOperation & > 
Acted
 Emitted when this entity performs an action.
sigc::signal< void, const
Atlas::Objects::Root & > 
Noise
 Emitted when this entity performs an action which causes a noise.
sigc::signal< void, bool > VisibilityChanged
sigc::signal< void > BeingDeleted
 Emitted prior to deletion.
sigc::signal< void, Task * > TaskAdded
sigc::signal< void, Task * > TaskRemoved

Protected Member Functions

virtual void init (const Atlas::Objects::Entity::RootEntity &ge, bool fromCreateOp)
 over-rideable initialisation helper.
virtual void onTalk (const Atlas::Objects::Operation::RootOperation &talk)
 process TALK data - default implementation emits the Say signal.
virtual void onAttrChanged (const std::string &attr, const Atlas::Message::Element &v)
virtual void onLocationChanged (Entity *oldLoc)
virtual void onMoved ()
 over-rideable hook method when then Entity position, orientation or velocity change.
virtual void onVisibilityChanged (bool vis)
 over-rideable hook when the actual (computed) visiblity of this entity changed.
virtual void onAction (const Atlas::Objects::Operation::RootOperation &act)
 Over-rideable hook when this entity is seen to perform an action.
virtual void onSoundAction (const Atlas::Objects::Operation::RootOperation &op)
 Over-rideable hook when this entity is heard performing an action.
virtual void onImaginary (const Atlas::Objects::Root &act)
 Over-rideable hook when this entity is seen to emit an imginary op.
virtual void setMoving (bool moving)
 over-rideable hook for when the entity changes from stationary to moving or vice-versa.
virtual void onChildAdded (Entity *child)
 Over-rideable hook when child entities are added.
virtual void onChildRemoved (Entity *child)
 Over-rideable hook when child entities are removed.

Friends

class IGRouter
class View
class EntityRouter
class Task

Classes

class  DynamicState


Detailed Description

Entity encapsulates the state and tracking of one game entity; this includes it's location in the containership tree (graph?), it's name and unique and id, and so on.

This class may be sub-classed by users (and those sub-classes built via a Factory), to allow specific functionality. This means there are two integration strategies; either subclassing and over-riding virtual functions, or creating peer clases and attaching them to the signals.


Member Function Documentation

Entity* Eris::Entity::getLocation (  )  const [inline]

the containing entity, or null if this is a top-level visible entity.

WFMath::Point<3> Eris::Entity::getPosition (  )  const [inline]

Returns the Entity's position inside it's parent in the parent's local system coordinates.

bool Eris::Entity::isMoving (  )  const

Test if this entity has a non-zero velocity vector.

WFMath::Point< 3 > Eris::Entity::getPredictedPos (  )  const

Retrieve the predicted position of this entity, based on it's velocity and acceleration.

If the entity is not moving, this is the same as calling getPosition().

WFMath::Vector< 3 > Eris::Entity::getPredictedVelocity (  )  const

Retrieve the current predicted velocity of an entity.

If the entity is not moving, this is an invalid Vector.

WFMath::Point< 3 > Eris::Entity::getViewPosition (  )  const

retreive this Entity's position in view coordinates.

WFMath::Quaternion Eris::Entity::getViewOrientation (  )  const

retreive this Entity's orientation in view coordinates.

const WFMath::Vector< 3 >& Eris::Entity::getVelocity ( void   )  const [inline]

Returns the entity's velocity as last set explicitely.

const WFMath::Quaternion& Eris::Entity::getOrientation ( void   )  const [inline]

Returns the entity's orientation as last set explicitely.

const WFMath::AxisBox< 3 >& Eris::Entity::getBBox ( void   )  const [inline]

Returns the entity's bounding box in the entity's local system coordinates.

bool Eris::Entity::isVisible (  )  const

determine if this entity is visible.

virtual void Eris::Entity::init ( const Atlas::Objects::Entity::RootEntity &  ge,
bool  fromCreateOp 
) [protected, virtual]

over-rideable initialisation helper.

When subclassing, if you over-ride this method, take care to call the base implementation, or unfortunate things will happen.

void Eris::Entity::onTalk ( const Atlas::Objects::Operation::RootOperation &  talk  )  [protected, virtual]

process TALK data - default implementation emits the Say signal.

Parameters:
talk The TALK operation

void Eris::Entity::onMoved (  )  [protected, virtual]

over-rideable hook method when then Entity position, orientation or velocity change.

The default implementation emits the Moved signal.

void Eris::Entity::onVisibilityChanged ( bool  vis  )  [protected, virtual]

over-rideable hook when the actual (computed) visiblity of this entity changed.

The default implementation emits the VisiblityChanged signal.

void Eris::Entity::onAction ( const Atlas::Objects::Operation::RootOperation &  act  )  [protected, virtual]

Over-rideable hook when this entity is seen to perform an action.

Default implementation emits the Action signal.

void Eris::Entity::onSoundAction ( const Atlas::Objects::Operation::RootOperation &  op  )  [protected, virtual]

Over-rideable hook when this entity is heard performing an action.

Default implementation emits the Noise signal.

void Eris::Entity::onImaginary ( const Atlas::Objects::Root &  act  )  [protected, virtual]

Over-rideable hook when this entity is seen to emit an imginary op.

Default implementation emits the Emote signal.

void Eris::Entity::setMoving ( bool  moving  )  [protected, virtual]

over-rideable hook for when the entity changes from stationary to moving or vice-versa.

This hook exists so a client can treat moving objects differently (eg, placing them in a different part of the scene graph). If you over-ride this, you must call the base version, or motion prediction will stop working for the entity.

void Eris::Entity::onChildAdded ( Entity child  )  [protected, virtual]

Over-rideable hook when child entities are added.

The default implementation emits the ChildAdded signal.

void Eris::Entity::onChildRemoved ( Entity child  )  [protected, virtual]

Over-rideable hook when child entities are removed.

The default implementation emits the Childremoved signal.


Member Data Documentation

sigc::signal<void, Entity*> Eris::Entity::LocationChanged

emitted when our location changes.

First argument is the entity, second is the old location. The new location can be found via getLocation. Note either the old or new location might be NULL.

sigc::signal<void, const StringSet&> Eris::Entity::Changed

Emitted when one or more attributes change.

The arguments are the Entity which changed, and a set of attribute IDs which were modified.

sigc::signal<void> Eris::Entity::Moved

Emitted when then entity's position, orientation or velocity change.

Argument is the entity that moved, so you can bind the same slot to multiple entities if desired.

sigc::signal<void, bool> Eris::Entity::Moving

Emitted when an entity starts or stops moving (as determined by the 'inMotion' method.

sigc::signal< void, const Atlas::Objects::Root & > Eris::Entity::Say

Emitted with the entity speaks.

The argument contains attributes that make up the content of the Say operation.

sigc::signal<void, const std::string&> Eris::Entity::Emote

Emitted when this entity emits an imgainary operation (also known as an emote.

This is used for debugging, but not much else.

sigc::signal<void, const Atlas::Objects::Operation::RootOperation&> Eris::Entity::Acted

Emitted when this entity performs an action.

The argument to the action is passed as the signal argument. For examples of action arguments, see some documentation that probably isn't written yet.

sigc::signal<void, const Atlas::Objects::Root&> Eris::Entity::Noise

Emitted when this entity performs an action which causes a noise.

This may happen alongside the sight of the action, or not, depending on the distance to the entity and so on.

sigc::signal<void> Eris::Entity::BeingDeleted

Emitted prior to deletion.

Note that entity instances may be deleted for different reasons - passing out of the view, being deleted on the server, or during disconnection. This signal is emitted regardless.


The documentation for this class was generated from the following files:
Generated on Sat Jul 28 23:03:01 2007 for Eris by  doxygen 1.5.2