Go to the documentation of this file.
31 double min_col,
double max_col,
33 double min_value,
double max_value,
35 const std::
string& label_format,
37 double label_font_size)
41 m_label_format(label_format),
44 m_min_value(min_value),
45 m_max_value(max_value),
46 m_label_font_size(label_font_size),
47 m_disable_depth_test(true)
57 double min_col,
double max_col,
59 double min_value,
double max_value,
63 double label_font_size)
68 label_format, label_font_size));
78 double col_min,
double col_max,
double value_min,
double value_max)
82 m_min_value = value_min;
83 m_max_value = value_max;
89 m_disable_depth_test = enable;
98 #if MRPT_HAS_OPENGL_GLUT
99 if (m_disable_depth_test)
107 unsigned int num_divisions = 64;
108 unsigned int num_labels = 4;
109 unsigned int one_label_each_nth = floor((num_divisions) / num_labels);
111 const double x0 = .0, x1 = m_width, x2 = m_width * 1.3;
112 const double Ay = m_height / (num_divisions - 1);
114 std::vector<mrpt::img::TColorf> cols(num_divisions);
115 for (
unsigned int i = 0; i < num_divisions; i++)
117 const double col_idx =
118 m_min_col + i * (m_max_col - m_min_col) / (num_divisions - 1);
120 m_colormap, col_idx, cols[i].
R, cols[i].
G, cols[i].B);
123 for (
unsigned int i = 0; i < num_divisions - 1; i++)
125 const double y0 = Ay * i, y1 = Ay * (i + 1);
126 const TPoint3D pt00(x0, y0, 0), pt10(x1, y0, 0);
127 const TPoint3D pt01(x0, y1, 0), pt11(x1, y1, 0);
135 glColor3f(cols[i + 1].
R, cols[i + 1].
G, cols[i + 1].B);
140 glColor3f(cols[i + 1].
R, cols[i + 1].
G, cols[i + 1].B);
148 for (
unsigned int i = 0; i < num_divisions; i++)
151 m_min_value + i * (m_max_value - m_min_value) / (num_divisions - 1);
152 const double y0 = Ay * i;
156 (i % one_label_each_nth) == 0 || i == (num_divisions - 1);
188 writeToStreamRender(out);
190 out <<
uint32_t(m_colormap) << m_min_col << m_max_col << m_min_value
191 << m_max_value << m_label_format << m_label_font_size
192 << m_disable_depth_test;
200 readFromStreamRender(
in);
203 in >> m_min_col >> m_max_col >> m_min_value >> m_max_value >>
204 m_label_format >> m_label_font_size >> m_disable_depth_test;
224 m_pose.composePoint(bb_min, bb_min);
225 m_pose.composePoint(bb_max, bb_max);
GLAPI void GLAPIENTRY glBegin(GLenum mode)
std::shared_ptr< CColorBar > Ptr
TColormap
Different colormaps for use in mrpt::img::colormap()
GLAPI void GLAPIENTRY glPopMatrix(void)
void setColormap(const mrpt::img::TColormap colormap)
void 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.
mrpt::img::TPixelCoordf 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.
A renderizable object suitable for rendering with OpenGL's display lists.
void glSetFont(const std::string &fontname)
sets the font to use for future font rendering commands.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
GLAPI void GLAPIENTRY glDisable(GLenum cap)
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
GLAPI void GLAPIENTRY glEnable(GLenum cap)
GLAPI void GLAPIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
GLAPI void GLAPIENTRY glColor3f(GLfloat red, GLfloat green, GLfloat blue)
GLAPI void GLAPIENTRY glColor3b(GLbyte red, GLbyte green, GLbyte blue)
GLAPI void GLAPIENTRY glPushMatrix(void)
Virtual base class for "archives": classes abstracting I/O streams.
void render_dl() const override
Render.
GLAPI void GLAPIENTRY glEnd(void)
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
GLAPI void GLAPIENTRY glLineWidth(GLfloat width)
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
GLAPI void GLAPIENTRY glShadeModel(GLenum mode)
double x
X,Y,Z coordinates.
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const override
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
void enableDepthTest(bool enable)
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
static Ptr Create(Args &&... args)
GLenum GLsizei GLsizei height
void setColorAndValueLimits(double col_min, double col_max, double value_min, double value_max)
This base provides a set of functions for maths stuff.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
GLsizei const GLchar ** string
GLAPI void GLAPIENTRY glVertex2d(GLdouble x, GLdouble y)
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
The namespace for 3D scene representation and rendering.
unsigned __int32 uint32_t
GLAPI void GLAPIENTRY glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |