NL3D::CLightUser Class Reference

#include <light_user.h>

Inheritance diagram for NL3D::CLightUser:

NL3D::ULight

Detailed Description

ULight implementation.
Author:
Lionel Berenguier

Nevrax France

Date:
2001

Definition at line 48 of file light_user.h.

Public Types

enum  TLightMode { DirectionalLight, PointLight, SpotLight }

Public Member Functions

Get methods.
NLMISC::CRGBA getAmbiant () const
float getConstantAttenuation () const
float getCutoff () const
NLMISC::CRGBA getDiffuse () const
NLMISC::CVector getDirection () const
float getExponent () const
float getLinearAttenuation () const
ULight::TLightMode getMode () const
NLMISC::CVector getPosition () const
float getQuadraticAttenuation () const
NLMISC::CRGBA getSpecular () const
Set methods.
void setAmbiant (const NLMISC::CRGBA &ambiant)
void setConstantAttenuation (float constant)
void setCutoff (float cutoff)
void setDiffuse (const NLMISC::CRGBA &diffuse)
void setDirection (const NLMISC::CVector &direction)
void setExponent (float exponent)
void setLinearAttenuation (float linear)
void setMode (ULight::TLightMode mode)
void setPosition (const NLMISC::CVector &position)
void setQuadraticAttenuation (float quadratic)
void setSpecular (const NLMISC::CRGBA &specular)
Quick setup.
void setNoAttenuation ()
void setupAttenuation (float farAttenuationBegin, float farAttenuationEnd)
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.

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.

void setupSpotExponent (float hotSpotAngle)
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.


Static Public Member Functions

ULightcreateLight ()

Protected Attributes

CLight _Light

Friends

class CDriverUser


Member Enumeration Documentation

enum NL3D::ULight::TLightMode [inherited]
 

Enumeration values:
DirectionalLight 
PointLight 
SpotLight 

Definition at line 48 of file u_light.h.

00049         { 
00050                 // The light is directional.
00051                 DirectionalLight, 
00052                 
00053                 // The light is a point.
00054                 PointLight, 
00055 
00056                 // The light is a spotlight with a cone.
00057                 SpotLight 
00058         };


Member Function Documentation

ULight * NL3D::ULight::createLight  )  [static, inherited]
 

This is the static function create a stand alone light.

Definition at line 34 of file light_user.cpp.

References NL3D_MEM_LIGHT.

00035 {
00036         NL3D_MEM_LIGHT
00037         // return the new light
00038         return new CLightUser;
00039 }

NLMISC::CRGBA NL3D::CLightUser::getAmbiant  )  const [inline, virtual]
 

Get the ambiant color of the light.

Implements NL3D::ULight.

Definition at line 253 of file light_user.h.

References _Light, NL3D::CLight::getAmbiant(), and NL3D_MEM_LIGHT.

00254         {
00255                 NL3D_MEM_LIGHT
00256                 return _Light.getAmbiant ();
00257         }

float NL3D::CLightUser::getConstantAttenuation  )  const [inline, virtual]
 

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 );

Implements NL3D::ULight.

Definition at line 320 of file light_user.h.

References _Light, NL3D::CLight::getConstantAttenuation(), and NL3D_MEM_LIGHT.

00321         {
00322                 NL3D_MEM_LIGHT
00323                 return _Light.getConstantAttenuation ();
00324         }

float NL3D::CLightUser::getCutoff  )  const [inline, virtual]
 

Get the cutoff of the light in radian. Should be between [0, Pi/2]. Used only for SpotLight.

Implements NL3D::ULight.

Definition at line 307 of file light_user.h.

References _Light, NL3D::CLight::getCutoff(), and NL3D_MEM_LIGHT.

00308         {
00309                 NL3D_MEM_LIGHT
00310                 return _Light.getCutoff ();
00311         }

NLMISC::CRGBA NL3D::CLightUser::getDiffuse  )  const [inline, virtual]
 

Get the diffuse color of the light.

