Class
List
Hierarchy
Modules
Common
Events
Math
Messages
Physics
Rendering
Sensors
Transport
Links
Gazebo Website
Wiki
Tutorials
Download
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
gazebo
common
MeshManager.hh
Go to the documentation of this file.
1
/*
2
* Copyright 2012 Nate Koenig
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 _MESHMANAGER_HH_
18
#define _MESHMANAGER_HH_
19
20
#include <map>
21
#include <string>
22
#include <vector>
23
#include <boost/thread/mutex.hpp>
24
25
#include "
math/Vector3.hh
"
26
#include "
math/Vector2d.hh
"
27
#include "
math/Plane.hh
"
28
#include "
common/SingletonT.hh
"
29
30
namespace
gazebo
31
{
32
namespace
common
33
{
34
class
ColladaLoader;
35
class
STLLoader;
36
class
Mesh;
37
class
Plane;
38
class
SubMesh;
39
42
45
class
MeshManager
:
public
SingletonT
<MeshManager>
46
{
48
private
:
MeshManager
();
49
53
private
:
virtual
~
MeshManager
();
54
58
public
:
const
Mesh
*
Load
(
const
std::string &_filename);
59
62
public
:
bool
IsValidFilename
(
const
std::string &_filename);
63
69
public
:
void
GetMeshAABB
(
const
Mesh
*_mesh,
70
math::Vector3
&_center,
71
math::Vector3
&_min_xyz,
72
math::Vector3
&_max_xyz);
73
75
public
:
void
GenSphericalTexCoord
(
const
Mesh
*_mesh,
76
math::Vector3
_center);
77
78
84
public
:
void
AddMesh
(
Mesh
*_mesh);
85
89
public
:
const
Mesh
*
GetMesh
(
const
std::string &_name)
const
;
90
93
public
:
bool
HasMesh
(
const
std::string &_name)
const
;
94
100
public
:
void
CreateSphere
(
const
std::string &_name,
float
_radius,
101
int
_rings,
int
_segments);
102
107
public
:
void
CreateBox
(
const
std::string &_name,
108
const
math::Vector3
&_sides,
109
const
math::Vector2d
&_uvCoords);
110
117
public
:
void
CreateCylinder
(
const
std::string &_name,
118
float
_radius,
119
float
_height,
120
int
_rings,
121
int
_segments);
122
129
public
:
void
CreateCone
(
const
std::string &_name,
130
float
_radius,
131
float
_height,
132
int
_rings,
133
int
_segments);
134
145
public
:
void
CreateTube
(
const
std::string &_name,
146
float
_innerRadius,
147
float
_outterRadius,
148
float
_height,
149
int
_rings,
150
int
_segments);
151
157
public
:
void
CreatePlane
(
const
std::string &_name,
158
const
math::Plane
&_plane,
159
const
math::Vector2d
&_segments,
160
const
math::Vector2d
&_uvTile);
161
169
public
:
void
CreatePlane
(
const
std::string &_name,
170
const
math::Vector3
&_normal,
171
double
_d,
172
const
math::Vector2d
&_size,
173
const
math::Vector2d
&_segments,
174
const
math::Vector2d
&_uvTile);
175
183
private
:
void
Tesselate2DMesh(
SubMesh
*_sm,
184
int
_meshWidth,
185
int
_meshHeight,
186
bool
_doubleSided);
187
191
public
:
void
CreateCamera
(
const
std::string &_name,
float
_scale);
192
194
private
:
ColladaLoader
*colladaLoader;
195
197
private
:
STLLoader
*stlLoader;
198
200
private
: std::map<std::string, Mesh*> meshes;
201
203
private
: std::vector<std::string> fileExtensions;
204
205
private
: boost::mutex mutex;
206
208
private
:
friend
class
SingletonT
<
MeshManager
>;
209
};
211
}
212
}
213
#endif
214
215