The Nebula Device 3: Models::CharacterNode Class Reference

The Nebula Device 3

Models::CharacterNode Class Reference

#include <characternode.h>

Inheritance diagram for Models::CharacterNode:

Models::TransformNode Models::ModelNode Core::RefCounted


Detailed Description

A TransformNode which describes a skinned shape. Since the CharacterNode is derived from the TransformNode (which in turn is derived from the TransformNode), a CharacterNode contains all the necessary information for rendering a skinned mesh.

It supports the use of variations and skinlists for multi exchangeable animated skins and textures (all the nebula2 character3 functionalities).

(C) 2007 Radon Labs GmbH

Public Member Functions

 CharacterNode ()
 constructor
virtual ~CharacterNode ()
 destructor
virtual
Resources::Resource::State 
GetResourceState () const
 get overall state of contained resources (Initial, Loaded, Pending, Failed, Cancelled)
SizeT GetNumSkins () const
 get number of skin infos
IndexT GetSkinIndexByName (const Util::String &n) const
 get skin index by name
const Char::SkinInfo & GetSkinInfoAt (IndexT i) const
 get skin info by index
const Util::Array
< Char::SkinInfo > & 
GetSkinInfoArray () const
 get whole skin info array
virtual Ptr
< ModelNodeInstance
CreateNodeInstance () const
 create a model node instance
virtual void LoadResources ()
 called when resources should be loaded
virtual void UnloadResources ()
 called when resources should be unloaded
void SetAnim (const Util::String &filename)
 set name of an anim resource
const Util::StringGetAnim () const
 get name of an anim resource
void SetVariationsUri (const Util::String &uri)
 set variations animation resource
const Util::StringGetVariationsUri () const
 get variations animation resource
void BeginVariations (SizeT num)
 begin defining variations
void SetVariation (IndexT varIndex, IndexT animGroupIndex, const Util::String &varName)
 set a variation
void EndVariations ()
 finish defining variations
SizeT GetNumVariations () const
 get number of variations
const Util::StringGetVariationNameAt (IndexT i) const
 get variation name at index
const Util::Array
< Char::CharJoint > & 
GetVariationJointsAt (IndexT i) const
 get variation joints at index
IndexT GetVariationIndexByName (const Util::String &n) const
 get variation index by name
void BeginClips (int numClips)
 begin adding clips
void SetClip (int clipIndex, int animGroupIndex, const Util::String &clipName)
 add an animation clip
void EndClips ()
 finish adding clips
int GetNumClips () const
 get number of clips in the animation
const Anim::AnimClip & GetClipAt (int clipIndex) const
 get clip at index
IndexT GetClipIndexByName (const Util::String &name) const
 get clip by name
Timing::Time GetClipDuration (int index) const
 get clip duration
const Ptr
< Char::CharacterSet > & 
GetCharacterSet () const
 get character set
void BeginJoints (int numJoints)
 begin adding joints
void SetJoint (int index, int parentJointIndex, const Math::vector &poseTranslate, const Math::quaternion &poseRotate, const Math::vector &poseScale, const Util::String &name)
 add a joint to the skeleton
void EndJoints ()
 finish adding joints
int GetNumJoints ()
 get number of joints in skeleton
void GetJoint (int index, int &parentJointIndex, Math::vector &poseTranslate, Math::quaternion &poseRotate, Math::vector &poseScale, Util::String &name)
 get joint attributes
const Ptr
< Anim::ManagedAnimation > & 
GetManagedAnimation () const
 get managed animation
const Ptr
< Char::Character > & 
GetCharacter () const
 get character
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
virtual void ApplySharedState ()
 apply state shared by all my ModelNodeInstances
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::bboxGetBoundingBox () 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::AttributeGetAttr (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::StringGetString (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::matrix44GetMatrix44 (const Attr::Matrix44AttrId &attrId) const
 get matrix44 value
void SetGuid (const Attr::GuidAttrId &attrId, const Util::Guid &guid)
 set guid value
const Util::GuidGetGuid (const Attr::GuidAttrId &attrId) const
 get guid value
void SetBlob (const Attr::BlobAttrId &attrId, const Util::Blob &blob)
 set blob value
const Util::BlobGetBlob (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
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::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

bool LoadVariation ()
 load variation
Util::Array
< Char::CharJoint > 
EvaluateVariation (const Ptr< Anim::Animation > &varAnim, IndexT groupIndex)
 extract skeleton variation from a variation clip
void SetupSkinInfos ()
 setup skin infos from child objects
virtual void LoadFromAttrs (const Attr::AttributeContainer &attrs)
 called to initialize from attributes
virtual void SaveToAttrs (Attr::AttributeContainer &attrs)
 called to save state back to attributes
void SetBoundingBox (const Math::bbox &b)
 set bounding box
virtual void OnAttachToModel (const Ptr< Model > &model)
 called when attached to model node
virtual void OnRemoveFromModel ()
 called when removed from model node
const Util::Array
< Ptr
< ModelNodeInstance > > & 
GetVisibleModelNodeInstances (ModelNodeType::Code t) const
 get visible model node instances

Member Function Documentation

void Models::CharacterNode::BeginVariations ( SizeT  num  ) 

begin defining variations

Begin defining variations.

void Models::CharacterNode::SetVariation ( IndexT  varIndex,
IndexT  animGroupIndex,
const Util::String varName 
)

set a variation

Define a variation.

void Models::CharacterNode::EndVariations (  ) 

finish defining variations

End defining variations.

void Models::CharacterNode::BeginJoints ( int  numJoints  )  [inline]

begin adding joints

Begin configuring the joint skeleton.

void Models::CharacterNode::SetJoint ( int  jointIndex,
int  parentJointIndex,
const Math::vector poseTranslate,
const Math::quaternion poseRotate,
const Math::vector poseScale,
const Util::String name 
) [inline]

add a joint to the skeleton

Add a joint to the joint skeleton.

void Models::CharacterNode::EndJoints (  )  [inline]

finish adding joints

Finish adding joints to the joint skeleton.

int Models::CharacterNode::GetNumJoints (  )  [inline]

get number of joints in skeleton

Get number of joints in joint skeleton.

void Models::CharacterNode::GetJoint ( int  index,
int &  parentJointIndex,
Math::vector poseTranslate,
Math::quaternion poseRotate,
Math::vector poseScale,
Util::String name 
) [inline]

get joint attributes

Get joint attributes.

void Models::CharacterNode::SetupSkinInfos (  )  [protected]

setup skin infos from child objects

Setup the skin info table from my child skin objects.

void Models::ModelNode::ApplySharedState (  )  [virtual, inherited]

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.

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.