MRPT  1.9.9
mrpt::opengl::CLight Struct Reference

Detailed Description

Each of the possible lights of a 3D scene.

See also
COpenGLViewport IMPORTANT NOTE: It's the user responsibility to define unique light IDs for each light. The OpenGL standard only assures that valid IDs are 0,1,..7 Refer to standard OpenGL literature and tutorials for the meaning of each field.

Definition at line 22 of file CLight.h.

#include <mrpt/opengl/CLight.h>

Public Member Functions

 CLight ()
 Default constructor, sets default values. More...
 
void setPosition (float x, float y, float z, float w)
 
void setDirection (float dx, float dy, float dz)
 
void writeToStream (mrpt::serialization::CArchive &out) const
 
void readFromStream (mrpt::serialization::CArchive &in)
 
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. More...
 

Public Attributes

uint8_t light_ID {0}
 OpenGL ID (typical range: 0-7) More...
 
float color_ambient [4]
 
float color_diffuse [4]
 
float color_specular [4]
 
float position [4]
 [x,y,z,w]: w=0 means directional light, w=1 means a light at a real 3D position. More...
 
float direction [3]
 [x,y,z] More...
 
float constant_attenuation {1.f}
 
float linear_attenuation {0.f}
 
float quadratic_attenuation {0.f}
 
float spot_exponent {0.f}
 
float spot_cutoff {180.f}
 

Constructor & Destructor Documentation

◆ CLight()

CLight::CLight ( )

Default constructor, sets default values.

Definition at line 22 of file CLight.cpp.

Member Function Documentation

◆ readFromStream()

void CLight::readFromStream ( mrpt::serialization::CArchive in)

Definition at line 59 of file CLight.cpp.

References MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION.

Referenced by mrpt::opengl::operator>>().

Here is the caller graph for this function:

◆ sendToOpenGL()

void CLight::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.

See also
COpenGLViewport)

Definition at line 81 of file CLight.cpp.

References GL_AMBIENT, GL_CONSTANT_ATTENUATION, GL_DIFFUSE, GL_LIGHT0, GL_LINEAR_ATTENUATION, GL_POSITION, GL_QUADRATIC_ATTENUATION, GL_SPECULAR, GL_SPOT_CUTOFF, GL_SPOT_DIRECTION, GL_SPOT_EXPONENT, glEnable(), glLightf(), and glLightfv().

Here is the call graph for this function:

◆ setDirection()

void CLight::setDirection ( float  dx,
float  dy,
float  dz 
)

Definition at line 108 of file CLight.cpp.

◆ setPosition()

void CLight::setPosition ( float  x,
float  y,
float  z,
float  w 
)

Definition at line 101 of file CLight.cpp.

◆ writeToStream()

void CLight::writeToStream ( mrpt::serialization::CArchive out) const

Definition at line 44 of file CLight.cpp.

Referenced by mrpt::opengl::operator<<().

Here is the caller graph for this function:

Member Data Documentation

◆ color_ambient

float mrpt::opengl::CLight::color_ambient[4]

Definition at line 33 of file CLight.h.

◆ color_diffuse

float mrpt::opengl::CLight::color_diffuse[4]

Definition at line 34 of file CLight.h.

◆ color_specular

float mrpt::opengl::CLight::color_specular[4]

Definition at line 35 of file CLight.h.

◆ constant_attenuation

float mrpt::opengl::CLight::constant_attenuation {1.f}

Definition at line 42 of file CLight.h.

◆ direction

float mrpt::opengl::CLight::direction[3]

[x,y,z]

Definition at line 41 of file CLight.h.

◆ light_ID

uint8_t mrpt::opengl::CLight::light_ID {0}

OpenGL ID (typical range: 0-7)

Definition at line 31 of file CLight.h.

◆ linear_attenuation

float mrpt::opengl::CLight::linear_attenuation {0.f}

Definition at line 43 of file CLight.h.

◆ position

float mrpt::opengl::CLight::position[4]

[x,y,z,w]: w=0 means directional light, w=1 means a light at a real 3D position.

Definition at line 39 of file CLight.h.

◆ quadratic_attenuation

float mrpt::opengl::CLight::quadratic_attenuation {0.f}

Definition at line 44 of file CLight.h.

◆ spot_cutoff

float mrpt::opengl::CLight::spot_cutoff {180.f}

Definition at line 46 of file CLight.h.

◆ spot_exponent

float mrpt::opengl::CLight::spot_exponent {0.f}

Definition at line 45 of file CLight.h.




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019