Models::ModelNode Class Reference
#include <modelnode.h>
Detailed Description
Represents a transformation hierarchy element inside a Model. Subclasses of ModelNodes represent transformations and geometry of a 3D model arranged in 3d hierarchy (but not in a logical hierarchy of C++ object, instead model nodes live in a flat array to prevent recursive iteration).A ModelNode is roughly comparable to a nSceneNode in Nebula2.
(C) 2007 Radon Labs GmbH
Public Member Functions | |
ModelNode () | |
constructor | |
virtual | ~ModelNode () |
destructor | |
virtual void | ApplySharedState () |
apply state shared by all my ModelNodeInstances | |
virtual Resources::Resource::State | GetResourceState () const |
get overall state of contained resources (Initial, Loaded, Pending, Failed, Cancelled) | |
const Util::Atom < Util::String > & | GetName () const |
get model node name | |
ModelNodeType::Code | GetType () const |
get the ModelNodeType | |
bool | HasParent () const |
return true if node has a parent | |
const Ptr< ModelNode > & | GetParent () const |
get parent node | |
const Util::Array < Ptr< ModelNode > > & | GetChildren () const |
get child nodes | |
bool | IsAttachedToModel () const |
return true if currently attached to a Model | |
const Ptr< Model > & | GetModel () const |
get model this node is attached to | |
const Math::bbox & | GetBoundingBox () const |
get bounding box of model node | |
const Attr::AttributeContainer & | GetAttrs () const |
read access to model node attributes | |
bool | HasAttr (const Attr::AttrId &attrId) const |
check if model node attribute exists | |
void | SetAttr (const Attr::Attribute &attr) |
set generic model node attribute | |
const Attr::Attribute & | GetAttr (const Attr::AttrId &attrId) const |
get generic model node attribute | |
void | SetBool (const Attr::BoolAttrId &attrId, bool val) |
set bool value | |
bool | GetBool (const Attr::BoolAttrId &attrId) const |
get bool value | |
void | SetFloat (const Attr::FloatAttrId &attrId, float val) |
set float value | |
float | GetFloat (const Attr::FloatAttrId &attrId) const |
get float value | |
void | SetInt (const Attr::IntAttrId &attrId, int val) |
set int value | |
int | GetInt (const Attr::IntAttrId &attrId) const |
get int value | |
void | SetString (const Attr::StringAttrId &attrId, const Util::String &val) |
set string value | |
const Util::String & | GetString (const Attr::StringAttrId &attrId) const |
get string value | |
void | SetFloat4 (const Attr::Float4AttrId &attrId, const Math::float4 &val) |
set float4 value | |
Math::float4 | GetFloat4 (const Attr::Float4AttrId &attrId) const |
get float4 value | |
void | SetMatrix44 (const Attr::Matrix44AttrId &attrId, const Math::matrix44 &val) |
set matrix44 value | |
const Math::matrix44 & | GetMatrix44 (const Attr::Matrix44AttrId &attrId) const |
get matrix44 value | |
void | SetGuid (const Attr::GuidAttrId &attrId, const Util::Guid &guid) |
set guid value | |
const Util::Guid & | GetGuid (const Attr::GuidAttrId &attrId) const |
get guid value | |
void | SetBlob (const Attr::BlobAttrId &attrId, const Util::Blob &blob) |
set blob value | |
const Util::Blob & | GetBlob (const Attr::BlobAttrId &attrId) const |
get blob value | |
void | SetName (const Util::Atom< Util::String > &n) |
set model node name | |
void | SetType (ModelNodeType::Code t) |
set ModelNodeType | |
void | SetParent (const Ptr< ModelNode > &p) |
set parent node | |
void | AddChild (const Ptr< ModelNode > &c) |
add a child node | |
virtual void | LoadFromAttrs (const Attr::AttributeContainer &attrs) |
called to initialize from attributes | |
void | AddVisibleNodeInstance (IndexT frameIndex, const Ptr< ModelNodeInstance > &nodeInst) |
called by model node instance on NotifyVisible() | |
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 | |
void | SetBoundingBox (const Math::bbox &b) |
set bounding box | |
virtual Ptr < ModelNodeInstance > | CreateNodeInstance () const |
create a model node instance | |
virtual void | OnAttachToModel (const Ptr< Model > &model) |
called when attached to model node | |
virtual void | OnRemoveFromModel () |
called when removed from model node | |
virtual void | SaveToAttrs (Attr::AttributeContainer &attrs) |
called to save state back to attributes | |
virtual void | LoadResources () |
called when resources should be loaded | |
virtual void | UnloadResources () |
called when resources should be unloaded | |
const Util::Array < Ptr < ModelNodeInstance > > & | GetVisibleModelNodeInstances (ModelNodeType::Code t) const |
get visible model node instances |
Member Function Documentation
void Models::ModelNode::ApplySharedState | ( | ) | [virtual] |
apply state shared by all my ModelNodeInstances
This method is called once before rendering the ModelNode's visible instance nodes through the ModelNodeInstance::ApplyState() and ModelNodeInstance::Render() methods. The method must apply the shader state that is shared across all instances. Since this state is constant across all instance nodes, this only happens once before rendering an instance set.
Reimplemented in Models::ShapeNode, Models::SkinShapeNode, and Models::StateNode.
Resource::State Models::ModelNode::GetResourceState | ( | ) | const [virtual] |
get overall state of contained resources (Initial, Loaded, Pending, Failed, Cancelled)
Returns the overall resource state (Initial, Loaded, Pending, Failed, Cancelled). Higher states override lower state (if some resources are already Loaded, and some are Pending, then Pending will be returned, if some resources failed to load, then Failed will be returned, etc...). Subclasses which load resource must override this method, and modify the return value of the parent class as needed).
Reimplemented in Models::CharacterNode, Models::ShapeNode, and Models::StateNode.
void Models::ModelNode::LoadResources | ( | ) | [protected, virtual] |
called when resources should be loaded
This method is called when required resources should be loaded.
Reimplemented in Models::CharacterNode, Models::ParticleSystemNode, Models::ShapeNode, Models::SkinShapeNode, and Models::StateNode.
void Models::ModelNode::UnloadResources | ( | ) | [protected, virtual] |
called when resources should be unloaded
This method is called when required resources should be unloaded.
Reimplemented in Models::CharacterNode, Models::ParticleSystemNode, Models::ShapeNode, and Models::StateNode.
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.