Main MRPT website
>
C++ reference
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
mrpt
opengl
C3DSScene.h
Go to the documentation of this file.
1
/* +---------------------------------------------------------------------------+
2
| The Mobile Robot Programming Toolkit (MRPT) C++ library |
3
| |
4
| http://www.mrpt.org/ |
5
| |
6
| Copyright (C) 2005-2012 University of Malaga |
7
| |
8
| This software was written by the Machine Perception and Intelligent |
9
| Robotics Lab, University of Malaga (Spain). |
10
| Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11
| |
12
| This file is part of the MRPT project. |
13
| |
14
| MRPT is free software: you can redistribute it and/or modify |
15
| it under the terms of the GNU General Public License as published by |
16
| the Free Software Foundation, either version 3 of the License, or |
17
| (at your option) any later version. |
18
| |
19
| MRPT is distributed in the hope that it will be useful, |
20
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
21
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22
| GNU General Public License for more details. |
23
| |
24
| You should have received a copy of the GNU General Public License |
25
| along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26
| |
27
+---------------------------------------------------------------------------+ */
28
#ifndef opengl_C3DSScene_H
29
#define opengl_C3DSScene_H
30
31
#include <
mrpt/opengl/CRenderizableDisplayList.h
>
32
#include <
mrpt/opengl/COpenGLScene.h
>
33
#include <
mrpt/utils/CMemoryChunk.h
>
34
35
namespace
mrpt
36
{
37
namespace
opengl
38
{
39
class
OPENGL_IMPEXP
C3DSScene
;
40
41
// This must be added to any CSerializable derived class:
42
DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE
(
C3DSScene
,
CRenderizableDisplayList
,
OPENGL_IMPEXP
)
43
44
/** This element keeps a set of objects imported from a 3DStudio file (.3ds).
45
* This class uses the opensource library <a href="http://lib3ds.sourceforge.net/" >lib3ds</a> internally.
46
* \sa opengl::COpenGLScene
47
* \ingroup mrpt_opengl_grp
48
*/
49
class
OPENGL_IMPEXP
C3DSScene
: public
CRenderizableDisplayList
50
{
51
DEFINE_SERIALIZABLE
(
C3DSScene
)
52
53
54
public:
55
56
/** Render child objects.
57
*/
58
void
render_dl() const;
59
60
/** 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.
61
* Previous contents are lost.
62
* If the file ends in ".gz", it'll be automatically decompressed using gzip (see mrpt::compress::zip).
63
*/
64
void
loadFrom3DSFile( const std::
string
&file_name );
65
66
/** Initializes all textures in the scene (See opengl::CTexturedPlane::loadTextureInOpenGL)
67
*/
68
void
initializeAllTextures();
69
70
/** Empty the object */
71
void
clear();
72
73
/** Evaluates the scene at a given animation time
74
*/
75
void
evaluateAnimation(
double
time_anim );
76
77
/** Enables an extra ambient light */
78
void
enableExtraAmbientLight(
bool
enable=true) { m_enable_extra_lighting=enable;
CRenderizableDisplayList::notifyChange
(); }
79
80
/* Simulation of ray-trace. */
81
virtual
bool
traceRay
(
const
mrpt::poses::CPose3D
&o,
double
&dist)
const
;
82
83
private
:
84
/** Default constructor
85
*/
86
C3DSScene
( );
87
88
/** Private, virtual destructor: only can be deleted from smart pointers */
89
virtual
~
C3DSScene
();
90
91
/** A container for automatic deletion of lib3ds's scene when the last reference of the smart_ptr's is destroyed.
92
*/
93
struct
TImpl3DS
94
{
95
TImpl3DS
();
96
~
TImpl3DS
();
97
void
*
file
;
//!< Lib3dsFile*
98
};
99
100
/** An internal pointer to the lib3ds library's object of type "Lib3dsFile"
101
*/
102
stlplus::smart_ptr<TImpl3DS>
m_3dsfile
;
103
104
/** Scale of the object */
105
//double m_scale_x,m_scale_y,m_scale_z;
106
107
bool
m_enable_extra_lighting
;
108
109
//float m_light_cons_attenuation; //!< OpenGL Light attenuation factor (default=1.0)
110
//float m_light_lin_attenuation; //!< OpenGL Light attenuation factor (default=0.0)
111
//float m_light_quad_attenuation; //!< OpenGL Light attenuation factor (default=0.0)
112
};
113
114
115
}
// end namespace
116
117
}
// End of namespace
118
119
120
#endif
Page generated by
Doxygen 1.8.3
for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013