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>
45 class ColladaExporter;
69 public:
const Mesh *Load(
const std::string &_filename);
77 public:
void Export(
const Mesh *_mesh,
const std::string &_filename,
78 const std::string &_extension,
bool _exportTextures =
false);
82 public:
bool IsValidFilename(
const std::string &_filename);
89 public:
void GetMeshAABB(
const Mesh *_mesh,
90 ignition::math::Vector3d &_center,
91 ignition::math::Vector3d &_min_xyz,
92 ignition::math::Vector3d &_max_xyz);
97 public:
void GenSphericalTexCoord(
const Mesh *_mesh,
98 const ignition::math::Vector3d &_center);
105 public:
void AddMesh(
Mesh *_mesh);
110 public:
const Mesh *GetMesh(
const std::string &_name)
const;
114 public:
bool HasMesh(
const std::string &_name)
const;
121 public:
void CreateSphere(
const std::string &_name,
float _radius,
122 int _rings,
int _segments);
128 public:
void CreateBox(
const std::string &_name,
129 const ignition::math::Vector3d &_sides,
130 const ignition::math::Vector2d &_uvCoords);
144 public:
void CreateExtrudedPolyline(
const std::string &_name,
145 const std::vector<std::vector<ignition::math::Vector2d> >
146 &_vertices,
double _height);
154 public:
void CreateCylinder(
const std::string &_name,
166 public:
void CreateCone(
const std::string &_name,
183 public:
void CreateTube(
const std::string &_name,
189 double _arc = 2.0 * M_PI);
196 public:
void CreatePlane(
const std::string &_name,
197 const ignition::math::Planed &_plane,
198 const ignition::math::Vector2d &_segments,
199 const ignition::math::Vector2d &_uvTile);
208 public:
void CreatePlane(
const std::string &_name,
209 const ignition::math::Vector3d &_normal,
211 const ignition::math::Vector2d &_size,
212 const ignition::math::Vector2d &_segments,
213 const ignition::math::Vector2d &_uvTile);
222 private:
void Tesselate2DMesh(
SubMesh *_sm,
230 public:
void CreateCamera(
const std::string &_name,
float _scale);
233 public:
void CreateBoolean(
const std::string &_name,
const Mesh *_m1,
240 const Mesh *_m2,
const int _operation,
241 const ignition::math::Pose3d &_offset = ignition::math::Pose3d::Zero);
251 private:
static void ConvertPolylinesToVerticesAndEdges(
252 const std::vector<std::vector<ignition::math::Vector2d> >
255 std::vector<ignition::math::Vector2d> &_vertices,
256 std::vector<ignition::math::Vector2i> &_edges);
265 private:
static size_t AddUniquePointToVerticesTable(
266 std::vector<ignition::math::Vector2d> &_vertices,
267 const ignition::math::Vector2d &_p,
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:44
Singleton template class.
Definition: SingletonT.hh:33
A child mesh.
Definition: Mesh.hh:216
#define GZ_COMMON_VISIBLE
Definition: system.hh:84
Class used to load Collada mesh files.
Definition: ColladaLoader.hh:46
Maintains and manages all meshes.
Definition: MeshManager.hh:56
Class used to export Collada mesh files.
Definition: ColladaExporter.hh:42
Class used to load STL mesh files.
Definition: STLLoader.hh:40