Go to the documentation of this file.
33 #if MRPT_HAS_OPENGL_GLUT
34 octree_assure_uptodate();
35 m_last_rendered_count_ongoing = 0;
68 m_last_rendered_count = m_last_rendered_count_ongoing;
76 const bool all,
const std::vector<size_t>& idxs,
77 const float render_area_sqpixels)
const
79 #if MRPT_HAS_OPENGL_GLUT
80 const size_t N = all ? m_points.size() : idxs.size();
83 1.0f,
static_cast<float>(
86 render_area_sqpixels))));
88 m_last_rendered_count_ongoing += N / decimation;
90 m_last_rendered_count_ongoing +=
91 (all ? m_points.size() : idxs.size()) / decimation;
95 for (
size_t i = 0; i < N; i += decimation)
104 for (
size_t i = 0; i < N; i += decimation)
121 writeToStreamRender(out);
124 out << m_pointSmooth;
135 readFromStreamRender(
in);
136 in >> m_points >> m_pointSize;
141 m_pointSmooth =
false;
146 readFromStreamRender(
in);
152 for (
uint32_t i = 0; i < n; i++) in >> m_points[i];
160 markAllPointsAsNew();
166 in >> o.
x >> o.
y >> o.
z >> o.
R >> o.
G >> o.
B;
173 out << o.
x << o.
y << o.
z << o.
R << o.
G << o.
B;
188 markAllPointsAsNew();
193 float x,
float y,
float z,
float R,
float G,
float B)
199 markAllPointsAsNew();
225 pt.
x, pt.
y, pt.
z, pt_color->
R, pt_color->
G, pt_color->
B));
254 const float coord_min,
const float coord_max,
const int coord_index,
260 const float coord_range = coord_max - coord_min;
261 const float coord_range_1 = coord_range != 0.0f ? 1.0f / coord_range : 1.0f;
262 for (
size_t i = 0; i < m_points.size(); i++)
268 coord = m_points[i].x;
271 coord = m_points[i].y;
274 coord = m_points[i].z;
277 const float col_idx =
278 std::max(0.0f,
std::min(1.0f, (
coord - coord_min) * coord_range_1));
281 this->setPointColor_fast(i,
r,
g,
b);
Lightweight 3D point (float version).
GLAPI void GLAPIENTRY glBegin(GLenum mode)
size_t PLY_export_get_vertex_count() const override
In a base class, return the number of vertices.
Global variables to change the run-time behaviour of some MRPT classes within mrpt-base.
TColormap
Different colormaps for use in mrpt::img::colormap()
void push_back(float x, float y, float z, float R, float G, float B)
Inserts a new point into the point cloud.
GLAPI void GLAPIENTRY glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
mrpt::serialization::CArchive & operator>>(mrpt::serialization::CArchive &in, mrpt::opengl::CLight &o)
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.
The base class of 3D objects that can be directly rendered through OpenGL.
void render_subset(const bool all, const std::vector< size_t > &idxs, const float render_area_sqpixels) const
Render a subset of points (required by octree renderer)
GLAPI void GLAPIENTRY glDisable(GLenum cap)
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.
GLAPI void GLAPIENTRY glEnable(GLenum cap)
void PLY_export_get_vertex(const size_t idx, mrpt::math::TPoint3Df &pt, bool &pt_has_color, mrpt::img::TColorf &pt_color) const override
In a base class, will be called after PLY_export_get_vertex_count() once for each exported point.
virtual void PLY_import_set_vertex_count(const size_t N) override
In a base class, reserve memory to prepare subsequent calls to PLY_import_set_vertex.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
Information about the rendering process being issued.
void markAllPointsAsNew()
Do needed internal work if all points are new (octree rebuilt,...)
Virtual base class for "archives": classes abstracting I/O streams.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
void recolorizeByCoordinate(const float coord_min, const float coord_max, const int coord_index=2, const mrpt::img::TColormap color_map=mrpt::img::cmJET)
Regenerates the color of each point according the one coordinate (coord_index:0,1,...
GLAPI void GLAPIENTRY glEnd(void)
GLdouble GLdouble GLdouble r
#define ASSERT_BELOW_(__A, __B)
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
virtual void PLY_import_set_vertex(const size_t idx, const mrpt::math::TPoint3Df &pt, const mrpt::img::TColorf *pt_color=nullptr) override
In a base class, will be called after PLY_import_set_vertex_count() once for each loaded point.
void checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
int round(const T value)
Returns the closer integer (int) to x.
#define GL_ONE_MINUS_SRC_ALPHA
A RGB color - floats in the range [0,1].
GLAPI void GLAPIENTRY glPointSize(GLfloat size)
void OCTREE_RENDER_MAX_DENSITY_POINTS_PER_SQPIXEL(float value)
Default value = 0.01 points/px^2.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
mrpt::serialization::CArchive & operator<<(mrpt::serialization::CArchive &out, const mrpt::opengl::CLight &o)
#define ASSERT_ABOVEEQ_(__A, __B)
void getCurrentRenderingInfo(TRenderInfo &ri)
Gather useful information on the render parameters.
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
This base provides a set of functions for maths stuff.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
The namespace for 3D scene representation and rendering.
void setPoint(size_t i, const TPointColour &p)
Write an individual point (checks for "i" in the valid range only in Debug).
A cloud of points, each one with an individual colour (R,G,B).
unsigned __int32 uint32_t
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
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 | |