# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::CLight Class Reference

Light class to work with driver. More...

#include <light.h>

Collaboration diagram for NL3D::CLight:

Collaboration graph
[legend]
List of all members.

Public Types

enum  TLightMode {
  DirectionalLight,
  PointLight,
  SpotLight
}

Public Methods

Quick setup.
void setupDirectional (const NLMISC::CRGBA& ambiant, const NLMISC::CRGBA& diffuse, const NLMISC::CRGBA& specular, const NLMISC::CVector& direction, float constant=1, float linear=0, float quadratic=0)
 Quick setup a directional light. More...

void setupPointLight (const NLMISC::CRGBA& ambiant, const NLMISC::CRGBA& diffuse, const NLMISC::CRGBA& specular, const NLMISC::CVector& position, const NLMISC::CVector& direction, float constant=1, float linear=0, float quadratic=0)
 Quick setup a point light. More...

void setupSpotLight (const NLMISC::CRGBA& ambiant, const NLMISC::CRGBA& diffuse, const NLMISC::CRGBA& specular, const NLMISC::CVector& position, const NLMISC::CVector& direction, float exponent, float cutoff, float constant=1, float linear=0, float quadratic=0)
 Quick setup a spotlight. More...

void setupAttenuation (float farAttenuationBegin, float farAttenuationEnd)
 Setup attenuation with begin and end attenuation distance. More...

void setNoAttenuation ()
 Set no attenuation. More...

void setupSpotExponent (float hotSpotAngle)
 Setup spot exponent with angle of the hotspot. More...

Set methods.
void setMode (TLightMode mode)
 Set the light mode. More...

void setAmbiant (const NLMISC::CRGBA& ambiant)
 Set the ambiant color of the light. More...

void setDiffuse (const NLMISC::CRGBA& diffuse)
 Set the diffuse color of the light. More...

void setSpecular (const NLMISC::CRGBA& specular)
 Set the specular color of the light. More...

void setPosition (const NLMISC::CVector& position)
 Set the position of the light. More...

void setDirection (const NLMISC::CVector& direction)
 Set the direction of the light. More...

void setExponent (float exponent)
 Set the Intensity distribution of the light. More...

void setCutoff (float cutoff)
 Set the cutoff of the light in radian. More...

void setConstantAttenuation (float constant)
 Set constant attenuation. More...

void setLinearAttenuation (float linear)
 Set linear attenuation. More...

void setQuadraticAttenuation (float quadratic)
 Set quadratic attenuation. More...

Get methods.
TLightMode getMode () const
 Get the light mode. More...

NLMISC::CRGBA getAmbiant () const
 Get the ambiant color of the light. More...

NLMISC::CRGBA getDiffuse () const
 Get the diffuse color of the light. More...

NLMISC::CRGBA getSpecular () const
 Get the specular color of the light. More...

NLMISC::CVector getPosition () const
 Get the position of the light. More...

NLMISC::CVector getDirection () const
 Get the direction of the light. More...

float getExponent () const
 Get the exponent of the light. More...

float getCutoff () const
 Get the cutoff of the light in radian. More...

float getConstantAttenuation () const
 Get constant attenuation. More...

float getLinearAttenuation () const
 Get linear attenuation. More...

float getQuadraticAttenuation () const
 Get quadratic attenuation. More...


Private Attributes

TLightMode _Mode
NLMISC::CRGBA _Ambiant
NLMISC::CRGBA _Diffuse
NLMISC::CRGBA _Specular
NLMISC::CVector _Position
NLMISC::CVector _Direction
float _Exponent
float _Cutoff
float _ConstantAttenuation
float _LinearAttenuation
float _QuadraticAttenuation

Detailed Description

Light class to work with driver.

Warning: nothing is initialized by default.

To use this light you must initialize the MODE (setMode), the COLORS and the 3 ATTENUATION FACTORS. If the mode is spotlight or pointlight, you must initialize the POSITION. If the mode is spotlight or directionallight, you must initialize the DIRECTION. It the mode is spotlight, you must intialize the EXPONENT and the CUTOFF.

To do so, you can use one of the three methods: setupDirectional, setupPointLight, setupSpotLight or use the specifics methods.

Author(s):
Cyril 'Hulud' Corvazier , Nevrax France
Date:
2001

Definition at line 55 of file light.h.


Member Enumeration Documentation

enum NL3D::CLight::TLightMode
 

Enumeration values:
DirectionalLight  
PointLight  
SpotLight  

Definition at line 59 of file light.h.


