eris
1.4.0
A WorldForge client library.
|
#include <View.h>
Public Types | |
typedef sigc::slot< void, ViewEntity * > | EntitySightSlot |
Public Member Functions | |
View (Avatar &av) | |
ViewEntity * | getEntity (const std::string &eid) const |
Avatar & | getAvatar () const |
Entity * | getTopLevel () const |
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 () |
void | registerFactory (std::unique_ptr< Factory > factory) |
double | getSimulationSpeed () const |
sigc::connection | notifyWhenEntitySeen (const std::string &eid, const EntitySightSlot &slot) |
void | dumpLookQueue () |
std::size_t | lookQueueSize () const |
void | sendLookAt (const std::string &eid) |
size_t | pruneAbandonedPendingEntities () |
Connection & | getConnection () const |
Public Attributes | |
sigc::signal< void, ViewEntity * > | EntitySeen |
sigc::signal< void, ViewEntity * > | EntityCreated |
sigc::signal< void, ViewEntity * > | EntityDeleted |
sigc::signal< void > | TopLevelEntityChanged |
emitted when the TLVE changes More... | |
sigc::signal< void, ViewEntity * > | InitialSightEntity |
Protected Member Functions | |
void | appear (const std::string &eid, double stamp) |
void | disappear (const std::string &eid) |
void | sight (const Atlas::Objects::Entity::RootEntity &ge) |
void | deleteEntity (const std::string &eid) |
void | unseen (const std::string &eid) |
bool | isPending (const std::string &eid) const |
test if the specified entity ID is pending initial sight on the View More... | |
void | addToPrediction (ViewEntity *ent) |
void | removeFromPrediction (ViewEntity *ent) |
void | taskRateChanged (Task *) |
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.
ViewEntity * Eris::View::getEntity | ( | const std::string & | eid | ) | const |
Retrieve an entity in the view by id. Returns nullptr if no such entity exists in the view.
Definition at line 45 of file View.cpp.
Referenced by Eris::ViewEntity::getEntity().
EventService & Eris::View::getEventService | ( | ) |
Gets the EventService used by the view.
Definition at line 77 of file View.cpp.
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 nullptr until the first emission of the TopLevelEntityChanged signal.
Definition at line 59 of file View.h.
References getEventService(), getTypeService(), notifyWhenEntitySeen(), registerFactory(), and update().
TypeService & Eris::View::getTypeService | ( | ) |
Gets the TypeService attached to the view.
Definition at line 69 of file View.cpp.
Referenced by getTopLevel().
TypeService & Eris::View::getTypeService | ( | ) | const |
Gets the TypeService attached to the view.
|
protected |
test if the specified entity ID is pending initial sight on the View
Definition at line 336 of file View.cpp.
Referenced by lookQueueSize().
|
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)
Definition at line 137 of file View.h.
References isPending(), sendLookAt(), and taskRateChanged().
sigc::connection Eris::View::notifyWhenEntitySeen | ( | const std::string & | eid, |
const EntitySightSlot & | slot | ||
) |
Connect 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)
Definition at line 58 of file View.cpp.
Referenced by getTopLevel().
void Eris::View::registerFactory | ( | std::unique_ptr< Factory > | factory | ) |
Register an Entity Factory with this view
Definition at line 54 of file View.cpp.
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.
Definition at line 375 of file View.cpp.
References Eris::Entity::getLocation(), and Eris::Entity::observe().
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.
Definition at line 134 of file View.cpp.
References Eris::Entity::firstSight(), Eris::Entity::getEntity(), Eris::Entity::getLocation(), Eris::Entity::getStamp(), Eris::TypeService::getTypeForAtlas(), Eris::TypeInfo::isBound(), Eris::Entity::isVisible(), Eris::Entity::m_recentlyCreated, Eris::Entity::setLocation(), and Eris::Entity::setVisible().
Referenced by lookQueueSize(), Eris::ViewEntity::onTaskAdded(), 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.
Definition at line 89 of file View.cpp.
References Eris::Entity::isMoving().
Referenced by getTopLevel().
sigc::signal<void, ViewEntity*> Eris::View::EntityCreated |
sigc::signal<void, ViewEntity*> Eris::View::EntityDeleted |
sigc::signal<void, ViewEntity*> Eris::View::EntitySeen |
sigc::signal<void, ViewEntity*> Eris::View::InitialSightEntity |
sigc::signal<void> Eris::View::TopLevelEntityChanged |