9 #ifndef opengl_CSetOfTriangles_H
10 #define opengl_CSetOfTriangles_H
41 for (
size_t i=0;i<3;i++) {
42 x[i]=p[i].x; y[i]=p[i].y; z[i]=p[i].z; r[i]=g[i]=b[i]=a[i]=1; }
45 float r[3],g[3],b[3],a[3];
72 mutable std::vector<mrpt::math::TPolygonWithPlane>
tmpPolygons;
99 m_triangles.insert(m_triangles.end(),
begin,
end);
100 polygonsUpToDate=
false;
111 m_triangles.reserve(
t);
142 template<class CONTAINER>
143 inline
void insertTriangles(const CONTAINER &c) {
144 this->insertTriangles(c.begin(),c.end());
152 return m_triangles.begin();
158 return m_triangles.end();
164 return m_triangles.rbegin();
170 return m_triangles.rend();
181 m_enableTransparency(enableTransparency),
182 polygonsUpToDate(false)
193 template<class T> inline CSetOfTrianglesPtr &operator<<(CSetOfTrianglesPtr &s,const T &
t) {
194 s->insertTriangles(
t.begin(),
t.end());
201 s->insertTriangle(
t);
#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...
3D polygon, inheriting from std::vector<TPoint3D>
A renderizable object suitable for rendering with OpenGL's display lists.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
The base class of 3D objects that can be directly rendered through OpenGL.
A set of colored triangles.
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...
size_t getTrianglesCount() const
Get triangle count.
bool polygonsUpToDate
Mutable variable used to check whether polygons need to be recalculated.
void insertTriangles(const CSetOfTrianglesPtr &p)
Inserts an existing CSetOfTriangles into this one.
void enableTransparency(bool v)
Enables or disables transparency.
bool m_enableTransparency
Transparency enabling.
const_iterator end() const
Gets the ending iterator to this object.
virtual ~CSetOfTriangles()
Private, virtual destructor: only can be deleted from smart pointers.
std::vector< TTriangle >::const_iterator const_iterator
Const iterator type.
void clearTriangles()
Clear this object.
CSetOfTriangles(bool enableTransparency=false)
Constructor.
const_iterator begin() const
Gets the beginning iterator to this object.
CRenderizable & setColorA_u8(const uint8_t a) MRPT_OVERRIDE
Color components in the range [0,255].
void render_dl() const MRPT_OVERRIDE
Render.
void insertTriangles(const InputIterator &begin, const InputIterator &end)
Inserts a set of triangles, bounded by iterators, into this set.
void insertTriangle(const TTriangle &t)
Inserts a triangle into the set.
const_reverse_iterator rend() const
Gets the reverse ending iterator to this object, which points to the beginning of the actual set.
std::vector< mrpt::math::TPolygonWithPlane > tmpPolygons
Polygon cache.
void updatePolygons() const
Polygon cache updating.
CRenderizable & setColorG_u8(const uint8_t g) MRPT_OVERRIDE
Color components in the range [0,255].
void getTriangle(size_t idx, TTriangle &t) const
Gets the triangle in a given position.
CRenderizable & setColorB_u8(const uint8_t b) MRPT_OVERRIDE
Color components in the range [0,255].
CRenderizable & setColor_u8(const mrpt::utils::TColor &c) MRPT_OVERRIDE
Changes the default object color.
std::vector< TTriangle > m_triangles
List of triangles.
std::vector< TTriangle >::const_reverse_iterator const_reverse_iterator
Const reverse iterator type.
void reserve(size_t t)
Reserves memory for certain number of triangles, avoiding multiple memory allocation calls.
CRenderizable & setColorR_u8(const uint8_t r) MRPT_OVERRIDE
Color components in the range [0,255].
const_reverse_iterator rbegin() const
Gets the reverse beginning iterator to this object, which points to the last triangle.
const Scalar * const_iterator
EIGEN_STRONG_INLINE const AdjointReturnType t() const
Transpose.
EIGEN_STRONG_INLINE iterator begin()
EIGEN_STRONG_INLINE iterator end()
bool BASE_IMPEXP traceRay(const vector< TPolygonWithPlane > &vec, const mrpt::poses::CPose3D &pose, double &dist)
Fast ray tracing method using polygons' properties.
class BASE_IMPEXP TPolygon3D
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
OPENGL_IMPEXP mrpt::utils::CStream & operator<<(mrpt::utils::CStream &out, const mrpt::opengl::CLight &o)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
TTriangle(const mrpt::math::TPolygon3D &p)