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



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019