Main MRPT website > C++ reference for MRPT 1.9.9
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-2017, 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 
16 namespace mrpt
17 {
18 namespace opengl
19 {
20 /** This element keeps a set of objects imported from a 3DStudio file (.3ds).
21  * This class uses the opensource library <a
22  * href="http://lib3ds.sourceforge.net/" >lib3ds</a> internally.
23  * \sa opengl::COpenGLScene
24  * \ingroup mrpt_opengl_grp
25  */
27 {
29 
30  public:
31  /** Render child objects.
32  */
33  void render_dl() const override;
34 
35  /** Evaluates the bounding box of this object (including possible children)
36  * in the coordinate frame of the object parent. */
37  void getBoundingBox(
38  mrpt::math::TPoint3D& bb_min,
39  mrpt::math::TPoint3D& bb_max) const override;
40 
41  /** Loads a scene from a 3DS file (3D Studio format) into this object, from
42  * 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
45  * gzip (see mrpt::compress::zip).
46  */
47  void loadFrom3DSFile(const std::string& file_name);
48 
49  /** Initializes all textures in the scene (See
50  * opengl::CTexturedPlane::loadTextureInOpenGL)
51  */
52  void initializeAllTextures();
53 
54  /** Empty the object */
55  void clear();
56 
57  /** Evaluates the scene at a given animation time
58  */
59  void evaluateAnimation(double time_anim);
60 
61  /** Enables an extra ambient light */
62  void enableExtraAmbientLight(bool enable = true)
63  {
64  m_enable_extra_lighting = enable;
66  }
67 
68  /* Simulation of ray-trace. */
69  bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const override;
70 
71  /** Default constructor
72  */
73  C3DSScene();
74 
75  /** Private, virtual destructor: only can be deleted from smart pointers */
76  virtual ~C3DSScene();
77 
78  private:
79  /** A container for automatic deletion of lib3ds's scene when the last
80  * reference of the smart_ptr's is destroyed.
81  */
82  struct TImpl3DS
83  {
84  TImpl3DS();
85  ~TImpl3DS();
86  /** Lib3dsFile* */
87  void* file;
88  };
89 
90  /** An internal pointer to the lib3ds library's object of type "Lib3dsFile"
91  */
92  std::shared_ptr<TImpl3DS> m_3dsfile;
93 
94  /** Scale of the object */
95  // double m_scale_x,m_scale_y,m_scale_z;
96  /** Bounding box */
98 
100 
101  // float m_light_cons_attenuation; //!< OpenGL Light attenuation
102  // factor
103  // (default=1.0)
104  // float m_light_lin_attenuation; //!< OpenGL Light attenuation
105  // factor
106  // (default=0.0)
107  // float m_light_quad_attenuation; //!< OpenGL Light attenuation
108  // factor
109  // (default=0.0)
110 };
111 
112 } // end namespace
113 
114 } // End of namespace
115 
116 #endif
std::shared_ptr< TImpl3DS > m_3dsfile
An internal pointer to the lib3ds library&#39;s object of type "Lib3dsFile".
Definition: C3DSScene.h:92
void * file
Lib3dsFile*.
Definition: C3DSScene.h:87
C3DSScene()
Default constructor.
Definition: C3DSScene.cpp:590
void render_dl() const override
Render child objects.
Definition: C3DSScene.cpp:57
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
mrpt::math::TPoint3D m_bbox_min
Scale of the object.
Definition: C3DSScene.h:97
void initializeAllTextures()
Initializes all textures in the scene (See opengl::CTexturedPlane::loadTextureInOpenGL) ...
Definition: C3DSScene.cpp:583
void clear()
Empty the object.
Definition: C3DSScene.cpp:600
void loadFrom3DSFile(const std::string &file_name)
Loads a scene from a 3DS file (3D Studio format) into this object, from either plain ...
Definition: C3DSScene.cpp:606
A renderizable object suitable for rendering with OpenGL&#39;s display lists.
GLsizei const GLchar ** string
Definition: glext.h:4101
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...
Definition: C3DSScene.cpp:748
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 container for automatic deletion of lib3ds&#39;s scene when the last reference of the smart_ptr&#39;s is de...
Definition: C3DSScene.h:82
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Simulation of ray-trace, given a pose.
Definition: C3DSScene.cpp:771
virtual ~C3DSScene()
Private, virtual destructor: only can be deleted from smart pointers.
Definition: C3DSScene.cpp:596
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
mrpt::math::TPoint3D m_bbox_max
Definition: C3DSScene.h:97
void enableExtraAmbientLight(bool enable=true)
Enables an extra ambient light.
Definition: C3DSScene.h:62
Lightweight 3D point.
void evaluateAnimation(double time_anim)
Evaluates the scene at a given animation time.
Definition: C3DSScene.cpp:735
This element keeps a set of objects imported from a 3DStudio file (.3ds).
Definition: C3DSScene.h:26



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019