Eris
1.4.0
|
View encapsulates the set of entities currently visible to an Avatar, as well as those that have recently been seen. More...
#include <View.h>
Public Types | |
typedef sigc::slot< void, Entity * > | EntitySightSlot |
Public Member Functions | |
View (Avatar *av) | |
Entity * | getEntity (const std::string &eid) const |
Retrieve an entity in the view by id. More... | |
Avatar * | getAvatar () const |
Entity * | getTopLevel () const |
return the current top-level entity. More... | |
TypeService & | getTypeService () |
Gets the TypeService attached to the view. More... | |
TypeService & | getTypeService () const |
Gets the TypeService attached to the view. More... | |
EventService & | getEventService () |
Gets the EventService used by the view. More... | |
EventService & | getEventService () const |
Gets the EventService used by the view. More... | |
void | update () |
once-per-frame update of the View - clients should call this method once per game loop (or similar), to allow the View to update Entity state. More... | |
void | registerFactory (Factory *) |
Register an Entity Factory with this view. | |
sigc::connection | notifyWhenEntitySeen (const std::string &eid, const EntitySightSlot &slot) |
Conenct up a slot to be fired when an Entity with the specified ID is seen. More... | |
void | dumpLookQueue () |
unsigned int | lookQueueSize () const |
Retrieve the current look queue size, for debugging / statistics purposes. More... | |
void | sendLookAt (const std::string &eid) |
Issue a LOOK operation for the specified entity ID. More... | |
Public Attributes | |
sigc::signal< void, Entity * > | EntitySeen |
emitted whenever the View creates a new Entity instance. More... | |
sigc::signal< void, Entity * > | EntityCreated |
emitted when a SIGHT(CREATE) op is received for an entity | |
sigc::signal< void, Entity * > | EntityDeleted |
emitted when a SIGHT(DELETE) op is received for an entity | |
sigc::signal< void > | AvatarEntityDeleted |
emitted AFTER the avatar entity was deleted due to a SIGHT(DELETE) op is received | |
sigc::signal< void, Entity * > | Appearance |
sigc::signal< void, Entity * > | Disappearance |
sigc::signal< void > | TopLevelEntityChanged |
emitted when the TLVE changes | |
sigc::signal< void, Entity * > | InitialSightEntity |
Emitted after a new Entity has been created and initialized. More... | |
Protected Member Functions | |
void | appear (const std::string &eid, float stamp) |
void | disappear (const std::string &eid) |
void | sight (const Atlas::Objects::Entity::RootEntity &ge) |
void | create (const Atlas::Objects::Entity::RootEntity &ge) |
void | deleteEntity (const std::string &eid) |
void | unseen (const std::string &eid) |
void | setEntityVisible (Entity *ent, bool vis) |
bool | isPending (const std::string &eid) const |
test if the specified entity ID is pending initial sight on the View | |
void | addToPrediction (Entity *ent) |
void | removeFromPrediction (Entity *ent) |
void | entityDeleted (Entity *ent) |
this is a hook that Entity's destructor calls to remove itself from the View's content map. More... | |
void | taskRateChanged (Task *) |
Method to register and unregister tasks with with view, so they can have their progress updated automatically by update(). More... | |
Friends | |
class | IGRouter |
class | ViewEntity |
class | Avatar |
class | Task |
View encapsulates the set of entities currently visible to an Avatar, as well as those that have recently been seen.
It receives visibility-affecting ops from the IGRouter, and uses them to update its state and emit signals.
|
protected |
this is a hook that Entity's destructor calls to remove itself from the View's content map.
The name is unfortantely similar to the public 'EntityDeleted' signal - alternative naming suggestions appreciated.
References Eris::Entity::getId().
Referenced by lookQueueSize(), and Eris::ViewEntity::shutdown().
Entity * Eris::View::getEntity | ( | const std::string & | eid | ) | const |
Retrieve an entity in the view by id.
Returns NULL if no such entity exists in the view.
Referenced by Eris::ViewEntity::getEntity().
EventService & Eris::View::getEventService | ( | ) |
Gets the EventService used by the view.
Referenced by getTopLevel().
EventService & Eris::View::getEventService | ( | ) | const |
Gets the EventService used by the view.
|
inline |
return the current top-level entity.
This will return NULL until the first emission of the TopLevelEntityChanged signal.
References getEventService(), getTypeService(), notifyWhenEntitySeen(), registerFactory(), and update().
TypeService & Eris::View::getTypeService | ( | ) |
Gets the TypeService attached to the view.
Referenced by getTopLevel().
TypeService & Eris::View::getTypeService | ( | ) | const |
Gets the TypeService attached to the view.
|
inline |
Retrieve the current look queue size, for debugging / statistics purposes.
Eg, this could be displayed as a bar-chart on screen in a client (optionally)
References entityDeleted(), isPending(), Eris::Factory::priority(), sendLookAt(), and taskRateChanged().
sigc::connection Eris::View::notifyWhenEntitySeen | ( | const std::string & | eid, |
const EntitySightSlot & | slot | ||
) |
Conenct up a slot to be fired when an Entity with the specified ID is seen.
If the entity is already visible, this is a no-op (and will log an error)
Referenced by getTopLevel().
void Eris::View::sendLookAt | ( | const std::string & | eid | ) |
Issue a LOOK operation for the specified entity ID.
The id may be empty for an anonymous look. The pending sight map will be updated with the appropriate information.
References Eris::Entity::getLocation().
Referenced by lookQueueSize().
|
protected |
Method to register and unregister tasks with with view, so they can have their progress updated automatically by update().
Only certain tasks (those with linear progress) are handled this way, but all tasks are submitted to this method.
References Eris::Entity::getContained(), Eris::Entity::getEntity(), Eris::Entity::getLocation(), Eris::Entity::getOrientation(), Eris::Entity::getPosition(), Eris::Entity::getStamp(), Eris::Entity::init(), Eris::TypeInfo::isBound(), Eris::Entity::isVisible(), Eris::Entity::m_recentlyCreated, Eris::Entity::numContained(), Eris::Entity::setLocation(), Eris::Entity::setVisible(), Eris::Entity::shutdown(), and Eris::Entity::sight().
Referenced by lookQueueSize(), and Eris::ViewEntity::task_ProgressRateChanged().
void Eris::View::update | ( | ) |
once-per-frame update of the View - clients should call this method once per game loop (or similar), to allow the View to update Entity state.
This includes motion prediction for moving entities, and confidence levels for disappeared entities.
References Eris::Entity::isMoving().
Referenced by getTopLevel().
sigc::signal<void, Entity*> Eris::View::EntitySeen |
sigc::signal<void, Entity*> Eris::View::InitialSightEntity |
Emitted after a new Entity has been created and initialized.
This signal is mainly meant for debugging or authoring; normal entity presentation logic should use EntitySeen or EntityCreated instead.