Entity Class Reference

#include <Entity.h>

Inherited by Physics2DEntity, and PhysicsEntity.

Collaboration diagram for Entity:

List of all members.


Public Member Functions

 Entity (unsigned short id, unsigned short environmentId, unsigned short instanceId, EntityType *type)
virtual ~Entity ()
virtual void changeEnvironment (Environment *newEnvironment)
virtual void dump ()
virtual void setFixed (bool fixed)
virtual void setEnvironmentTransformation (TransformationData trans)
virtual void setWorldTransformation (TransformationData trans)
void setAttachment (AttachmentKey key, void *attachment)
bool isFixed ()
unsigned short getInstanceId ()
unsigned int getTypeBasedId ()
unsigned int getEnvironmentBasedId ()
EntityTypegetEntityType ()
EnvironmentgetEnvironment ()
TransformationData getEnvironmentTransformation ()
TransformationData getWorldTransformation ()
ModelInterfacegetVisualRepresentation ()
void * getAttachment (AttachmentKey key)

Public Attributes

SceneGraphAttachmentsceneGraphAttachment
 Pointer for SceneGraphInterface to store Entity-specific data.

Protected Member Functions

virtual void update ()
virtual void setEnvironment (Environment *env)

Protected Attributes

bool fixed
 Defines if the Entity is fixed or movable.
unsigned int environmentBasedId
unsigned int typeBasedId
TransformationData trans
EntityTypetype
 Pointer to the EntityType the Entity is an instance of.
Environmentenv
 Pointer to the Environment the Entity is insied.
SceneGraphInterfacesgIF
 Pointer to the SceneGraphInterface used for rendering.
ModelInterfacevisualRepresentation
 Pointer to the graphical model representing the Entity.
std::map< AttachmentKey, void * > attachmentMap
 Map for Modules to store Entity-specific data.

Friends

class Environment

Constructor & Destructor Documentation

Entity::Entity ( unsigned short  id,
unsigned short  environmentId,
unsigned short  instanceId,
EntityType type 
)

Constructor sets the Ids of the Entity, initializes the boolean fixed with the one from the EntityType and clones the model from the EntityType it is an instance from.

Parameters:
id ID of the Entity inside the Environment
environmentId ID of the Environment the Entity should be built in
instanceId ID of the Entity instance of the EntityType
type EntityType from which the Entity is an instance of

Entity::~Entity (  )  [virtual]

Destructor removes the Entity from the instanceList of the EntityType.


Member Function Documentation

void Entity::changeEnvironment ( Environment newEnvironment  )  [virtual]

Moves the Entity from one Environment to another. It does so by calling the removeEntity()-method of the current Environment, correcting the Environment-Transformation of the Entity to match to the new Environment and calling the addEntity-method of the new Environment.

Parameters:
newEnvironment Environment to which the Entity should be migrated

void Entity::dump (  )  [virtual]

The method dumps information about the Entity.

void * Entity::getAttachment ( AttachmentKey  key  ) 

Returns the attachment stored with the passed key.

Parameters:
key Key for the attachment to search
Returns:
AttachmentKey stored with the passed key

EntityType * Entity::getEntityType (  ) 

Returns the EntityType from which the Entity is an instance of.

Returns:
EntityType of the Entity

Environment * Entity::getEnvironment (  ) 

Returns the Environment to which the Entity currently belongs to. At startup the Entity is created in an Environment. Over time the Entity can be moved from one Environment to another one. This method always returns the Environment where the Entity can currently be found.

Returns:
Environment the Entity belongs to

unsigned int Entity::getEnvironmentBasedId (  ) 

Returns the EnvironmentBasedId of the Entity. This id consists of: upper 16 bit: Id of the Environment it was built in lower 16 bit: Id of the Entity in the Environment (as configured in the config file) NOTE: the environmentBasedId never changes over time, so the part of the ID containing the Environment-ID belongs always to the Environment the Entity was built in which must not be the same as the Environment to which the Entity currently belongs to. This concept allows to access Entities according to their IDs set in the config file.

Returns:
environmentBasedId of the Entity

