Main MRPT website > C++ reference for MRPT 1.4.0
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-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 
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 
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
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:39
::mrpt::utils::CStream & operator>>(mrpt::utils::CStream &in, CAngularObservationMeshPtr &pObj)
OPENGL_IMPEXP mrpt::utils::CStream & operator<<(mrpt::utils::CStream &out, const mrpt::opengl::CLight &o)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Each of the possible lights of a 3D scene.
Definition: CLight.h:29
uint8_t light_ID
OpenGL ID (typical range: 0-7)
Definition: CLight.h:35
float quadratic_attenuation
Definition: CLight.h:45
float constant_attenuation
Definition: CLight.h:43
float linear_attenuation
Definition: CLight.h:44
CLight()
Default constructor, sets default values.
void setPosition(float x, float y, float z, float w)
float spot_exponent
Definition: CLight.h:46
void sendToOpenGL() const
Define the light in the current OpenGL rendering context (users normally don't need to call this expl...
void setDirection(float dx, float dy, float dz)
void readFromStream(mrpt::utils::CStream &in)
void writeToStream(mrpt::utils::CStream &out) const
A template to obtain the type of its argument as a string at compile time.
Definition: TTypeName.h:48



Page generated by Doxygen 1.9.1 for MRPT 1.4.0 SVN: at Sat Jan 30 21:34:41 UTC 2021