Main MRPT website > C++ reference for MRPT 1.4.0
CSetOfTexturedTriangles.h
Go to the documentation of this file.
1/* +---------------------------------------------------------------------------+
2 | Mobile Robot Programming Toolkit (MRPT) |
3 | http://www.mrpt.org/ |
4 | |
5 | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file |
6 | See: http://www.mrpt.org/Authors - All rights reserved. |
7 | Released under BSD License. See details in http://www.mrpt.org/License |
8 +---------------------------------------------------------------------------+ */
9#ifndef opengl_CSetOfTexturedTriangles_H
10#define opengl_CSetOfTexturedTriangles_H
11
13
14namespace mrpt
15{
16 namespace utils { class CStream; }
17
18 namespace opengl
19 {
20 // This must be added to any CSerializable derived class:
22
23 /** A set of textured triangles.
24 * This class can be used to draw any solid, arbitrarily complex object with textures.
25 * \sa opengl::COpenGLScene
26 * \ingroup mrpt_opengl_grp
27 */
29 {
31
32 public:
33 /** Triangle vertex. This structure encapsulates the vertex coordinates and the image pixels.
34 */
36 {
37 TVertex( ); //!< Default constructor
38 TVertex(float x, float y, float z, uint32_t u, uint32_t v);
39 float m_x, m_y, m_z; //!< 3D vertex coordinates.
40 uint32_t m_u, m_v; //!< 2D texture coordinates. Notice that the texture coordinates are 2D pixels!!!
43 };
44
45 /** Triangle. This structure encapsulates the triangle vertices.
46 */
48 {
49 TTriangle( ); //!< Default constructor
51 TVertex m_v1, m_v2, m_v3; //!< vertices
54 };
55
56 /** Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent. */
58
59 protected:
60 /** Triangle array. */
61 std::vector<TTriangle> m_triangles;
62
64
65 public:
66 void clearTriangles( ) { m_triangles.clear(); CRenderizableDisplayList::notifyChange(); }
67 size_t getTrianglesCount( ) const { return m_triangles.size(); }
68 const TTriangle & getTriangle( size_t idx) const { ASSERT_(idx<m_triangles.size()); return m_triangles[idx]; }
69 void getTriangle( size_t idx, TTriangle &t ) const { ASSERT_(idx<m_triangles.size()); t = m_triangles[idx]; CRenderizableDisplayList::notifyChange(); }
70 void insertTriangle( const TTriangle &t ) { m_triangles.push_back(t); CRenderizableDisplayList::notifyChange(); }
71
72
73 virtual bool traceRay( const mrpt::poses::CPose3D &o,double &dist ) const MRPT_OVERRIDE;
74
75 private:
76 /** Constructor
77 */
78 CSetOfTexturedTriangles( ) : m_triangles()
79 { }
80
81 /** Private, virtual destructor: only can be deleted from smart pointers */
83 };
85
86 } // end namespace
87
88} // End of namespace
89
90#endif
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
const TTriangle & getTriangle(size_t idx) const
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
void getTriangle(size_t idx, TTriangle &t) const
virtual ~CSetOfTexturedTriangles()
Private, virtual destructor: only can be deleted from smart pointers.
void render_texturedobj() const MRPT_OVERRIDE
Must be implemented by derived classes.
virtual bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const MRPT_OVERRIDE
Simulation of ray-trace, given a pose.
std::vector< TTriangle > m_triangles
Triangle array.
A base class for all OpenGL objects with loadable textures.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition CPose3D.h:73
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition CStream.h:39
EIGEN_STRONG_INLINE const AdjointReturnType t() const
Transpose.
#define ASSERT_(f)
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
Definition mrpt_macros.h:28
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
unsigned long uint32_t
Definition pstdint.h:216
Lightweight 3D point.
TTriangle(TVertex v1, TVertex v2, TVertex v3)
void writeToStream(mrpt::utils::CStream &out) const
void readFromStream(mrpt::utils::CStream &in)
void readFromStream(mrpt::utils::CStream &in)
void writeToStream(mrpt::utils::CStream &out) const
TVertex(float x, float y, float z, uint32_t u, uint32_t v)



Page generated by Doxygen 1.9.8 for MRPT 1.4.0 SVN: at Thu Dec 14 16:41:50 UTC 2023