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;
64 public:
const Mesh *Load(
const std::string &_filename);
72 public:
void Export(
const Mesh *_mesh,
const std::string &_filename,
73 const std::string &_extension,
bool _exportTextures =
false);
77 public:
bool IsValidFilename(
const std::string &_filename);
84 public:
void GetMeshAABB(
const Mesh *_mesh,
85 ignition::math::Vector3d &_center,
86 ignition::math::Vector3d &_min_xyz,
87 ignition::math::Vector3d &_max_xyz);
92 public:
void GenSphericalTexCoord(
const Mesh *_mesh,
93 const ignition::math::Vector3d &_center);
100 public:
void AddMesh(
Mesh *_mesh);
105 public:
const Mesh *GetMesh(
const std::string &_name)
const;
109 public:
bool HasMesh(
const std::string &_name)
const;
116 public:
void CreateSphere(
const std::string &_name,
float _radius,
117 int _rings,
int _segments);
123 public:
void CreateBox(
const std::string &_name,
124 const ignition::math::Vector3d &_sides,
125 const ignition::math::Vector2d &_uvCoords);
139 public:
void CreateExtrudedPolyline(
const std::string &_name,
140 const std::vector<std::vector<ignition::math::Vector2d> >
141 &_vertices,
double _height);
149 public:
void CreateCylinder(
const std::string &_name,
161 public:
void CreateCone(
const std::string &_name,
178 public:
void CreateTube(
const std::string &_name,
184 double _arc = 2.0 * M_PI);
191 public:
void CreatePlane(
const std::string &_name,
192 const ignition::math::Planed &_plane,
193 const ignition::math::Vector2d &_segments,
194 const ignition::math::Vector2d &_uvTile);
203 public:
void CreatePlane(
const std::string &_name,
204 const ignition::math::Vector3d &_normal,
206 const ignition::math::Vector2d &_size,
207 const ignition::math::Vector2d &_segments,
208 const ignition::math::Vector2d &_uvTile);
217 private:
void Tesselate2DMesh(
SubMesh *_sm,
225 public:
void CreateCamera(
const std::string &_name,
float _scale);
228 public:
void CreateBoolean(
const std::string &_name,
const Mesh *_m1,
235 const Mesh *_m2,
const int _operation,
236 const ignition::math::Pose3d &_offset = ignition::math::Pose3d::Zero);
246 private:
static void ConvertPolylinesToVerticesAndEdges(
247 const std::vector<std::vector<ignition::math::Vector2d> >
250 std::vector<ignition::math::Vector2d> &_vertices,
251 std::vector<ignition::math::Vector2i> &_edges);
260 private:
static size_t AddUniquePointToVerticesTable(
261 std::vector<ignition::math::Vector2d> &_vertices,
262 const ignition::math::Vector2d &_p,
275 private: std::map<std::string, Mesh*> meshes;
278 private: std::vector<std::string> fileExtensions;
280 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:51
Class used to export Collada mesh files.
Definition: ColladaExporter.hh:42
Class used to load STL mesh files.
Definition: STLLoader.hh:40