Eris
1.4.0
|
An entity which is bound to an Eris::View. More...
#include <ViewEntity.h>
Public Member Functions | |
ViewEntity (const std::string &id, TypeInfo *ty, View *view) | |
Ctor. More... | |
virtual void | shutdown () |
Shuts down the entity. More... | |
virtual View * | getView () const |
Gets the view to which this entity belongs, if any. More... | |
![]() | |
Entity (const std::string &id, TypeInfo *ty) | |
size_t | numContained () const |
Gets the number of contained entities, i.e. More... | |
Entity * | getContained (size_t index) const |
Gets the child entity at the specified index. More... | |
const Atlas::Message::Element & | valueOfAttr (const std::string &attr) const |
Gets the value of a named attribute. More... | |
bool | hasAttr (const std::string &p) const |
Checks whether an attribute exists. More... | |
const Atlas::Message::Element * | ptrOfAttr (const std::string &attr) const |
Gets the value of a named attribute, or null if none exists. More... | |
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. More... | |
const std::string & | getId () const |
Retrieve the unique entity ID. More... | |
const std::string & | getName () const |
Gets the name of the entity. More... | |
float | getStamp () const |
Access the current time-stamp of the entity. More... | |
TypeInfo * | getType () const |
Gets the type of this entity. More... | |
Entity * | getLocation () const |
The containing entity, or null if this is a top-level visible entity. More... | |
WFMath::Point< 3 > | getPosition () const |
Returns the Entity's position inside it's parent in the parent's local system coordinates. More... | |
const AttrMap | getAttributes () const |
Gets all attributes defined for this entity. More... | |
const AttrMap & | getInstanceAttributes () const |
Gets all locally defined attributes. More... | |
bool | isMoving () const |
Test if this entity has a non-zero velocity vector. More... | |
const WFMath::Point< 3 > & | getPredictedPos () const |
Retrieve the predicted position of this entity, based on it's velocity and acceleration. More... | |
const WFMath::Vector< 3 > & | getPredictedVelocity () const |
Retrieve the current predicted velocity of an entity. More... | |
const WFMath::Quaternion & | getPredictedOrientation () const |
Retrieve the current predicted orientation of an entity. More... | |
WFMath::Point< 3 > | getViewPosition () const |
Retrieve this Entity's position in view coordinates. More... | |
WFMath::Quaternion | getViewOrientation () const |
Retrieve this Entity's orientation in view coordinates. More... | |
const WFMath::Vector< 3 > & | getVelocity () const |
Returns the entity's velocity as last set explicitly. More... | |
const WFMath::Vector< 3 > & | getAngularVelocity () const |
Returns the entity's angular velocity as last set explicitly. More... | |
const WFMath::Quaternion & | getOrientation () const |
Returns the entity's orientation as last set explicitly. More... | |
const WFMath::AxisBox< 3 > & | getBBox () const |
Returns the entity's bounding box in the entity's local system coordinates. More... | |
bool | hasBBox () const |
Returns true if the entity has a bounding box. More... | |
const std::map< std::string, Task * > & | getTasks () const |
Gets the tasks associated with this entity. More... | |
bool | hasChild (const std::string &eid) const |
bool | isVisible () const |
determine if this entity is visible. More... | |
template<class C > | |
C | toLocationCoords (const C &c) const |
template<class C > | |
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 |
Protected Member Functions | |
virtual void | onTalk (const Atlas::Objects::Operation::RootOperation &talk) |
process TALK data - default implementation emits the Say signal. More... | |
virtual void | onSoundAction (const Atlas::Objects::Operation::RootOperation &op) |
Over-rideable hook when this entity is heard performing an action. More... | |
virtual void | onVisibilityChanged (bool vis) |
over-rideable hook when the actual (computed) visiblity of this entity changed. More... | |
virtual void | onTaskAdded (Task *task) |
Over-rideable hook for when tasks are added. More... | |
virtual void | removeFromMovementPrediction () |
Removes the entity from any movement prediction service. More... | |
virtual void | addToMovementPredition () |
Adds the entity to any movement prediction service. More... | |
virtual Entity * | getEntity (const std::string &id) |
Gets an entity with the supplied id from the system. More... | |
virtual TypeService * | getTypeService () const |
Gets the typeservice used throughout the Eris system. More... | |
void | task_ProgressRateChanged (Task *task) |
Listen to task progress rates updates and send to the view. More... | |
![]() | |
virtual void | init (const Atlas::Objects::Entity::RootEntity &ge, bool fromCreateOp) |
over-rideable initialisation helper. More... | |
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. More... | |
virtual void | onAction (const Atlas::Objects::Operation::RootOperation &act) |
Over-rideable hook when this entity is seen to perform an action. More... | |
virtual void | onImaginary (const Atlas::Objects::Root &act) |
Over-rideable hook when this entity is seen to emit an imginary op. More... | |
virtual void | setMoving (bool moving) |
over-rideable hook for when the entity changes from stationary to moving or vice-versa. More... | |
virtual void | onChildAdded (Entity *child) |
Over-rideable hook when child entities are added. More... | |
virtual void | onChildRemoved (Entity *child) |
Over-rideable hook when child entities are removed. More... | |
void | sight (const Atlas::Objects::Entity::RootEntity &gent) |
Fully initialise all entity state based on a RootEntity, including location and contents. | |
void | setFromRoot (const Atlas::Objects::Root &obj, bool allowMotion, bool includeTypeInfoAttributes=false) |
Initialise all simple state from a Root. More... | |
void | setVisible (bool vis) |
the View calls this to change local entity visibility. More... | |
void | setAttr (const std::string &p, const Atlas::Message::Element &v) |
bool | nativeAttrChanged (const std::string &p, const Atlas::Message::Element &v) |
Map Atlas attributes to natively stored properties. More... | |
void | typeInfo_AttributeChanges (const std::string &attributeName, const Atlas::Message::Element &element) |
Connected to the TypeInfo::AttributeChanges event. More... | |
virtual void | attrChangedFromTypeInfo (const std::string &attributeName, const Atlas::Message::Element &element) |
Called when an attribute has been changed in the TypeInfo for this entity. More... | |
void | fillAttributesFromType (Entity::AttrMap &attributes, TypeInfo *typeInfo) const |
Utility method for recursively filling a map of attributes from a TypeInfo instance. More... | |
void | beginUpdate () |
void | addToUpdate (const std::string &attr) |
void | endUpdate () |
void | setLocationFromAtlas (const std::string &locId) |
update the entity's location based on Atlas data. More... | |
void | setLocation (Entity *newLocation) |
setLocation is the core of the entity hierarchy maintenance logic. More... | |
void | setContentsFromAtlas (const StringList &contents) |
wrapper for setLocation with additional code the retrive the location if it's not available right now | |
void | filterMoveAttrs (Atlas::Message::MapType &attrs) const |
Remove from a map all items whose key is a movement related attribute, eg position or velocity. | |
void | buildEntityDictFromContents (IdEntityMap &dict) |
void | addChild (Entity *e) |
void | removeChild (Entity *e) |
void | addToLocation () |
void | removeFromLocation () |
void | updateTasks (const Atlas::Message::Element &e) |
void | updateCalculatedVisibility (bool wasVisible) |
recursively update the real visiblity of this entity, and fire appropriate signals. More... | |
void | updatePredictedState (const WFMath::TimeStamp &t) |
Protected Attributes | |
View * | m_view |
The View which owns this Entity. | |
EntityRouter * | m_router |
A router instance which routes messages from the view into this entity. | |
![]() | |
AttrMap | m_attrs |
TypeInfo * | m_type |
Entity * | m_location |
EntityArray | m_contents |
const std::string | m_id |
the Atlas object ID | |
std::string | m_name |
a human readable name | |
float | m_stamp |
last modification time (in seconds) | |
std::string | m_description |
bool | m_visible |
bool | m_limbo |
waiting for parent bind | |
WFMath::Vector< 3 > | m_scale |
WFMath::AxisBox< 3 > | m_bbox |
WFMath::AxisBox< 3 > | m_bboxUnscaled |
WFMath::Point< 3 > | m_position |
WFMath::Vector< 3 > | m_velocity |
WFMath::Quaternion | m_orientation |
WFMath::Vector< 3 > | m_acc |
WFMath::Vector< 3 > | m_angularVelocity |
Angular velocity. More... | |
float | m_angularMag |
The magnitude of the angular velocity. More... | |
DynamicState | m_predicted |
int | m_updateLevel |
If greater than zero, we are doing a batched update. More... | |
StringSet | m_modifiedAttrs |
When a batched property update is in progress, the set tracks the names of each modified property. More... | |
ObserverMap | m_observers |
bool | m_hasBBox |
This flag should be set when the server notifies that this entity has a bounding box. More... | |
WFMath::TimeStamp | m_lastMoveTime |
bool | m_moving |
flag recording if this entity is current considered in-motion | |
bool | m_recentlyCreated |
flag set if this entity was the subject of a sight(create) | |
std::map< std::string, Task * > | m_tasks |
bool | m_initialised |
Friends | |
class | EntityRouter |
Additional Inherited Members | |
![]() | |
typedef std::map< std::string, Atlas::Message::Element > | AttrMap |
typedef sigc::slot< void, const Atlas::Message::Element & > | AttrChangedSlot |
A slot which can be used for receiving attribute update signals. | |
![]() | |
static boost::optional< std::string > | extractEntityId (const Atlas::Message::Element &element) |
Extracts an entity id from the supplied element. More... | |
![]() | |
sigc::signal< void, Entity * > | ChildAdded |
sigc::signal< void, Entity * > | ChildRemoved |
sigc::signal< void, Entity * > | LocationChanged |
Signal that the entity's container changed. More... | |
sigc::signal< void, const StringSet & > | Changed |
Emitted when one or more attributes change. More... | |
sigc::signal< void > | Moved |
Emitted when then entity's position, orientation or velocity change. More... | |
sigc::signal< void, bool > | Moving |
Emitted when an entity starts or stops moving (as determined by the 'setMoving' method. More... | |
sigc::signal< void, const Atlas::Objects::Root &> | Say |
Emitted with the entity speaks. More... | |
sigc::signal< void, const std::string & > | Emote |
Emitted when this entity emits an imaginary operation (also known as an emote. More... | |
sigc::signal< void, const Atlas::Objects::Operation::RootOperation & > | Acted |
Emitted when this entity performs an action. More... | |
sigc::signal< void, const Atlas::Objects::Root & > | Noise |
Emitted when this entity performs an action which causes a noise. More... | |
sigc::signal< void, bool > | VisibilityChanged |
Emitted when the visibility of the entity changes. More... | |
sigc::signal< void > | BeingDeleted |
Emitted prior to deletion. More... | |
sigc::signal< void, Task * > | TaskAdded |
Emitted when a task has been added to the entity. More... | |
sigc::signal< void, Task * > | TaskRemoved |
Emitted when a task has been removed from the entity. More... | |
![]() | |
typedef std::unordered_map< std::string, Entity * > | IdEntityMap |
typedef sigc::signal< void, const Atlas::Message::Element & > | AttrChangedSignal |
typedef std::unordered_map< std::string, AttrChangedSignal > | ObserverMap |
An entity which is bound to an Eris::View.
This subclass of Eris::Entity is intimately bound to a View. As Atlas messages are received from the server these will be routed into an instance of this class.
In your client this is the class you would want to work with for any entities which represents entities that are on the server. If you however are working with entities that aren't represented on the server (the typical example would be if you're allowing client side authoring where you want to create entities locally) you would instead want to implement a new class which inherits Eris::Entity.
|
protectedvirtual |
Adds the entity to any movement prediction service.
This is called when movement has started.
Implements Eris::Entity.
References m_view.
|
protectedvirtual |
Gets an entity with the supplied id from the system.
id | The id of the entity to get. |
Implements Eris::Entity.
References Eris::View::getEntity(), and m_view.
|
protectedvirtual |
Gets the typeservice used throughout the Eris system.
Implements Eris::Entity.
References m_view.
|
inlinevirtual |
Gets the view to which this entity belongs, if any.
References m_view.
|
protectedvirtual |
Over-rideable hook when this entity is heard performing an action.
Default implementation emits the Noise signal.
Reimplemented from Eris::Entity.
References Eris::Avatar::Hear, m_view, and Eris::Entity::onSoundAction().
|
protectedvirtual |
process TALK data - default implementation emits the Say signal.
talk | The TALK operation |
Reimplemented from Eris::Entity.
References Eris::Avatar::Hear, m_view, and Eris::Entity::onTalk().
|
protectedvirtual |
Over-rideable hook for when tasks are added.
task | The new task. |
Reimplemented from Eris::Entity.
References Eris::Entity::onTaskAdded(), and task_ProgressRateChanged().
|
protectedvirtual |
over-rideable hook when the actual (computed) visiblity of this entity changed.
The default implementation emits the VisiblityChanged signal.
Reimplemented from Eris::Entity.
References m_view, and Eris::Entity::onVisibilityChanged().
|
protectedvirtual |
Removes the entity from any movement prediction service.
This is called when movement has stopped.
Implements Eris::Entity.
References m_view.
|
virtual |
Shuts down the entity.
A call to this must be made before the entity is deleted. In normal operations, where Eris itself takes care of the entities, it will be called automatically. If you however manually handle instance of this in your code you must call it yourself.
Reimplemented from Eris::Entity.
References Eris::View::entityDeleted(), Eris::Entity::m_id, m_router, m_view, and Eris::Entity::shutdown().
|
protected |
Listen to task progress rates updates and send to the view.
task | The task which is changed. |
References m_view, and Eris::View::taskRateChanged().
Referenced by onTaskAdded().