33 #if MRPT_HAS_OPENGL_GLUT 35 if (m_enableTransparency)
52 for (it=m_triangles.begin();it!=m_triangles.end();++it)
56 float ax= it->x[1] - it->x[0];
57 float ay= it->y[1] - it->y[0];
58 float az= it->z[1] - it->z[0];
60 float bx= it->x[2] - it->x[0];
61 float by= it->y[2] - it->y[0];
62 float bz= it->z[2] - it->z[0];
66 glColor4f( it->r[0],it->g[0],it->b[0],it->a[0] );
69 glColor4f( it->r[1],it->g[1],it->b[1],it->a[1] );
72 glColor4f( it->r[2],it->g[2],it->b[2],it->a[2] );
118 writeToStreamRender(out);
121 for (
size_t i=0;i<
n;i++)
125 out << m_enableTransparency;
140 readFromStreamRender(
in);
144 for (
size_t i=0;i<
n;i++)
148 in >> m_enableTransparency;
149 else m_enableTransparency =
true;
155 polygonsUpToDate=
false;
160 if (!polygonsUpToDate) updatePolygons();
290 const float col =
r/255.f;
298 const float col =
g/255.f;
306 const float col =
b/255.f;
314 const float col =
a/255.f;
320 if (!polygonsUpToDate) updatePolygons();
321 size_t N=tmpPolygons.size();
322 for (
size_t i=0;i<N;i++) polys[i]=tmpPolygons[i].poly;
327 size_t N=m_triangles.size();
328 tmpPolygons.resize(N);
329 for (
size_t i=0;i<N;i++)
for (
size_t j=0;j<3;j++) {
336 polygonsUpToDate=
true;
342 bb_min =
mrpt::math::TPoint3D(std::numeric_limits<double>::max(),std::numeric_limits<double>::max(), std::numeric_limits<double>::max());
343 bb_max =
mrpt::math::TPoint3D(-std::numeric_limits<double>::max(),-std::numeric_limits<double>::max(),-std::numeric_limits<double>::max());
345 for (
size_t i=0;i<m_triangles.size();i++)
363 m_pose.composePoint(bb_min, bb_min);
364 m_pose.composePoint(bb_max, bb_max);
368 reserve(m_triangles.size()+
p->m_triangles.size());
369 m_triangles.insert(m_triangles.end(),
p->m_triangles.begin(),
p->m_triangles.end());
370 polygonsUpToDate=
false;
CRenderizable & setColorB_u8(const uint8_t b) MRPT_OVERRIDE
Color components in the range [0,255].
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
GLAPI void GLAPIENTRY glEnable(GLenum cap)
void getPolygons(std::vector< mrpt::math::TPolygon3D > &polys) const
Gets the polygon cache.
bool BASE_IMPEXP traceRay(const std::vector< TPolygonWithPlane > &vec, const mrpt::poses::CPose3D &pose, double &dist)
Fast ray tracing method using polygons' properties.
GLAPI void GLAPIENTRY glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
The base class of 3D objects that can be directly rendered through OpenGL.
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
#define GL_ONE_MINUS_SRC_ALPHA
double z
X,Y,Z coordinates.
IMPLEMENTS_SERIALIZABLE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, mrpt::nav) IMPLEMENTS_SERIALIZABLE(CHolonomicFullEval
static void triangle_readFromStream(mrpt::utils::CStream &i, CSetOfTriangles::TTriangle &t)
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
A renderizable object suitable for rendering with OpenGL's display lists.
void WriteBufferFixEndianness(const T *ptr, size_t ElementCount)
Writes a sequence of elemental datatypes, taking care of reordering their bytes from the running arch...
static void triangle_writeToStream(mrpt::utils::CStream &o, const CSetOfTriangles::TTriangle &t)
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
This base provides a set of functions for maths stuff.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
CRenderizable & setColorA_u8(const uint8_t a) MRPT_OVERRIDE
Color components in the range [0,255].
GLAPI void GLAPIENTRY glBegin(GLenum mode)
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...
CRenderizable & setColorR_u8(const uint8_t r) MRPT_OVERRIDE
Color components in the range [0,255].
void keep_max(T &var, const K test_val)
If the second argument is above the first one, set the first argument to this higher value...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const MRPT_OVERRIDE
Ray tracing.
void updatePolygons() const
Polygon cache updating.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLdouble GLdouble GLdouble r
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
void keep_min(T &var, const K test_val)
If the second argument is below the first one, set the first argument to this lower value...
size_t ReadBufferFixEndianness(T *ptr, size_t ElementCount)
Reads a sequence of elemental datatypes, taking care of reordering their bytes from the MRPT stream s...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
The namespace for 3D scene representation and rendering.
A RGB color - floats in the range [0,1].
GLAPI void GLAPIENTRY glEnd(void)
A set of colored triangles.
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
GLAPI void GLAPIENTRY glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
unsigned __int32 uint32_t
GLAPI void GLAPIENTRY glDisable(GLenum cap)
GLubyte GLubyte GLubyte a
void insertTriangles(const InputIterator &begin, const InputIterator &end)
Inserts a set of triangles, bounded by iterators, into this set.
CRenderizable & setColor_u8(const mrpt::utils::TColor &c) MRPT_OVERRIDE
Changes the default object color.
3D polygon, inheriting from std::vector<TPoint3D>
CRenderizable & setColorG_u8(const uint8_t g) MRPT_OVERRIDE
Color components in the range [0,255].