Kochol Game Engine  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
kge::sn::AnimatedMesh Class Reference

#include <AnimatedMesh.h>

Inheritance diagram for kge::sn::AnimatedMesh:
kge::sn::SceneNode kge::KgeUnknown

Public Member Functions

 AnimatedMesh (gfx::MeshBuffer *mb)
 Constructor.
 ~AnimatedMesh ()
 Destructor.
virtual void PreRender (float elapsedTime)
 Karhayee ke Ghabl az render bayad anjam shvad. Mesle colision detection.
virtual void Render ()
 Render kardane Object.
virtual void PostRender ()
 Karhaee ke bad az render bayad anjam beshe.
virtual bool AddEffect (efx::EffectType p, efx::Effect **ppOut)
virtual void Draw (bool WithMaterial, bool WithTransform, bool bPosition, bool bNormalTexcoord, bool bTangentBinormal)
virtual void SetAnimationTime (float StartTime=0.0f, float EndTime=-1.0f, bool Loop=true, bool Blend=true)
virtual void SetAnimationFrame (int StartTime=0, int EndTime=-1, bool Loop=true, bool Blend=true)
void SetActionFrame (int ActionFrame)
 Sets the action frame.
bool IsActionFrameReached ()
 Returns true if action frame of animation reached. Note: It only returns true one time for each frame.
virtual void SetAnimationSpeed (float Speed)
float GetAnimationSpeed ()
 Returns the animation speed.
virtual void SetShader (gfx::ShaderInstance *shader)
virtual u32 GetMaterialCount ()
 Get the count of materials this node has.
virtual gfx::MaterialGetMaterial (u32 Index)
virtual BoneGetBoneByName (const char *Name)
virtual BoneGetBones ()
virtual u32 GetBonesCount ()
virtual void ConnectOnAnimationEnd (kge::core::Functor1< void, void * > *pFun)
virtual void DisconnectOnAnimationEnd ()
 Stop from calling user function.
virtual void SetUserData (void *data)
 Set your data for sending back them on callbacks.
virtual void * GetUserData ()
 Get your data.
void SetFileName (core::String *str)
 For internal use.
core::StringGetFileName ()
 Returns the mesh file name.
void RemoveChildrenFromBones ()
- Public Member Functions inherited from kge::sn::SceneNode
 SceneNode ()
 Constructor.
virtual ~SceneNode ()
 Destructor.
virtual void AddChild (SceneNode *child)
 Adds a node as child.
virtual void SetSceneManager (SceneManager *smgr)
 Sets the scene manager and renderer pointer.
virtual void SetPosition (const math::Vector &v)
 Set the position of the scenenode.
virtual void SetRotation (const math::Vector &v)
 Set the rotation of the scenenode.
virtual void SetScale (const math::Vector &v)
 Set the scale of the scenenode.
virtual void SetAutomaticCulling (bool isTrue)
 Set Cutting Enable or Disable.
virtual void SetVisible (bool isVisible)
 Set Visible Enable or Disable.
virtual bool GetVisible ()
 Get Visible.
virtual bool IsVisibleInFrame ()
 Is it visible in this frame?
virtual const math::VectorGetPosition () const
 Returns the node position.
virtual const math::VectorGetRotation () const
 Returns the node rotation.
virtual const math::VectorGetScale () const
 Returns the node scale.
virtual math::MatrixGetAbsoluteMatrix () const
 Get the absolute matrix.
virtual math::MatrixGetFinalMatrix ()
 Get the final matrix.
virtual math::SphereGetBoundingBox ()
 Returns the node bounding box.
virtual math::AABBGetAxisAlignedBoundingBox ()
 Returns the node Axis aligned bounding box.
virtual NodeType GetType () const
 Returns the node type.
virtual void RemoveChild (SceneNode *child)
virtual void RemoveChildren ()
 Removes all children of this node.
virtual const SceneNodeGetParent ()
 Returns the node parent.
