9 #ifndef opengl_CSetOfObjects_H 10 #define opengl_CSetOfObjects_H 54 insert(objs.begin(), objs.end());
70 void render()
const override;
99 typename T::Ptr
getByClass(
const size_t& ith = 0)
const;
179 o->insertCollection(
v);
185 template <
typename T>
189 size_t foundCount = 0;
193 if (*it && (*it)->GetRuntimeClass()->derivedFrom(class_ID))
194 if (foundCount++ == ith)
return std::dynamic_pointer_cast<T>(*it);
201 (*it)->GetRuntimeClass() ==
211 return typename T::Ptr();
void clear()
Clear the list of objects in the scene, deleting objects' memory.
mrpt::utils::CStream & operator<<(mrpt::utils::CStream &out, const mrpt::opengl::CLight &o)
A set of object, which are referenced to the coordinates framework established in this object...
CSetOfObjects()
Default constructor.
void insertCollection(const T &objs)
Inserts a set of objects into the list.
virtual ~CSetOfObjects()
Private, virtual destructor: only can be deleted from smart pointers.
std::deque< CRenderizable::Ptr > CListOpenGLObjects
A list of objects pointers, automatically managing memory free at destructor, and managing copies cor...
bool contains(const CRenderizable::Ptr &obj) const
void render() const override
Render child objects.
CListOpenGLObjects m_objects
The list of child objects.
virtual 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.
bool empty() const
Returns true if there are no objects.
std::shared_ptr< CRenderizable > Ptr
const Scalar * const_iterator
virtual CRenderizable & setColorR_u8(const uint8_t r) override
Color components in the range [0,255].
GLsizei GLsizei GLuint * obj
virtual CRenderizable & setColorG_u8(const uint8_t g) override
Color components in the range [0,255].
void insert(const T_it &begin, const T_it &end)
Inserts a set of objects, bounded by iterators, into the list.
A class for storing a list of text lines.
const_iterator end() const
size_t size()
Returns number of objects.
virtual CRenderizable & setColorA_u8(const uint8_t a) override
Color components in the range [0,255].
void dumpListOfObjects(mrpt::utils::CStringList &lst)
Retrieves a list of all objects in text form.
std::shared_ptr< CSetOfObjects > Ptr
GLsizei const GLchar ** string
Declares a class that represents a probability density function (pdf) of a 2D pose (x...
const_iterator begin() const
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.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
static CSetOfObjects::Ptr posePDF2opengl(const mrpt::poses::CPosePDF &o)
Returns a representation of a the PDF - this is just an auxiliary function, it's more natural to call...
virtual CRenderizable & setColor_u8(const mrpt::utils::TColor &c) override
GLdouble GLdouble GLdouble r
Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually)...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
CListOpenGLObjects::const_iterator const_iterator
The namespace for 3D scene representation and rendering.
CListOpenGLObjects::iterator iterator
A structure that holds runtime class type information.
void initializeAllTextures()
Initializes all textures in the scene (See opengl::CTexturedPlane::loadTextureInOpenGL) ...
Declares a class that represents a Probability Distribution function (PDF) of a 3D point (x...
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
virtual CRenderizable & setColorB_u8(const uint8_t b) override
Color components in the range [0,255].
Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually)...
virtual 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...
T::Ptr getByClass(const size_t &ith=0) const
Returns the i'th object of a given class (or of a descendant class), or nullptr (an empty smart point...