Public Types | Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes | Static Protected Attributes

Nytro::Game::Entity Class Reference

An entity class, a *thing* in the game world; it's a higher class Scene node. More...

#include <nyEntity.h>

Inheritance diagram for Nytro::Game::Entity:
Inheritance graph
[legend]

Public Types

enum  EEntityFlags {
  eEntityFlag_Selectable = NYTRO_BIT(0), eEntityFlag_Selected = NYTRO_BIT(1), eEntityFlag_CastShadows = NYTRO_BIT(2), eEntityFlag_ReceiveShadows = NYTRO_BIT(3),
  eEntityFlag_CanBeReflected = NYTRO_BIT(4), eEntityFlag_StaticEntity = NYTRO_BIT(5), eEntityFlag_CanBeHiddenByOcclusion = NYTRO_BIT(6)
}

Public Member Functions

 Entity ()
virtual ~Entity ()
EntityGroupgetGroup ()
string getPrefabFileName ()
PrefabDatagetPrefab ()
uint32 getEntityFlags ()
void setEntityFlags (uint32 aFlags)
virtual void setGroup (EntityGroup *pGroup)
 set the group of this entity, if grouped
virtual void setPrefabFileName (const char *pFileName)
 set prefab file name
virtual void setPrefab (PrefabData *pPrefab)
 set prefab data object
virtual bool traceRay (Ray &rRay, SceneNodeHitInfo *pHit, ETraceRayAccuracy aAccuracy=eTraceRayAccuracy_Brute)
 trace ray through entity, default checks if it hits entity icon
virtual void schematicRender ()
 render schematic, defaults render the icon at m_translation
virtual void triggerEvent (EntityEvent *pEvent, Base *pInitiator, ParameterList *pParams=NULL)
 trigger an event
void triggerEvent (const char *pEvent, Base *pInitiator, ParameterList *pParams=NULL)
 trigger and event by name
map< char *, EntityEvent * > & getEvents ()
void addEvent (EntityEvent *pEvent)
 add a new event, the object will be managed by the class from now on, it must be created with 'new', not a static object use the NYTRO_ADD_ENTITY_EVENT macro in the object's constructor to add events.
void resetEvents ()
 reset all events to untriggered state
EntityLayergetLayer ()
void setLayer (EntityLayer *pLayer)
virtual EResult loadFromStream (Stream *pStream)
 load entity persistent data from stream
virtual EResult saveToStream (Stream *pStream)
 save entity persistent data to stream
virtual void onEvent (EntityEvent *pEvent)
 user code to handle events
virtual bool onEditorDelete ()
 called when this entity is deleted inside the editor, you should not delete the entity data, but just disconnect it from SceneGraph and other stuff, sort of a silent/hidden 'delete', because when the Redo operation from the editor will be issued, you must restore the connections and put back the entity
virtual void onEditorUndoDelete ()
 called when a Undo delete action was issued in the editor, you must restore the "deleted" entity here, reconnecting it to the Scene graph and such
virtual void onStartSimulation ()
 called BEFORE the Physics simulation is about to begin, by default it saves the initial Pos/Rot/Scale transform into internal m_initial* variables
virtual void onStopSimulation ()
 called AFTER the Physics simulation is stopped, by default restores the initial Pos/Rot/Scale transform from internal m_initial* variables
virtual void onBeforeUnloadResource (Resource *pRes)
 called by the World object when the engine is about to unload a resource
virtual void onAfterReloadResource (Resource *pRes)
 called by the World object when the engine reloaded a resource
virtual void onPropertyValueChanged (voidptr pPropertyData)
virtual void onFormatGetPropertyValue (voidptr pPropertyData, string &rOutValue)
virtual void prepare ()
vector< EntityVisualEditHandle * > & getVisualEditHandles ()
virtual void onVisualEditHandleMove (EntityVisualEditHandle *pHandle)
 called when a visual handle was moved inside the editor
virtual bool onVisualEditHandleDelete (EntityVisualEditHandle *pHandle)

Static Public Member Functions

static void setShowConstantSizedEntityIcons (bool bShow)
static UiFxTimergetSelectionBlinkTimer ()

Data Fields

 NYTRO_CLASS_HAS_PROPERTIES

Protected Member Functions

void drawEntityIcon ()

Protected Attributes

