ScummVM API documentation
t3d_face.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 #ifndef WATCHMAKER_T3D_FACE_H
23 #define WATCHMAKER_T3D_FACE_H
24 
25 #include "watchmaker/3d/types3d.h"
26 #include "watchmaker/3d/material.h"
27 
28 namespace Watchmaker {
29 
30 struct t3dBODY;
31 struct t3dFACE {
32  uint32 flags = 0; // face status 4
33  NormalPtr n; // pointer to the face normal 4
34 private:
35  int16 MatVertexIndex[3] = {}; // Vertices indices in material 6
36  uint16 _materialIndex = 0;
37  MaterialPtr _mat = nullptr; // pointer to material 4
38  t3dBODY *_body = nullptr;
39 public:
40  int16 VertexIndex[3] = {}; // Vertices indices in mesh 6
41 
42  void setMatVertexIndex(int index, int16 value) {
43  MatVertexIndex[index] = value;
44  }
45  uint16 getMatVertexIndex(int index) {
46  return MatVertexIndex[index];
47  }
48 public:
49  MaterialPtr lightmap; // pointer to lightmap (or 2nd material) 4
50 
52 
53  bool hasMaterialFlag(uint32 flag) {
54  return getMaterial()->hasFlag(flag);
55  }
56  MaterialPtr getMaterial();
57  const gMaterial *getMaterial() const;
58  uint16 getMaterialIndex() const {
59  return _materialIndex;
60  }
61  void setMaterialIndex(uint32 index) {
62  _materialIndex = index;
63  _mat = nullptr;
64  getMaterial();
65  }
66 
67  void checkVertices() {
68  for (int i = 0; i < 3; i++) {
69  assert((int)getMaterial()->VertsList.size() > MatVertexIndex[i]);
70  }
71  }
72 
73  bool isVisible() const;
74 };
75 
76 } // End of namespace Watchmaker
77 
78 #endif // SCUMMVM_T3D_FACE_H
Definition: 2d_stuff.h:30
Definition: t3d_face.h:31
Definition: stream.h:745
Definition: t3d_body.h:32
Definition: material.h:39