![]() |
RobWorkProject
24.12.4-
|
A concrete 3d object consisting of geometry information, material and texture. More...
#include <Object3D.hpp>
Inherits Object3DGeneric.
Public Types | |
typedef rw::core::Ptr< Object3D > | Ptr |
Smart pointer type for Object3D. | |
![]() | |
typedef rw::core::Ptr< Object3DGeneric > | Ptr |
Smart pointer type for Object3DGeneric. | |
![]() | |
typedef rw::core::Ptr< TriMesh > | Ptr |
smart pointer type to this class | |
![]() | |
enum | GeometryType { PointCloud , LineMesh , PlainTriMesh , IdxTriMesh , SpherePrim , BoxPrim , OBBPrim , AABBPrim , LinePrim , PointPrim , PyramidPrim , ConePrim , TrianglePrim , CylinderPrim , TubePrim , PlanePrim , RayPrim , Implicit , Quadratic , UserType } |
geometry data types | |
typedef rw::core::Ptr< GeometryData > | Ptr |
smart pointer type to this class | |
typedef rw::core::Ptr< const GeometryData > | CPtr |
const smart pointer type to this class | |
Public Member Functions | |
Object3D (const std::string &name) | |
constructor More... | |
virtual | ~Object3D () |
destructor | |
virtual std::size_t | countFaces () const |
Get the number of faces. More... | |
virtual std::vector< rw::math::Vector3D< float > > | getFaceVertices (size_t idx) const |
Returns vertices corresponding to the idx face. More... | |
virtual rw::geometry::Triangle< double > | getTriangle (size_t idx) const |
gets the triangle at index idx. More... | |
void | addTriangle (const rw::geometry::IndexedTriangle< T > &tri) |
add triangle using currently selected material | |
void | addTriangles (const std::vector< rw::geometry::IndexedTriangle< T >> &tris) |
add triangles using currently selected material | |
void | addTriangles (T material, const std::vector< rw::geometry::IndexedTriangle< T >> &tris) |
add triangles to this object using a specific material in the Model3D More... | |
void | scale (double scale) |
Scales the model by scale. More... | |
virtual size_t | getSize () const |
gets the number of triangles in the triangle array. | |
virtual size_t | size () const |
gets the number of triangles in the triangle array. | |
virtual rw::core::Ptr< TriMesh > | clone () const |
make a clone of this triangle mesh More... | |
virtual Object3DGeneric::Ptr | copy () const |
make a clone of this triangle mesh More... | |
![]() | |
virtual | ~Object3DGeneric () |
destructor | |
bool | hasTexture () const |
test if the object is textured | |
void | setMaterial (std::size_t material) |
set the material used by addTriangles More... | |
virtual void | getTriangle (size_t idx, rw::geometry::Triangle< double > &dst) const |
gets the triangle at index idx. More... | |
virtual void | getTriangle (size_t idx, rw::geometry::Triangle< float > &dst) const |
gets the triangle at index idx. Using Floating point presicion More... | |
virtual GeometryType | getType () const |
the type of this primitive | |
![]() | |
virtual | ~TriMesh () |
destructor | |
rw::core::Ptr< TriMesh > | getTriMesh (bool forceCopy=true) |
gets a trimesh representation of this geometry data. More... | |
rw::core::Ptr< const TriMesh > | getTriMesh (bool forceCopy=true) const |
gets a trimesh representation of this geometry data. More... | |
virtual bool | isConvex () |
test if this geometry data is convex More... | |
void | setConvexEnabled (bool isConvex) |
double | getVolume () const |
calculate a volume of this triangle mesh | |
![]() | |
virtual | ~GeometryData () |
Destructor. | |
Public Attributes | |
std::vector< rw::geometry::IndexedTriangle< T > > | _faces |
list containing indexed polygons. The polygons index into the _vertices array and the _normals array The normal is implicitly indexed and defined as same index as the vertex. | |
std::vector< rw::geometry::IndexedPolygonN< T > > | _polys |
list containing indexed polygons. The polygons index into the _vertices array and the _normals array The normal is implicitly indexed and defined as same index as the vertex. | |
![]() | |
std::string | _name |
name/id of object | |
int | _parentObj |
index of parent object | |
bool | _hasTexture |
true if any of the materials used has texture | |
std::vector< rw::math::Vector3D< float > > | _vertices |
Vertice array. | |
std::vector< rw::math::Vector3D< float > > | _normals |
Normal array, there must be exactly one normal per vertex. | |
std::vector< rw::math::Vector2D< float > > | _texCoords |
Texture coordinate array, the texture coordinates can be mapped to either vertices or faces. The reason for this is that often vertices share two or more texcoordinates and if mapping directly to vertices then additional vertices is necessary. | |
bool | _mappedToFaces |
if true then the tex coodinates are mapped to faces and not vertices. if false then the texCoords are mapped to each vertice | |
rw::math::Transform3D< float > | _transform |
Transform of the object. | |
std::vector< Object3DGeneric::Ptr > | _kids |
Child objects. | |
rw::math::Vector2D< float > | _texOffset |
Offset of texture. | |
rw::math::Vector2D< float > | _texRepeat |
Repeat texture. | |
std::vector< MaterialMapData > | _materialMap |
maps material into a range of triangles. | |
std::vector< MaterialPolys::Ptr > | _matPolys |
Polygons ordered according to material. | |
Additional Inherited Members | |
![]() | |
static std::string | toString (GeometryType type) |
format GeometryType to string More... | |
![]() | |
Object3DGeneric (const std::string &name) | |
constructor More... | |
A concrete 3d object consisting of geometry information, material and texture.
The template parameter should be chosen based on the number of vertices in the mesh, in order to reduce memory consumption.
For a mesh that has 255 vertices or less, use Object3D<uint8_t>.
For a mesh that has 65535 vertices or less, use Object3D<uint16_t>.
For a mesh that has more than 65535 vertices, use Object3D<uint32_t>.
|
inline |
constructor
name | [in] name of object |
|
inline |
add triangles to this object using a specific material in the Model3D
material | [in] index of the material to be used |
tris | [in] triangles to add |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Returns vertices corresponding to the idx face.
idx | [in] Index of the face |
Implements Object3DGeneric.
|
inlinevirtual |
gets the triangle at index idx.
idx | [in] the index of the triangle. |
Implements Object3DGeneric.
|
inlinevirtual |
Scales the model by scale.
The transformation of the model is not scaled.
scale | [in] scaling factor |
Implements TriMesh.