TransformationData Entity::getEnvironmentTransformation (  ) 

Returns the Transformation of the Entity in Environment-coordinates.

Returns:
Transformation in Environment-coordinates

unsigned short Entity::getInstanceId (  ) 

Returns the instanceId of the Entity. The instanceId is a unique ID inside the associated EntityType. It is part of the typeBasedId. This can be used to identify the Entity as one of many of the same EntityType.

Returns:
unique instanceId of the Entity inside the associated EntityType.

unsigned int Entity::getTypeBasedId (  ) 

Returns the TypeBasedId of the Entity. This Id consists of: upper 16 bit: Id of the EntityType the Entity belongs to lower 16 bit: Id of the instance of the Entity inside the EntityType

Returns:
typeBasedId of the Entity

ModelInterface * Entity::getVisualRepresentation (  ) 

Returns the virual representation of the Entity. The method returns the Model used as the visual representation of the Entity.

Returns:
Model used for Entity.

TransformationData Entity::getWorldTransformation (  ) 

Returns the Transformation of the Entity in World-coordinates.

Returns:
Transformation in World-coordinates

bool Entity::isFixed (  ) 

Returns if the Entity is fixed or movable.

Returns:
true if the Entity is not movable, false otherwise

void Entity::setAttachment ( AttachmentKey  key,
void *  attachment 
)

Stores the passed attachment under the passed key.

Parameters:
key Key with which the attachment should be identified
attachment Attachment to store

void Entity::setEnvironment ( Environment env  )  [protected, virtual]

Sets the Environment the Entity belongs to. It is called by the Environment-class and initially sets the pointer to the Environment the Entity is created in. The method is not intended to be used when the Environment is changed, therefore call the changeEnvironment method.

Parameters:
env Environment the Entity belongs to

Reimplemented in ArticulatedPhysicsEntity, LinkedPhysicsEntity, and SimplePhysicsEntity.

void Entity::setEnvironmentTransformation ( TransformationData  trans  )  [virtual]

Sets the Transformation of the Entity in Environment-coordinates!!! It also calls the update-method to write the new Entity-Transformation to the SceneGraph.

Parameters:
trans the Transformation of the Entity in Environment-coordinates

void Entity::setFixed ( bool  fixed  )  [virtual]

Defines if the Entity is movable or not. The default value is taken from the EntityType the Entity is an instance of.

Parameters:
fixed true if the Entity should not be movable, false otherwise

void Entity::setWorldTransformation ( TransformationData  trans  )  [virtual]

Sets the Transformation of the Entity in World-coordinates!!! It also calls the update-method to write the new Entity-Transformation to the SceneGraph.

Parameters:
trans the Transformation of the Entity in World-coordinates

Reimplemented in SimplePhysicsEntity.

void Entity::update (  )  [protected, virtual]

Updates the graphical representation of the Entity. The method calls the update-method from the SceneGraphInterface to update the current Entity-Transformation in the SceneGraph.


Friends And Related Function Documentation

friend class Environment [friend]


Member Data Documentation

std::map<AttachmentKey, void*> Entity::attachmentMap [protected]

Map for Modules to store Entity-specific data.

Environment* Entity::env [protected]

Pointer to the Environment the Entity is insied.

unsigned int Entity::environmentBasedId [protected]

unique ID consisting of: upper short: ID of the Environment the Entity was built in lower short: ID of the Entity inside the Environment (configured in the config-file)

bool Entity::fixed [protected]

Defines if the Entity is fixed or movable.

Pointer for SceneGraphInterface to store Entity-specific data.

Pointer to the SceneGraphInterface used for rendering.

Transformation of the entity in env space (= matrix from entity space to env space)

EntityType* Entity::type [protected]

Pointer to the EntityType the Entity is an instance of.

unsigned int Entity::typeBasedId [protected]

unique ID consisting of: upper short: ID of the EntityType of the Entity lower short: instance ID of the Entity in the EntityType

Pointer to the graphical model representing the Entity.


The documentation for this class was generated from the following files:

Generated on Wed Oct 20 16:11:56 2010 for inVRs by doxygen 1.5.8