Member Function Documentation

NLMISC::CRGBA NL3D::CLight::getAmbiant ( ) const [inline]
 

Get the ambiant color of the light.

Definition at line 232 of file light.h.

float NL3D::CLight::getConstantAttenuation ( ) const [inline]
 

Get constant attenuation.

The intensity of the light is attenuated this way: light_intensity = light_intensity / ( CONSTANT_ATTENUATION + vertex_light_distance * LINEAR_ATTENUATION + vertex_light_distance * vertex_light_distance * QUADRATIC_ATTENUATION );

Definition at line 292 of file light.h.

float NL3D::CLight::getCutoff ( ) const [inline]
 

Get the cutoff of the light in radian.

Should be between [0, Pi/2]. Used only for SpotLight.

Definition at line 280 of file light.h.

NLMISC::CRGBA NL3D::CLight::getDiffuse ( ) const [inline]
 

Get the diffuse color of the light.

Definition at line 240 of file light.h.

NLMISC::CVector NL3D::CLight::getDirection ( ) const [inline]
 

Get the direction of the light.

Used only for DirectionalLight and SpotLight.

Definition at line 264 of file light.h.

float NL3D::CLight::getExponent ( ) const [inline]
 

Get the exponent of the light.

Used only for SpotLight.

Definition at line 272 of file light.h.

float NL3D::CLight::getLinearAttenuation ( ) const [inline]
 

Get linear attenuation.

The intensity of the light is attenuated this way: light_intensity = light_intensity / ( CONSTANT_ATTENUATION + vertex_light_distance * LINEAR_ATTENUATION + vertex_light_distance * vertex_light_distance * QUADRATIC_ATTENUATION );

Definition at line 304 of file light.h.

TLightMode NL3D::CLight::getMode ( ) const [inline]
 

Get the light mode.

Definition at line 224 of file light.h.

NLMISC::CVector NL3D::CLight::getPosition ( ) const [inline]
 

Get the position of the light.

Used only for SpotLight and PointLight.

Definition at line 256 of file light.h.

float NL3D::CLight::getQuadraticAttenuation ( ) const [inline]
 

Get quadratic attenuation.

The intensity of the light is attenuated this way: light_intensity = light_intensity / ( CONSTANT_ATTENUATION + vertex_light_distance * LINEAR_ATTENUATION + vertex_light_distance * vertex_light_distance * QUADRATIC_ATTENUATION );

Definition at line 316 of file light.h.

NLMISC::CRGBA NL3D::CLight::getSpecular ( ) const [inline]
 

Get the specular color of the light.

Definition at line 248 of file light.h.

void NL3D::CLight::setAmbiant ( const NLMISC::CRGBA & ambiant ) [inline]
 

Set the ambiant color of the light.

Definition at line 127 of file light.h.

Referenced by CExportNel::buildLight().

void NL3D::CLight::setConstantAttenuation ( float constant ) [inline]
 

Set constant attenuation.

The intensity of the light is attenuated this way: light_intensity = light_intensity / ( CONSTANT_ATTENUATION + vertex_light_distance * LINEAR_ATTENUATION + vertex_light_distance * vertex_light_distance * QUADRATIC_ATTENUATION );

Definition at line 187 of file light.h.

void NL3D::CLight::setCutoff ( float cutoff ) [inline]
 

Set the cutoff of the light in radian.

Should be between [0, Pi/2]. Used only for SpotLight.

Definition at line 175 of file light.h.

Referenced by CExportNel::buildLight().

void NL3D::CLight::setDiffuse ( const NLMISC::CRGBA & diffuse ) [inline]
 

Set the diffuse color of the light.

Definition at line 135 of file light.h.

Referenced by CExportNel::buildLight().

void NL3D::CLight::setDirection ( const NLMISC::CVector & direction ) [inline]
 

Set the direction of the light.

Used only for DirectionalLight and SpotLight.

Definition at line 159 of file light.h.

Referenced by CExportNel::buildLight().

void NL3D::CLight::setExponent ( float exponent ) [inline]
 

Set the Intensity distribution of the light.

Should be between [0, 1]. Used only for SpotLight.

Definition at line 167 of file light.h.

void NL3D::CLight::setLinearAttenuation ( float linear ) [inline]
 

Set linear attenuation.

The intensity of the light is attenuated this way: light_intensity = light_intensity / ( CONSTANT_ATTENUATION + vertex_light_distance * LINEAR_ATTENUATION + vertex_light_distance * vertex_light_distance * QUADRATIC_ATTENUATION );

