53 writeToStreamRender(out);
56 for (
const auto& m_object : m_objects) out << *m_object;
70 readFromStreamRender(
in);
91 #if MRPT_HAS_OPENGL_GLUT 92 CListOpenGLObjects::iterator it;
93 for (
auto&
obj : m_objects)
108 newObject.get() !=
this,
109 "Error: Trying to insert container into itself!");
110 m_objects.push_back(newObject);
118 for (
auto& m_object : m_objects)
121 string s(m_object->GetRuntimeClass()->className);
122 if (m_object->m_name.size())
123 s +=
string(
" (") + m_object->m_name +
string(
")");
126 if (m_object->GetRuntimeClass() ==
131 std::vector<std::string> auxLst;
133 for (
const auto& i : auxLst) lst.emplace_back(
string(
" ") + i);
143 for (
auto it = m_objects.begin(); it != m_objects.end(); ++it)
150 (*it)->GetRuntimeClass() ==
152 dynamic_cast<CSetOfObjects*>(it->get())->removeObject(
obj);
160 for (
const auto& m_object : m_objects)
161 if (m_object->traceRay(nueva, tmp))
189 m_objects.begin(), m_objects.end(),
191 m_color.R =
c.R, m_color.G =
c.G, m_color.B =
c.B,
198 return find(m_objects.begin(), m_objects.end(),
obj) != m_objects.end();
203 for (
auto& m_object : m_objects) m_object->
setColorR_u8(m_color.R =
r);
209 for (
auto& m_object : m_objects) m_object->
setColorG_u8(m_color.G =
g);
215 for (
auto& m_object : m_objects) m_object->
setColorB_u8(m_color.B =
b);
221 for (
auto& m_object : m_objects) m_object->
setColorA_u8(m_color.A =
a);
230 for (
auto& m_object : m_objects)
232 if (m_object->m_name == str)
235 m_object->GetRuntimeClass() ==
239 dynamic_cast<CSetOfObjects*
>(m_object.get())->getByName(str);
252 std::numeric_limits<double>::max(), std::numeric_limits<double>::max(),
253 std::numeric_limits<double>::max());
255 -std::numeric_limits<double>::max(),
256 -std::numeric_limits<double>::max(),
257 -std::numeric_limits<double>::max());
259 for (
const auto& m_object : m_objects)
262 std::numeric_limits<double>::max(),
263 std::numeric_limits<double>::max(),
264 std::numeric_limits<double>::max());
266 -std::numeric_limits<double>::max(),
267 -std::numeric_limits<double>::max(),
268 -std::numeric_limits<double>::max());
269 m_object->getBoundingBox(child_bbmin, child_bbmax);
double x
X,Y,Z coordinates.
A base class for all OpenGL objects with loadable textures.
const_iterator find(const KEY &key) const
A set of object, which are referenced to the coordinates framework established in this object...
CSetOfObjects()
Default constructor.
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
void render() const override
Render child objects.
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].
void WriteAs(const TYPE_FROM_ACTUAL &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...
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].
GLsizei GLsizei GLuint * obj
CRenderizable & setColorG_u8(const uint8_t g) override
Color components in the range [0,255].
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 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...
CRenderizable & setColorA_u8(const uint8_t a) override
Color components in the range [0,255].
virtual CRenderizable & setColorG_u8(const uint8_t g)
Color components in the range [0,255].
~CSetOfObjects() override
Private, virtual destructor: only can be deleted from smart pointers.
#define IS_DERIVED(obj, class_name)
True if the given reference to object (derived from mrpt::rtti::CObject) is an instance of the given ...
#define IS_CLASS(obj, class_name)
True if the given reference to object (derived from mrpt::rtti::CObject) is of the given class...
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
GLsizei const GLchar ** string
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).
#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.
GLdouble GLdouble GLdouble r
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).
The namespace for 3D scene representation and rendering.
FSetColor(uint8_t R, uint8_t G, uint8_t B, uint8_t A)
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
void initializeAllTextures()
Initializes all textures in the scene (See opengl::CTexturedPlane::loadTextureInOpenGL) ...
void renderSetOfObjects(const mrpt::opengl::CListOpenGLObjects &objs)
For each object in the list:
void loadTextureInOpenGL() const
VERY IMPORTANT: If you use a multi-thread application, you MUST call this from the same thread that w...
CRenderizable & setColor_u8(const mrpt::img::TColor &c) override
unsigned __int32 uint32_t
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.
GLubyte GLubyte GLubyte a
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...