The Nebula Device 3: Models::ShapeNodeInstance Class Reference

The Nebula Device 3

Models::ShapeNodeInstance Class Reference

#include <shapenodeinstance.h>

Inheritance diagram for Models::ShapeNodeInstance:

Models::StateNodeInstance Models::TransformNodeInstance Models::ModelNodeInstance Core::RefCounted Characters::CharacterSkinNodeInstance

Detailed Description

The ShapeNodeInstance actually renders a static shape, and holds all the necessary per-instance state to do so.

(C) 2007 Radon Labs GmbH

Public Member Functions

 ShapeNodeInstance ()
 constructor
virtual ~ShapeNodeInstance ()
 destructor
virtual void OnVisibilityResolve (IndexT resolveIndex, float distToViewer)
 called during visibility resolve
virtual void Render ()
 perform rendering
virtual void ApplyState ()
 apply per-instance state prior to rendering
Ptr< CoreGraphics::ShaderVariableInstanceCreateShaderVariableInstance (const CoreGraphics::ShaderVariable::Semantic &semantic)
 instanciate a shader variable by semantic
bool HasShaderVariableInstance (const CoreGraphics::ShaderVariable::Semantic &semantic) const
 return true if a shader variable has been instantiated
const Ptr< CoreGraphics::ShaderVariableInstance > & GetShaderVariableInstance (const CoreGraphics::ShaderVariable::Semantic &semantic) const
 get a shader variable instance
virtual void OnRenderBefore (IndexT frameIndex, Timing::Time time)
 called from ModelEntity::OnRenderBefore
void SetPosition (const Math::point &p)
 set position
const Math::pointGetPosition () const
 get position
void SetRotate (const Math::quaternion &r)
 set rotate quaternion
const Math::quaternionGetRotate () const
 get rotate quaternion
void SetScale (const Math::vector &s)
 set scale
const Math::vectorGetScale () const
 get scale
void SetRotatePivot (const Math::point &p)
 set rotate pivot
const Math::pointGetRotatePivot () const
 get rotate pivot
void SetScalePivot (const Math::point &p)
 set scale pivot
const Math::pointGetScalePivot () const
 get scale pivot
void SetOffsetMatrix (const Math::matrix44 &m)
 set optional offset matrix
const Math::matrix44GetOffsetMatrix () const
 get optional offset matrix
bool IsInViewSpace () const
 is transformnode in viewspace
void SetInViewSpace (bool b)
 set transformnode in viewspace
bool GetLockedToViewer () const
 get LockedToViewer
void SetLockedToViewer (bool val)
 set LockedToViewer
const Math::matrix44GetLocalTransform ()
 get resulting local transform matrix in local parent space
const Math::matrix44GetModelTransform () const
 get model space transform (valid after Update())
virtual void DiscardHierarchy ()
 discard the model node instance and all of its children
bool IsValid () const
 return true if the model node instance is valid
virtual void OnNotifyCullingVisible (IndexT frameIndex, Timing::Time time)
 called from ModelEntity::OnNotifyCullingVisible
const Util::StringAtomGetName () const
 get model node name
bool HasParent () const
 return true if node has a parent
const Ptr< ModelNodeInstance > & GetParent () const
 get parent node
const Util::Array< Ptr< ModelNodeInstance > > & GetChildren () const
 get child nodes
bool HasChild (const Util::StringAtom &name) const
 return true if a direct child exists by name
const Ptr< ModelNodeInstance > & LookupChild (const Util::StringAtom &name) const
 get pointer to direct child by name
Ptr< ModelNodeInstanceLookupPath (const Util::String &path)
 get modelnodeinstance by hierarchy path
const Ptr< ModelInstance > & GetModelInstance () const
 get the ModelInstance we are attached to
const Ptr< ModelNode > & GetModelNode () const
 get the ModelNode we're associated with
void SetVisible (bool b, Timing::Time time, bool recursive=true)
 set the node instance's visibility
bool IsVisible () const
 return true if node instance is set to visible
IndexT GetModelNodeInstanceIndex () const
 get model node instance index for current frame
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::StringGetClassName () 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 Discard ()
 called when removed from ModelInstance
virtual void Setup (const Ptr< ModelInstance > &inst, const Ptr< ModelNode > &node, const Ptr< ModelNodeInstance > &parentNodeInst)
 called when attached to ModelInstance
virtual void RenderDebug ()
 render node specific debug shape
void SetParent (const Ptr< ModelNodeInstance > &p)
 set parent node
void AddChild (const Ptr< ModelNodeInstance > &c)
 add a child node
virtual void OnShow (Timing::Time time)
 called when the node becomes visible with current time
virtual void OnHide (Timing::Time time)
 called when the node becomes invisible

Member Function Documentation

void Models::TransformNodeInstance::OnRenderBefore ( IndexT  frameIndex,
Timing::Time  time 
) [virtual, inherited]

called from ModelEntity::OnRenderBefore

The update method should first invoke any animators which change per-instance attributes (this is done in the parent class). Then the local space transforms must be flattened into model space.

NOTE: this method must be called late in the frame to give other systems a chance to modify the transform matrix (for instance the character attachment system).

Reimplemented from Models::ModelNodeInstance.

Reimplemented in Particles::ParticleSystemNodeInstance.

void Models::TransformNodeInstance::RenderDebug (  )  [protected, virtual, inherited]

render node specific debug shape

Render a debug visualization of the node.

Reimplemented from Models::ModelNodeInstance.

Reimplemented in Characters::CharacterNodeInstance, and Particles::ParticleSystemNodeInstance.

void Models::ModelNodeInstance::DiscardHierarchy (  )  [virtual, inherited]

discard the model node instance and all of its children

Discards this model node instance and all of its children recursively.

bool Models::ModelNodeInstance::IsVisible (  )  const [inherited]

return true if node instance is set to visible

FIXME: The recursion in this is method makes it slow, especially in deep hierarchies. Also it can't be inlined.

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.