17 #ifndef _GAZEBO_MESH_HH_
18 #define _GAZEBO_MESH_HH_
23 #include <ignition/math/Vector3.hh>
24 #include <ignition/math/Vector2.hh>
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;
75 public: ignition::math::Vector3d Max()
const;
84 public: ignition::math::Vector3d Min()
const;
88 public:
unsigned int GetVertexCount()
const;
92 public:
unsigned int GetNormalCount()
const;
96 public:
unsigned int GetIndexCount()
const;
100 public:
unsigned int GetTexCoordCount()
const;
105 public:
void AddSubMesh(
SubMesh *_child);
109 public:
unsigned int GetSubMeshCount()
const;
114 public:
int AddMaterial(
Material *_mat);
118 public:
unsigned int GetMaterialCount()
const;
123 public:
const Material *GetMaterial(
int _index)
const;
128 public:
int GetMaterialIndex(
const Material *_mat)
const;
134 public:
const SubMesh *GetSubMesh(
unsigned int _i)
const;
139 public:
const SubMesh *GetSubMesh(
const std::string &_name)
const;
144 public:
void FillArrays(
float **_vertArr,
int **_indArr)
const;
148 public:
void RecalculateNormals();
164 public:
void GetAABB(ignition::math::Vector3d &_center,
165 ignition::math::Vector3d &_minXYZ,
166 ignition::math::Vector3d &_maxXYZ)
const;
173 public:
void GenSphericalTexCoord(
const math::Vector3 &_center)
179 public:
void GenSphericalTexCoord(
180 const ignition::math::Vector3d &_center);
184 public:
Skeleton* GetSkeleton()
const;
187 public:
void SetSkeleton(
Skeleton *_skel);
190 public:
bool HasSkeleton()
const;
194 public:
void Scale(
double _factor);
205 public:
void SetScale(
const ignition::math::Vector3d &_factor);
218 public:
void Center(
const ignition::math::Vector3d &_center =
219 ignition::math::Vector3d::Zero);
229 public:
void Translate(
const ignition::math::Vector3d &_vec);
232 private: std::string name;
235 private: std::string path;
238 private: std::vector<SubMesh *> submeshes;
241 private: std::vector<Material *> materials;
282 public:
void SetName(
const std::string &_n);
286 public: std::string GetName()
const;
290 public:
void SetPrimitiveType(PrimitiveType _type);
294 public: PrimitiveType GetPrimitiveType()
const;
300 public:
void CopyVertices(
const std::vector<math::Vector3> &_verts)
305 public:
void CopyVertices(
306 const std::vector<ignition::math::Vector3d> &_verts);
312 public:
void CopyNormals(
const std::vector<math::Vector3> &_norms)
317 public:
void CopyNormals(
318 const std::vector<ignition::math::Vector3d> &_norms);
322 public:
void SetVertexCount(
unsigned int _count);
326 public:
void SetIndexCount(
unsigned int _count);
330 public:
void SetNormalCount(
unsigned int _count);
334 public:
void SetTexCoordCount(
unsigned int _count);
338 public:
void AddIndex(
unsigned int _i);
348 public:
void AddVertex(
const ignition::math::Vector3d &_v);
354 public:
void AddVertex(
double _x,
double _y,
double _z);
364 public:
void AddNormal(
const ignition::math::Vector3d &_n);
370 public:
void AddNormal(
double _x,
double _y,
double _z);
375 public:
void AddTexCoord(
double _u,
double _v);
381 public:
void AddNodeAssignment(
unsigned int _vertex,
unsigned int _node,
395 public: ignition::math::Vector3d Vertex(
unsigned int _i)
const;
402 public:
void SetVertex(
unsigned int _i,
const math::Vector3 &_v)
408 public:
void SetVertex(
unsigned int _i,
409 const ignition::math::Vector3d &_v);
422 public: ignition::math::Vector3d Normal(
unsigned int _i)
const;
429 public:
void SetNormal(
unsigned int _i,
const math::Vector3 &_n)
435 public:
void SetNormal(
unsigned int _i,
436 const ignition::math::Vector3d &_n);
449 public: ignition::math::Vector2d TexCoord(
unsigned int _i)
const;
460 public:
void SetTexCoord(
unsigned int _i,
const math::Vector2d &_t)
466 public:
void SetTexCoord(
unsigned int _i,
467 const ignition::math::Vector2d &_t);
471 public:
unsigned int GetIndex(
unsigned int _i)
const;
480 public: ignition::math::Vector3d Max() const;
489 public: ignition::math::Vector3d Min() const;
492 public:
unsigned int GetVertexCount() const;
495 public:
unsigned int GetNormalCount() const;
498 public:
unsigned int GetIndexCount() const;
501 public:
unsigned int GetTexCoordCount() const;
504 public:
unsigned int GetNodeAssignmentsCount() const;
507 public:
unsigned int GetMaxIndex() const;
512 public:
void SetMaterialIndex(
unsigned int _index);
515 public:
unsigned int GetMaterialIndex() const;
522 public:
bool HasVertex(const math::Vector3 &_v) const
523 GAZEBO_DEPRECATED(6.0);
528 public:
bool HasVertex(const ignition::math::Vector3d &_v) const;
534 public:
unsigned int GetVertexIndex(const math::Vector3 &_v) const
535 GAZEBO_DEPRECATED(6.0);
540 public:
unsigned int GetVertexIndex(
541 const ignition::math::Vector3d &_v) const;
546 public:
void FillArrays(
float **_vertArr,
int **_indArr) const;
549 public:
void RecalculateNormals();
556 public:
void GenSphericalTexCoord(const math::Vector3 &_center)
557 GAZEBO_DEPRECATED(6.0);
562 public:
void GenSphericalTexCoord(
563 const ignition::math::Vector3d &_center);
567 public:
void Scale(
double _factor);
574 public:
void Center(const math::Vector3 &_center = math::Vector3::Zero)
575 GAZEBO_DEPRECATED(6.0);
580 public:
void Center(const ignition::math::Vector3d &_center =
581 ignition::math::Vector3d::Zero);
587 public:
void Translate(const math::Vector3 &_vec) GAZEBO_DEPRECATED(6.0);
591 public:
void Translate(const ignition::math::Vector3d &_vec);
597 public:
void SetScale(const math::Vector3 &_factor)
598 GAZEBO_DEPRECATED(6.0);
602 public:
void SetScale(const ignition::math::Vector3d &_factor);
605 private: std::vector<ignition::math::Vector3d> vertices;
608 private: std::vector<ignition::math::Vector3d> normals;
611 private: std::vector<ignition::math::Vector2d> texCoords;
614 private: std::vector<
unsigned int> indices;
620 private: PrimitiveType primitiveType;
624 private:
int materialIndex;
627 private: std::
string name;
A 3D mesh.
Definition: Mesh.hh:44
A skeleton.
Definition: Skeleton.hh:53
Encapsulates description of a material.
Definition: common/Material.hh:34
Generic double x, y vector.
Definition: Vector2d.hh:36
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:47
A child mesh.
Definition: Mesh.hh:265
unsigned int nodeIndex
node (or bone) index
Definition: Mesh.hh:258
#define GZ_COMMON_VISIBLE
Definition: system.hh:91
unsigned int vertexIndex
index of the vertex
Definition: Mesh.hh:255
PrimitiveType
An enumeration of the geometric mesh primitives.
Definition: Mesh.hh:268
Vertex to node weighted assignement for skeleton animation visualization.
Definition: Mesh.hh:249
static const Vector3 Zero
math::Vector3(0, 0, 0)
Definition: Vector3.hh:42
float weight
the weight (between 0 and 1)
Definition: Mesh.hh:261