virtual void SetParent (SceneNode *parent)
 Sets the node parent.
virtual void SetName (const char *name)
 Sets the node name.
virtual core::StringGetName ()
 Gets the node name.
virtual void SetID (int ID)
 Sets the node ID.
virtual int GetID ()
 Gets the node ID.
void EnableShadow (bool enable)
bool HasShadow () const
virtual void UpdateFinalMat ()
 Update final matrix.
- Public Member Functions inherited from kge::KgeUnknown
 KgeUnknown ()
 Constructor.
virtual ~KgeUnknown ()
 Destructor.
virtual void AddRef ()
 Add a reference to the object.
virtual void DecRef ()
 Decrease a reference from the object. if its reference count get 0 then the object will destroy.
u32 GetRefCount ()
 Return resource reference count.
const char * GetDebugText ()
 returns the instance debug text.

Static Public Member Functions

static void SetGlobalAnimationSpeed (float fSpeed)
 Sets the global animation speed.
static float GetGlobalAnimationSpeed ()

Protected Member Functions

virtual void Animate (float elapsedTime)
 Animates the mesh.
virtual void RenderMesh ()
 Renders the mesh depend on their Bones.
virtual void CreateMirrorPlane (efx::Effect **ppCreatedMirror)
virtual void CreateShadowPlane (efx::Effect **ppCreatedShadow)
virtual void CreateHardwareSkin ()
virtual void SetShaderConstsForHS (gfx::ShaderInstance *si)
- Protected Member Functions inherited from kge::sn::SceneNode
virtual bool HasThisEffect (efx::EffectType p)
- Protected Member Functions inherited from kge::KgeUnknown
void SetDebugText (char *text)

Protected Attributes

gfx::MeshBuffer * m_pMeshBuffer
sn::Meshm_pMeshes
 Mesh buffer pointer.
core::Stringm_pFileName
 Meshes.
Bonem_pBones
 *< Mesh file name
gfx::Animationm_pAnimation
 Bones.
u32 m_iNumMeshes
 Animation.
u32 m_iNumBones
 The count of meshes.
float m_fStartTime
 The count of bones.
float m_fActionFrame
 The action time of animation.
float m_fEndTime
 The end time of animation.
float m_fLastTime
 The last time of animation.
float m_fSpeed
 The animation speed.
float m_fBlendTime
bool m_bLoop
bool m_bBlend
 Loop the animation or not.
bool m_bActionFrameReached
bool m_bCheckForActionFrame
u32m_pTLastFrameData
u32m_pRLastFrameData
u32m_pTCurFrameData
u32m_pRCurFrameData
gfx::Shaderm_pVHSshader
gfx::Shaderm_pPHSshader
gfx::ShaderHandle m_shBones
gfx::ShaderHandle m_shViewProj
gfx::ShaderHandle m_shDiffColor
gfx::ShaderHandle m_shWorld
gfx::ShaderHandle m_shDir
gfx::ShaderInstancem_pShaderInstance
gfx::Materialm_pMaterials
kge::core::Functor1< void,
void * > * 
m_pEndAniFunc
 Mesh materials.
void * m_pUData
 User data.
- Protected Attributes inherited from kge::sn::SceneNode
core::String m_sName
int m_iID
SceneManagerm_pSnMan
gfx::Rendererm_pRenderer
bool m_bVis
bool m_bAutoCulling
bool m_bVisFrame
SceneNodem_pParent
std::vector< SceneNode * > m_vChilds
std::vector< int > m_vEffectType
std::vector< efx::Effect * > m_vEffect
math::Matrixm_pAbsMat
math::Matrixm_pFinalMat
math::Vector m_Position
math::Vector m_Rotation
math::Vector m_Scale
math::Spherem_pBB
math::AABBm_pAABB
NodeType m_eNodeType
bool m_hasShadow

Static Protected Attributes