Implements NL3D::ULight.

Definition at line 262 of file light_user.h.

References _Light, NL3D::CLight::getDiffuse(), and NL3D_MEM_LIGHT.

00263         {
00264                 NL3D_MEM_LIGHT
00265                 return _Light.getDiffuse ();
00266         }

NLMISC::CVector NL3D::CLightUser::getDirection  )  const [inline, virtual]
 

Get the direction of the light. Used only for DirectionalLight and SpotLight.

Implements NL3D::ULight.

Definition at line 289 of file light_user.h.

References _Light, NL3D::CLight::getDirection(), and NL3D_MEM_LIGHT.

00290         {
00291                 NL3D_MEM_LIGHT
00292                 return _Light.getDirection ();
00293         }

float NL3D::CLightUser::getExponent  )  const [inline, virtual]
 

Get the exponent of the light. Used only for SpotLight.

Implements NL3D::ULight.

Definition at line 298 of file light_user.h.

References _Light, NL3D::CLight::getExponent(), and NL3D_MEM_LIGHT.

00299         {
00300                 NL3D_MEM_LIGHT
00301                 return _Light.getExponent ();
00302         }

float NL3D::CLightUser::getLinearAttenuation  )  const [inline, virtual]
 

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 );

Implements NL3D::ULight.

Definition at line 333 of file light_user.h.

References _Light, NL3D::CLight::getLinearAttenuation(), and NL3D_MEM_LIGHT.

00334         {
00335                 NL3D_MEM_LIGHT
00336                 return _Light.getLinearAttenuation ();
00337         }

ULight::TLightMode NL3D::CLightUser::getMode  )  const [inline, virtual]
 

Get the light mode.

Implements NL3D::ULight.

Definition at line 244 of file light_user.h.

References _Light, NL3D::CLight::getMode(), NL3D_MEM_LIGHT, and uint32.

00245         {
00246                 NL3D_MEM_LIGHT
00247                 return (ULight::TLightMode)(uint32)_Light.getMode ();
00248         }

NLMISC::CVector NL3D::CLightUser::getPosition  )  const [inline, virtual]
 

Get the position of the light. Used only for SpotLight and PointLight.

Implements NL3D::ULight.

Definition at line 280 of file light_user.h.

References _Light, NL3D::CLight::getPosition(), and NL3D_MEM_LIGHT.

00281         {
00282                 NL3D_MEM_LIGHT
00283                 return _Light.getPosition ();
00284         }

float NL3D::CLightUser::getQuadraticAttenuation  )  const [inline, virtual]
 

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 );

Implements NL3D::ULight.

Definition at line 346 of file light_user.h.

References _Light, NL3D::CLight::getQuadraticAttenuation(), and NL3D_MEM_LIGHT.

00347         {
00348                 NL3D_MEM_LIGHT
00349                 return _Light.getQuadraticAttenuation ();
00350         }

NLMISC::CRGBA NL3D::CLightUser::getSpecular  )  const [inline, virtual]
 

Get the specular color of the light.

Implements NL3D::ULight.

Definition at line 271 of file light_user.h.

References _Light, NL3D::CLight::getSpecular(), and NL3D_MEM_LIGHT.

00272         {
00273                 NL3D_MEM_LIGHT
00274                 return _Light.getSpecular ();
00275         }

void NL3D::CLightUser::setAmbiant const NLMISC::CRGBA ambiant  )  [inline, virtual]
 

Set the ambiant color of the light.

Implements NL3D::ULight.

Definition at line 137 of file light_user.h.

References _Light, NL3D_MEM_LIGHT, and NL3D::CLight::setAmbiant().

00138         {
00139                 NL3D_MEM_LIGHT
00140                 _Light.setAmbiant (ambiant);
00141         }

void NL3D::CLightUser::setConstantAttenuation float  constant  )  [inline, virtual]
 

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 );

Implements NL3D::ULight.

Definition at line 204 of file light_user.h.

References _Light, NL3D_MEM_LIGHT, and NL3D::CLight::setConstantAttenuation().

