17 #ifndef _GAZEBO_MESHMANAGER_HH_
18 #define _GAZEBO_MESHMANAGER_HH_
24 #include <boost/thread/mutex.hpp>
26 #include <ignition/math/Plane.hh>
27 #include <ignition/math/Matrix3.hh>
28 #include <ignition/math/Matrix4.hh>
29 #include <ignition/math/Vector2.hh>
40 class ColladaExporter;
65 public:
const Mesh *Load(
const std::string &_filename);
73 public:
void Export(
const Mesh *_mesh,
const std::string &_filename,
74 const std::string &_extension,
bool _exportTextures =
false);
78 public:
bool IsValidFilename(
const std::string &_filename);
85 public:
void GetMeshAABB(
const Mesh *_mesh,
86 ignition::math::Vector3d &_center,
87 ignition::math::Vector3d &_min_xyz,
88 ignition::math::Vector3d &_max_xyz);
93 public:
void GenSphericalTexCoord(
const Mesh *_mesh,
94 const ignition::math::Vector3d &_center);
101 public:
void AddMesh(
Mesh *_mesh);
106 public:
const Mesh *GetMesh(
const std::string &_name)
const;
110 public:
bool HasMesh(
const std::string &_name)
const;
117 public:
void CreateSphere(
const std::string &_name,
float _radius,
118 int _rings,
int _segments);
124 public:
void CreateBox(
const std::string &_name,
125 const ignition::math::Vector3d &_sides,
126 const ignition::math::Vector2d &_uvCoords);
140 public:
void CreateExtrudedPolyline(
const std::string &_name,
141 const std::vector<std::vector<ignition::math::Vector2d> >
142 &_vertices,
double _height);
150 public:
void CreateCylinder(
const std::string &_name,
162 public:
void CreateCone(
const std::string &_name,
179 public:
void CreateTube(
const std::string &_name,
185 double _arc = 2.0 * M_PI);
192 public:
void CreatePlane(
const std::string &_name,
193 const ignition::math::Planed &_plane,
194 const ignition::math::Vector2d &_segments,
195 const ignition::math::Vector2d &_uvTile);
204 public:
void CreatePlane(
const std::string &_name,
205 const ignition::math::Vector3d &_normal,
207 const ignition::math::Vector2d &_size,
208 const ignition::math::Vector2d &_segments,
209 const ignition::math::Vector2d &_uvTile);
218 private:
void Tesselate2DMesh(
SubMesh *_sm,
226 public:
void CreateCamera(
const std::string &_name,
float _scale);
229 public:
void CreateBoolean(
const std::string &_name,
const Mesh *_m1,
236 const Mesh *_m2,
const int _operation,
237 const ignition::math::Pose3d &_offset = ignition::math::Pose3d::Zero);
247 private:
static void ConvertPolylinesToVerticesAndEdges(
248 const std::vector<std::vector<ignition::math::Vector2d> >
251 std::vector<ignition::math::Vector2d> &_vertices,
252 std::vector<ignition::math::Vector2i> &_edges);
261 private:
static size_t AddUniquePointToVerticesTable(
262 std::vector<ignition::math::Vector2d> &_vertices,
263 const ignition::math::Vector2d &_p,
277 private: FBXLoader *fbxLoader =
nullptr;
280 private: std::map<std::string, Mesh*> meshes;
283 private: std::vector<std::string> fileExtensions;
285 private: boost::mutex mutex;
A 3D mesh.
Definition: Mesh.hh:42
Singleton template class.
Definition: SingletonT.hh:33
A child mesh.
Definition: Mesh.hh:214
Class used to load Collada mesh files.
Definition: ColladaLoader.hh:46
Maintains and manages all meshes.
Definition: MeshManager.hh:52
Class used to export Collada mesh files.
Definition: ColladaExporter.hh:42
Class used to load STL mesh files.
Definition: STLLoader.hh:40