35 writeToStreamRender(
out);
36 auto n = (uint32_t)m_triangles.size();
38 for (
size_t i = 0; i < n; i++) m_triangles[i].writeTo(
out);
47 readFromStreamRender(in);
51 for (
size_t i = 0; i < n; i++) m_triangles[i].readFrom(in);
57 polygonsUpToDate =
false;
64 if (!polygonsUpToDate) updatePolygons();
71 for (
auto& t : m_triangles) t.setColor(c);
79 for (
auto& t : m_triangles) t.setColor(m_color);
87 for (
auto& t : m_triangles) t.setColor(m_color);
95 for (
auto& t : m_triangles) t.setColor(m_color);
103 for (
auto& t : m_triangles) t.setColor(m_color);
108 std::vector<mrpt::math::TPolygon3D>& polys)
const 110 if (!polygonsUpToDate) updatePolygons();
111 size_t N = m_polygons.size();
112 for (
size_t i = 0; i < N; i++) polys[i] = m_polygons[i].poly;
118 size_t N = m_triangles.size();
119 m_polygons.resize(N);
120 for (
size_t i = 0; i < N; i++)
121 for (
size_t j = 0; j < 3; j++)
129 polygonsUpToDate =
true;
137 std::numeric_limits<double>::max(), std::numeric_limits<double>::max(),
138 std::numeric_limits<double>::max());
140 -std::numeric_limits<double>::max(),
141 -std::numeric_limits<double>::max(),
142 -std::numeric_limits<double>::max());
144 for (
const auto& t : m_triangles)
175 reserve(m_triangles.size() + p->m_triangles.size());
177 m_triangles.end(), p->m_triangles.begin(), p->m_triangles.end());
178 polygonsUpToDate =
false;
void keep_min(T &var, const K test_val)
If the second argument is below the first one, set the first argument to this lower value...
CRenderizable & setColorG_u8(const uint8_t g) override
Overwrite all triangles colors with the one provided.
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Simulation of ray-trace, given a pose.
void getPolygons(std::vector< mrpt::math::TPolygon3D > &polys) const
Gets the polygon cache.
bool traceRay(const std::vector< TPolygonWithPlane > &vec, const mrpt::math::TPose3D &pose, double &dist)
Fast ray tracing method using polygons' properties.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
void notifyChange() const
Call to enable calling renderUpdateBuffers() before the next render() rendering iteration.
const float & x(size_t i) const
A triangle (float coordinates) with RGBA colors (u8) and UV (texture coordinates) for each vertex...
The base class of 3D objects that can be directly rendered through OpenGL.
void onUpdateBuffers_Triangles() override
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
Renderizable generic renderer for objects using the triangles shader.
CRenderizable & setColor_u8(const mrpt::img::TColor &c) override
Overwrite all triangles colors with the one provided.
CRenderizable & setColorR_u8(const uint8_t r) override
Overwrite all triangles colors with the one provided.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
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.
IMPLEMENTS_SERIALIZABLE(CSetOfTriangles, CRenderizableShaderTriangles, mrpt::opengl) void CSetOfTriangles
TPoint3D_< double > TPoint3D
Lightweight 3D point.
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...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
void keep_max(T &var, const K test_val)
If the second argument is above the first one, set the first argument to this higher value...
void updatePolygons() const
Explicitly updates the internal polygon cache, with all triangles as polygons.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
const float & y(size_t i) const
Virtual base class for "archives": classes abstracting I/O streams.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
mrpt::vision::TStereoCalibResults out
const float & z(size_t i) const
The namespace for 3D scene representation and rendering.
A set of colored triangles, able to draw any solid, arbitrarily complex object without textures...
CRenderizable & setColorB_u8(const uint8_t b) override
Overwrite all triangles colors with the one provided.
CRenderizable & setColorA_u8(const uint8_t a) override
Overwrite all triangles colors with the one provided.
void insertTriangles(const InputIterator &begin, const InputIterator &end)
Inserts a set of triangles, bounded by iterators, into this set.
3D polygon, inheriting from std::vector<TPoint3D>