static float m_sAnimSpeed
 Global animation speed.

Detailed Description

Definition at line 20 of file AnimatedMesh.h.

Constructor & Destructor Documentation

kge::sn::AnimatedMesh::AnimatedMesh ( gfx::MeshBuffer *  mb)

Constructor.

kge::sn::AnimatedMesh::~AnimatedMesh ( )

Destructor.

Member Function Documentation

virtual bool kge::sn::AnimatedMesh::AddEffect ( efx::EffectType  p,
efx::Effect **  ppOut 
)
virtual

Ezafe kardane effect be hamin gereh.

Parameters
pEffecti ke mikhahid ezafe konid.
ppOutClass Effect sakhte shode.
Returns
agar ke in gereh betavanad in effect ra bepazirad true bar migardanad.

Reimplemented from kge::sn::SceneNode.

virtual void kge::sn::AnimatedMesh::Animate ( float  elapsedTime)
protectedvirtual

Animates the mesh.

virtual void kge::sn::AnimatedMesh::ConnectOnAnimationEnd ( kge::core::Functor1< void, void * > *  pFun)
virtual

Get a pointer to function to call it at the end of animation.

virtual void kge::sn::AnimatedMesh::CreateHardwareSkin ( )
protectedvirtual
virtual void kge::sn::AnimatedMesh::CreateMirrorPlane ( efx::Effect **  ppCreatedMirror)
protectedvirtual
virtual void kge::sn::AnimatedMesh::CreateShadowPlane ( efx::Effect **  ppCreatedShadow)
protectedvirtual
virtual void kge::sn::AnimatedMesh::DisconnectOnAnimationEnd ( )
virtual

Stop from calling user function.

virtual void kge::sn::AnimatedMesh::Draw ( bool  WithMaterial,
bool  WithTransform,
bool  bPosition,
bool  bNormalTexcoord,
bool  bTangentBinormal 
)
virtual

Draw the node with/without its Materials and Transforms.

Parameters
WithMaterialDraw it with its own materials or not?
WithMaterialDraw it with its own Transformations or not?

Implements kge::sn::SceneNode.

float kge::sn::AnimatedMesh::GetAnimationSpeed ( )
inline

Returns the animation speed.

Definition at line 89 of file AnimatedMesh.h.

virtual Bone* kge::sn::AnimatedMesh::GetBoneByName ( const char *  Name)
virtual

Get a bone by its name.

Parameters
NameThe bone name.
Returns
Returns the requested bone.
virtual Bone* kge::sn::AnimatedMesh::GetBones ( )
inlinevirtual

Definition at line 111 of file AnimatedMesh.h.

virtual u32 kge::sn::AnimatedMesh::GetBonesCount ( )
inlinevirtual

Definition at line 113 of file AnimatedMesh.h.

core::String* kge::sn::AnimatedMesh::GetFileName ( )
inline

Returns the mesh file name.

Definition at line 132 of file AnimatedMesh.h.

static float kge::sn::AnimatedMesh::GetGlobalAnimationSpeed ( )
inlinestatic

Definition at line 138 of file AnimatedMesh.h.

virtual gfx::Material* kge::sn::AnimatedMesh::GetMaterial ( u32  Index)
virtual

Get the node material by its index.

Parameters
IndexThe material index. Some nodes have more than one material.
Returns
Returns the requested material.

Reimplemented from kge::sn::SceneNode.

virtual u32 kge::sn::AnimatedMesh::GetMaterialCount ( )
virtual

Get the count of materials this node has.

Reimplemented from kge::sn::SceneNode.

virtual void* kge::sn::AnimatedMesh::GetUserData ( )
inlinevirtual

Get your data.

Definition at line 126 of file AnimatedMesh.h.

bool kge::sn::AnimatedMesh::IsActionFrameReached ( )
inline

Returns true if action frame of animation reached. Note: It only returns true one time for each frame.

