MRPT  1.9.9
CLight.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
13 namespace mrpt::opengl
14 {
15 /** Each of the possible lights of a 3D scene \sa COpenGLViewport
16  * *IMPORTANT NOTE*: It's the user responsibility to define unique light IDs
17  * for each light.
18  * The OpenGL standard only assures that valid IDs are 0,1,..7
19  * Refer to standard OpenGL literature and tutorials for the meaning of each
20  * field.
21  */
22 struct CLight
23 {
24  /** Default constructor, sets default values */
25  CLight();
26 
27  void setPosition(float x, float y, float z, float w);
28  void setDirection(float dx, float dy, float dz);
29 
30  /** OpenGL ID (typical range: 0-7) */
31  uint8_t light_ID{0};
32 
33  float color_ambient[4];
34  float color_diffuse[4];
35  float color_specular[4];
36 
37  /** [x,y,z,w]: w=0 means directional light, w=1 means a light at a real 3D
38  * position. */
39  float position[4];
40  /** [x,y,z] */
41  float direction[3];
43  float linear_attenuation{0.f};
45  float spot_exponent{0.f};
46  float spot_cutoff{180.f};
47 
50 
51  /** Define the light in the current OpenGL rendering context (users normally
52  * don't need to call this explicitly, it's done from within a \sa
53  * COpenGLViewport) */
54  void sendToOpenGL() const;
55 
57 };
58 
63 
64 } // namespace mrpt::opengl
float direction[3]
[x,y,z]
Definition: CLight.h:41
float constant_attenuation
Definition: CLight.h:42
mrpt::serialization::CArchive & operator<<(mrpt::serialization::CArchive &out, const mrpt::opengl::CLight &o)
Definition: CLight.cpp:122
CLight()
Default constructor, sets default values.
Definition: CLight.cpp:22
void readFromStream(mrpt::serialization::CArchive &in)
Definition: CLight.cpp:58
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:80
void writeToStream(mrpt::serialization::CArchive &out) const
Definition: CLight.cpp:43
Each of the possible lights of a 3D scene.
Definition: CLight.h:22
float color_specular[4]
Definition: CLight.h:35
#define DECLARE_TTYPENAME_CLASSNAME(_CLASSNAME)
Like DECLARE_CUSTOM_TTYPENAME(), but for use within the class declaration body.
Definition: TTypeName.h:104
float spot_exponent
Definition: CLight.h:45
Virtual base class for "archives": classes abstracting I/O streams.
Definition: CArchive.h:54
mrpt::vision::TStereoCalibResults out
float linear_attenuation
Definition: CLight.h:43
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:15
uint8_t light_ID
OpenGL ID (typical range: 0-7)
Definition: CLight.h:31
mrpt::serialization::CArchive & operator>>(mrpt::serialization::CArchive &in, mrpt::opengl::CLight &o)
Definition: CLight.cpp:116
float color_ambient[4]
Definition: CLight.h:33
float color_diffuse[4]
Definition: CLight.h:34
float quadratic_attenuation
Definition: CLight.h:44
void setPosition(float x, float y, float z, float w)
Definition: CLight.cpp:100
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:39
void setDirection(float dx, float dy, float dz)
Definition: CLight.cpp:107



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 338471620 Mon Feb 17 00:12:39 2020 +0100 at lun feb 17 00:15:10 CET 2020