TDME2 1.9.121
FacesEntity.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
5
6#include <tdme/tdme.h>
10#include <tdme/math/Vector3.h>
11
12using std::string;
13using std::vector;
14
20
21/**
22 * Node faces entity
23 * A node can have multiple entities containing faces and a applied material
24 * @author Andreas Drewke
25 * @version $Id$
26 */
28{
29private:
30 string id;
33 vector<Face> faces;
36 vector<int32_t> lod1Indices;
37 vector<int32_t> lod2Indices;
38 vector<int32_t> lod3Indices;
42
43 /**
44 * Determine features
45 */
46 void determineFeatures();
47
48public:
49 /**
50 * Public constructor
51 */
53
54 /**
55 * Public constructor
56 * @param node node
57 * @param id id
58 */
59 FacesEntity(Node* node, const string& id);
60
61 /**
62 * @return faces entity id
63 */
64 inline const string& getId() const {
65 return id;
66 }
67
68 /**
69 * Set up the entity's material
70 * @param material material
71 */
73 this->material = material;
74 }
75
76 /**
77 * @return entity's material
78 */
79 inline const Material* getMaterial() const {
80 return material;
81 }
82
83 /**
84 * @return entity's faces
85 */
86 inline const vector<Face>& getFaces() const {
87 return faces;
88 }
89
90 /**
91 * Set up entity's faces
92 * @param faces faces
93 */
94 void setFaces(const vector<Face>& faces);
95
96 /**
97 * @return if texture coordinates are available for the whole entity
98 */
99 inline bool isTextureCoordinatesAvailable() const {
100 return textureCoordinatesAvailable == true && node->getTextureCoordinates().size() > 0;
101 }
102
103 /**
104 * @return if tangents and bitangents are available for the whole entity
105 */
106 inline bool isTangentBitangentAvailable() const {
107 return tangentBitangentAvailable == true && node->getTangents().size() > 0 && node->getBitangents().size() > 0;
108 }
109
110 /**
111 * @return LOD1 distance
112 */
113 inline float getLOD1Distance() const {
114 return lod1Distance;
115 }
116
117 /**
118 * Set LOD1 distance
119 * @param lod1Distance LOD1 distance
120 */
121 inline void setLOD1Distance(float lod1Distance) {
122 this->lod1Distance = lod1Distance;
123 }
124
125 /**
126 * @return LOD1 indices
127 */
128 inline const vector<int32_t>& getLOD1Indices() const {
129 return lod1Indices;
130 }
131
132 /**
133 * Set LOD1 indices
134 * @param lod1Indices lod1 indices
135 */
136 void setLOD1Indices(const vector<int32_t>& lod1Indices);
137
138 /**
139 * @return LOD2 distance
140 */
141 inline float getLOD2Distance() const {
142 return lod2Distance;
143 }
144
145 /**
146 * Set LOD2 distance
147 * @param lod2Distance LOD2 distance
148 */
149 inline void setLOD2Distance(float lod2Distance) {
150 this->lod2Distance = lod2Distance;
151 }
152
153 /**
154 * @return LOD2 indices
155 */
156 inline const vector<int32_t>& getLOD2Indices() const {
157 return lod2Indices;
158 }
159
160 /**
161 * Set LOD2 indices
162 * @param lod1Indices lod1 indices
163 */
164 void setLOD2Indices(const vector<int32_t>& lod2Indices);
165
166 /**
167 * @return LOD3 distance
168 */
169 inline float getLOD3Distance() const {
170 return lod3Distance;
171 }
172
173 /**
174 * Set LOD3 distance
175 * @param lod3Distance LOD1 distance
176 */
177 inline void setLOD3Distance(float lod3Distance) {
178 this->lod3Distance = lod3Distance;
179 }
180
181 /**
182 * @return LOD3 indices
183 */
184 inline const vector<int32_t>& getLOD3Indices() const {
185 return lod3Indices;
186 }
187
188 /**
189 * Set LOD3 indices
190 * @param lod3Indices lod3 indices
191 */
192 void setLOD3Indices(const vector<int32_t>& lod3Indices);
193
194};
Represents a model face, consisting of vertex, normal, tangent and bitangent vectors,...
Definition: Face.h:19
Node faces entity A node can have multiple entities containing faces and a applied material.
Definition: FacesEntity.h:28
FacesEntity()
Public constructor.
Definition: FacesEntity.cpp:23
void setMaterial(Material *material)
Set up the entity's material.
Definition: FacesEntity.h:72
void determineFeatures()
Determine features.
Definition: FacesEntity.cpp:58
const string & getId() const
Definition: FacesEntity.h:64
vector< int32_t > lod1Indices
Definition: FacesEntity.h:36
vector< int32_t > lod2Indices
Definition: FacesEntity.h:37
const vector< int32_t > & getLOD1Indices() const
Definition: FacesEntity.h:128
const vector< Face > & getFaces() const
Definition: FacesEntity.h:86
bool isTextureCoordinatesAvailable() const
Definition: FacesEntity.h:99
void setLOD1Distance(float lod1Distance)
Set LOD1 distance.
Definition: FacesEntity.h:121
vector< int32_t > lod3Indices
Definition: FacesEntity.h:38
const vector< int32_t > & getLOD3Indices() const
Definition: FacesEntity.h:184
void setLOD2Indices(const vector< int32_t > &lod2Indices)
Set LOD2 indices.
Definition: FacesEntity.cpp:80
const vector< int32_t > & getLOD2Indices() const
Definition: FacesEntity.h:156
const Material * getMaterial() const
Definition: FacesEntity.h:79
bool isTangentBitangentAvailable() const
Definition: FacesEntity.h:106
void setLOD2Distance(float lod2Distance)
Set LOD2 distance.
Definition: FacesEntity.h:149
void setLOD3Distance(float lod3Distance)
Set LOD3 distance.
Definition: FacesEntity.h:177
void setLOD1Indices(const vector< int32_t > &lod1Indices)
Set LOD1 indices.
Definition: FacesEntity.cpp:72
void setLOD3Indices(const vector< int32_t > &lod3Indices)
Set LOD3 indices.
Definition: FacesEntity.cpp:88
void setFaces(const vector< Face > &faces)
Set up entity's faces.
Definition: FacesEntity.cpp:47
Represents a material.
Definition: Material.h:21
Model node.
Definition: Node.h:31
const vector< Vector3 > & getTangents() const
Definition: Node.h:199
const vector< Vector3 > & getBitangents() const
Definition: Node.h:212
const vector< TextureCoordinate > & getTextureCoordinates() const
Definition: Node.h:186
Class representing texture UV coordinates data.
3D vector 3 class
Definition: Vector3.h:22