Definition at line 76 of file AnimatedMesh.h.

virtual void kge::sn::AnimatedMesh::PostRender ( )
virtual

Karhaee ke bad az render bayad anjam beshe.

Implements kge::sn::SceneNode.

virtual void kge::sn::AnimatedMesh::PreRender ( float  elapsedTime)
virtual

Karhayee ke Ghabl az render bayad anjam shvad. Mesle colision detection.

Implements kge::sn::SceneNode.

void kge::sn::AnimatedMesh::RemoveChildrenFromBones ( )
virtual void kge::sn::AnimatedMesh::Render ( )
virtual

Render kardane Object.

Implements kge::sn::SceneNode.

virtual void kge::sn::AnimatedMesh::RenderMesh ( )
protectedvirtual

Renders the mesh depend on their Bones.

void kge::sn::AnimatedMesh::SetActionFrame ( int  ActionFrame)

Sets the action frame.

virtual void kge::sn::AnimatedMesh::SetAnimationFrame ( int  StartTime = 0,
int  EndTime = -1,
bool  Loop = true,
bool  Blend = true 
)
virtual

Set the mesh animation frame.

Parameters
StartTimeThe starting frame for animation.
EndTimeThe frame which the animation must stop from that frame if you want to stop it at the end pass -1 to do it auto.
LoopLoop the animation by true.
virtual void kge::sn::AnimatedMesh::SetAnimationSpeed ( float  Speed)
inlinevirtual

Set the animation speed default value is 1.0f

Parameters
SpeedThe animation speed.

Definition at line 86 of file AnimatedMesh.h.

virtual void kge::sn::AnimatedMesh::SetAnimationTime ( float  StartTime = 0.0f,
float  EndTime = -1.0f,
bool  Loop = true,
bool  Blend = true 
)
virtual

Set the mesh animation time.

Parameters
StartTimeThe starting time for animation.
EndTimeThe time which the animation must stop from that time if you want to stop it at the end pass -1 to do it auto.
LoopLoop the animation by true.
void kge::sn::AnimatedMesh::SetFileName ( core::String str)
inline

For internal use.

Definition at line 129 of file AnimatedMesh.h.

static void kge::sn::AnimatedMesh::SetGlobalAnimationSpeed ( float  fSpeed)
inlinestatic

Sets the global animation speed.

Definition at line 135 of file AnimatedMesh.h.

virtual void kge::sn::AnimatedMesh::SetShader ( gfx::ShaderInstance shader)
virtual

Set the shader for all materials.

Parameters
shaderShader to set.
virtual void kge::sn::AnimatedMesh::SetShaderConstsForHS ( gfx::ShaderInstance si)
protectedvirtual
virtual void kge::sn::AnimatedMesh::SetUserData ( void *  data)
inlinevirtual

Set your data for sending back them on callbacks.

Definition at line 123 of file AnimatedMesh.h.

Member Data Documentation

bool kge::sn::AnimatedMesh::m_bActionFrameReached
protected

Definition at line 165 of file AnimatedMesh.h.

bool kge::sn::AnimatedMesh::m_bBlend
protected

Loop the animation or not.

Definition at line 165 of file AnimatedMesh.h.

bool kge::sn::AnimatedMesh::m_bCheckForActionFrame
protected

Definition at line 165 of file AnimatedMesh.h.

bool kge::sn::AnimatedMesh::m_bLoop
protected

Definition at line 165 of file AnimatedMesh.h.

float kge::sn::AnimatedMesh::m_fActionFrame
protected

The action time of animation.

Definition at line 158 of file AnimatedMesh.h.

float kge::sn::AnimatedMesh::m_fBlendTime
protected

Definition at line 158 of file AnimatedMesh.h.

float kge::sn::AnimatedMesh::m_fEndTime
protected

The end time of animation.

Definition at line 158 of file AnimatedMesh.h.

float kge::sn::AnimatedMesh::m_fLastTime
protected

