Gazebo Common
API Reference
6.0.1
insert_drive_file
Tutorials
library_books
Classes
toc
Namespaces
insert_drive_file
Files
launch
Gazebo Website
Index
List
Hierarchy
Members: All
Members: Functions
Members: Variables
Members: Typedefs
Members: Enumerations
Members: Enumerator
List
Members
Functions
Typedefs
Variables
Enumerations
Enumerator
src
gz-common
graphics
include
gz
common
SubMesh.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 GZ_COMMON_SUBMESH_HH_
18
#define GZ_COMMON_SUBMESH_HH_
19
20
#include <memory>
21
#include <optional>
22
#include <string>
23
24
#include <
gz/math/Vector3.hh
>
25
#include <
gz/math/Vector2.hh
>
26
27
#include <gz/utils/ImplPtr.hh>
28
29
#include <
gz/common/graphics/Types.hh
>
30
#include <gz/common/graphics/Export.hh>
31
32
namespace
gz
33
{
34
namespace
common
35
{
36
class
Material;
37
class
NodeAssignment;
38
40
class
GZ_COMMON_GRAPHICS_VISIBLE
SubMesh
41
{
43
public
:
enum
PrimitiveType
44
{
46
POINTS
,
48
LINES
,
51
LINESTRIPS
,
53
TRIANGLES
,
57
TRIFANS
,
61
TRISTRIPS
62
};
63
65
public
:
SubMesh
();
66
69
public
:
explicit
SubMesh
(
const
std::string
&_name);
70
72
public
:
virtual
~SubMesh
();
73
76
public
:
void
SetName
(
const
std::string
&_name);
77
80
public
:
std::string
Name
()
const
;
81
84
public
:
void
SetPrimitiveType
(
PrimitiveType
_type);
85
88
public
:
PrimitiveType
SubMeshPrimitiveType
()
const
;
89
92
public
:
void
AddIndex
(
const
unsigned
int
_index);
93
96
public
:
void
AddVertex
(
const
gz::math::Vector3d
&_v);
97
102
public
:
void
AddVertex
(
const
double
_x,
const
double
_y,
const
double
_z);
103
106
public
:
void
AddNormal
(
const
gz::math::Vector3d
&_n);
107
112
public
:
void
AddNormal
(
const
double
_x,
const
double
_y,
const
double
_z);
113
121
public
:
void
AddTexCoord
(
const
double
_u,
const
double
_v);
122
129
public
:
void
AddTexCoord
(
const
gz::math::Vector2d
&_uv);
130
135
public
:
void
AddTexCoordBySet
(
double
_u,
double
_v,
136
unsigned
int
_setIndex);
137
142
public
:
void
AddTexCoordBySet
(
const
gz::math::Vector2d
&_uv,
143
unsigned
int
_setIndex);
144
149
public
:
void
AddNodeAssignment
(
const
unsigned
int
_vertex,
150
const
unsigned
int
_node,
151
const
float
_weight);
157
public
:
gz::math::Vector3d
Vertex
(
const
unsigned
int
_index)
const
;
158
163
public
:
const
gz::math::Vector3d
*
VertexPtr
()
const
;
164
168
public
:
void
SetVertex
(
const
unsigned
int
_index,
169
const
gz::math::Vector3d
&_v);
170
176
public
:
gz::math::Vector3d
Normal
(
const
unsigned
int
_index)
const
;
177
181
public
:
void
SetNormal
(
const
unsigned
int
_index,
182
const
gz::math::Vector3d
&_n);
183
189
public
:
gz::math::Vector2d
TexCoord
(
190
const
unsigned
int
_index)
const
;
191
199
public
:
gz::math::Vector2d
TexCoordBySet
(
200
unsigned
int
_index,
201
unsigned
int
_setIndex)
const
;
202
209
public
:
void
SetTexCoord
(
const
unsigned
int
_index,
210
const
gz::math::Vector2d
&_uv);
211
216
public
:
void
SetTexCoordBySet
(
unsigned
int
_index,
217
const
gz::math::Vector2d
&_uv,
218
unsigned
int
_setIdex);
219
223
public
:
int
Index
(
const
unsigned
int
_index)
const
;
224
229
public
:
const
unsigned
int
*
IndexPtr
()
const
;
230
234
public
:
void
SetIndex
(
const
unsigned
int
_index,
235
const
unsigned
int
_i);
236
243
public
:
NodeAssignment
NodeAssignmentByIndex
(
244
const
unsigned
int
_index)
const
;
245
248
public
:
gz::math::Vector3d
Max
()
const
;
249
252
public
:
gz::math::Vector3d
Min
()
const
;
253
256
public
:
unsigned
int
VertexCount
()
const
;
257
260
public
:
unsigned
int
NormalCount
()
const
;
261
264
public
:
unsigned
int
IndexCount
()
const
;
265
273
public
:
unsigned
int
TexCoordCount
()
const
;
274
279
public
:
unsigned
int
TexCoordCountBySet
(
unsigned
int
_setIndex)
const
;
280
283
public
:
unsigned
int
TexCoordSetCount
()
const
;
284
287
public
:
unsigned
int
NodeAssignmentsCount
()
const
;
288
291
public
:
unsigned
int
MaxIndex
()
const
;
292
296
public
:
void
SetMaterialIndex
(
const
unsigned
int
_index);
297
301
public
: std::optional<unsigned int>
GetMaterialIndex
()
const
;
302
306
public
:
bool
HasVertex
(
const
gz::math::Vector3d
&_v)
const
;
307
313
public
:
bool
HasVertex
(
const
unsigned
int
_index)
const
;
314
320
public
:
bool
HasNormal
(
const
unsigned
int
_index)
const
;
321
332
public
:
bool
HasTexCoord
(
const
unsigned
int
_index)
const
;
333
340
public
:
bool
HasTexCoordBySet
(
unsigned
int
_index,
unsigned
int
_setIndex)
341
const
;
342
348
public
:
bool
HasNodeAssignment
(
const
unsigned
int
_index)
const
;
349
353
public
:
int
IndexOfVertex
(
const
gz::math::Vector3d
&_v)
const
;
354
358
public
:
void
FillArrays
(
double
**_vertArr,
int
**_indexndArr)
const
;
359
361
public
:
void
RecalculateNormals
();
362
366
public
:
void
GenSphericalTexCoord
(
367
const
gz::math::Vector3d
&_center);
368
373
public
:
void
GenSphericalTexCoordBySet
(
374
const
gz::math::Vector3d
&_center,
375
unsigned
int
_setIndex);
376
379
public
:
void
Scale
(
const
gz::math::Vector3d
&_factor);
380
383
public
:
void
Scale
(
const
double
&_factor);
384
388
public
:
void
Center
(
const
gz::math::Vector3d
&_center =
389
gz::math::Vector3d::Zero
);
390
393
public
:
void
Translate
(
const
gz::math::Vector3d
&_vec);
394
406
public
:
double
Volume
()
const
;
407
409
GZ_UTILS_IMPL_PTR(dataPtr)
410
};
411
414
class
GZ_COMMON_GRAPHICS_VISIBLE
NodeAssignment
415
{
417
public
:
NodeAssignment
();
418
420
public
:
unsigned
int
vertexIndex
;
421
423
public
:
unsigned
int
nodeIndex
;
424
427
public
:
float
weight
;
428
};
429
}
430
}
431
432
#endif