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-2018, 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 #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) */
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];
46  float spot_cutoff;
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 }
65 
float direction[3]
[x,y,z]
Definition: CLight.h:41
GLdouble GLdouble z
Definition: glext.h:3872
float constant_attenuation
Definition: CLight.h:42
mrpt::serialization::CArchive & operator<<(mrpt::serialization::CArchive &out, const mrpt::opengl::CLight &o)
Definition: CLight.cpp:128
CLight()
Default constructor, sets default values.
Definition: CLight.cpp:22
void readFromStream(mrpt::serialization::CArchive &in)
Definition: CLight.cpp:64
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:86
void writeToStream(mrpt::serialization::CArchive &out) const
Definition: CLight.cpp:49
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:4178
Each of the possible lights of a 3D scene.
Definition: CLight.h:22
unsigned char uint8_t
Definition: rptypes.h:41
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:100
float spot_exponent
Definition: CLight.h:45
Virtual base class for "archives": classes abstracting I/O streams.
Definition: CArchive.h:52
float linear_attenuation
Definition: CLight.h:43
GLuint in
Definition: glext.h:7274
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:122
float color_ambient[4]
Definition: CLight.h:33
GLenum GLint GLint y
Definition: glext.h:3538
float color_diffuse[4]
Definition: CLight.h:34
GLenum GLint x
Definition: glext.h:3538
float quadratic_attenuation
Definition: CLight.h:44
void setPosition(float x, float y, float z, float w)
Definition: CLight.cpp:106
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:113



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020