Go to the documentation of this file.
51 writeToStreamRender(
out);
53 out.WriteAs<uint32_t>(m_objects.size());
54 for (
const auto& m_object : m_objects)
out << *m_object;
68 readFromStreamRender(in);
87 newObject.get() !=
this,
88 "Error: Trying to insert container into itself!");
89 m_objects.push_back(newObject);
97 for (
auto& m_object : m_objects)
100 string s(m_object->GetRuntimeClass()->className);
101 if (m_object->m_name.size())
102 s += string(
" (") + m_object->m_name + string(
")");
105 if (m_object->GetRuntimeClass() ==
110 std::vector<std::string> auxLst;
112 for (
const auto& i : auxLst) lst.emplace_back(
string(
" ") + i);
122 for (
auto it = m_objects.begin(); it != m_objects.end(); ++it)
129 (*it)->GetRuntimeClass() ==
139 for (
const auto& m_object : m_objects)
140 if (m_object->traceRay(nueva, tmp))
159 : r(
R), g(
G), b(B), a(
A)
168 m_objects.begin(), m_objects.end(),
170 m_color.R = c.
R, m_color.G = c.
G, m_color.B = c.
B,
177 return find(m_objects.begin(), m_objects.end(), obj) != m_objects.end();
182 for (
auto& m_object : m_objects) m_object->
setColorR_u8(m_color.R = r);
188 for (
auto& m_object : m_objects) m_object->
setColorG_u8(m_color.G = g);
194 for (
auto& m_object : m_objects) m_object->
setColorB_u8(m_color.B = b);
200 for (
auto& m_object : m_objects) m_object->
setColorA_u8(m_color.A = a);
209 for (
auto& m_object : m_objects)
211 if (m_object->m_name == str)
214 m_object->GetRuntimeClass() ==
218 dynamic_cast<CSetOfObjects*
>(m_object.get())->getByName(str);
231 std::numeric_limits<double>::max(), std::numeric_limits<double>::max(),
232 std::numeric_limits<double>::max());
234 -std::numeric_limits<double>::max(),
235 -std::numeric_limits<double>::max(),
236 -std::numeric_limits<double>::max());
238 for (
const auto& m_object : m_objects)
241 std::numeric_limits<double>::max(),
242 std::numeric_limits<double>::max(),
243 std::numeric_limits<double>::max());
245 -std::numeric_limits<double>::max(),
246 -std::numeric_limits<double>::max(),
247 -std::numeric_limits<double>::max());
248 m_object->getBoundingBox(child_bbmin, child_bbmax);
void dumpListOfObjects(std::vector< std::string > &lst)
Retrieves a list of all objects in text form
void clear()
Clear the contents of this container.
virtual CRenderizable & setColorG_u8(const uint8_t g)
Color components in the range [0,255].
TPoint3D_< double > TPoint3D
Lightweight 3D point.
std::map< shader_id_t, std::multimap< float, RenderQueueElement > > RenderQueue
A queue for rendering, sorted by shader program to minimize changes of OpenGL shader programs while r...
void render(const RenderContext &rc) const override
Implements the rendering of 3D objects in each class derived from CRenderizable.
bool contains(const CRenderizable::Ptr &obj) const
void removeObject(const CRenderizable::Ptr &obj)
Removes the given object from the scene (it also deletes the object to free its memory).
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.
CRenderizable & setColorG_u8(const uint8_t g) override
Color components in the range [0,255].
virtual CRenderizable & setColorA_u8(const uint8_t a)
Color components in the range [0,255].
const_iterator find(const KEY &key) const
virtual CRenderizable & setColorB_u8(const uint8_t b)
Color components in the range [0,255].
CRenderizable::Ptr getByName(const std::string &str)
Returns the first object with a given name, or a nullptr pointer if not found.
FSetColor(uint8_t R, uint8_t G, uint8_t B, uint8_t A)
mrpt::vision::TStereoCalibResults out
void insert(const CRenderizable::Ptr &newObject)
Insert a new object to the list.
std::shared_ptr< CRenderizable > Ptr
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void enqueForRenderRecursive(const mrpt::opengl::TRenderMatrices &state, RenderQueue &rq) const override
virtual CRenderizable & setColorR_u8(const uint8_t r)
Color components in the range [0,255].
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
CRenderizable & setColorB_u8(const uint8_t b) override
Color components in the range [0,255].
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...
Virtual base class for "archives": classes abstracting I/O streams.
void operator()(CRenderizable::Ptr &p)
A set of object, which are referenced to the coordinates framework established in this object.
CRenderizable & setColorA_u8(const uint8_t a) override
Color components in the range [0,255].
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
void renderUpdateBuffers() const override
Called whenever m_outdatedBuffers is true: used to re-generate OpenGL vertex buffers,...
#define CLASS_ID_NAMESPACE(class_name, namespaceName)
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
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.
Context for calls to render()
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Simulation of ray-trace, given a pose.
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
void enqueForRendering(const mrpt::opengl::CListOpenGLObjects &objs, const mrpt::opengl::TRenderMatrices &state, RenderQueue &rq)
Processes, recursively, all objects in the list, classifying them by shader programs into a list suit...
Rendering state related to the projection and model-view matrices.
This base provides a set of functions for maths stuff.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
CRenderizable & setColorR_u8(const uint8_t r) override
Color components in the range [0,255].
The namespace for 3D scene representation and rendering.
CRenderizable & setColor_u8(const mrpt::img::TColor &c) override
Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Thu May 21 21:53:32 UTC 2020 | |