Go to the documentation of this file.
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;
TPoint3D_< double > TPoint3D
Lightweight 3D point.
void notifyChange() const
Call to enable calling renderUpdateBuffers() before the next render() rendering iteration.
void insertTriangles(const InputIterator &begin, const InputIterator &end)
Inserts a set of triangles, bounded by iterators, into this set.
A set of colored triangles, able to draw any solid, arbitrarily complex object without textures.
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Simulation of ray-trace, given a pose.
The base class of 3D objects that can be directly rendered through OpenGL.
CRenderizable & setColorR_u8(const uint8_t r) override
Overwrite all triangles colors with the one provided.
void onUpdateBuffers_Triangles() override
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
mrpt::vision::TStereoCalibResults out
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
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 updatePolygons() const
Explicitly updates the internal polygon cache, with all triangles as polygons.
CRenderizable & setColor_u8(const mrpt::img::TColor &c) override
Overwrite all triangles colors with the one provided.
bool traceRay(const std::vector< TPolygonWithPlane > &vec, const mrpt::math::TPose3D &pose, double &dist)
Fast ray tracing method using polygons' properties.
Virtual base class for "archives": classes abstracting I/O streams.
CRenderizable & setColorB_u8(const uint8_t b) override
Overwrite all triangles colors with the one provided.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
CRenderizable & setColorA_u8(const uint8_t a) override
Overwrite all triangles colors with the one provided.
const float & x(size_t i) const
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 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.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
3D polygon, inheriting from std::vector<TPoint3D>
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
CRenderizable & setColorG_u8(const uint8_t g) override
Overwrite all triangles colors with the one provided.
A triangle (float coordinates) with RGBA colors (u8) and UV (texture coordinates) for each vertex.
const float & y(size_t i) const
const float & z(size_t i) const
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
std::shared_ptr< mrpt::opengl ::CSetOfTriangles > Ptr
This base provides a set of functions for maths stuff.
Renderizable generic renderer for objects using the triangles shader.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
IMPLEMENTS_SERIALIZABLE(CSetOfTriangles, CRenderizableShaderTriangles, mrpt::opengl) void CSetOfTriangles
void getPolygons(std::vector< mrpt::math::TPolygon3D > &polys) const
Gets the polygon cache.
The namespace for 3D scene representation and rendering.
Page generated by Doxygen 1.8.18 for MRPT 2.0.4 at Thu Sep 24 07:14:18 UTC 2020 | |