|
|
|
|
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 ReferenceLight class to work with driver.
More...
#include <light.h>
Collaboration diagram for NL3D::CLight:
[legend]List of all members.
Public Types |
enum | TLightMode {
DirectionalLight,
PointLight,
SpotLight
} |
Public Methods |
|
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...
|
|
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...
|
|
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
|
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. |
|
Get the diffuse color of the light.
Definition at line 240 of file light.h. |
|
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. |
|
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. |
|
Get the specular color of the light.
Definition at line 248 of file light.h. |
void NL3D::CLight::setAmbiant (
|
const NLMISC::CRGBA & ambiant ) [inline]
|
|
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]
|
|
void NL3D::CLight::setDirection (
|
const NLMISC::CVector & direction ) [inline]
|
|
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]
|
|
void NL3D::CLight::setNoAttenuation (
|
)
|
|
void NL3D::CLight::setPosition (
|
const NLMISC::CVector & position ) [inline]
|
|
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]
|
|
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(). |
|
Quick setup a directional light.
Definition at line 35 of file light.cpp. |
|
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(). |
|
Quick setup a spotlight.
Definition at line 80 of file light.cpp. |
Member Data Documentation
float NL3D::CLight::_ConstantAttenuation [private]
|
|
float NL3D::CLight::_Cutoff [private]
|
|
float NL3D::CLight::_Exponent [private]
|
|
float NL3D::CLight::_LinearAttenuation [private]
|
|
float NL3D::CLight::_QuadraticAttenuation [private]
|
|
The documentation for this class was generated from the following files:
|
|