17 #if MRPT_HAS_OPENGL_GLUT 18 #ifdef MRPT_OS_WINDOWS 24 #include <OpenGL/gl.h> 31 #if MRPT_HAS_OPENGL_GLUT && defined(MRPT_OS_WINDOWS) 33 #if defined(_MSC_VER) || defined(__BORLANDC__) 34 #pragma comment (lib,"opengl32.lib") 35 #pragma comment (lib,"GlU32.lib") 37 #endif // MRPT_HAS_OPENGL_GLUT 57 m_line_R(1.f),m_line_G(0.f),m_line_B(0.f),m_line_A(0.5f),
59 m_points_R(1.0f),m_points_G(0.0f),m_points_B(0.0f),m_points_A(1.0f),
60 m_plane_R(0.01f),m_plane_G(0.01f),m_plane_B(0.6f),m_plane_A(0.6f),
61 m_enable_points(true), m_enable_line(true), m_enable_surface(true)
80 #if MRPT_HAS_OPENGL_GLUT 81 ASSERT_(m_scan.scan.size()==m_scan.validRange.size());
87 m_cache_points.clear();
88 m_cache_points.insertionOptions.minDistBetweenLaserPoints = 0;
89 m_cache_points.insertionOptions.isPlanarMap=
false;
91 m_cache_points.insertObservation( &m_scan );
97 m_cache_points.getPointsBuffer(
n,
x,
y,
z);
105 if (
n>1 && m_enable_line)
110 glColor4f( m_line_R,m_line_G,m_line_B,m_line_A );
123 if (
n>0 && m_enable_points)
129 glColor4f( m_points_R,m_points_G,m_points_B,m_points_A );
141 if (
n>1 && m_enable_surface)
145 glColor4f(m_plane_R,m_plane_G,m_plane_B,m_plane_A);
149 glVertex3f( m_scan.sensorPose.x(), m_scan.sensorPose.y(), m_scan.sensorPose.z() );
173 writeToStreamRender(out);
176 << m_line_R << m_line_G << m_line_B << m_line_A
178 << m_points_R << m_points_G << m_points_B << m_points_A
179 << m_plane_R << m_plane_G << m_plane_B << m_plane_A
180 << m_enable_points << m_enable_line << m_enable_surface;
195 readFromStreamRender(
in);
198 >> m_line_R >> m_line_G >> m_line_B >> m_line_A
200 >> m_points_R >> m_points_G >> m_points_B >> m_points_A
201 >> m_plane_R >> m_plane_G >> m_plane_B >> m_plane_A;
205 in >> m_enable_points >> m_enable_line >> m_enable_surface;
209 m_enable_points = m_enable_line = m_enable_surface =
true;
225 m_cache_points.clear();
226 m_cache_points.insertionOptions.minDistBetweenLaserPoints = 0;
227 m_cache_points.insertionOptions.isPlanarMap=
false;
229 m_cache_points.insertObservation( &m_scan );
233 const float *
x,*
y,*
z;
235 m_cache_points.getPointsBuffer(
n,
x,
y,
z);
236 if (!
n || !
x)
return;
238 bb_min =
mrpt::math::TPoint3D(std::numeric_limits<double>::max(),std::numeric_limits<double>::max(), std::numeric_limits<double>::max());
239 bb_max =
mrpt::math::TPoint3D(-std::numeric_limits<double>::max(),-std::numeric_limits<double>::max(),-std::numeric_limits<double>::max());
241 for (
size_t i=0;i<
n;i++)
249 m_pose.composePoint(bb_min, bb_min);
250 m_pose.composePoint(bb_max, bb_max);
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
GLAPI void GLAPIENTRY glEnable(GLenum cap)
GLAPI void GLAPIENTRY glPointSize(GLfloat size)
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
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
double z
X,Y,Z coordinates.
GLAPI void GLAPIENTRY glLineWidth(GLfloat width)
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
A renderizable object suitable for rendering with OpenGL's display lists.
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.
This object renders a 2D laser scan by means of three elements: the points, the line along end-points...
GLAPI void GLAPIENTRY glBegin(GLenum mode)
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...
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
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...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
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...
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)
void render_dl() const MRPT_OVERRIDE
Render.
GLAPI void GLAPIENTRY glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
GLAPI void GLAPIENTRY glDisable(GLenum cap)
void clear()
< Clear the scan
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
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...