- 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
19class CalCoreModel;
20class CalSkeleton;
21class CalCoreMaterial;
22
23
24class CAL3D_API CalHardwareModel
25{
26public:
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
40public:
41 CalHardwareModel(CalCoreModel *pCoreModel);
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 const std::vector<CalHardwareMesh> & getVectorHardwareMesh() const;
58 void getAmbientColor(unsigned char *pColorBuffer) const;
59 void getDiffuseColor(unsigned char *pColorBuffer) const;
60 void getSpecularColor(unsigned char *pColorBuffer) const;
61 const CalQuaternion & getRotationBoneSpace(int boneId, CalSkeleton *pSkeleton) const;
62 const CalVector & getTranslationBoneSpace(int boneId, CalSkeleton *pSkeleton) const;
63
64 float getShininess() const;
65
66 int getHardwareMeshCount() const;
67 int getFaceCount() const;
68 int getVertexCount() const;
69 int getBoneCount() const;
70
71 int getBaseVertexIndex() const;
72 int getStartIndex() const;
73
74 int getTotalFaceCount() const;
75 int getTotalVertexCount() const;
76
77 Cal::UserData getMapUserData(int mapId);
78 const Cal::UserData getMapUserData(int mapId) const;
79
80 bool selectHardwareMesh(size_t meshId);
81
82private:
83 bool canAddFace(CalHardwareMesh &hardwareMesh, CalCoreSubmesh::Face & face,std::vector<CalCoreSubmesh::Vertex>& vectorVertex, int maxBonesPerMesh) const;
84 int addVertex(CalHardwareMesh &hardwareMesh, int indice , CalCoreSubmesh *pCoreSubmesh, int maxBonesPerMesh);
85 int addBoneIndice(CalHardwareMesh &hardwareMesh, int Indice, int maxBonesPerMesh);
86
87
88private:
89
90 std::vector<CalHardwareMesh> m_vectorHardwareMesh;
91 std::vector<CalIndex> m_vectorVertexIndiceUsed;
92 int m_selectedHardwareMesh;
93 std::vector<int> m_coreMeshIds;
94 CalCoreModel *m_pCoreModel;
95
96
97 char *m_pVertexBuffer;
98 int m_vertexStride;
99 char *m_pNormalBuffer;
100 int m_normalStride;
101 char *m_pWeightBuffer;
102 int m_weightStride;
103 char *m_pMatrixIndexBuffer;
104 int m_matrixIndexStride;
105 char *m_pTextureCoordBuffer[8];
106 int m_textureCoordStride[8];
107 int m_textureCoordNum;
108 char *m_pTangentSpaceBuffer[8];
109 int m_tangentSpaceStride[8];
110
111 CalIndex *m_pIndexBuffer;
112
113 int m_totalVertexCount;
114 int m_totalFaceCount;
115};
116
117#endif
Definition corematerial.h:23
Definition coremodel.h:26
Definition coresubmesh.h:32
Definition hardwaremodel.h:25
The quaternion class.
Definition quaternion.h:36
Definition skeleton.h:21
The vector class.
Definition vector.h:37
Definition coresubmesh.h:67
Definition hardwaremodel.h:28

Generated by The Cal3D Team with Doxygen 1.10.0