00205         {
00206                 NL3D_MEM_LIGHT
00207                 _Light.setConstantAttenuation (constant);
00208         }

void NL3D::CLightUser::setCutoff float  cutoff  )  [inline, virtual]
 

Set the cutoff of the light in radian. Should be between [0, Pi/2]. Used only for SpotLight.

Implements NL3D::ULight.

Definition at line 191 of file light_user.h.

References _Light, NL3D_MEM_LIGHT, and NL3D::CLight::setCutoff().

00192         {
00193                 NL3D_MEM_LIGHT
00194                 _Light.setCutoff (cutoff);
00195         }

void NL3D::CLightUser::setDiffuse const NLMISC::CRGBA diffuse  )  [inline, virtual]
 

Set the diffuse color of the light.

Implements NL3D::ULight.

Definition at line 146 of file light_user.h.

References _Light, NL3D_MEM_LIGHT, and NL3D::CLight::setDiffuse().

00147         {
00148                 NL3D_MEM_LIGHT
00149                 _Light.setDiffuse (diffuse);
00150         }

void NL3D::CLightUser::setDirection const NLMISC::CVector direction  )  [inline, virtual]
 

Set the direction of the light. Used only for DirectionalLight and SpotLight.

Implements NL3D::ULight.

Definition at line 173 of file light_user.h.

References _Light, NL3D_MEM_LIGHT, and NL3D::CLight::setDirection().

00174         {
00175                 NL3D_MEM_LIGHT
00176                 _Light.setDirection (direction);
00177         }

void NL3D::CLightUser::setExponent float  exponent  )  [inline, virtual]
 

Set the Intensity distribution of the light. Should be between [0, 1]. Used only for SpotLight.

Implements NL3D::ULight.

Definition at line 182 of file light_user.h.

References _Light, NL3D_MEM_LIGHT, and NL3D::CLight::setExponent().

00183         {
00184                 NL3D_MEM_LIGHT
00185                 _Light.setExponent (exponent);
00186         }

void NL3D::CLightUser::setLinearAttenuation float  linear  )  [inline, virtual]
 

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 );

Implements NL3D::ULight.

Definition at line 217 of file light_user.h.

References _Light, NL3D_MEM_LIGHT, and NL3D::CLight::setLinearAttenuation().

00218         {
00219                 NL3D_MEM_LIGHT
00220                 _Light.setLinearAttenuation (linear);
00221         }

void NL3D::CLightUser::setMode ULight::TLightMode  mode  )  [inline, virtual]
 

Set the light mode.

Implements NL3D::ULight.

Definition at line 128 of file light_user.h.

References _Light, NL3D_MEM_LIGHT, NL3D::CLight::setMode(), and uint32.

00129         {
00130                 NL3D_MEM_LIGHT
00131                 _Light.setMode ((CLight::TLightMode)(uint32)mode);
00132         }

void NL3D::CLightUser::setNoAttenuation  )  [inline, virtual]
 

Set no attenuation.

The light will not use attenuation.

Implements NL3D::ULight.

Definition at line 101 of file light_user.h.

References _Light, NL3D_MEM_LIGHT, and NL3D::CLight::setNoAttenuation().

00102         {
00103                 NL3D_MEM_LIGHT
00104                 _Light.setNoAttenuation ();
00105         }

void NL3D::CLightUser::setPosition const NLMISC::CVector position  )  [inline, virtual]
 

Set the position of the light. Used only for SpotLight and PointLight.

Implements NL3D::ULight.

Definition at line 164 of file light_user.h.

References _Light, NL3D_MEM_LIGHT, and NL3D::CLight::setPosition().

00165         {
00166                 NL3D_MEM_LIGHT
00167                 _Light.setPosition (position);
00168         }

void NL3D::CLightUser::setQuadraticAttenuation float  quadratic  )  [inline, virtual]
 

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 );

Implements NL3D::ULight.

Definition at line 230 of file light_user.h.

