My Project
|
base class for all xref objects More...
#include <XRefObject.h>
Public Member Functions | |
XRefObject (CMeshObject *pParent, AssetEntity *pModel, const Vector3 &vOrigin, const Matrix4 &mxLocalTransform) | |
CMeshObject * | GetParent () |
Get the parent object associated with this object. | |
AssetEntity * | GetModelAsset () |
return the model asset associated with this object | |
virtual bool | SetParamsFromAsset () |
return true if asset effect type is known. More... | |
virtual void | Animate (double dTimeDelta, int nRenderNumber=0) |
animate the model | |
virtual HRESULT | Draw (SceneState *sceneState) |
draw the model | |
virtual HRESULT | DrawInner (SceneState *sceneState, const Matrix4 *pMxWorld=0, float fCameraToObjectDist=0.f) |
virtual bool | SetReplaceableTexture (int ReplaceableTextureID, TextureEntity *pTextureEntity) |
set the replaceable texture at the given index with a new texture. More... | |
Matrix4 * | GetRenderMatrix (Matrix4 &mxWorld, const Matrix4 *pMxParent=NULL, int nRenderNumber=0) |
get matrix for rendering More... | |
virtual Matrix4 * | GetAttachmentMatrix (Matrix4 &pOut, int nAttachmentID=0, int nRenderNumber=0) |
Get the specified attachment matrix of the current model. More... | |
virtual void | SetAnimation (int nAnimID) |
Set the current animation id. More... | |
virtual int | GetAnimation () |
get the scaling. More... | |
virtual void | SetAnimFrame (int nFrame) |
set the current animation frame number relative to the beginning of current animation. More... | |
virtual int | GetAnimFrame () |
get the current animation frame number relative to the beginning of current animation. More... | |
virtual void | SetUseGlobalTime (bool bUseGlobalTime) |
whether to use global time to sync animation. More... | |
virtual bool | IsUseGlobalTime () |
whether to use global time to sync animation. More... | |
Matrix4 & | GetLocalMatrix () |
get local matrix | |
Matrix4 * | GetMatrix (Matrix4 &mxWorld, const Matrix4 *pMatParent) |
get matrix relative to a parent matrix | |
virtual int | GetPrimaryTechniqueHandle () |
when batch-rendering a group of objects, objects are usually sorted by their render techniques and then by their primary asset. More... | |
virtual void | SetPrimaryTechniqueHandle (int nHandle) |
Set a new render technique handle. More... | |
Protected Attributes | |
asset_ptr< AssetEntity > | m_pModelEntity |
Vector3 | m_vOrigin |
the xrefed model's origin relative to its parent model. More... | |
Matrix4 | m_mxLocalTransform |
animated local transform: this is usually a const read from the model file | |
int | m_nTechniqueHandle |
the primary technique handle | |
CMeshObject * | m_pParent |
parent object | |
base class for all xref objects
|
inlinevirtual |
get the scaling.
Reimplemented in ParaEngine::XRefAnimInstance.
|
inlinevirtual |
get the current animation frame number relative to the beginning of current animation.
Reimplemented in ParaEngine::XRefAnimInstance.
|
inlinevirtual |
Get the specified attachment matrix of the current model.
this is usually for getting the mount point on a certain model, such as horses. It also works for static mesh with xrefed mountable objects.
pOut | output result |
nAttachmentID | see ATTACHMENT_ID. default to 0, which is general mount point. ATT_ID_MOUNT1-9(20-28) is another mount points |
nRenderNumber | if it is bigger than current calculated render number, the value will be recalculated. If 0, it will not recalculate |
Reimplemented in ParaEngine::XRefAnimInstance.
|
inlinevirtual |
when batch-rendering a group of objects, objects are usually sorted by their render techniques and then by their primary asset.
One can access the effect file currently associated with the handle in the asset manager. Please note that, the game engine may change the mapping from technique handle to the effect file, secretly at runtime. Effect files capable to be assigned to the same technique handle must also share the same (vertex) input declaration in order to be swapped secretly at runtime. Note: the Draw() function of object will dynamically retrieve the effect file for each call. If the effect file is not valid, it will try to render using directx 9's fixed programming pipeline.
Matrix4 * ParaEngine::XRefObject::GetRenderMatrix | ( | Matrix4 & | mxWorld, |
const Matrix4 * | pMxParent = NULL , |
||
int | nRenderNumber = 0 |
||
) |
get matrix for rendering
mxWorld | out |
pMxParent | in, if NULL, parent render world matrix is used. |
nRenderNumber | if it is bigger than current calculated render number, the value will be recalculated. If 0, it will not recalculate |
|
inlinevirtual |
whether to use global time to sync animation.
Default to false. if true, all characters plays exactly the same frames if they are using the same animation file at all times, if false, each character advances its time frame separately according to their visibility in the scene.
Reimplemented in ParaEngine::XRefAnimInstance.
|
inlinevirtual |
Set the current animation id.
nAnimID | 0 is default standing animation. 4 is walking, 5 is running. more information, please see AnimationID |
Reimplemented in ParaEngine::XRefAnimInstance.
|
inlinevirtual |
set the current animation frame number relative to the beginning of current animation.
nFrame | 0 means beginning. if nFrame is longer than the current animation length, it will wrap (modulate the length). |
Reimplemented in ParaEngine::XRefAnimInstance.
|
virtual |
return true if asset effect type is known.
and false in case the asset is not loaded yet.
Reimplemented in ParaEngine::XRefAnimInstance, and ParaEngine::XRefMeshObject.
|
inlinevirtual |
Set a new render technique handle.
If the effect file associated with the handle is invalid or do not share the same input declaration as the object at the time of drawing, the object will not be drawn or will be drawn improperly. This function rarely needs to be called by users. Technique handles are usually automatically assigned by the game engine when the asset file is loaded. Of course, users can use special effect files for the rendering of special objects; then this function needs to be called.
nHandle |
|
inlinevirtual |
set the replaceable texture at the given index with a new texture.
this function will succeed regardless whether the mesh is initialized. Hence it can be used at loading time. because default instance of the mesh may use different replaceable texture set.
ReplaceableTextureID | usually [0-32) generally speaking, replaceable ID 0 is used for general purpose replaceable texture, ID 1 is for user defined. ID 2 is for custom skins. |
pTextureEntity | The reference account of the texture entity will be automatically increased by one. |
Reimplemented in ParaEngine::XRefAnimInstance, and ParaEngine::XRefMeshObject.
|
inlinevirtual |
whether to use global time to sync animation.
Default to false. if true, all characters plays exactly the same frames if they are using the same animation file at all times, if false, each character advances its time frame separately according to their visibility in the scene.
Reimplemented in ParaEngine::XRefAnimInstance.
|
protected |
the xrefed model's origin relative to its parent model.
this is usually a const read from the model file