30 octree_assure_uptodate();
31 m_last_rendered_count_ongoing = 0;
37 &tst[1].x == (&tst[0].x + 3),
"memory layout not as expected");
39 &tst[1].y == (&tst[0].y + 3),
"memory layout not as expected");
41 &tst[1].z == (&tst[0].z + 3),
"memory layout not as expected");
46 octree_assure_uptodate();
47 m_last_rendered_count_ongoing = 0;
61 m_last_rendered_count = m_last_rendered_count_ongoing;
66 [[maybe_unused]]
const bool all,
67 [[maybe_unused]]
const std::vector<size_t>& idxs,
68 [[maybe_unused]]
const float render_area_sqpixels)
const 70 #if 0 && MRPT_HAS_OPENGL_GLUT 72 const size_t N = all ? m_points.size() : idxs.size();
76 render_area_sqpixels))));
78 m_last_rendered_count_ongoing += N / decimation;
80 m_last_rendered_count_ongoing +=
81 (all ? m_points.size() : idxs.size()) / decimation;
85 for (
size_t i = 0; i < N; i += decimation)
87 const TPointColour& p = m_points[i];
88 glColor4ub(p.r, p.g, p.b, m_color.A);
89 glVertex3f(p.pt.x, p.pt.y, p.pt.z);
94 for (
size_t i = 0; i < N; i += decimation)
96 const TPointColour& p = m_points[idxs[i]];
97 glColor4ub(p.r, p.g, p.b, m_color.A);
98 glVertex3f(p.pt.x, p.pt.y, p.pt.z);
107 writeToStreamRender(
out);
108 out << m_points << m_point_colors;
123 "Binary backward compatibility lost for this class.");
128 readFromStreamRender(in);
129 in >> m_points >> m_point_colors;
137 markAllPointsAsNew();
149 auto& c = m_point_colors[i];
157 markAllPointsAsNew();
163 float x,
float y,
float z,
float R,
float G,
float B,
float A)
165 m_points.emplace_back(x, y, z);
170 markAllPointsAsNew();
217 auto& p = m_points[idx];
218 auto& p_color = m_point_colors[idx];
225 const float coord_min,
const float coord_max,
const int coord_index,
231 const float coord_range = coord_max - coord_min;
232 const float coord_range_1 = coord_range != 0.0f ? 1.0f / coord_range : 1.0f;
233 for (
size_t i = 0; i < m_points.size(); i++)
239 coord = m_points[i].x;
242 coord = m_points[i].y;
245 coord = m_points[i].z;
248 const float col_idx =
249 std::max(0.0f, std::min(1.0f, (coord - coord_min) * coord_range_1));
252 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.
#define THROW_EXCEPTION(msg)
size_t size(const MATRIXLIKE &m, const int dim)
#define ASSERT_BELOW_(__A, __B)
#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.
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.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void push_back(float x, float y, float z, float R, float G, float B, float A=1)
Inserts a new point into the point cloud.
float d2f(const double d)
shortcut for static_cast<float>(double)
void params_deserialize(mrpt::serialization::CArchive &in)
This base provides a set of functions for maths stuff.
void OCTREE_RENDER_MAX_DENSITY_POINTS_PER_SQPIXEL(float value)
Default value = 0.01 points/px^2.
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.
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
XYZ point (float) + RGBA(u8)
#define ASSERT_ABOVEEQ_(__A, __B)
void params_serialize(mrpt::serialization::CArchive &out) const
uint8_t f2u8(const float f)
converts a float [0,1] into an uint8_t [0,255] (without checking for out of bounds) ...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Virtual base class for "archives": classes abstracting I/O streams.
mrpt::vision::TStereoCalibResults out
An RGBA 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 setPoint(size_t i, const mrpt::math::TPointXYZfRGBAu8 &p)
Write an individual point (checks for "i" in the valid range only in Debug).
TColor asTColor() const
Returns the 0-255 integer version of this color: RGBA_u8.
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.
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()
int round(const T value)
Returns the closer integer (int) to x.