2 #include "IAttributeFields.h" 3 #include "modelheaders.h" 5 #include "AnimInstanceBase.h" 6 #include "ParameterBlock.h" 7 #include "ParaXModelInstance.h" 8 #include "TextureAnim.h" 9 #include "ParaXModelCommon.h" 10 #include "ModelRenderPass.h" 24 struct ModelAttachment;
68 ATTRIBUTE_METHOD1(
CParaXModel, DumpTextureUsage_s,
const char**) {*p1 = cls->DumpTextureUsage();
return S_OK;}
69 ATTRIBUTE_METHOD1(
CParaXModel, GetPolyCount_s,
int*) {*p1 = cls->GetPolyCount();
return S_OK;}
70 ATTRIBUTE_METHOD1(
CParaXModel, GetPhysicsCount_s,
int*) {*p1 = cls->GetPhysicsCount();
return S_OK;}
71 ATTRIBUTE_METHOD1(
CParaXModel, GetGeosetsCount_s,
int*) { *p1 = (int)cls->geosets.size();
return S_OK; }
72 ATTRIBUTE_METHOD1(
CParaXModel, GetRenderPassesCount_s,
int*) { *p1 = (int)cls->passes.size();
return S_OK; }
73 ATTRIBUTE_METHOD1(
CParaXModel, GetObjectNum_s,
void**) { *p1 = (
void*)(&(cls->GetObjectNum()));
return S_OK; }
74 ATTRIBUTE_METHOD1(
CParaXModel, GetVertices_s,
void**) { *p1 = (
void*)(cls->m_origVertices);
return S_OK; }
75 ATTRIBUTE_METHOD1(
CParaXModel, GetRenderPasses_s,
void**) { *p1 = (
void*)(&(cls->passes[0]));
return S_OK; }
76 ATTRIBUTE_METHOD1(
CParaXModel, GetGeosets_s,
void**) { *p1 = (
void*)(&(cls->geosets[0]));
return S_OK; }
77 ATTRIBUTE_METHOD1(
CParaXModel, GetIndices_s,
void**) { *p1 = (
void*)(&(cls->m_indices[0]));
return S_OK; }
78 ATTRIBUTE_METHOD1(
CParaXModel, GetAnimations_s,
void**) { *p1 = (
void*)(cls->anims);
return S_OK; }
79 ATTRIBUTE_METHOD1(
CParaXModel, SaveToDisk_s,
char*) { cls->SaveToDisk(p1);
return S_OK; }
96 void initIndices(
int nIndices, uint16* pIndices);
134 void updateEmitters(
SceneState * pSceneState,
float dt);
136 void drawBoundingVolume();
156 void PostCalculateBoneMatrix(uint32 nBones);
175 void lightsOn(uint32 lbase);
176 void lightsOff(uint32 lbase);
211 void RenderShaderAnim(
SceneState* pSceneState);
221 bool HasAlphaBlendedObjects();
236 HRESULT
ClonePhysicsMesh(DWORD* pNumVertices,
Vector3 ** ppVerts, DWORD* pNumTriangles, DWORD** ppIndices,
int* pnMeshPhysicsGroup = NULL,
int* pnTotalMeshGroupCount = NULL);
238 void SaveToDisk(
const char* path);
242 void SetVertexBufferDirty();
247 void InitVertexBuffer_NOANIM();
248 void InitVertexBuffer_BMAX();
249 void InitVertexBuffer();
282 bool animGeometry : 1, animTextures : 1, animBones : 1, animTexRGB : 1;
283 bool rotatePartice2SpeedVector : 1;
287 int *globalSequences;
299 int m_nCurrentFrameNumber;
300 Vector3 * m_vertices, *m_normals;
309 asset_ptr<TextureEntity> *textures;
311 std::vector<ModelRenderPass> passes;
317 std::vector<ModelGeoset> geosets;
351 bool m_bTextureLoaded;
354 std::vector<ModelAttachment> m_atts;
366 enum VERTEX_BUFFER_STATE
374 VERTEX_BUFFER_STATE m_vbState;
376 static const size_t MAX_USE_VERTEX_BUFFER_SIZE = 1024 * 1024 * 256;
377 static size_t m_uUsedVB;
383 float m_fUpperBodyFacingAngle;
384 float m_fUpperBodyUpDownAngle;
387 typedef asset_ptr<CParaXModel> CParaXModelPtr;
int GetNextPhysicsGroupID(int nPhysicsGroup=-1)
return the physics group id that is closest to nPhysicsGroup.
Definition: ParaXModel.cpp:2156
Which DXT Compression to Use? Obviously, there are some trade-offs between the different formats whic...
Definition: TextureEntity.h:29
bool * showGeosets
a list of face group
Definition: ParaXModel.h:320
void calcBones()
for model without animations, but with bones.
Definition: ParaXModel.cpp:743
bool IsBmaxModel()
whether it is bmax model with vertex color.
Definition: ParaXModel.cpp:247
using software skinning
Definition: ParaXModel.h:39
HRESULT ClonePhysicsMesh(DWORD *pNumVertices, Vector3 **ppVerts, DWORD *pNumTriangles, DWORD **ppIndices, int *pnMeshPhysicsGroup=NULL, int *pnTotalMeshGroupCount=NULL)
Get the physics mesh in terms of vertices and indices.
Definition: ParaXModel.cpp:2172
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
int * m_frame_number_vertices
this always contains the same number of items as m_origVertices.
Definition: ParaXModel.h:298
ShadowVolume is a structure for storing shadow volume geometries.
Definition: ShadowVolume.h:39
It's used as parameter to Draw method of each scene object.
Definition: SceneState.h:284
const char * DumpTextureUsage()
get texture usage such as the number of textures and their sizes.
Definition: ParaXModel.cpp:2069
AnimIndex m_NextAnim
the next animation index.if it is -1, the next animation will depends on the loop property of the cur...
Definition: ParaXModel.h:334
float GetBoundingRadius()
get the mesh radius
Definition: ParaXModel.cpp:2033
void animate(SceneState *pSceneState, CharacterPose *pPose, IAttributeFields *pAnimInstance=NULL)
animate the entire model according to the current animation and blending settings.
Definition: ParaXModel.cpp:852
this is another kind of particle system.
Definition: particle.h:253
virtual IAttributeFields * GetChildAttributeObject(const std::string &sName)
get attribute by child object.
Definition: ParaXModel.cpp:2146
different physics engine has different winding order.
Definition: EventBinding.h:32
const ParaXModelObjNum & GetObjectNum() const
get the number of objects in the model.
Definition: ParaXModel.h:89
bool canAttach(int id)
whether the model has a specified attachment point
Definition: ParaXModel.cpp:2047
int m_boneLookup[MAX_KNOWN_BONE_NODE]
a mapping from known bone id to bone index.
Definition: ParaXModel.h:363
bool InitDeviceObjects()
TODO: currently this is not implemented.
Definition: ParaXModel.cpp:207
render without animation.
Definition: ParaXModel.h:43
float m_radius
bounding radius
Definition: ParaXModel.h:257
AnimIndex m_BlendingAnim
the animation sequence with which the current animation should be blended.
Definition: ParaXModel.h:339
using hardware skinning, need vertex shader 1.1 or later
Definition: ParaXModel.h:41
a single animated bone, it contains both the bone instance data and all animation data of the bone...
Definition: ParaXBone.h:15
void LoadTextures()
load textures
Definition: ParaXModel.cpp:219
const ModelAnimation * GetModelAnimByIndex(int nAnimIndex)
return NULL if not exist
Definition: ParaXModel.cpp:295
ParaXModelObjNum m_objNum
object counts
Definition: ParaXModel.h:255
Definition: modelheaders.h:226
cross platform vertex/index buffer.
Definition: ParaVertexBuffer.h:18
static const int MAX_MODEL_TEXTURES
max number of textures per model
Definition: ParaXModel.h:264
Vector3 m_vNeckYawAxis
default to unitY
Definition: ParaXModel.h:358
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
virtual const char * GetAttributeClassDescription()
a static string, describing the attribute class object
Definition: ParaXModel.h:56
int GetAnimIDByIndex(int nAnimIndex)
return the ID of the animation at the specified index.
Definition: ParaXModel.cpp:287
ParaVertexBuffer m_pVertexBuffer
vertex buffer for skinned vertex
Definition: ParaXModel.h:276
static VertexDeclarationPtr m_pVertexDeclaration
vertex declaration used in the vertex shader of the effect file
Definition: ParaXModel.h:274
Definition: ParaXModelCommon.h:13
LightParams is a structure for which a shadow volume is built.
Definition: ShadowVolume.h:8
void drawModel(SceneState *pSceneState, CParameterBlock *pMaterialParam=NULL, int nRenderMethod=-1)
Definition: ParaXModel.cpp:1706
Definition: ParaXModelCommon.h:57
Matrix4 * GetAttachmentMatrix(Matrix4 *pOut, int nAttachmentID, const AnimIndex &CurrentAnim, const AnimIndex &BlendingAnim, float blendingFactor, bool bRecalcBone=true, IAttributeFields *pAnimInstance=NULL)
calculate only specified bone in the attachment, all parent bones will also be calculated in order to...
Definition: ParaXModel.cpp:695
int GetPhysicsCount()
get physics polycount of this mesh object
Definition: ParaXModel.cpp:2064
static CEffectFile * m_pEffectFile
The effect file entity used to render the animated model.
Definition: ParaXModel.h:272
Standard 2-dimensional vector.
Definition: ParaVector2.h:16
ParaIndexBuffer m_pIndexBuffer
index buffer
Definition: ParaXModel.h:278
float blendingFactor
by how much the blending frame should be blended with the current frame.
Definition: ParaXModel.h:344
int m_nHasAlphaBlendedRenderPass
-1 uninitialized.
Definition: ParaXModel.h:259
The particle class keeps a list of all of its instances.A particle system instance is always associat...
Definition: particle.h:99
AnimIndex GetAnimIndexByID(int nAnimID)
return the animation index by animation ID.
Definition: ParaXModel.cpp:274
bool DeleteDeviceObjects()
TODO: currently this is not implemented.
Definition: ParaXModel.cpp:214
Definition: TextureAnim.h:5
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: ParaMatrix4.h:23
RENDER_METHOD
in what method to render the mesh
Definition: ParaXModel.h:37
std::vector< CFaceGroup * > m_faceGroups
translucent face groups.
Definition: ParaXModel.h:315
vertex element
Definition: VertexDeclarationOpenGL.h:21
in OpenGL, there is no different between vertex and index buffer.
Definition: ParaVertexBuffer.h:78
virtual int GetChildAttributeObjectCount(int nColumnIndex=0)
get the number of child objects (row count) in the given column.
Definition: ParaXModel.cpp:2115
Definition: effect_file.h:323
ModelAttachment & NewAttachment(bool bOverwrite, int nAttachmentID, int nBoneIndex, const Vector3 &pivotPoint)
create new attachment
Definition: ParaXModel.cpp:652
it presents a given in bone animation providers or parax local model bone animation pools ...
Definition: AnimInstanceBase.h:13
A common interface for all classes implementing IAttributeFields By implementing this class's virtual...
Definition: IAttributeFields.h:59
Definition: ParaXModelCommon.h:8
float fBlendingTime
blending time in seconds
Definition: ParaXModel.h:347
ParaXHeaderDef m_header
model header
Definition: ParaXModel.h:253
Definition: ParaXModelCommon.h:27
static const int MAX_MODEL_ATTACHMENTS
max number of attachment points per model
Definition: ParaXModel.h:266
BMAX model color model.
Definition: ParaXModel.h:45
void draw(SceneState *pSceneState, CParameterBlock *materialParams=NULL, int nRenderMethod=-1)
render the model, according to the current animation states.
Definition: ParaXModel.cpp:1973
the pose of the character.
Definition: ParaXModel.h:381
int GetPolyCount()
get polycount of this mesh object
Definition: ParaXModel.cpp:2052
bool CheckMinVersion(int v0, int v1=0, int v2=0, int v3=0)
check the minimum file version.
Definition: ParaXModel.cpp:202
bool SetupTransformByID(int nID)
set the transform matrix for the specified attachment ID on this model.
Definition: ParaXModel.cpp:682
Definition: ParaXModelCommon.h:40
void BuildShadowVolume(ShadowVolume *pShadowVolume, LightParams *pLight, Matrix4 *mxWorld)
Build Shadow Volume.
Definition: ParaXModel.cpp:1782
Vector3 GetWeightedVertexByIndex(unsigned short nIndex)
Definition: ParaXModel.cpp:1962
virtual int GetChildAttributeColumnCount()
we support multi-dimensional child object.
Definition: ParaXModel.cpp:2151
virtual const char * GetAttributeClassName()
a static string, describing the attribute class object's name
Definition: ParaXModel.h:54
void initTranslucentFaceGroups()
call this function only once after the model data is loaded.
Definition: ParaXModel.cpp:575
Definition: ParaXModelCommon.h:50
bool HasAttachmentMatrix(int nAttachmentID)
whether we have attachment matrix.
Definition: ParaXModel.cpp:730
bool IsValid()
whether this is a valid model
Definition: ParaXModel.cpp:269
std::vector< int > m_TranslucentPassIndice
it has the same number of element as the passes.
Definition: ParaXModel.h:313
AnimIndex m_CurrentAnim
current animation index, this is different from sequence ID an absolute ParaX frame number denoting t...
Definition: ParaXModel.h:329
void initVertices(int nVertices, ModelVertex *pVertices)
file loading for ParaX file type
Definition: ParaXModel.cpp:471
ModelAnimation * anims
animation info for the current model
Definition: ParaXModel.h:269
ParaX model is the model file for character animation, etc in the game world.
Definition: ParaXModel.h:30
Definition: ModelRenderPass.h:9
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: ParaXModel.cpp:2339
Vector3 m_vNeckPitchAxis
default to unitZ
Definition: ParaXModel.h:360
virtual int GetAttributeClassID()
attribute class ID should be identical, unless one knows how overriding rules work.
Definition: ParaXModel.h:52
void ClearFaceGroups()
clear all face groups.
Definition: ParaXModel.cpp:258
Definition: modelheaders.h:165
void DrawPass(ModelRenderPass &p)
only called inside Render* function
Definition: ParaXModel.cpp:1596
bool HasAnimation()
return true if the model has animation.
Definition: ParaXModel.cpp:847
a list of CParameter{name, value} pairs of anything.
Definition: ParameterBlock.h:108