Vector3D m_initialTranslation
Vector3D m_initialScale
Vector3D m_iconOffsetFromAabbCenter
Quaternion m_initialRotation
EntityGroupm_pGroup
string m_prefabFileName
int32 m_layerIndex
int32 m_groupIndex
PrefabDatam_pPrefab
Vector3D m_entityIconCorners [4]
Texturem_pEntityIconTexture
EntityLayerm_pLayer
uint32 m_entityFlags
uint8 m_performanceCost
 the entity's performance cost, between 0..255, 255 being very costly
map< char *, EntityEvent * > m_events
vector< EntityVisualEditHandle * > m_visualEditHandles

Static Protected Attributes

static bool s_bShowConstantSizedEntityIcons
static UiFxTimer s_selectionBlinkTimer

Detailed Description

An entity class, a *thing* in the game world; it's a higher class Scene node.

Definition at line 152 of file nyEntity.h.


Member Enumeration Documentation

Enumerator:
eEntityFlag_Selectable 

the entity can be selected

eEntityFlag_Selected 

the entity can be selected

eEntityFlag_CastShadows 
eEntityFlag_ReceiveShadows 
eEntityFlag_CanBeReflected 
eEntityFlag_StaticEntity 
eEntityFlag_CanBeHiddenByOcclusion 

Definition at line 156 of file nyEntity.h.


Constructor & Destructor Documentation

Nytro::Game::Entity::Entity (  ) 
virtual Nytro::Game::Entity::~Entity (  )  [virtual]

Member Function Documentation

void Nytro::Game::Entity::addEvent ( EntityEvent pEvent  ) 

add a new event, the object will be managed by the class from now on, it must be created with 'new', not a static object use the NYTRO_ADD_ENTITY_EVENT macro in the object's constructor to add events.

Ex: NYTRO_ADD_ENTITY_EVENT( "onHit", { Variant( "hitPoint", Variant::TYPE_VECTOR3D ), Variant( "hitNormal", Variant::TYPE_VECTOR3D ) } );

void Nytro::Game::Entity::drawEntityIcon (  )  [protected]
uint32 Nytro::Game::Entity::getEntityFlags (  ) 
Returns:
entity flags
map<char*,EntityEvent*>& Nytro::Game::Entity::getEvents (  ) 
Returns:
events
EntityGroup* Nytro::Game::Entity::getGroup (  ) 
Returns:
the entity's group
EntityLayer* Nytro::Game::Entity::getLayer (  ) 
Returns:
the layer index
PrefabData* Nytro::Game::Entity::getPrefab (  ) 
Returns:
prefab data object
string Nytro::Game::Entity::getPrefabFileName (  ) 
Returns:
prefab file name
static UiFxTimer& Nytro::Game::Entity::getSelectionBlinkTimer (  )  [static]
vector<EntityVisualEditHandle*>& Nytro::Game::Entity::getVisualEditHandles (  ) 
Returns:
a vector of visual editing handles, which can be manipulated in the editor to edit various entity parameters by dragging the handles. Example: a road having handles for the road nodes or a fence special entity having handles for its fence parts, fenced trigger and others
Remarks:
if the number of handles is zero, the entity cannot be edited visually, by dragging handles, inside the viewport
virtual EResult Nytro::Game::Entity::loadFromStream ( Stream pStream  )  [virtual]

load entity persistent data from stream

virtual void Nytro::Game::Entity::onAfterReloadResource ( Resource pRes  )  [virtual]

called by the World object when the engine reloaded a resource

Reimplemented from Nytro::Core::ResourceObserver.

Reimplemented in Nytro::Game::ModelEntity.

virtual void Nytro::Game::Entity::onBeforeUnloadResource ( Resource pRes  )  [virtual]

called by the World object when the engine is about to unload a resource

Reimplemented from Nytro::Core::ResourceObserver.

Reimplemented in Nytro::Game::ModelEntity.

virtual bool Nytro::Game::Entity::onEditorDelete (  )  [virtual]

called when this entity is deleted inside the editor, you should not delete the entity data, but just disconnect it from SceneGraph and other stuff, sort of a silent/hidden 'delete', because when the Redo operation from the editor will be issued, you must restore the connections and put back the entity

Returns:
false if this entity does not support Undo/Redo operation on Delete

Reimplemented in Nytro::Game::ModelEntity, and Nytro::Game::SoundSourceEntity.

virtual void Nytro::Game::Entity::onEditorUndoDelete (  )  [virtual]

called when a Undo delete action was issued in the editor, you must restore the "deleted" entity here, reconnecting it to the Scene graph and such

Reimplemented in Nytro::Game::ModelEntity, and Nytro::Game::SoundSourceEntity.

virtual void Nytro::Game::Entity::onEvent ( EntityEvent pEvent  )  [virtual]

user code to handle events

virtual void Nytro::Game::Entity::onFormatGetPropertyValue ( voidptr  pPropertyData,
string &  rOutValue 
) [virtual]
virtual void Nytro::Game::Entity::onPropertyValueChanged ( voidptr  pPropertyData  )  [virtual]
virtual void Nytro::Game::Entity::onStartSimulation (  )  [virtual]

called BEFORE the Physics simulation is about to begin, by default it saves the initial Pos/Rot/Scale transform into internal m_initial* variables

virtual void Nytro::Game::Entity::onStopSimulation (  )  [virtual]

called AFTER the Physics simulation is stopped, by default restores the initial Pos/Rot/Scale transform from internal m_initial* variables

virtual bool Nytro::Game::Entity::onVisualEditHandleDelete ( EntityVisualEditHandle pHandle  )  [virtual]
Returns:
true if you want that handle to be deleted
virtual void Nytro::Game::Entity::onVisualEditHandleMove ( EntityVisualEditHandle pHandle  )  [virtual]

called when a visual handle was moved inside the editor

virtual void Nytro::Game::Entity::prepare (  )  [virtual]
void Nytro::Game::Entity::resetEvents (  ) 

reset all events to untriggered state

virtual EResult Nytro::Game::Entity::saveToStream ( Stream pStream  )  [virtual]

save entity persistent data to stream

virtual void Nytro::Game::Entity::schematicRender (  )  [virtual]
void Nytro::Game::Entity::setEntityFlags ( uint32  aFlags  ) 
Returns:
entity flags
virtual void Nytro::Game::Entity::setGroup ( EntityGroup pGroup  )  [virtual]

set the group of this entity, if grouped

void Nytro::Game::Entity::setLayer ( EntityLayer pLayer  ) 
Returns:
the layer index
virtual void Nytro::Game::Entity::setPrefab ( PrefabData pPrefab  )  [virtual]

set prefab data object

virtual void Nytro::Game::Entity::setPrefabFileName ( const char *  pFileName  )  [virtual]

set prefab file name

static void Nytro::Game::Entity::setShowConstantSizedEntityIcons ( bool  bShow  )  [static]
virtual bool Nytro::Game::Entity::traceRay ( Ray rRay,
SceneNodeHitInfo *  pHit,
ETraceRayAccuracy  aAccuracy = eTraceRayAccuracy_Brute 
) [virtual]

trace ray through entity, default checks if it hits entity icon

Reimplemented in Nytro::Game::ModelEntity.

virtual void Nytro::Game::Entity::triggerEvent ( EntityEvent pEvent,
Base pInitiator,
ParameterList pParams = NULL 
) [virtual]

trigger an event

void Nytro::Game::Entity::triggerEvent ( const char *  pEvent,
Base pInitiator,
ParameterList pParams = NULL 
)

trigger and event by name


Field Documentation

Definition at line 269 of file nyEntity.h.

Definition at line 266 of file nyEntity.h.

map<char*,EntityEvent*> Nytro::Game::Entity::m_events [protected]

Definition at line 272 of file nyEntity.h.

Definition at line 264 of file nyEntity.h.

Definition at line 260 of file nyEntity.h.

Definition at line 261 of file nyEntity.h.

Definition at line 260 of file nyEntity.h.

Definition at line 260 of file nyEntity.h.

Definition at line 264 of file nyEntity.h.

Definition at line 267 of file nyEntity.h.

the entity's performance cost, between 0..255, 255 being very costly

Definition at line 271 of file nyEntity.h.

Definition at line 262 of file nyEntity.h.

Definition at line 268 of file nyEntity.h.

Definition at line 265 of file nyEntity.h.

Definition at line 263 of file nyEntity.h.

Definition at line 273 of file nyEntity.h.

Definition at line 255 of file nyEntity.h.

Definition at line 256 of file nyEntity.h.


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

© Copyright 7thFACTOR Entertainment - All rights reserved