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 
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
mrpt::opengl::CLight::linear_attenuation
float linear_attenuation
Definition: CLight.h:44
utils_defs.h
mrpt::utils::TTypeName< mrpt::opengl::CLight >::get
static std::string get()
Definition: CLight.h:64
mrpt::opengl::CLight
Each of the possible lights of a 3D scene.
Definition: CLight.h:28
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CParticleFilter.h:16
mrpt::opengl::CLight::light_ID
uint8_t light_ID
OpenGL ID (typical range: 0-7)
Definition: CLight.h:35
TTypeName.h
mrpt::utils::CStream
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
mrpt::opengl::CLight::quadratic_attenuation
float quadratic_attenuation
Definition: CLight.h:45
mrpt::opengl::operator<<
OPENGL_IMPEXP mrpt::utils::CStream & operator<<(mrpt::utils::CStream &out, const mrpt::opengl::CLight &o)
mrpt::opengl::operator>>
::mrpt::utils::CStream & operator>>(mrpt::utils::CStream &in, CAngularObservationMeshPtr &pObj)
mrpt::opengl::CLight::spot_exponent
float spot_exponent
Definition: CLight.h:46
mrpt::utils::TTypeName
A template to obtain the type of its argument as a string at compile time.
Definition: TTypeName.h:47
mrpt::opengl::CLight::constant_attenuation
float constant_attenuation
Definition: CLight.h:43
mrpt::opengl::CLight::spot_cutoff
float spot_cutoff
Definition: CLight.h:47



Page generated by Doxygen 1.8.16 for MRPT 1.4.0 SVN: at Mon Oct 14 23:11:08 UTC 2019