17 #ifndef _GAZEBO_MESH_HH_ 18 #define _GAZEBO_MESH_HH_ 23 #include <ignition/math/Vector3.hh> 24 #include <ignition/math/Vector2.hh> 44 class GZ_COMMON_VISIBLE
Mesh 50 public:
virtual ~
Mesh();
54 public:
void SetPath(
const std::string &_path);
58 public: std::string GetPath()
const;
62 public:
void SetName(
const std::string &_n);
66 public: std::string GetName()
const;
70 public: ignition::math::Vector3d Max()
const;
74 public: ignition::math::Vector3d Min()
const;
78 public:
unsigned int GetVertexCount()
const;
82 public:
unsigned int GetNormalCount()
const;
86 public:
unsigned int GetIndexCount()
const;
90 public:
unsigned int GetTexCoordCount()
const;
95 public:
void AddSubMesh(
SubMesh *_child);
99 public:
unsigned int GetSubMeshCount()
const;
104 public:
int AddMaterial(
Material *_mat);
108 public:
unsigned int GetMaterialCount()
const;
113 public:
const Material *GetMaterial(
int _index)
const;
118 public:
int GetMaterialIndex(
const Material *_mat)
const;
124 public:
const SubMesh *GetSubMesh(
unsigned int _i)
const;
129 public:
const SubMesh *GetSubMesh(
const std::string &_name)
const;
134 public:
void FillArrays(
float **_vertArr,
int **_indArr)
const;
138 public:
void RecalculateNormals();
144 public:
void GetAABB(ignition::math::Vector3d &_center,
145 ignition::math::Vector3d &_minXYZ,
146 ignition::math::Vector3d &_maxXYZ)
const;
151 public:
void GenSphericalTexCoord(
152 const ignition::math::Vector3d &_center);
156 public:
Skeleton* GetSkeleton()
const;
159 public:
void SetSkeleton(
Skeleton *_skel);
162 public:
bool HasSkeleton()
const;
166 public:
void Scale(
double _factor);
170 public:
void SetScale(
const ignition::math::Vector3d &_factor);
175 public:
void Center(
const ignition::math::Vector3d &_center =
176 ignition::math::Vector3d::Zero);
180 public:
void Translate(
const ignition::math::Vector3d &_vec);
183 private: std::string name;
186 private: std::string path;
189 private: std::vector<SubMesh *> submeshes;
192 private: std::vector<Material *> materials;
233 public:
void SetName(
const std::string &_n);
237 public: std::string GetName()
const;
249 public:
void CopyVertices(
250 const std::vector<ignition::math::Vector3d> &_verts);
254 public:
void CopyNormals(
255 const std::vector<ignition::math::Vector3d> &_norms);
259 public:
void SetVertexCount(
unsigned int _count);
263 public:
void SetIndexCount(
unsigned int _count);
267 public:
void SetNormalCount(
unsigned int _count);
271 public:
void SetTexCoordCount(
unsigned int _count);
275 public:
void AddIndex(
unsigned int _i);
279 public:
void AddVertex(
const ignition::math::Vector3d &_v);
285 public:
void AddVertex(
double _x,
double _y,
double _z);
289 public:
void AddNormal(
const ignition::math::Vector3d &_n);
295 public:
void AddNormal(
double _x,
double _y,
double _z);
300 public:
void AddTexCoord(
double _u,
double _v);
306 public:
void AddNodeAssignment(
unsigned int _vertex,
unsigned int _node,
312 public: ignition::math::Vector3d Vertex(
unsigned int _i)
const;
317 public:
void SetVertex(
unsigned int _i,
318 const ignition::math::Vector3d &_v);
323 public: ignition::math::Vector3d Normal(
unsigned int _i)
const;
328 public:
void SetNormal(
unsigned int _i,
329 const ignition::math::Vector3d &_n);
334 public: ignition::math::Vector2d TexCoord(
unsigned int _i)
const;
343 public:
void SetTexCoord(
unsigned int _i,
344 const ignition::math::Vector2d &_t);
348 public:
unsigned int GetIndex(
unsigned int _i)
const;
352 public: ignition::math::Vector3d Max()
const;
356 public: ignition::math::Vector3d Min()
const;
359 public:
unsigned int GetVertexCount()
const;
362 public:
unsigned int GetNormalCount()
const;
365 public:
unsigned int GetIndexCount()
const;
368 public:
unsigned int GetTexCoordCount()
const;
371 public:
unsigned int GetNodeAssignmentsCount()
const;
374 public:
unsigned int GetMaxIndex()
const;
379 public:
void SetMaterialIndex(
unsigned int _index);
382 public:
unsigned int GetMaterialIndex()
const;
387 public:
bool HasVertex(
const ignition::math::Vector3d &_v)
const;
392 public:
unsigned int GetVertexIndex(
393 const ignition::math::Vector3d &_v)
const;
398 public:
void FillArrays(
float **_vertArr,
int **_indArr)
const;
401 public:
void RecalculateNormals();
406 public:
void GenSphericalTexCoord(
407 const ignition::math::Vector3d &_center);
411 public:
void Scale(
double _factor);
416 public:
void Center(
const ignition::math::Vector3d &_center =
417 ignition::math::Vector3d::Zero);
421 public:
void Translate(
const ignition::math::Vector3d &_vec);
425 public:
void SetScale(
const ignition::math::Vector3d &_factor);
428 private: std::vector<ignition::math::Vector3d> vertices;
431 private: std::vector<ignition::math::Vector3d> normals;
434 private: std::vector<ignition::math::Vector2d> texCoords;
437 private: std::vector<unsigned int> indices;
440 private: std::vector<NodeAssignment> nodeAssignments;
447 private:
int materialIndex;
450 private: std::string name;
A 3D mesh.
Definition: Mesh.hh:44
PrimitiveType
An enumeration of the geometric mesh primitives.
Definition: Mesh.hh:219
A skeleton.
Definition: Skeleton.hh:53
Encapsulates description of a material.
Definition: common/Material.hh:34
Forward declarations for the common classes.
Definition: Animation.hh:33
A child mesh.
Definition: Mesh.hh:216
float weight
the weight (between 0 and 1)
Definition: Mesh.hh:212
unsigned int nodeIndex
node (or bone) index
Definition: Mesh.hh:209
Vertex to node weighted assignement for skeleton animation visualization.
Definition: Mesh.hh:200
unsigned int vertexIndex
index of the vertex
Definition: Mesh.hh:206