24 const
std::
string& str, const
std::
string& fontName, const
float scale,
26 const
double text_kerning)
29 m_text_style(text_style),
30 m_text_spacing(text_spacing),
31 m_text_kerning(text_kerning)
33 this->setScale(scale);
49 m_str, tris, vbd, m_text_style, m_text_spacing, m_text_kerning);
52 cbd.assign(vbd.size(), m_color);
53 for (
auto& tri : m_triangles) tri.setColor(m_color);
59 writeToStreamRender(
out);
60 out << m_str << m_fontName << (uint32_t)m_text_style << m_text_spacing
70 readFromStreamRender(in);
73 in >> m_str >> m_fontName >> i >> m_text_spacing >> m_text_kerning;
91 bb_max.x = m_str.size() * m_scale_x;
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
void notifyChange() const
Call to enable calling renderUpdateBuffers() before the next render() rendering iteration.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
The base class of 3D objects that can be directly rendered through OpenGL.
void onUpdateBuffers_Text() override
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
TOpenGLFontStyle
Different style for vectorized font rendering.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
std::pair< double, double > glDrawText(const std::string &text, std::vector< mrpt::opengl::TTriangle > &tris, std::vector< mrpt::math::TPoint3Df > &render_lines, TEXT_STYLE style, double spacing, double kerning)
renders a string in GL using the current settings.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::vector< mrpt::math::TPoint3Df > m_vertex_buffer_data
List of lines.
Virtual base class for "archives": classes abstracting I/O streams.
mrpt::vision::TStereoCalibResults out
void glSetFont(const std::string &fontname)
sets the font to use for future font rendering commands.
A 3D text (rendered with OpenGL primitives), with selectable font face and drawing style...
The namespace for 3D scene representation and rendering.
std::vector< mrpt::opengl::TTriangle > m_triangles
List of triangles.
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 serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
std::vector< mrpt::img::TColor > m_color_buffer_data