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();
82 1.0f, static_cast<float>(
85 render_area_sqpixels))));
87 m_last_rendered_count_ongoing += N / decimation;
89 m_last_rendered_count_ongoing +=
90 (all ? m_points.size() : idxs.size()) / decimation;
94 for (
size_t i = 0; i < N; i += decimation)
103 for (
size_t i = 0; i < N; i += decimation)
120 writeToStreamRender(out);
123 out << m_pointSmooth;
134 readFromStreamRender(
in);
135 in >> m_points >> m_pointSize;
140 m_pointSmooth =
false;
145 readFromStreamRender(
in);
151 for (
uint32_t i = 0; i < n; i++) in >> m_points[i];
159 markAllPointsAsNew();
165 in >> o.
x >> o.
y >> o.
z >> o.
R >> o.
G >> o.
B;
172 out << o.
x << o.
y << o.
z << o.
R << o.
G << o.
B;
187 markAllPointsAsNew();
192 float x,
float y,
float z,
float R,
float G,
float B)
198 markAllPointsAsNew();
224 pt.
x, pt.
y, pt.
z, pt_color->
R, pt_color->
G, pt_color->
B));
253 const float coord_min,
const float coord_max,
const int coord_index,
259 const float coord_range = coord_max - coord_min;
260 const float coord_range_1 = coord_range != 0.0f ? 1.0f / coord_range : 1.0f;
261 for (
size_t i = 0; i < m_points.size(); i++)
267 coord = m_points[i].x;
270 coord = m_points[i].y;
273 coord = m_points[i].z;
276 const float col_idx =
277 std::max(0.0f,
std::min(1.0f, (
coord - coord_min) * coord_range_1));
280 this->setPointColor_fast(i,
r,
g,
b);
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.
TColormap
Different colormaps for use in mrpt::img::colormap()
Global variables to change the run-time behaviour of some MRPT classes within mrpt-base.
GLAPI void GLAPIENTRY glEnable(GLenum cap)
GLAPI void GLAPIENTRY glPointSize(GLfloat size)
mrpt::serialization::CArchive & operator<<(mrpt::serialization::CArchive &out, const mrpt::opengl::CLight &o)
#define ASSERT_BELOW_(__A, __B)
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
A cloud of points, each one with an individual colour (R,G,B).
This file implements several operations that operate element-wise on individual or pairs of container...
The base class of 3D objects that can be directly rendered through OpenGL.
#define GL_ONE_MINUS_SRC_ALPHA
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void setPoint(size_t i, const TPointColour &p)
Write an individual point (checks for "i" in the valid range only in Debug).
This base provides a set of functions for maths stuff.
Lightweight 3D point (float version).
void OCTREE_RENDER_MAX_DENSITY_POINTS_PER_SQPIXEL(float value)
Default value = 0.01 points/px^2.
Information about the rendering process being issued.
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...
size_t PLY_export_get_vertex_count() const override
In a base class, return the number of vertices.
GLAPI void GLAPIENTRY glBegin(GLenum mode)
#define ASSERT_ABOVEEQ_(__A, __B)
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Virtual base class for "archives": classes abstracting I/O streams.
GLdouble GLdouble GLdouble r
void push_back(float x, float y, float z, float R, float G, float B)
Inserts a new point into the point cloud.
void checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
A RGB color - floats in the range [0,1].
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...
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)
The namespace for 3D scene representation and rendering.
void getCurrentRenderingInfo(TRenderInfo &ri)
Gather useful information on the render parameters.
GLAPI void GLAPIENTRY glEnd(void)
mrpt::serialization::CArchive & operator>>(mrpt::serialization::CArchive &in, mrpt::opengl::CLight &o)
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
GLAPI void GLAPIENTRY glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to 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,2 for X,Y,Z) and the given color map.
unsigned __int32 uint32_t
GLAPI void GLAPIENTRY glDisable(GLenum cap)
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.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
void markAllPointsAsNew()
Do needed internal work if all points are new (octree rebuilt,...)
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.
int round(const T value)
Returns the closer integer (int) to x.