- Cal3D 0.11 API Reference -

hardwaremodel.h
1//****************************************************************************//
2// hardwaremodel.h //
3// Copyright (C) 2004 Desmecht Laurent //
4//****************************************************************************//
5// This library is free software; you can redistribute it and/or modify it //
6// under the terms of the GNU Lesser General Public License as published by //
7// the Free Software Foundation; either version 2.1 of the License, or (at //
8// your option) any later version. //
9//****************************************************************************//
10
11#ifndef CAL_HARDWAREMODEL_H
12#define CAL_HARDWAREMODEL_H
13
14
15#include "cal3d/global.h"
16#include "cal3d/coresubmesh.h"
17
18
19 class CalCoreModel;
20 class CalSkeleton;
21 class CalCoreMaterial;
22
23
24 class CAL3D_API CalHardwareModel
25{
26 public:
27 struct CalHardwareMesh
28 {
29 std::vector<int> m_vectorBonesIndices;
30
31 int baseVertexIndex;
32 int vertexCount;
33 int startIndex;
34 int faceCount;
35 CalCoreMaterial *pCoreMaterial;
36
37 int meshId,submeshId;
38 };
39
40 public:
41 CalHardwareModel(CalCoreModel* pCoreModel);
42 ~CalHardwareModel() { }
43
44 void setVertexBuffer( char * pVertexBuffer, int stride);
45 void setIndexBuffer( CalIndex * pIndexBuffer);
46 void setNormalBuffer( char * pNormalBuffer, int stride);
47 void setWeightBuffer( char * pWeightBuffer, int stride);
48 void setMatrixIndexBuffer( char * pMatrixIndexBuffer, int stride);
49 void setTextureCoordNum(int textureCoordNum);
50 void setTextureCoordBuffer(int mapId, char * pTextureCoordBuffer, int stride);
51 void setTangentSpaceBuffer(int mapId, char * pTangentSpaceBuffer, int stride);
52 void setCoreMeshIds(const std::vector<int>& coreMeshIds);
53
54 bool load(int baseVertexIndex, int startIndex,int maxBonesPerMesh);
55
56 std::vector<CalHardwareMesh> & getVectorHardwareMesh();
57 void getAmbientColor(unsigned char *pColorBuffer);
58 void getDiffuseColor(unsigned char *pColorBuffer);
59 void getSpecularColor(unsigned char *pColorBuffer);
60 const CalQuaternion & getRotationBoneSpace(int boneId, CalSkeleton *pSkeleton);
61 const CalVector & getTranslationBoneSpace(int boneId, CalSkeleton *pSkeleton);
62
63 float getShininess();
64
65 int getHardwareMeshCount();
66 int getFaceCount();
67 int getVertexCount();
68 int getBoneCount();
69
70 int getBaseVertexIndex();
71 int getStartIndex();
72
73 int getTotalFaceCount();
74 int getTotalVertexCount();
75
76 Cal::UserData getMapUserData(int mapId);
77
78 bool selectHardwareMesh(size_t meshId);
79
80 private:
81 bool canAddFace(CalHardwareMesh &hardwareMesh, CalCoreSubmesh::Face & face,std::vector<CalCoreSubmesh::Vertex>& vectorVertex, int maxBonesPerMesh);
82 int addVertex(CalHardwareMesh &hardwareMesh, int indice , CalCoreSubmesh *pCoreSubmesh, int maxBonesPerMesh);
83 int addBoneIndice(CalHardwareMesh &hardwareMesh, int Indice, int maxBonesPerMesh);
84
85
86 private:
87
88 std::vector<CalHardwareMesh> m_vectorHardwareMesh;
89 std::vector<CalIndex> m_vectorVertexIndiceUsed;
90 int m_selectedHardwareMesh;
91 std::vector<int> m_coreMeshIds;
92 CalCoreModel *m_pCoreModel;
93
94
95 char * m_pVertexBuffer;
96 int m_vertexStride;
97 char * m_pNormalBuffer;
98 int m_normalStride;
99 char * m_pWeightBuffer;
100 int m_weightStride;
101 char * m_pMatrixIndexBuffer;
102 int m_matrixIndexStride;
103 char * m_pTextureCoordBuffer[8];
104 int m_textureCoordStride[8];
105 int m_textureCoordNum;
106 char * m_pTangentSpaceBuffer[8];
107 int m_tangentSpaceStride[8];
108
109 CalIndex * m_pIndexBuffer;
110
111 int m_totalVertexCount;
112 int m_totalFaceCount;
113};
114
115#endif
CalCoreMaterial
Definition corematerial.h:21
CalCoreModel
Definition coremodel.h:26
CalCoreSubmesh
Definition coresubmesh.h:23
CalHardwareModel::CalHardwareModel
CalHardwareModel(CalCoreModel *pCoreModel)
Constructs the hardware model instance.
Definition hardwaremodel.cpp:36
CalQuaternion
The quaternion class.
Definition quaternion.h:36
CalSkeleton
Definition skeleton.h:21
CalVector
The vector class.
Definition vector.h:37
CalCoreSubmesh::Face
Definition coresubmesh.h:57
CalHardwareModel::CalHardwareMesh
Definition hardwaremodel.h:28

Generated by The Cal3D Team with Doxygen 1.15.0