Definition at line 199 of file light.h.

void NL3D::CLight::setMode ( TLightMode mode ) [inline]
 

Set the light mode.

Definition at line 119 of file light.h.

Referenced by CExportNel::buildLight().

void NL3D::CLight::setNoAttenuation ( )
 

Set no attenuation.

The light will not use attenuation.

Definition at line 155 of file light.cpp.

Referenced by CExportNel::buildLight().

void NL3D::CLight::setPosition ( const NLMISC::CVector & position ) [inline]
 

Set the position of the light.

Used only for SpotLight and PointLight.

Definition at line 151 of file light.h.

Referenced by CExportNel::buildLight().

void NL3D::CLight::setQuadraticAttenuation ( float quadratic ) [inline]
 

Set quadratic attenuation.

The intensity of the light is attenuated this way: light_intensity = light_intensity / ( CONSTANT_ATTENUATION + vertex_light_distance * LINEAR_ATTENUATION + vertex_light_distance * vertex_light_distance * QUADRATIC_ATTENUATION );

Definition at line 211 of file light.h.

void NL3D::CLight::setSpecular ( const NLMISC::CRGBA & specular ) [inline]
 

Set the specular color of the light.

Definition at line 143 of file light.h.

Referenced by CExportNel::buildLight().

void NL3D::CLight::setupAttenuation ( float farAttenuationBegin,
float farAttenuationEnd )
 

Setup attenuation with begin and end attenuation distance.

Parameters:
farAttenuationBegin   is the distance of the begin of the attenuation (attenuation == 0.9f)
farAttenuationEnd   is the distance of the end of the attenuation (attenuation == 0.1f)

Definition at line 107 of file light.cpp.

Referenced by CExportNel::buildLight().

void NL3D::CLight::setupDirectional ( const NLMISC::CRGBA & ambiant,
const NLMISC::CRGBA & diffuse,
const NLMISC::CRGBA & specular,
const NLMISC::CVector & direction,
float constant = 1,
float linear = 0,
float quadratic = 0 )
 

Quick setup a directional light.

Definition at line 35 of file light.cpp.

void NL3D::CLight::setupPointLight ( const NLMISC::CRGBA & ambiant,
const NLMISC::CRGBA & diffuse,
const NLMISC::CRGBA & specular,
const NLMISC::CVector & position,
const NLMISC::CVector & direction,
float constant = 1,
float linear = 0,
float quadratic = 0 )
 

Quick setup a point light.

Definition at line 57 of file light.cpp.

void NL3D::CLight::setupSpotExponent ( float hotSpotAngle )
 

Setup spot exponent with angle of the hotspot.

Parameters:
hotSpotAngle   is the angle in radian between the axis of the spot and the vector from light where attenuation is == 0.9.

Definition at line 145 of file light.cpp.

Referenced by CExportNel::buildLight().

void NL3D::CLight::setupSpotLight ( const NLMISC::CRGBA & ambiant,
const NLMISC::CRGBA & diffuse,
const NLMISC::CRGBA & specular,
const NLMISC::CVector & position,
const NLMISC::CVector & direction,
float exponent,
float cutoff,
float constant = 1,
float linear = 0,
float quadratic = 0 )
 

Quick setup a spotlight.

Definition at line 80 of file light.cpp.


Member Data Documentation

NLMISC::CRGBA NL3D::CLight::_Ambiant [private]
 

Definition at line 327 of file light.h.

float NL3D::CLight::_ConstantAttenuation [private]
 

Definition at line 340 of file light.h.

float NL3D::CLight::_Cutoff [private]
 

Definition at line 337 of file light.h.

NLMISC::CRGBA NL3D::CLight::_Diffuse [private]
 

Definition at line 328 of file light.h.

NLMISC::CVector NL3D::CLight::_Direction [private]
 

Definition at line 333 of file light.h.

float NL3D::CLight::_Exponent [private]
 

Definition at line 336 of file light.h.

float NL3D::CLight::_LinearAttenuation [private]
 

Definition at line 341 of file light.h.

TLightMode NL3D::CLight::_Mode [private]
 

Definition at line 324 of file light.h.

NLMISC::CVector NL3D::CLight::_Position [private]
 

Definition at line 332 of file light.h.

float NL3D::CLight::_QuadraticAttenuation [private]
 

Definition at line 342 of file light.h.

NLMISC::CRGBA NL3D::CLight::_Specular [private]
 

Definition at line 329 of file light.h.


The documentation for this class was generated from the following files: