InternalGraphics::InternalModelEntity Class Reference
#include <internalmodelentity.h>
Inheritance diagram for InternalGraphics::InternalModelEntity:
Detailed Description
Represents a visible graphics object.(C) 2007 Radon Labs GmbH
Public Types | |
enum | LinkType |
visibility link types | |
typedef IndexT | Id |
a unique id for graphics entities | |
Public Member Functions | |
InternalModelEntity () | |
constructor | |
virtual | ~InternalModelEntity () |
destructor | |
void | SetResourceId (const Resources::ResourceId &resId) |
set the model's resource id | |
const Resources::ResourceId & | GetResourceId () const |
get the model's resource id | |
void | SetRootNodePath (const Util::StringAtom &rootNodePath) |
optional path to root node (allows to instantiate a ModelEntity from part of a ModelNode hierarchy) | |
const Util::StringAtom & | GetRootNodePath () const |
get root node path, return invalid string atom if root node | |
void | SetRootNodeOffsetMatrix (const Math::matrix44 &offsetMatrix) |
set optional root node offset matrix | |
const Math::matrix44 & | GetRootNodeOffsetMatrix () const |
get optional root node offset matrix | |
void | ConfigureAnimDrivenMotionTracking (bool enabled, const Util::StringAtom &jointName) |
enable anim driven motion tracking | |
void | ConfigureAnimEventTracking (bool enabled, bool onlyDominatingClip) |
enable anim event tracking | |
void | ConfigureCharJointTracking (bool enabled, const Util::Array< Util::StringAtom > &jointNames) |
configure joint tracking | |
Resources::Resource::State | GetModelResourceState () const |
get the state of the contained managed model resource | |
const Ptr< Models::ModelInstance > & | GetModelInstance () const |
get pointer to model instance (only valid if already loaded) | |
bool | HasCharacter () const |
return true if this is a character | |
const Ptr< Characters::CharacterInstance > & | GetCharacterInstance () const |
get pointer to character instance | |
const Ptr< Characters::Character > & | GetCharacter () const |
get pointer to character | |
bool | IsAnimDrivenMotionTrackingEnabled () const |
return true if anim driven motion tracking is enabled | |
const Util::StringAtom & | GetAnimDrivenMotionJointName () const |
get anim driven motion joint name | |
const Math::vector & | GetAnimDrivenMotionVector () const |
get the current anim-driven-motion tracking vector | |
bool | IsAnimEventTrackingEnabled () const |
return true if anim event tracking is enabled | |
const Util::Array< Animation::AnimEventInfo > & | GetAnimEvents () const |
return the array of anim events of the current frame | |
bool | IsCharJointTrackingEnabled () const |
return true if joint tracking is enabled | |
void | AddTrackedCharJoint (const Util::StringAtom &jointName) |
dynamically add a tracked joint, note: you cannot remove tracked joints once added! | |
bool | IsCharJointDataValid () const |
return true if current char joint data is valid in this frame (may change by visibility) | |
const Util::Array< Shared::CharJointInfo > & | GetCharJointInfos () const |
get char joint information | |
virtual void | HandleMessage (const Ptr< Messaging::Message > &msg) |
handle a message | |
bool | IsActive () const |
return true if entity is currently active (is between OnActivate()/OnDeactivate() | |
bool | IsValid () const |
return true if entity is current valid (ready for rendering) | |
Id | GetId () const |
get the graphics entity's unique id | |
InternalGraphicsEntityType::Code | GetType () const |
get the entity type | |
void | SetTransform (const Math::matrix44 &m) |
set the entity's world space transform | |
const Math::matrix44 & | GetTransform () const |
get the entity's world space transform | |
void | SetVisible (bool b) |
set the entity's visibility | |
bool | IsVisible () const |
return true if entity is set to visible | |
const Ptr< InternalStage > & | GetStage () const |
get the stage this entity is attached to | |
bool | IsAttachedToStage () const |
return true if entity is attached to stage | |
Timing::Time | GetEntityTime () const |
get current entity time | |
const Math::bbox & | GetLocalBoundingBox () |
get the local space bounding box | |
const Math::bbox & | GetGlobalBoundingBox () |
get bounding box in global space | |
void | ClearLinks (LinkType linkType) |
clear all visibility links | |
void | AddLink (LinkType linkType, const Ptr< InternalGraphicsEntity > &entity) |
add visibility link | |
const Util::Array< Ptr< InternalGraphicsEntity > > & | GetLinks (LinkType type) const |
get visibility links by type | |
virtual Math::ClipStatus::Type | ComputeClipStatus (const Math::bbox &box) |
compute clip status against bounding box | |
void | MarkRemove () |
mark the entity for removal from the stage at the next possible time | |
bool | IsMarkedForRemove () const |
return true if this entity has been marked for removal | |
void | AddDeferredMessage (const Ptr< Messaging::Message > &msg) |
add a message for deferred handling once the object becomes valid | |
int | GetRefCount () const |
get the current refcount | |
void | AddRef () |
increment refcount by one | |
void | Release () |
decrement refcount and destroy object if refcount is zero | |
bool | IsInstanceOf (const Rtti &rtti) const |
return true if this object is instance of given class | |
bool | IsInstanceOf (const Util::String &className) const |
return true if this object is instance of given class by string | |
bool | IsInstanceOf (const Util::FourCC &classFourCC) const |
return true if this object is instance of given class by fourcc | |
bool | IsA (const Rtti &rtti) const |
return true if this object is instance of given class, or a derived class | |
bool | IsA (const Util::String &rttiName) const |
return true if this object is instance of given class, or a derived class, by string | |
bool | IsA (const Util::FourCC &rttiFourCC) const |
return true if this object is instance of given class, or a derived class, by fourcc | |
const Util::String & | GetClassName () const |
get the class name | |
Util::FourCC | GetClassFourCC () const |
get the class FourCC code | |
Static Public Member Functions | |
static void | DumpRefCountingLeaks () |
dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!) | |
Protected Member Functions | |
virtual void | OnActivate () |
called when entity is created | |
virtual void | OnDeactivate () |
called before entity is destroyed | |
virtual void | OnSetupSharedData () |
called to setup the client-portion of the shared data object | |
virtual void | OnDiscardSharedData () |
called to discard the client-portion of the shared data object | |
virtual void | OnResetSharedData () |
called per frame to reset the shared data object | |
virtual void | OnResolveVisibility () |
called from internalview | |
virtual void | OnTransformChanged () |
called when transform matrix changed | |
virtual void | OnCullBefore (Timing::Time time, Timing::Time globalTimeFactor, IndexT frameIndex) |
called before culling on each(!) graphics entity (visible or not!) | |
virtual void | OnNotifyCullingVisible (const Ptr< InternalGraphicsEntity > &observer, IndexT frameIndex) |
called when the entity has been found visible, may be called several times per frame! | |
virtual void | OnRenderBefore (IndexT frameIndex) |
called right before rendering | |
virtual void | OnRenderDebug () |
called to render a debug visualization of the entity | |
void | ValidateModelInstance () |
validate the ModelInstance | |
virtual void | OnShow () |
called when the entity becomes visible | |
virtual void | OnHide () |
called when the entity becomes invisible | |
void | HandleCharacterAnimEvents (Timing::Time time) |
handle per-frame anim events | |
void | HandleCharacterAnimDrivenMotion () |
handle per-frame anim-driven-movement stuff | |
void | HandleTrackedJoints () |
handle tracked character joints | |
void | SetSharedData (const Ptr< FrameSync::FrameSyncSharedData > &data) |
set pointer to shared data object | |
void | SetType (InternalGraphicsEntityType::Code t) |
set entity type, call in constructor of derived class! | |
void | SetValid (bool b) |
set to valid state (when the entity becomes ready for rendering) | |
void | UpdateClipStatus (Math::ClipStatus::Type c) |
update current clip status | |
void | UpdateTime (Timing::Time time, Timing::Time timeFactor) |
update current time | |
virtual void | OnAttachToStage (const Ptr< InternalStage > &stage) |
called when attached to Stage | |
virtual void | OnRemoveFromStage () |
called when removed from Stage | |
void | SetLocalBoundingBox (const Math::bbox &b) |
set the local space bounding box | |
void | UpdateGlobalBoundingBox () |
update the global bounding box from the transform and local box | |
void | HandleDeferredMessages () |
handle deferred messages (called by subclasses once resources are loaded) |
Member Function Documentation
void InternalGraphics::InternalModelEntity::HandleMessage | ( | const Ptr< Messaging::Message > & | msg | ) | [virtual] |
handle a message
Handle a message, override this method accordingly in subclasses!
Reimplemented from InternalGraphics::InternalGraphicsEntity.
void InternalGraphics::InternalModelEntity::OnActivate | ( | ) | [protected, virtual] |
called when entity is created
This will initialize the managed model inside the ModelEntity.
Reimplemented from InternalGraphics::InternalGraphicsEntity.
void InternalGraphics::InternalModelEntity::OnDeactivate | ( | ) | [protected, virtual] |
called before entity is destroyed
Cleanup our managed model, and ModelInstance if it is already initialized.
Reimplemented from InternalGraphics::InternalGraphicsEntity.
void InternalGraphics::InternalModelEntity::OnSetupSharedData | ( | ) | [protected, virtual] |
called to setup the client-portion of the shared data object
This method is called from OnActivate() to setup the shared data object of the entity. The method must call the ClientSetup() method on the sharedData object with the same template type as the main-thread side entity.
Reimplemented from InternalGraphics::InternalGraphicsEntity.
void InternalGraphics::InternalModelEntity::OnDiscardSharedData | ( | ) | [protected, virtual] |
called to discard the client-portion of the shared data object
Called from OnDeactivate() to discard the shared data object of the entity from the client side.
Reimplemented from InternalGraphics::InternalGraphicsEntity.
void InternalGraphics::InternalModelEntity::OnResetSharedData | ( | ) | [protected, virtual] |
called per frame to reset the shared data object
This method is called once per frame before OnCullBefore() to initialize the shared data object with suitable data (which may be overwritten with uptodate-data later in the frame). This is necessary because the SharedData object is double buffered, and thus if an update if missed for one frame invalid data from the previous frame may "leak" into the next frame.
Reimplemented from InternalGraphics::InternalGraphicsEntity.
void InternalGraphics::InternalModelEntity::OnResolveVisibility | ( | ) | [protected, virtual] |
called from internalview
This method is called whenever the the internalview comes to its Render method. Add light entities to the LightServer or to the ShadowServer.
Reimplemented from InternalGraphics::InternalGraphicsEntity.
void InternalGraphics::InternalModelEntity::OnTransformChanged | ( | ) | [protected, virtual] |
called when transform matrix changed
In OnTransformChanged() we need to update the transformation of our ModelInstance (if it has already been initialised).
Reimplemented from InternalGraphics::InternalGraphicsEntity.
void InternalGraphics::InternalModelEntity::OnCullBefore | ( | Timing::Time | time_, | |
Timing::Time | timeFactor_, | |||
IndexT | frameIndex | |||
) | [protected, virtual] |
called before culling on each(!) graphics entity (visible or not!)
This method is called each frame on each entity (visible or not), so keep this method cheap!
Reimplemented from InternalGraphics::InternalGraphicsEntity.
void InternalGraphics::InternalModelEntity::OnNotifyCullingVisible | ( | const Ptr< InternalGraphicsEntity > & | observer, | |
IndexT | frameIndex | |||
) | [protected, virtual] |
called when the entity has been found visible, may be called several times per frame!
This method is called once (per-view) before the entity is rendered, and only for visible entities. Please note that this method may be called several times per frame!
Reimplemented from InternalGraphics::InternalGraphicsEntity.
void InternalGraphics::InternalModelEntity::OnRenderBefore | ( | IndexT | frameIndex | ) | [protected, virtual] |
called right before rendering
This method is called on the entity from InternalView::Render() once per frame for every visible entity.
Reimplemented from InternalGraphics::InternalGraphicsEntity.
void InternalGraphics::InternalModelEntity::OnRenderDebug | ( | ) | [protected, virtual] |
called to render a debug visualization of the entity
Render our debug visualization (the bounding box).
Reimplemented from InternalGraphics::InternalGraphicsEntity.
void InternalGraphics::InternalModelEntity::ValidateModelInstance | ( | ) | [protected] |
validate the ModelInstance
This creates and initializes our ModelInstance if needed. Since Model loading happens asynchronously this may happen at any time after the ModelEntity is activated.
void InternalGraphics::InternalModelEntity::OnShow | ( | ) | [protected, virtual] |
called when the entity becomes visible
This method is called from the SetVisible() method when the entity changes from invisible to visible state.
Reimplemented from InternalGraphics::InternalGraphicsEntity.
void InternalGraphics::InternalModelEntity::OnHide | ( | ) | [protected, virtual] |
called when the entity becomes invisible
This method is called from the SetVisible() method when the entity changes from visible to invisible state.
Reimplemented from InternalGraphics::InternalGraphicsEntity.
void InternalGraphics::InternalModelEntity::HandleCharacterAnimEvents | ( | Timing::Time | time | ) | [protected] |
handle per-frame anim events
Handle character anim event stuff, always call this method, even if anim event tracking is not enabled.
void InternalGraphics::InternalModelEntity::HandleCharacterAnimDrivenMotion | ( | ) | [protected] |
handle per-frame anim-driven-movement stuff
Handle character anim driven motion feedback. This is called once per frame for visible characters.
void InternalGraphics::InternalModelEntity::HandleTrackedJoints | ( | ) | [protected] |
handle tracked character joints
Handle the tracked character joints if joint tracking is enabled. NOTE: it's important that this method is called after the character's asynchronous update jobs have finished!
ClipStatus::Type InternalGraphics::InternalGraphicsEntity::ComputeClipStatus | ( | const Math::bbox & | box | ) | [virtual, inherited] |
compute clip status against bounding box
Compute the clip status between this entity and a bounding box in global space. This method must be overwritten in a derived class.
Reimplemented in InternalGraphics::InternalCameraEntity, Lighting::InternalGlobalLightEntity, Lighting::InternalPointLightEntity, and Lighting::InternalSpotLightEntity.
void InternalGraphics::InternalGraphicsEntity::AddDeferredMessage | ( | const Ptr< Messaging::Message > & | msg | ) | [inherited] |
add a message for deferred handling once the object becomes valid
Message handlers may decide to defer message handling until the object has become valid.
void InternalGraphics::InternalGraphicsEntity::OnAttachToStage | ( | const Ptr< InternalStage > & | s | ) | [protected, virtual, inherited] |
called when attached to Stage
This method is called when the graphics entity is attached to a stage. An entity may only be attached to one stage at any time, but can be attached to different stages during its lifetime. Attachging an entity to a stage may be relatively slow because the entity must be inserted into the cell hierarchy.
void InternalGraphics::InternalGraphicsEntity::OnRemoveFromStage | ( | ) | [protected, virtual, inherited] |
called when removed from Stage
This method is called when the graphics entity is removed from a stage.
void InternalGraphics::InternalGraphicsEntity::HandleDeferredMessages | ( | ) | [protected, inherited] |
handle deferred messages (called by subclasses once resources are loaded)
This method is called once when an object with deferred validation (e.g. ModelEntities) become valid (usually after their resources have finished loading). Any deferred messages will be processed here.
int Core::RefCounted::GetRefCount | ( | ) | const [inline, inherited] |
get the current refcount
Return the current refcount of the object.
void Core::RefCounted::AddRef | ( | ) | [inline, inherited] |
increment refcount by one
Increment the refcount of the object.
void Core::RefCounted::Release | ( | ) | [inline, inherited] |
decrement refcount and destroy object if refcount is zero
Decrement the refcount and destroy object if refcount is zero.
const Util::String & Core::RefCounted::GetClassName | ( | ) | const [inline, inherited] |
get the class name
Get the class name of the object.
Util::FourCC Core::RefCounted::GetClassFourCC | ( | ) | const [inline, inherited] |
get the class FourCC code
Get the class FourCC of the object.
void Core::RefCounted::DumpRefCountingLeaks | ( | ) | [static, inherited] |
dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)
This method should be called as the very last before an application exits.