28 m_enable_lighting(false),
29 m_enable_cube_transparency(true),
30 m_showVoxelsAsPoints(false),
31 m_showVoxelsAsPointsSize(3.0f),
34 m_grid_color (0xE0,0xE0,0xE0, 0x90),
55 #if MRPT_HAS_OPENGL_GLUT 70 const GLubyte grid_line_indices[] = {
76 const GLubyte cube_indices[36] = {
85 const GLfloat normals_cube[3*6*4] = {
86 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0,
87 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0,
88 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
89 0,-1, 0, 0,-1, 0, 0,-1, 0, 0,-1, 0,
90 0, 0,-1, 0, 0,-1, 0, 0,-1, 0, 0,-1,
91 -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0 };
100 #if MRPT_HAS_OPENGL_GLUT 115 if ( m_grid_color.A != 255 )
121 glColor4ub(m_grid_color.R,m_grid_color.G,m_grid_color.B,m_grid_color.A);
123 const size_t nGrids = m_grid_cubes.size();
124 for (
size_t i=0;i<nGrids;i++)
130 c.max.x,
c.min.y,
c.max.z,
131 c.max.x,
c.min.y,
c.min.z,
132 c.max.x,
c.max.y,
c.min.z,
133 c.min.x,
c.max.y,
c.min.z,
134 c.min.x,
c.max.y,
c.max.z,
135 c.min.x,
c.min.y,
c.max.z,
136 c.min.x,
c.min.y,
c.min.z
154 if (m_enable_cube_transparency)
160 if (m_showVoxelsAsPoints)
166 for (
size_t i=0;i<m_voxel_sets.size();i++)
168 if (!m_voxel_sets[i].visible)
continue;
170 const std::vector<TVoxel> & voxels = m_voxel_sets[i].voxels;
171 const size_t N = voxels.size();
172 for (
size_t j=0;j<N;j++)
178 const double L = voxels[j].side_length * 0.5;
180 if (!m_showVoxelsAsPoints)
205 if (m_showVoxelsAsPoints)
210 if (m_enable_cube_transparency)
231 out <<
a.visible <<
a.voxels;
235 in >>
a.visible >>
a.voxels;
240 out <<
a.min <<
a.max;
244 in >>
a.min >>
a.max;
249 out <<
a.coords <<
a.side_length <<
a.color;
253 in >>
a.coords >>
a.side_length >>
a.color;
270 writeToStreamRender(out);
274 << m_bb_min << m_bb_max
275 << m_enable_lighting << m_showVoxelsAsPoints << m_showVoxelsAsPointsSize
276 << m_show_grids << m_grid_width << m_grid_color
277 << m_enable_cube_transparency
294 readFromStreamRender(
in);
298 >> m_bb_min >> m_bb_max
299 >> m_enable_lighting >> m_showVoxelsAsPoints >> m_showVoxelsAsPointsSize
300 >> m_show_grids >> m_grid_width >> m_grid_color;
303 in >> m_enable_cube_transparency;
304 else m_enable_cube_transparency =
false;
329 m_pose.composePoint(bb_min, bb_min);
330 m_pose.composePoint(bb_max, bb_max);
335 return a.coords.z <
b.coords.z;
340 for (
size_t i=0;i<m_voxel_sets.size();i++)
342 std::sort( m_voxel_sets[i].voxels.begin(),m_voxel_sets[i].voxels.end(), &
sort_voxels_z );
GLAPI void GLAPIENTRY glDisableClientState(GLenum array)
GLAPI void GLAPIENTRY glEnableClientState(GLenum array)
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...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
OPENGL_IMPEXP mrpt::utils::CStream & operator<<(mrpt::utils::CStream &out, const mrpt::opengl::CLight &o)
visualization_mode_t
The different coloring schemes, which modulate the generic mrpt::opengl::CRenderizable object color...
GLAPI void GLAPIENTRY glEnable(GLenum cap)
GLAPI void GLAPIENTRY glPointSize(GLfloat size)
::mrpt::utils::CStream & operator>>(mrpt::utils::CStream &in, CAngularObservationMeshPtr &pObj)
void setBoundingBox(const mrpt::math::TPoint3D &bb_min, const mrpt::math::TPoint3D &bb_max)
Manually changes the bounding box (normally the user doesn't need to call this)
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...
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
#define GL_ONE_MINUS_SRC_ALPHA
void clear()
Clears everything.
GLAPI void GLAPIENTRY glPopAttrib(void)
IMPLEMENTS_SERIALIZABLE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, mrpt::nav) IMPLEMENTS_SERIALIZABLE(CHolonomicFullEval
bool sort_voxels_z(const COctoMapVoxels::TVoxel &a, const COctoMapVoxels::TVoxel &b)
GLAPI void GLAPIENTRY glLineWidth(GLfloat width)
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
void render_dl() const MRPT_OVERRIDE
Render.
A renderizable object suitable for rendering with OpenGL's display lists.
A flexible renderer of voxels, typically from a 3D octo map (see mrpt::maps::COctoMap).
#define GL_COLOR_BUFFER_BIT
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.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
GLAPI void GLAPIENTRY glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
GLAPI void GLAPIENTRY glBegin(GLenum mode)
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
GLAPI void GLAPIENTRY glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
The info of each grid block.
GLAPI void GLAPIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
The info of each of the voxels.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Color goes from black (occupied voxel) to the chosen color (free voxel)
GLAPI void GLAPIENTRY glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
GLAPI void GLAPIENTRY glPushAttrib(GLbitfield mask)
#define DECLARE_CUSTOM_TTYPENAME(_TYPE)
Identical to MRPT_DECLARE_TTYPENAME but intended for user code.
mrpt::math::TPoint3D max
opposite corners of the cube
void OPENGL_IMPEXP checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
The namespace for 3D scene representation and rendering.
GLAPI void GLAPIENTRY glEnd(void)
unsigned __int32 uint32_t
GLAPI void GLAPIENTRY glDisable(GLenum cap)
GLubyte GLubyte GLubyte a