Go to the documentation of this file.
9 #ifndef opengl_COpenGLScene_H
10 #define opengl_COpenGLScene_H
88 insert(objs.begin(), objs.end(), vpn);
106 template <
class T_it>
137 void clear(
bool createMainViewport =
true);
164 template <
typename T>
171 typename T::Ptr o = (*it)->getByClass<T>(ith);
174 return typename T::Ptr();
223 template <
typename FUNCTOR>
230 itO != (*it)->end(); ++itO)
241 template <
typename FUNCTOR,
typename EXTRA_PARAM>
243 FUNCTOR functor,
const EXTRA_PARAM& userParam)
const
256 template <
typename FUNCTOR>
264 std::dynamic_pointer_cast<CSetOfObjects>(o);
266 it !=
obj->end(); ++it)
286 s->insert(
v.begin(),
v.end());
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...
bool followCamera() const
Return the value of "followCamera".
EIGEN_STRONG_INLINE iterator begin()
const Scalar * const_iterator
void initializeAllTextures()
Initializes all textures in the scene (See opengl::CTexturedPlane::loadTextureInOpenGL)
void insert(const CRenderizable::Ptr &newObject, const std::string &viewportName=std::string("main"))
Insert a new object into the scene, in the given viewport (by default, into the "main" viewport).
std::vector< COpenGLViewport::Ptr > TListViewports
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives.
GLsizei GLsizei GLuint * obj
virtual ~COpenGLScene()
Destructor:
std::shared_ptr< CRenderizable > Ptr
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CListOpenGLObjects::const_iterator const_iterator
void dumpListOfObjects(std::vector< std::string > &lst)
Retrieves a list of all objects in text form.
GLdouble GLdouble GLdouble r
A set of object, which are referenced to the coordinates framework established in this object.
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max, const std::string &vpn=std::string("main")) const
Evaluates the bounding box of the scene in the given viewport (default: "main").
TListViewports m_viewports
The list of viewports, indexed by name.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
bool loadFromFile(const std::string &fil)
Loads the scene from a 3Dscene file, the format used by the application SceneViewer3D.
#define IS_CLASS(ptrObj, class_name)
Evaluates to true if the given pointer to an object (derived from mrpt::rtti::CObject) is of the give...
void enableFollowCamera(bool enabled)
If disabled (default), the SceneViewer application will ignore the camera of the "main" viewport and ...
The virtual base class which provides a unified interface for all persistent objects in MRPT.
COpenGLViewport::Ptr createViewport(const std::string &viewportName)
Creates a new viewport, adding it to the scene and returning a pointer to the new object.
std::shared_ptr< CSetOfObjects > Ptr
mrpt::serialization::CArchive & operator<<(mrpt::serialization::CArchive &out, const mrpt::opengl::CLight &o)
bool saveToFile(const std::string &fil) const
Saves the scene to a 3Dscene file, loadable by the application SceneViewer3D.
void clear(bool createMainViewport=true)
Clear the list of objects and viewports in the scene, deleting objects' memory, and leaving just the ...
static void internal_visitAllObjects(FUNCTOR functor, const CRenderizable::Ptr &o)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
size_t viewportsCount() const
CListOpenGLObjects::const_iterator const_iterator
COpenGLScene & operator=(const COpenGLScene &obj)
Copy operator:
void removeObject(const CRenderizable::Ptr &obj, const std::string &viewportName=std::string("main"))
Removes the given object from the scene (it also deletes the object to free its memory).
GLsizei const GLchar ** string
std::shared_ptr< COpenGLScene > Ptr
void insert(const T_it &begin, const T_it &end, const std::string &vpn=std::string("main"))
Inserts a set of objects into the scene, in the given viewport ("main" by default).
COpenGLViewport::Ptr getViewport(const std::string &viewportName=std::string("main")) const
Returns the viewport with the given name, or nullptr if it does not exist; note that the default view...
CRenderizable::Ptr getByName(const std::string &str, const std::string &viewportName=std::string("main"))
Returns the first object with a given name, or nullptr (an empty smart pointer) if not found.
std::shared_ptr< COpenGLViewport > Ptr
void render() const
Render this scene.
void visitAllObjects(FUNCTOR functor) const
Recursive depth-first visit all objects in all viewports of the scene, calling the user-supplied func...
void visitAllObjects(FUNCTOR functor, const EXTRA_PARAM &userParam) const
Recursive depth-first visit all objects in all viewports of the scene, calling the user-supplied func...
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const
Traces a ray.
COpenGLScene()
Constructor.
void insertCollection(const T &objs, const std::string &vpn=std::string("main"))
Inserts a set of objects into the scene, in the given viewport ("main" by default).
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |