ScummVM API documentation
SubMesh.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * Copyright (C) 2006-2010 - Frictional Games
24 *
25 * This file is part of HPL1 Engine.
26 */
27
28#ifndef HPL_SUB_MESH_H
29#define HPL_SUB_MESH_H
30
31#include "hpl1/engine/graphics/GraphicsTypes.h"
32#include "hpl1/engine/math/MathTypes.h"
33#include "hpl1/engine/math/MeshTypes.h"
34#include "hpl1/engine/system/SystemTypes.h"
35
36namespace hpl {
37
38class iMaterial;
39class iVertexBuffer;
40
41class cMesh;
42
43class cMaterialManager;
44
45class cSubMesh {
46 friend class cMesh;
47 friend class cSubMeshEntity;
48
49public:
50 cSubMesh(const tString &asName, cMaterialManager *apMaterialManager);
51 ~cSubMesh();
52
53 void SetMaterial(iMaterial *apMaterial);
54 void SetVertexBuffer(iVertexBuffer *apVtxBuffer);
55
56 // Renderable implementation.
57 iMaterial *GetMaterial();
58 iVertexBuffer *GetVertexBuffer();
59
60 tString GetName() { return msName; }
61
62 // Vertex-Bone pairs
63 void ResizeVertexBonePairs(int alSize);
64 int GetVertexBonePairNum();
65 cVertexBonePair &GetVertexBonePair(int alNum);
66
67 void AddVertexBonePair(const cVertexBonePair &aPair);
68 void ClearVertexBonePairs();
69
70 void CompileBonePairs();
71
72 const cTriEdge &GetEdge(int alIndex) const { return mvEdges[alIndex]; }
73 int GetEdgeNum() { return (int)mvEdges.size(); }
74
75 tTriEdgeVec *GetEdgeVecPtr() { return &mvEdges; }
76
77 tTriangleDataVec *GetTriangleVecPtr() { return &mvTriangles; }
78
79 void SetDoubleSided(bool abX) { mbDoubleSided = abX; }
80 bool GetDoubleSided() { return mbDoubleSided; }
81
82 const tString &GetGroup() { return msGroup; }
83 void SetGroup(const tString &asGroup) { msGroup = asGroup; }
84
85 const tString &GetNodeName() { return msNodeName; }
86 void SetNodeName(const tString &asNodeName) { msNodeName = asNodeName; }
87
88 void SetModelScale(const cVector3f &avScale) { mvModelScale = avScale; }
89 cVector3f GetModelScale() { return mvModelScale; }
90
91 const cMatrixf &GetLocalTransform() { return m_mtxLocalTransform; }
92 void SetLocalTransform(const cMatrixf &a_mtxTrans) { m_mtxLocalTransform = a_mtxTrans; }
93
94 bool GetIsOneSided() { return mbIsOneSided; }
95 const cVector3f &GetOneSidedNormal() { return mvOneSidedNormal; }
96
97 void Compile();
98
99private:
100 void CheckOneSided();
101
102 iMaterial *mpMaterial;
103 iVertexBuffer *mpVtxBuffer;
104
105 cMatrixf m_mtxLocalTransform;
106
107 tVertexBonePairVec mvVtxBonePairs;
108
109 tString msGroup;
110 tString msNodeName;
111
112 float *mpVertexWeights;
113 unsigned char *mpVertexBones;
114
115 tTriEdgeVec mvEdges;
116 tTriangleDataVec mvTriangles;
117
118 cVector3f mvModelScale;
119
120 tString msName;
121
122 bool mbDoubleSided;
123
124 bool mbIsOneSided;
125 cVector3f mvOneSidedNormal;
126
127 cMaterialManager *mpMaterialManager;
128
129 cMesh *mpParent;
130};
131
132} // namespace hpl
133
134#endif // HPL_SUB_MESH_H
size_type size() const
Definition: array.h:316
Definition: str.h:59
Definition: MaterialManager.h:41
Definition: Mesh.h:215
Definition: SubMeshEntity.h:95
Definition: SubMesh.h:45
Definition: MeshTypes.h:54
Definition: GraphicsTypes.h:107
Definition: Material.h:203
Definition: VertexBuffer.h:90