References _Light, NL3D_MEM_LIGHT, and NL3D::CLight::setQuadraticAttenuation().

00231         {
00232                 NL3D_MEM_LIGHT
00233                 _Light.setQuadraticAttenuation (quadratic);
00234         }

void NL3D::CLightUser::setSpecular const NLMISC::CRGBA specular  )  [inline, virtual]
 

Set the specular color of the light.

Implements NL3D::ULight.

Definition at line 155 of file light_user.h.

References _Light, NL3D_MEM_LIGHT, and NL3D::CLight::setSpecular().

00156         {
00157                 NL3D_MEM_LIGHT
00158                 _Light.setSpecular (specular);
00159         }

void NL3D::CLightUser::setupAttenuation float  farAttenuationBegin,
float  farAttenuationEnd
[inline, virtual]
 

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)

Implements NL3D::ULight.

Definition at line 89 of file light_user.h.

References _Light, NL3D_MEM_LIGHT, and NL3D::CLight::setupAttenuation().

00090         {
00091                 NL3D_MEM_LIGHT
00092                 _Light.setupAttenuation (farAttenuationBegin, farAttenuationEnd);
00093         }

void NL3D::CLightUser::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
[inline, virtual]
 

Quick setup a directional light.

Implements NL3D::ULight.

Definition at line 60 of file light_user.h.

References _Light, NL3D_MEM_LIGHT, and NL3D::CLight::setupDirectional().

00062         {
00063                 NL3D_MEM_LIGHT
00064                 _Light.setupDirectional (ambiant, diffuse, specular, direction, constant, linear, quadratic);
00065         }

void NL3D::CLightUser::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
[inline, virtual]
 

Quick setup a point light.

Implements NL3D::ULight.

Definition at line 68 of file light_user.h.

References _Light, NL3D_MEM_LIGHT, and NL3D::CLight::setupPointLight().

00070         {
00071                 NL3D_MEM_LIGHT
00072                 _Light.setupPointLight (ambiant, diffuse, specular, position, direction, constant, linear, quadratic);
00073         }

void NL3D::CLightUser::setupSpotExponent float  hotSpotAngle  )  [inline, virtual]
 

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.

Implements NL3D::ULight.

Definition at line 113 of file light_user.h.

References _Light, NL3D_MEM_LIGHT, and NL3D::CLight::setupSpotExponent().

00114         {
00115                 NL3D_MEM_LIGHT
00116                 _Light.setupSpotExponent (hotSpotAngle);
00117         }

void NL3D::CLightUser::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
[inline, virtual]
 

Quick setup a spotlight.

Implements NL3D::ULight.

Definition at line 76 of file light_user.h.

References _Light, NL3D_MEM_LIGHT, and NL3D::CLight::setupSpotLight().

00078         {
00079                 NL3D_MEM_LIGHT
00080                 _Light.setupSpotLight (ambiant, diffuse, specular, position, direction, exponent, cutoff, constant, linear, quadratic);
00081         }


Friends And Related Function Documentation

friend class CDriverUser [friend]
 

Definition at line 52 of file light_user.h.


Field Documentation

CLight NL3D::CLightUser::_Light [protected]
 

Definition at line 51 of file light_user.h.

Referenced by getAmbiant(), getConstantAttenuation(), getCutoff(), getDiffuse(), getDirection(), getExponent(), getLinearAttenuation(), getMode(), getPosition(), getQuadraticAttenuation(), getSpecular(), setAmbiant(), setConstantAttenuation(), setCutoff(), setDiffuse(), setDirection(), setExponent(), NL3D::CDriverUser::setLight(), setLinearAttenuation(), setMode(), setNoAttenuation(), setPosition(), setQuadraticAttenuation(), setSpecular(), setupAttenuation(), setupDirectional(), setupPointLight(), setupSpotExponent(), and setupSpotLight().


The documentation for this class was generated from the following file:
Generated on Tue Mar 16 06:49:37 2004 for NeL by doxygen 1.3.6