Pathfinder
MeshAccessor.h
Go to the documentation of this file.
1 
10 #ifndef MESHACCESSOR_H
11 #define MESHACCESSOR_H
12 
13 #include <cstdint>
14 
15 #include <Rendering/Mesh/Mesh.h>
16 #include <Rendering/Mesh/MeshIndexData.h>
17 #include <Rendering/Mesh/VertexAttributeAccessors.h>
18 #include <Rendering/MeshUtils/ConnectivityAccessor.h>
19 #include <Rendering/MeshUtils/TriangleAccessor.h>
20 
21 #include "AABB.h"
22 
23 namespace Pathfinder {
24 
29  class MeshAccessor {
30 
31  private:
32 
37  MinSG::GeometryNode* geoNodePtr;
38 
39 
43  Rendering::Mesh* meshPtr;
44 
45 
50  Rendering::MeshVertexData& meshVertexData;
51 
52 
57  Rendering::MeshIndexData& meshIndexData;
58 
59 
63  Geometry::Matrix4x4 worldTransformationMatrix;
64 
65 
70  Util::Reference<Rendering::MeshUtils::ConnectivityAccessor>
72 
73 
78  Util::Reference<Rendering::MeshUtils::TriangleAccessor>
80 
81 
86 
87 
91  std::vector<Polygon*> polygons;
92 
93 
102  bool
103  triIdValid(
104  const uint32_t& id
105  );
106 
107 
116  bool
118  const uint32_t& id
119  );
120 
121 
131  Polygon*
133  const uint32_t& id
134  );
135 
136 
137  public:
138 
144  MeshAccessor(
145  MinSG::GeometryNode* geoNodePtr
146  );
147 
148 
152  void
154  );
155 
156 
166  Polygon*
168  const uint32_t& id
169  );
170 
171 
182  Geometry::Vec3
183  getVertex(
184  const uint32_t& id
185  );
186 
187 
197  std::vector<uint32_t>
199  const uint32_t& id
200  );
201 
202 
208  AABB
209  getAABB(
210  );
211 
212 
218  uint32_t
220  );
221 
222 
228  uint32_t
230  );
231 
232 
239  MinSG::GeometryNode*
241  ) const;
242 
243  };
244 
245 
256  bool
257  operator==(
258  const MeshAccessor& l,
259  const MeshAccessor& r
260  );
261 
262 }
263 
264 #endif
Util::Reference< Rendering::MeshUtils::ConnectivityAccessor > connectivityAccessorRef
A reference to the ConnectivityAccessor which enables access to the connectivity between vertices...
Definition: MeshAccessor.h:71
Rendering::MeshVertexData & meshVertexData
The VertexData which holds information about the vertices of the mesh.
Definition: MeshAccessor.h:50
Rendering::Mesh * meshPtr
A pointer to the managed mesh.
Definition: MeshAccessor.h:43
Definition: AABB.cpp:21
A struct that represents a single polygon.
Definition: Polygon.h:21
This file declares the AABB struct that models an axis aligned bounding box.
This class is used to simplify the accessing of meshes, their vertices and polygons.
Definition: MeshAccessor.h:29
AABB getAABB()
Return the aabb member variable.
Definition: MeshAccessor.cpp:143
Polygon * newPolygonPtr(const uint32_t &id)
For a given Id, create a new Polygon object for the corresponding polygon in the managed mesh...
Definition: MeshAccessor.cpp:34
bool operator==(const MeshAccessor &l, const MeshAccessor &r)
Overload operator==.
Definition: MeshAccessor.cpp:163
uint32_t getVertexCount()
Return the number of vertices in the managed mesh.
Definition: MeshAccessor.cpp:148
Geometry::Matrix4x4 worldTransformationMatrix
The matrix to convert local to world coordinates.
Definition: MeshAccessor.h:63
Util::Reference< Rendering::MeshUtils::TriangleAccessor > triAccessorRef
A reference to the triangle accessor which enables polygon access.
Definition: MeshAccessor.h:79
Polygon * getPolygonPtr(const uint32_t &id)
For a given Id, return the corresponding polygon in world coordinates.
Definition: MeshAccessor.cpp:113
MinSG::GeometryNode * getGeoNodePtr() const
Return the pointer stored in the member variable geoNodePtr.
Definition: MeshAccessor.cpp:158
AABB aabb
The AABB of the managed mesh.
Definition: MeshAccessor.h:85
MeshAccessor(MinSG::GeometryNode *geoNodePtr)
A constructor which initializes all member variables.
Definition: MeshAccessor.cpp:53
bool vertexIdValid(const uint32_t &id)
For a given Id, decide if this Id is a valid Id for accessing a vertex of this mesh.
Definition: MeshAccessor.cpp:29
bool triIdValid(const uint32_t &id)
For a given Id, decide if this Id is a valid Id for accessing a polygon of this mesh.
Definition: MeshAccessor.cpp:24
Rendering::MeshIndexData & meshIndexData
The IndexData which holds information about the indices of the vertices of the mesh.
Definition: MeshAccessor.h:57
void deletePolygons()
Delete all allocated polygon objects.
Definition: MeshAccessor.cpp:102
std::vector< uint32_t > getAdjacentVertexIds(const uint32_t &id)
Return a list containing all ids of vertices adjacent to the vertex id.
Definition: MeshAccessor.cpp:132
std::vector< Polygon * > polygons
A list of pointers to Polygon objects.
Definition: MeshAccessor.h:91
Geometry::Vec3 getVertex(const uint32_t &id)
Return the positon of the vertex corresponding to the given Id.
Definition: MeshAccessor.cpp:122
uint32_t getIndexCount()
Return the number of indices in the managed mesh.
Definition: MeshAccessor.cpp:153
This struct models an AABB.
Definition: AABB.h:22
MinSG::GeometryNode * geoNodePtr
A pointer to the GeometryNode which holds the mesh that is to be managed.
Definition: MeshAccessor.h:37