Main MRPT website > C++ reference for MRPT 1.4.0
C3DSScene.h
Go to the documentation of this file.
1/* +---------------------------------------------------------------------------+
2 | Mobile Robot Programming Toolkit (MRPT) |
3 | http://www.mrpt.org/ |
4 | |
5 | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file |
6 | See: http://www.mrpt.org/Authors - All rights reserved. |
7 | Released under BSD License. See details in http://www.mrpt.org/License |
8 +---------------------------------------------------------------------------+ */
9#ifndef opengl_C3DSScene_H
10#define opengl_C3DSScene_H
11
15
16namespace mrpt
17{
18 namespace opengl
19 {
20 // This must be added to any CSerializable derived class:
22
23 /** This element keeps a set of objects imported from a 3DStudio file (.3ds).
24 * This class uses the opensource library <a href="http://lib3ds.sourceforge.net/" >lib3ds</a> internally.
25 * \sa opengl::COpenGLScene
26 * \ingroup mrpt_opengl_grp
27 */
29 {
31
32
33 public:
34
35 /** Render child objects.
36 */
38
39 /** Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent. */
40 void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE;
41
42 /** Loads a scene from a 3DS file (3D Studio format) into this object, from either plain .3ds format, or in gzip compressed .3ds.gz format.
43 * Previous contents are lost.
44 * If the file ends in ".gz", it'll be automatically decompressed using gzip (see mrpt::compress::zip).
45 */
46 void loadFrom3DSFile( const std::string &file_name );
47
48 /** Initializes all textures in the scene (See opengl::CTexturedPlane::loadTextureInOpenGL)
49 */
50 void initializeAllTextures();
51
52 /** Empty the object */
53 void clear();
54
55 /** Evaluates the scene at a given animation time
56 */
57 void evaluateAnimation( double time_anim );
58
59 /** Enables an extra ambient light */
60 void enableExtraAmbientLight(bool enable=true) { m_enable_extra_lighting=enable; CRenderizableDisplayList::notifyChange(); }
61
62 /* Simulation of ray-trace. */
63 bool traceRay(const mrpt::poses::CPose3D &o,double &dist) const MRPT_OVERRIDE;
64
65 private:
66 /** Default constructor
67 */
69
70 /** Private, virtual destructor: only can be deleted from smart pointers */
71 virtual ~C3DSScene();
72
73 /** A container for automatic deletion of lib3ds's scene when the last reference of the smart_ptr's is destroyed.
74 */
75 struct TImpl3DS
76 {
79 void *file; //!< Lib3dsFile*
80 };
81
82 /** An internal pointer to the lib3ds library's object of type "Lib3dsFile"
83 */
85
86 /** Scale of the object */
87 //double m_scale_x,m_scale_y,m_scale_z;
88 mrpt::math::TPoint3D m_bbox_min, m_bbox_max; //!< Bounding box
89
91
92 //float m_light_cons_attenuation; //!< OpenGL Light attenuation factor (default=1.0)
93 //float m_light_lin_attenuation; //!< OpenGL Light attenuation factor (default=0.0)
94 //float m_light_quad_attenuation; //!< OpenGL Light attenuation factor (default=0.0)
95 };
97
98
99 } // end namespace
100
101} // End of namespace
102
103
104#endif
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#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...
This element keeps a set of objects imported from a 3DStudio file (.3ds).
Definition C3DSScene.h:29
C3DSScene()
Default constructor.
stlplus::smart_ptr< TImpl3DS > m_3dsfile
An internal pointer to the lib3ds library's object of type "Lib3dsFile".
Definition C3DSScene.h:84
virtual ~C3DSScene()
Private, virtual destructor: only can be deleted from smart pointers.
void render_dl() const MRPT_OVERRIDE
Render child objects.
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const MRPT_OVERRIDE
Simulation of ray-trace, given a pose.
mrpt::math::TPoint3D m_bbox_max
Bounding box.
Definition C3DSScene.h:88
A renderizable object suitable for rendering with OpenGL's display lists.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition CPose3D.h:73
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
Definition mrpt_macros.h:28
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
STL namespace.
Lightweight 3D point.
A container for automatic deletion of lib3ds's scene when the last reference of the smart_ptr's is de...
Definition C3DSScene.h:76



Page generated by Doxygen 1.9.8 for MRPT 1.4.0 SVN: at Thu Dec 14 17:13:25 UTC 2023