28 double min_col,
double max_col,
29 double min_value,
double max_value,
30 const std::
string &label_format,
31 double label_font_size
35 m_label_format(label_format),
36 m_min_col(min_col), m_max_col(max_col),
37 m_min_value(min_value), m_max_value(max_value),
38 m_label_font_size(label_font_size),
39 m_disable_depth_test(true)
47 double min_col,
double max_col,
48 double min_value,
double max_value,
50 double label_font_size
66 m_min_value = value_min;
67 m_max_value = value_max;
73 m_disable_depth_test = enable;
81 #if MRPT_HAS_OPENGL_GLUT
88 unsigned int num_divisions = 64;
89 unsigned int num_labels = 4;
90 unsigned int one_label_each_nth = floor((num_divisions) / num_labels);
92 const double x0 = .0, x1 = m_width, x2 = m_width*1.3;
93 const double Ay = m_height / (num_divisions - 1);
95 std::vector<mrpt::utils::TColorf> cols(num_divisions);
96 for (
unsigned int i = 0; i < num_divisions; i++) {
97 const double col_idx = m_min_col + i*(m_max_col - m_min_col) / (num_divisions - 1);
101 for (
unsigned int i = 0; i < num_divisions-1; i++)
103 const double y0 = Ay*i, y1 = Ay*(i + 1);
104 const TPoint3D pt00(x0, y0, 0), pt10(x1, y0, 0);
105 const TPoint3D pt01(x0, y1, 0), pt11(x1, y1, 0);
113 glColor3f(cols[i + 1].
R, cols[i + 1].G, cols[i + 1].B);
118 glColor3f(cols[i + 1].
R, cols[i + 1].G, cols[i + 1].B);
126 for (
unsigned int i = 0; i < num_divisions; i++)
128 const double val = m_min_value + i*(m_max_value - m_min_value) / (num_divisions - 1);
129 const double y0 = Ay*i;
132 bool draw_label = (i % one_label_each_nth) == 0 || i == (num_divisions - 1);
167 writeToStreamRender(out);
171 m_min_col << m_max_col <<
172 m_min_value << m_max_value <<
174 m_label_font_size << m_disable_depth_test;
185 readFromStreamRender(
in);
189 m_min_col >> m_max_col >>
190 m_min_value >> m_max_value >>
193 m_disable_depth_test;
213 m_pose.composePoint(bb_min, bb_min);
214 m_pose.composePoint(bb_max, bb_max);
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
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...
void setColorAndValueLimits(double col_min, double col_max, double value_min, double value_max)
void setColormap(const mrpt::utils::TColormap colormap)
void enableDepthTest(bool enable)
static CColorBarPtr Create()
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 render_dl() const MRPT_OVERRIDE
Render.
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)
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
GLAPI void GLAPIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z)
GLAPI void GLAPIENTRY glVertex2d(GLdouble x, GLdouble y)
GLAPI void GLAPIENTRY glEnable(GLenum cap)
GLAPI void GLAPIENTRY glPushMatrix(void)
GLAPI void GLAPIENTRY glLineWidth(GLfloat width)
GLAPI void GLAPIENTRY glBegin(GLenum mode)
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
GLAPI void GLAPIENTRY glPopMatrix(void)
GLAPI void GLAPIENTRY glEnd(void)
GLAPI void GLAPIENTRY glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
GLAPI void GLAPIENTRY glColor3f(GLfloat red, GLfloat green, GLfloat blue)
GLAPI void GLAPIENTRY glDisable(GLenum cap)
GLAPI void GLAPIENTRY glColor3b(GLbyte red, GLbyte green, GLbyte blue)
GLAPI void GLAPIENTRY glShadeModel(GLenum mode)
GLenum GLsizei GLsizei height
GLsizei const GLchar ** string
TColormap
Different colormaps for use in mrpt::utils::colormap()
void BASE_IMPEXP colormap(const TColormap &color_map, const float color_index, float &r, float &g, float &b)
Transform a float number in the range [0,1] into RGB components.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
This base provides a set of functions for maths stuff.
void OPENGL_IMPEXP glSetFont(const std::string &fontname)
sets the font to use for future font rendering commands.
mrpt::utils::TPixelCoordf OPENGL_IMPEXP glDrawText(const std::string &text, const double textScale, enum TOpenGLFontStyle style=NICE, double spacing=1.5, double kerning=0.1)
renders a string in GL using the current settings.
The namespace for 3D scene representation and rendering.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
unsigned __int32 uint32_t
double z
X,Y,Z coordinates.