The last time of animation.

Definition at line 158 of file AnimatedMesh.h.

float kge::sn::AnimatedMesh::m_fSpeed
protected

The animation speed.

Definition at line 158 of file AnimatedMesh.h.

float kge::sn::AnimatedMesh::m_fStartTime
protected

The count of bones.

The start time of animation.

Definition at line 158 of file AnimatedMesh.h.

u32 kge::sn::AnimatedMesh::m_iNumBones
protected

The count of meshes.

Definition at line 155 of file AnimatedMesh.h.

u32 kge::sn::AnimatedMesh::m_iNumMeshes
protected

Animation.

Definition at line 155 of file AnimatedMesh.h.

gfx::Animation* kge::sn::AnimatedMesh::m_pAnimation
protected

Bones.

Definition at line 153 of file AnimatedMesh.h.

Bone* kge::sn::AnimatedMesh::m_pBones
protected

*< Mesh file name

Definition at line 151 of file AnimatedMesh.h.

kge::core::Functor1<void, void*>* kge::sn::AnimatedMesh::m_pEndAniFunc
protected

Mesh materials.

Pointer to user function.

Definition at line 189 of file AnimatedMesh.h.

core::String* kge::sn::AnimatedMesh::m_pFileName
protected

Meshes.

Definition at line 149 of file AnimatedMesh.h.

gfx::Material* kge::sn::AnimatedMesh::m_pMaterials
protected

Definition at line 186 of file AnimatedMesh.h.

gfx::MeshBuffer* kge::sn::AnimatedMesh::m_pMeshBuffer
protected

Definition at line 145 of file AnimatedMesh.h.

sn::Mesh* kge::sn::AnimatedMesh::m_pMeshes
protected

Mesh buffer pointer.

Definition at line 147 of file AnimatedMesh.h.

gfx::Shader * kge::sn::AnimatedMesh::m_pPHSshader
protected

Definition at line 177 of file AnimatedMesh.h.

u32 * kge::sn::AnimatedMesh::m_pRCurFrameData
protected

Definition at line 170 of file AnimatedMesh.h.

u32 * kge::sn::AnimatedMesh::m_pRLastFrameData
protected

Definition at line 170 of file AnimatedMesh.h.

gfx::ShaderInstance* kge::sn::AnimatedMesh::m_pShaderInstance
protected

Definition at line 184 of file AnimatedMesh.h.

u32 * kge::sn::AnimatedMesh::m_pTCurFrameData
protected

Definition at line 170 of file AnimatedMesh.h.

u32* kge::sn::AnimatedMesh::m_pTLastFrameData
protected

Definition at line 170 of file AnimatedMesh.h.

void* kge::sn::AnimatedMesh::m_pUData
protected

User data.

Definition at line 192 of file AnimatedMesh.h.

gfx::Shader* kge::sn::AnimatedMesh::m_pVHSshader
protected

Definition at line 177 of file AnimatedMesh.h.

float kge::sn::AnimatedMesh::m_sAnimSpeed
staticprotected

Global animation speed.

Definition at line 195 of file AnimatedMesh.h.

gfx::ShaderHandle kge::sn::AnimatedMesh::m_shBones
protected

Definition at line 179 of file AnimatedMesh.h.

gfx::ShaderHandle kge::sn::AnimatedMesh::m_shDiffColor
protected

Definition at line 179 of file AnimatedMesh.h.

gfx::ShaderHandle kge::sn::AnimatedMesh::m_shDir
protected

Definition at line 179 of file AnimatedMesh.h.

gfx::ShaderHandle kge::sn::AnimatedMesh::m_shViewProj
protected

Definition at line 179 of file AnimatedMesh.h.

gfx::ShaderHandle kge::sn::AnimatedMesh::m_shWorld
protected

Definition at line 179 of file AnimatedMesh.h.


The documentation for this class was generated from the following file: