Ignition Common

API Reference

3.5.0
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 IGNITION_COMMON_MESH_HH_
18 #define IGNITION_COMMON_MESH_HH_
19 
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
24 #include <ignition/math/Vector3.hh>
25 #include <ignition/math/Vector2.hh>
26 
28 #include <ignition/common/graphics/Export.hh>
30 
31 namespace ignition
32 {
33  namespace common
34  {
35  class Material;
36  class Skeleton;
37  class MeshPrivate;
38 
41  class IGNITION_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: ignition::math::Vector3d Max() const;
68 
71  public: ignition::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 
100  public: std::weak_ptr<SubMesh> AddSubMesh(
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 
130  public: std::weak_ptr<SubMesh> SubMeshByIndex(
131  const unsigned int _index) const;
132 
136  public: std::weak_ptr<SubMesh> SubMeshByName(
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(ignition::math::Vector3d &_center,
153  ignition::math::Vector3d &_minXYZ,
154  ignition::math::Vector3d &_maxXYZ) const;
155 
159  public: void GenSphericalTexCoord(
160  const ignition::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 ignition::math::Vector3d &_factor);
177 
180  public: void SetScale(const ignition::math::Vector3d &_factor);
181 
185  public: void Center(const ignition::math::Vector3d &_center =
187 
190  public: void Translate(const ignition::math::Vector3d &_vec);
191 
204  public: double Volume() const;
205 
208  private: std::unique_ptr<MeshPrivate> dataPtr;
210  };
211  }
212 }
213 
214 #endif
#define IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
Definition: SuppressWarning.hh:67
STL class.
Encapsulates description of a material.
Definition: Material.hh:38
A child mesh.
Definition: SubMesh.hh:40
STL class.
STL class.
static const Vector3 Zero
Forward declarations for the common classes.
#define IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
Microsoft Visual Studio does not automatically export the interface information for member variables ...
Definition: SuppressWarning.hh:64
A 3D mesh.
Definition: Mesh.hh:41