Gazebo Common

API Reference

5.6.0
gz/common/Mesh.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef GZ_COMMON_MESH_HH_
18 #define GZ_COMMON_MESH_HH_
19 
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
24 #include <gz/math/Vector3.hh>
25 #include <gz/math/Vector2.hh>
26 
27 #include <gz/utils/ImplPtr.hh>
28 
30 #include <gz/common/graphics/Export.hh>
31 
32 namespace gz
33 {
34  namespace common
35  {
36  class Material;
37  class Skeleton;
38 
41  class GZ_COMMON_GRAPHICS_VISIBLE Mesh
42  {
44  public: Mesh();
45 
47  public: virtual ~Mesh();
48 
51  public: void SetPath(const std::string &_path);
52 
55  public: std::string Path() const;
56 
59  public: void SetName(const std::string &_name);
60 
63  public: std::string Name() const;
64 
67  public: gz::math::Vector3d Max() const;
68 
71  public: gz::math::Vector3d Min() const;
72 
75  public: unsigned int VertexCount() const;
76 
79  public: unsigned int NormalCount() const;
80 
83  public: unsigned int IndexCount() const;
84 
87  public: unsigned int TexCoordCount() const;
88 
94  public: std::weak_ptr<SubMesh> AddSubMesh(const SubMesh &_child);
95 
101  std::unique_ptr<SubMesh> _child);
102 
105  public: unsigned int SubMeshCount() const;
106 
110  public: int AddMaterial(const MaterialPtr &_mat);
111 
114  public: unsigned int MaterialCount() const;
115 
119  public: MaterialPtr MaterialByIndex(const unsigned int _index) const;
120 
125  public: int IndexOfMaterial(const Material *_mat) const;
126 
131  const unsigned int _index) const;
132 
137  const std::string &_name) const;
138 
142  public: void FillArrays(double **_vertArr, int **_indArr) const;
143 
146  public: void RecalculateNormals();
147 
152  public: void AABB(gz::math::Vector3d &_center,
153  gz::math::Vector3d &_minXYZ,
154  gz::math::Vector3d &_maxXYZ) const;
155 
159  public: void GenSphericalTexCoord(
160  const gz::math::Vector3d &_center);
161 
164  public: SkeletonPtr MeshSkeleton() const;
165 
168  public: void SetSkeleton(const SkeletonPtr &_skel);
169 
172  public: bool HasSkeleton() const;
173 
176  public: void Scale(const gz::math::Vector3d &_factor);
177 
180  public: void SetScale(const gz::math::Vector3d &_factor);
181 
185  public: void Center(const gz::math::Vector3d &_center =
187 
190  public: void Translate(const gz::math::Vector3d &_vec);
191 
204  public: double Volume() const;
205 
207  GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
208  };
209  }
210 }
211 
212 #endif