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() ==
131 dynamic_cast<CSetOfObjects*>(it->get())->removeObject(obj);
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 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...
const_iterator find(const KEY &key) const
A set of object, which are referenced to the coordinates framework established in this object...
virtual CRenderizable & setColorA_u8(const uint8_t a)
Color components in the range [0,255].
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
bool contains(const CRenderizable::Ptr &obj) const
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.
std::shared_ptr< CRenderizable > Ptr
virtual CRenderizable & setColorR_u8(const uint8_t r)
Color components in the range [0,255].
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
CRenderizable & setColorR_u8(const uint8_t r) override
Color components in the range [0,255].
CRenderizable & setColorG_u8(const uint8_t g) override
Color components in the range [0,255].
Context for calls to render()
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
This base provides a set of functions for maths stuff.
virtual CRenderizable & setColorB_u8(const uint8_t b)
Color components in the range [0,255].
void renderUpdateBuffers() const override
Called whenever m_outdatedBuffers is true: used to re-generate OpenGL vertex buffers, etc.
CRenderizable & setColorA_u8(const uint8_t a) override
Color components in the range [0,255].
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...
virtual CRenderizable & setColorG_u8(const uint8_t g)
Color components in the range [0,255].
TPoint3D_< double > TPoint3D
Lightweight 3D point.
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
Rendering state related to the projection and model-view matrices.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
void removeObject(const CRenderizable::Ptr &obj)
Removes the given object from the scene (it also deletes the object to free its memory).
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...
#define CLASS_ID_NAMESPACE(class_name, namespaceName)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Virtual base class for "archives": classes abstracting I/O streams.
void dumpListOfObjects(std::vector< std::string > &lst)
Retrieves a list of all objects in text form.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
mrpt::vision::TStereoCalibResults out
void render(const RenderContext &rc) const override
Implements the rendering of 3D objects in each class derived from CRenderizable.
The namespace for 3D scene representation and rendering.
void enqueForRenderRecursive(const mrpt::opengl::TRenderMatrices &state, RenderQueue &rq) const override
FSetColor(uint8_t R, uint8_t G, uint8_t B, uint8_t A)
CRenderizable & setColor_u8(const mrpt::img::TColor &c) override
CRenderizable::Ptr getByName(const std::string &str)
Returns the first object with a given name, or a nullptr pointer if not found.
void insert(const CRenderizable::Ptr &newObject)
Insert a new object to the list.
CRenderizable & setColorB_u8(const uint8_t b) override
Color components in the range [0,255].
void clear()
Clear the contents of this container.
void operator()(CRenderizable::Ptr &p)
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...
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...