The Nebula Device 3: Models::ModelNodeInstance Class Reference

The Nebula Device 3

Models::ModelNodeInstance Class Reference

#include <modelnodeinstance.h>

Inheritance diagram for Models::ModelNodeInstance:

Core::RefCounted Models::TransformNodeInstance Models::CharacterNodeInstance Models::StateNodeInstance Models::ShapeNodeInstance Models::ParticleSystemNodeInstance Models::SkinShapeNodeInstance


Detailed Description

A ModelNodeInstance holds the per-instance data of a ModelNode and does most of the actually interesting Model rendering stuff.

(C) 2007 Radon Labs GmbH

Public Member Functions

 ModelNodeInstance ()
 constructor
virtual ~ModelNodeInstance ()
 destructor
virtual void Update ()
 perform per-frame updates
virtual void ApplyState ()
 apply per-instance state prior to rendering
virtual void Render ()
 perform rendering
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 IsAttachedToModelInstance () const
 return true if attached to ModelInstance
const Ptr
< ModelInstance > & 
GetModelInstance () const
 get the ModelInstance we are attached to
const Ptr< ModelNode > & GetModelNode () const
 get the ModelNode we're associated with
virtual void SetVisible (bool b)
 set visible, used by charactersystem
bool IsVisible () const
 is visible
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

void SetParent (const Ptr< ModelNodeInstance > &p)
 set parent node
void AddChild (const Ptr< ModelNodeInstance > &c)
 add a child node
virtual void OnAttachToModelInstance (const Ptr< ModelInstance > &inst, const Ptr< ModelNode > &node, const Ptr< ModelNodeInstance > &parentNodeInst)
 called when attached to ModelInstance
virtual void OnRemoveFromModelInstance ()
 called when removed from ModelInstance
virtual void OnNotifyVisible (IndexT frameIndex)
 notify that we are visible
virtual void RenderDebug ()
 render node specific debug shape
void SetChildrenVisiblity (ModelNodeInstance *parent, bool b)
 set visible flag of children

Member Function Documentation

void Models::ModelNodeInstance::Update (  )  [virtual]

perform per-frame updates

The Update() method is called exactly once per frame before visibility culling on every *potentially* visible model node instance. Actions performed in the Update() usually include resolving the world space transformation (if changed) and performing animation. The Update() method will be called from ModelInstance::Update() in "hierarchy order" (parent nodes will called before their child nodes).

Reimplemented in Models::CharacterNodeInstance, Models::ParticleSystemNodeInstance, Models::SkinShapeNodeInstance, and Models::TransformNodeInstance.

void Models::ModelNodeInstance::ApplyState (  )  [virtual]

apply per-instance state prior to rendering

The ApplyState() method is called when per-instance shader-state should be applied. This method may be called several times per frame. The calling order is always in "render order", first, the ApplyState() method on the ModelNode will be called, then each ApplyState() and Render() method of the ModelNodeInstance objects.

Reimplemented in Models::StateNodeInstance, and Models::TransformNodeInstance.

void Models::ModelNodeInstance::Render (  )  [virtual]

perform rendering

The Render() method is called when the ModelNodeInstance needs to render itself. There will always be a call to the Apply() method before Render() is called, however, Render() may be called several times per Apply() invokation.

Reimplemented in Models::ParticleSystemNodeInstance, Models::ShapeNodeInstance, and Models::SkinShapeNodeInstance.

void Models::ModelNodeInstance::SetVisible ( bool  b  )  [inline, virtual]

set visible, used by charactersystem

Set visibility of node and its children, should not be call per frame!

Reimplemented in Models::SkinShapeNodeInstance.

void Models::ModelNodeInstance::OnNotifyVisible ( IndexT  frameIndex  )  [protected, virtual]

notify that we are visible

This method is called from the NotifyVisible() methode of our ModelInstance object. If the ModelNodeInstance provides something renderable it should respond by adding itself as visible node instance to its model node.

Reimplemented in Models::ParticleSystemNodeInstance, Models::ShapeNodeInstance, and Models::SkinShapeNodeInstance.

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.