9 #ifndef opengl_COpenGLScene_H 10 #define opengl_COpenGLScene_H 59 virtual ~COpenGLScene();
63 COpenGLScene & operator =( const COpenGLScene &obj );
67 COpenGLScene( const COpenGLScene &obj );
73 template<class T> inline
void insertCollection(const T &objs,const
std::
string &vpn=
std::
string("main")) {
74 insert(objs.begin(),objs.end(),vpn);
81 void insert(
const CRenderizablePtr &newObject,
const std::string &viewportName=std::string(
"main"));
87 template<
class T_it>
inline void insert(
const T_it &
begin,
const T_it &
end,
const std::string &vpn=std::string(
"main")) {
88 for (T_it it=begin;it!=
end;it++) insert(*it,vpn);
95 COpenGLViewportPtr createViewport(
const std::string &viewportName );
99 COpenGLViewportPtr getViewport(
const std::string &viewportName = std::string(
"main") )
const;
109 void clear(
bool createMainViewport =
true );
123 CRenderizablePtr getByName(
const std::string &str,
const std::string &viewportName = std::string(
"main") );
132 template <
typename T>
133 typename T::SmartPtr
getByClass(
const size_t &ith = 0 )
const 138 typename T::SmartPtr o = (*it)->getByClass<T>(ith);
139 if (o.present())
return o;
141 return typename T::SmartPtr();
148 void removeObject(
const CRenderizablePtr &obj,
const std::string &viewportName = std::string(
"main") );
152 void initializeAllTextures();
162 bool saveToFile(
const std::string &fil)
const;
168 bool loadFromFile(
const std::string &fil);
180 template <
typename FUNCTOR>
186 internal_visitAllObjects(functor, *itO);
194 template <
typename FUNCTOR,
typename EXTRA_PARAM>
196 visitAllObjects( std::bind2nd(functor,userParam) );
207 template <
typename FUNCTOR>
213 CSetOfObjectsPtr obj = CSetOfObjectsPtr(o);
215 internal_visitAllObjects(functor,*it);
223 inline COpenGLScenePtr &operator<<(COpenGLScenePtr &s,const CRenderizablePtr &r) {
228 template <
class T>
inline COpenGLScenePtr &operator<<(COpenGLScenePtr &s,const std::vector<T> &v) {
229 s->insert(v.begin(),v.end());
EIGEN_STRONG_INLINE iterator end()
A set of object, which are referenced to the coordinates framework established in this object...
void visitAllObjects(FUNCTOR functor) const
Recursive depth-first visit all objects in all viewports of the scene, calling the user-supplied func...
The virtual base class which provides a unified interface for all persistent objects in MRPT...
EIGEN_STRONG_INLINE iterator begin()
const Scalar * const_iterator
A class for storing a list of text lines.
std::vector< COpenGLViewportPtr > TListViewports
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
T::SmartPtr getByClass(const size_t &ith=0) const
Returns the i'th object of a given class (or of a descendant class), or NULL (an empty smart pointer)...
class BASE_IMPEXP CSerializable
void enableFollowCamera(bool enabled)
If disabled (default), the SceneViewer application will ignore the camera of the "main" viewport and ...
size_t viewportsCount() const
TListViewports m_viewports
The list of viewports, indexed by name.
static void internal_visitAllObjects(FUNCTOR functor, const CRenderizablePtr &o)
bool BASE_IMPEXP traceRay(const vector< TPolygonWithPlane > &vec, const mrpt::poses::CPose3D &pose, double &dist)
Fast ray tracing method using polygons' properties.
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).
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...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
#define IS_CLASS(ptrObj, class_name)
Evaluates to true if the given pointer to an object (derived from mrpt::utils::CSerializable) is of t...
CListOpenGLObjects::const_iterator const_iterator
CListOpenGLObjects::const_iterator const_iterator
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...
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives...
bool followCamera() const
Return the value of "followCamera".
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)