ScummVM API documentation
t3d_body.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 #ifndef WATCHMAKER_T3D_BODY_H
24 #define WATCHMAKER_T3D_BODY_H
25 
26 #include "watchmaker/types.h"
27 #include "watchmaker/t3d.h"
28 #include "watchmaker/3d/t3d_mesh.h"
29 
30 namespace Watchmaker {
31 
32 struct t3dBODY {
33  Common::String name; // room name
34  uint32 NumMeshes() {
35  return MeshTable.size();
36  }; // num meshes
37  uint32 NumCameras() const {
38  return CameraTable.size(); // num cameras
39  }
40  uint16 NumPaths() const {
41  return CameraPath.size(); // num camera paths
42  }
43  uint32 NumLights() const {
44  return LightTable.size(); // num lights
45  }
46  uint16 NumPanels[T3D_MAX_LEVELS] = {}; // num panels per level
47  uint16 NumNormals = 0; // num face normals
48  uint16 NumVerticesNormals = 0; // num vertex normals
49  uint16 NumPosLights() const {
50  return PosLightTable.size();
51  }; // num positional lights
52  uint16 NumLevels = 0; // num panel levels
53  uint16 CurLevel = 0; // current level
54  uint32 NumTotVerts = 0; // total number of verts in room
55  t3dV3F AmbientLight; // room ambient color
56  Common::Array<t3dMESH> MeshTable; // meshes list
57  MaterialTable MatTable; // materials list
58  uint32 NumMaterials() const {
59  return MatTable.size(); // num materials
60  }
61  MaterialTable LightmapTable; // lightmap material list
62  uint32 NumLightmaps = 0; // num lightmap materials
63  MaterialTable MirrorMatTable; // material list (for mirrors)
64  uint32 NumMirrorMaterials() const {
65  return MirrorMatTable.size();
66  }; // num materials (for mirror)
67 private:
68  Common::Array<Common::SharedPtr<VertexBuffer>> VBTable; // metrial vertex buffers list
69 public:
70  Common::SharedPtr<VertexBuffer> addVertexBuffer() {
72  return VBTable.back();
73  }
74  void clearVBTable() {
75  for (uint i = 0; i < VBTable.size(); i++) {
76  rDeleteVertexBuffer(*VBTable[i]);
77  }
78  VBTable.clear();
79  }
80  uint32 NumVB() {
81  return VBTable.size();
82  }; // num vertex buffer
83 public:
84  Common::Array<t3dCAMERA> CameraTable; // camera list
85  Common::Array<t3dLIGHT> LightTable; // light list
86  Common::Array<t3dPLIGHT> PosLightTable; // positional light list
87  NormalList NList; // normal list
88  t3dCAMERAGRID CameraGrid; // camera grid
89  Common::Array<t3dCAMERAPATH> CameraPath; // camer paths list
90  t3dPAN *Panel[T3D_MAX_LEVELS] = {}; // room panels for level
91  t3dF32 PanelHeight[T3D_MAX_LEVELS] = {}; // panel height for levels
92  Common::SharedPtr<t3dVolLights> VolumetricLights; // volumetric lights
93  t3dMESH *BlockMeshes[T3D_MAX_BLOCK_MESHES] = {}; // block mesh (for external rooms)
94  t3dV3F MinPos; // min room position
95 private:
96  void allocateNormals();
97  void initNormals(Common::SeekableReadStream &stream);
98 public:
99  t3dCAMERA *PickCamera(uint8 in);
100  Common::Array<t3dPLIGHT> getPositionalLight(uint8 pos);
101 
102  t3dBODY *loadFromStream(WGame &game, const Common::String &pname, Common::SeekableReadStream &stream, uint32 LoaderFlags);
103  void populatePortalLists();
104 };
105 
106 } // End of namespace Watchmaker
107 
108 #endif // WATCHMAKER_T3D_BODY_H
Definition: types3d.h:38
Definition: 2d_stuff.h:30
Definition: str.h:59
Definition: t3d.h:328
Definition: array.h:52
void clear()
Definition: array.h:320
Definition: t3d.h:196
Definition: stream.h:745
void push_back(const T &element)
Definition: array.h:180
Definition: t3d_body.h:32
Definition: render.h:83
Definition: t3d_mesh.h:30
size_type size() const
Definition: array.h:315
Definition: game.h:55
Definition: t3d.h:213
Definition: ptr.h:159
T & back()
Definition: array.h:229