Main MRPT website > C++ reference for MRPT 1.9.9
CLight.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 
10 #ifndef opengl_CLight_H
11 #define opengl_CLight_H
12 
13 #include <mrpt/utils/utils_defs.h>
14 #include <mrpt/utils/TTypeName.h>
15 
16 namespace mrpt
17 {
18 namespace utils
19 {
20 class CStream;
21 }
22 
23 namespace opengl
24 {
25 /** Each of the possible lights of a 3D scene \sa COpenGLViewport
26  * *IMPORTANT NOTE*: It's the user responsibility to define unique light IDs
27  * for each light.
28  * The OpenGL standard only assures that valid IDs are 0,1,..7
29  * Refer to standard OpenGL literature and tutorials for the meaning of each
30  * field.
31  */
32 struct CLight
33 {
34  /** Default constructor, sets default values */
35  CLight();
36 
37  void setPosition(float x, float y, float z, float w);
38  void setDirection(float dx, float dy, float dz);
39 
40  /** OpenGL ID (typical range: 0-7) */
42 
43  float color_ambient[4];
44  float color_diffuse[4];
45  float color_specular[4];
46 
47  /** [x,y,z,w]: w=0 means directional light, w=1 means a light at a real 3D
48  * position. */
49  float position[4];
50  /** [x,y,z] */
51  float direction[3];
56  float spot_cutoff;
57 
58  void writeToStream(mrpt::utils::CStream& out) const;
60 
61  /** Define the light in the current OpenGL rendering context (users normally
62  * don't need to call this explicitly, it's done from within a \sa
63  * COpenGLViewport) */
64  void sendToOpenGL() const;
65 };
66 
71 
72 } // end namespace
73 
74 namespace utils
75 {
76 template <>
78 {
79  static std::string get() { return std::string("mrpt::opengl::CLight"); }
80 };
81 }
82 
83 } // End of namespace
84 
85 #endif
float direction[3]
[x,y,z]
Definition: CLight.h:51
GLdouble GLdouble z
Definition: glext.h:3872
mrpt::utils::CStream & operator<<(mrpt::utils::CStream &out, const mrpt::opengl::CLight &o)
Definition: CLight.cpp:132
float constant_attenuation
Definition: CLight.h:52
A template to obtain the type of its argument as a string at compile time.
Definition: TTypeName.h:55
CLight()
Default constructor, sets default values.
Definition: CLight.cpp:24
void writeToStream(mrpt::utils::CStream &out) const
Definition: CLight.cpp:51
void sendToOpenGL() const
Define the light in the current OpenGL rendering context (users normally don&#39;t need to call this expl...
Definition: CLight.cpp:88
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:4178
Each of the possible lights of a 3D scene.
Definition: CLight.h:32
unsigned char uint8_t
Definition: rptypes.h:41
float color_specular[4]
Definition: CLight.h:45
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::utils::CStream & operator>>(mrpt::utils::CStream &in, mrpt::opengl::CLight &o)
Definition: CLight.cpp:126
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
float spot_exponent
Definition: CLight.h:55
float linear_attenuation
Definition: CLight.h:53
GLuint in
Definition: glext.h:7274
uint8_t light_ID
OpenGL ID (typical range: 0-7)
Definition: CLight.h:41
void readFromStream(mrpt::utils::CStream &in)
Definition: CLight.cpp:66
float color_ambient[4]
Definition: CLight.h:43
GLenum GLint GLint y
Definition: glext.h:3538
float color_diffuse[4]
Definition: CLight.h:44
GLenum GLint x
Definition: glext.h:3538
float quadratic_attenuation
Definition: CLight.h:54
void setPosition(float x, float y, float z, float w)
Definition: CLight.cpp:108
float position[4]
[x,y,z,w]: w=0 means directional light, w=1 means a light at a real 3D position.
Definition: CLight.h:49
void setDirection(float dx, float dy, float dz)
Definition: CLight.cpp:115



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