9 #ifndef opengl_CSetOfTriangles_H 10 #define opengl_CSetOfTriangles_H 39 for (
size_t i = 0; i<3; i++) {
40 r[i] = g[i] = b[i] = a[i] = 1.0f;
45 for (
size_t i=0;i<3;i++) {
46 x[i]=p[i].x; y[i]=p[i].y;
z[i]=p[i].z; r[i]=g[i]=b[i]=a[i]=1.0f;
50 float r[3],g[3],b[3],a[3];
77 mutable std::vector<mrpt::math::TPolygonWithPlane>
tmpPolygons;
82 void updatePolygons()
const;
104 m_triangles.insert(m_triangles.end(),
begin,
end);
105 polygonsUpToDate=
false;
111 void insertTriangles(
const CSetOfTrianglesPtr &p);
116 m_triangles.reserve(t);
141 void getPolygons(std::vector<mrpt::math::TPolygon3D> &polys)
const;
147 template<
class CONTAINER>
149 this->insertTriangles(c.begin(),c.end());
156 inline const_iterator
begin()
const {
157 return m_triangles.begin();
162 inline const_iterator
end()
const {
163 return m_triangles.end();
168 inline const_reverse_iterator
rbegin()
const {
169 return m_triangles.rbegin();
174 inline const_reverse_iterator
rend()
const {
175 return m_triangles.rend();
186 m_enableTransparency(enableTransparency),
187 polygonsUpToDate(false)
198 template<class T> inline CSetOfTrianglesPtr &operator<<(CSetOfTrianglesPtr &s,const T &
t) {
199 s->insertTriangles(t.begin(),t.end());
206 s->insertTriangle(t);
void getTriangle(size_t idx, TTriangle &t) const
Gets the triangle in a given position.
const_reverse_iterator rend() const
Gets the reverse ending iterator to this object, which points to the beginning of the actual set...
OPENGL_IMPEXP mrpt::utils::CStream & operator<<(mrpt::utils::CStream &out, const mrpt::opengl::CLight &o)
EIGEN_STRONG_INLINE iterator end()
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
const_iterator end() const
Gets the ending iterator to this object.
The base class of 3D objects that can be directly rendered through OpenGL.
EIGEN_STRONG_INLINE iterator begin()
std::vector< mrpt::math::TPolygonWithPlane > tmpPolygons
Polygon cache.
EIGEN_STRONG_INLINE const AdjointReturnType t() const
Transpose.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
const Scalar * const_iterator
size_t getTrianglesCount() const
Get triangle count.
const_iterator begin() const
Gets the beginning iterator to this object.
TTriangle(const mrpt::math::TPolygon3D &p)
A renderizable object suitable for rendering with OpenGL's display lists.
#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...
std::vector< TTriangle >::const_iterator const_iterator
Const iterator type.
void insertTriangle(const TTriangle &t)
Inserts a triangle into the set.
CSetOfTriangles(bool enableTransparency=false)
Constructor.
std::vector< TTriangle > m_triangles
List of triangles.
void enableTransparency(bool v)
Enables or disables transparency.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
const_reverse_iterator rbegin() const
Gets the reverse beginning iterator to this object, which points to the last triangle.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t x(y+z)
void reserve(size_t t)
Reserves memory for certain number of triangles, avoiding multiple memory allocation calls...
std::vector< TTriangle >::const_reverse_iterator const_reverse_iterator
Const reverse iterator type.
virtual ~CSetOfTriangles()
Private, virtual destructor: only can be deleted from smart pointers.
A set of colored triangles.
bool BASE_IMPEXP traceRay(const std::vector< TPolygonWithPlane > &vec, const mrpt::poses::CPose3D &pose, double &dist)
Fast ray tracing method using polygons' properties.
void clearTriangles()
Clear this object.
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
void insertTriangles(const CONTAINER &c)
Inserts a set of triangles, given in a container of either TTriangle's or TPolygon3D.
bool polygonsUpToDate
Mutable variable used to check whether polygons need to be recalculated.
bool m_enableTransparency
Transparency enabling.
void insertTriangles(const InputIterator &begin, const InputIterator &end)
Inserts a set of triangles, bounded by iterators, into this set.
3D polygon, inheriting from std::vector<TPoint3D>