SLProject 4.0.000
|
Abstract Light class for OpenGL light sources. More...
#include <SLLight.h>
Public Member Functions | |
SLLight (SLfloat ambiPower=0.1f, SLfloat diffPower=1.0f, SLfloat specPower=1.0f, SLint id=-1) | |
virtual | ~SLLight ()=default |
void | id (const SLint id) |
void | isOn (const SLbool on) |
void | powers (SLfloat ambiPow, SLfloat diffPow, SLfloat specPow, const SLCol4f &ambiDiffSpecCol=SLCol4f::WHITE) |
Sets the ambient, diffuse and specular powers all with the same color. More... | |
void | ambiDiffPowers (SLfloat ambiPow, SLfloat diffPow, const SLCol4f &ambiDiffCol=SLCol4f::WHITE) |
Sets the ambient and diffuse powers with the same color. More... | |
void | ambiDiffColor (const SLCol4f &ambiDiffCol) |
Sets the same color to the ambient and diffuse colors. More... | |
void | ambientColor (const SLCol4f &ambi) |
void | ambientPower (const SLfloat ambPow) |
void | diffuseColor (const SLCol4f &diff) |
void | diffusePower (const SLfloat diffPow) |
void | specularColor (const SLCol4f &spec) |
void | specularPower (const SLfloat specPow) |
void | spotExponent (const SLfloat exp) |
void | spotCutOffDEG (SLfloat cutOffAngleDEG) |
void | kc (SLfloat kc) |
void | kl (SLfloat kl) |
void | kq (SLfloat kq) |
void | attenuation (const SLfloat kConstant, const SLfloat kLinear, const SLfloat kQuadratic) |
void | createsShadows (SLbool createsShadows) |
void | shadowMap (SLShadowMap *shadowMap) |
void | doSmoothShadows (SLbool doSS) |
void | smoothShadowLevel (SLuint ssLevel) |
void | shadowMinBias (SLfloat minBias) |
void | shadowMaxBias (SLfloat maxBias) |
SLint | id () const |
SLbool | isOn () const |
SLCol4f | ambientColor () |
SLfloat | ambientPower () const |
SLCol4f | diffuseColor () |
SLfloat | diffusePower () const |
SLCol4f | specularColor () |
SLfloat | specularPower () const |
SLfloat | spotCutOffDEG () const |
SLfloat | spotCosCut () const |
SLfloat | spotExponent () const |
SLfloat | kc () const |
SLfloat | kl () const |
SLfloat | kq () const |
SLbool | isAttenuated () const |
SLfloat | attenuation (SLfloat dist) const |
SLbool | createsShadows () const |
SLShadowMap * | shadowMap () |
SLbool | doSoftShadows () const |
SLuint | softShadowLevel () const |
SLfloat | shadowMinBias () const |
SLfloat | shadowMaxBias () const |
virtual SLbool | doCascadedShadows () const |
virtual SLCol4f | ambient ()=0 |
Return normally _ambientColor * _ambientPower. More... | |
virtual SLCol4f | diffuse ()=0 |
Returns normally _diffuseColor * _diffusePower. More... | |
virtual SLCol4f | specular ()=0 |
Returns normally _specularColor * _specularPower. More... | |
virtual SLVec4f | positionWS () const =0 |
virtual SLVec3f | spotDirWS ()=0 |
virtual SLfloat | shadowTest (SLRay *ray, const SLVec3f &L, SLfloat lightDist, SLNode *root3D)=0 |
virtual SLfloat | shadowTestMC (SLRay *ray, const SLVec3f &L, SLfloat lightDist, SLNode *root3D)=0 |
virtual void | createShadowMap (float lightClipNear=0.1f, float lightClipFar=20.0f, SLVec2f size=SLVec2f(8, 8), SLVec2i texSize=SLVec2i(1024, 1024))=0 |
virtual void | createShadowMapAutoSize (SLCamera *camera, SLVec2i texSize=SLVec2i(1024, 1024), int numCascades=0)=0 |
virtual void | renderShadowMap (SLSceneView *sv, SLNode *root) |
SLLight::renderShadowMap renders the shadow map of the light. More... | |
Static Public Member Functions | |
static SLfloat | oneOverGamma () |
Static Public Attributes | |
static SLCol4f | globalAmbient = SLCol4f(0.1f, 0.1f, 0.1f, 1.0f) |
static global ambient light intensity More... | |
static SLfloat | gamma = 1.0f |
final output gamma value More... | |
static SLbool | doColoredShadows = false |
flag if shadows should be displayed with colors for debugging More... | |
Protected Attributes | |
SLint | _id |
OpenGL light number (0-7) More... | |
SLbool | _isOn |
Flag if light is on or off. More... | |
SLCol4f | _ambientColor |
Ambient light color (RGB 0-1) More... | |
SLfloat | _ambientPower |
Ambient light power (0-N) More... | |
SLCol4f | _diffuseColor |
Diffuse light color (RGB 0-1) More... | |
SLfloat | _diffusePower |
Diffuse light power (0-N) More... | |
SLCol4f | _specularColor |
Specular light color (RGB 0-1) More... | |
SLfloat | _specularPower |
Specular light power (0-N) More... | |
SLfloat | _spotCutOffDEG |
Half the spot cone angle. More... | |
SLfloat | _spotCosCutOffRAD |
cosine of spotCutoff angle More... | |
SLfloat | _spotExponent |
Spot attenuation from center to edge of cone. More... | |
SLfloat | _kc |
Constant light attenuation. More... | |
SLfloat | _kl |
Linear light attenuation. More... | |
SLfloat | _kq |
Quadratic light attenuation. More... | |
SLbool | _isAttenuated |
fast attenuation flag for ray tracing More... | |
SLbool | _createsShadows |
flag if light creates shadows or not More... | |
SLShadowMap * | _shadowMap |
Used for shadow mapping. More... | |
SLbool | _doSoftShadows |
flag if percentage-closer filtering for smooth shadows is enabled More... | |
SLuint | _softShadowLevel |
Radius to smoothing (1 = 3 * 3; 2 = 5 * 5; ...) More... | |
SLfloat | _shadowMinBias |
Min. bias at 0 deg. to use to prevent shadow acne. More... | |
SLfloat | _shadowMaxBias |
Max. bias at 90 deg. to use to prevent shadow acne. More... | |
Abstract Light class for OpenGL light sources.
The abstract SLLight class encapsulates an invisible light source according to the OpenGL specification. The derivatives SLLightSpot and SLLightRect will also derive from SLNode and can therefore be freely placed in space.
|
explicit |
|
virtualdefault |
|
inline |
Sets the same color to the ambient and diffuse colors.
|
inline |
Sets the ambient and diffuse powers with the same color.
|
pure virtual |
Return normally _ambientColor * _ambientPower.
Implemented in SLLightDirect, SLLightRect, and SLLightSpot.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
pure virtual |
Implemented in SLLightDirect, SLLightRect, and SLLightSpot.
|
pure virtual |
Implemented in SLLightRect, SLLightSpot, and SLLightDirect.
|
inline |
void SLLight::createsShadows | ( | SLbool | createsShadows | ) |
|
pure virtual |
Returns normally _diffuseColor * _diffusePower.
Implemented in SLLightDirect, SLLightRect, and SLLightSpot.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
Reimplemented in SLLightDirect.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void SLLight::kc | ( | SLfloat | kc | ) |
|
inline |
void SLLight::kl | ( | SLfloat | kl | ) |
|
inline |
void SLLight::kq | ( | SLfloat | kq | ) |
|
inlinestatic |
|
pure virtual |
Implemented in SLLightDirect, SLLightRect, and SLLightSpot.
|
inline |
Sets the ambient, diffuse and specular powers all with the same color.
|
virtual |
SLLight::renderShadowMap renders the shadow map of the light.
Reimplemented in SLLightDirect.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
pure virtual |
Implemented in SLLightDirect, SLLightRect, and SLLightSpot.
|
pure virtual |
Implemented in SLLightDirect, SLLightRect, and SLLightSpot.
|
inline |
|
inline |
|
pure virtual |
Returns normally _specularColor * _specularPower.
Implemented in SLLightDirect, SLLightRect, and SLLightSpot.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void SLLight::spotCutOffDEG | ( | SLfloat | cutOffAngleDEG | ) |
|
pure virtual |
Implemented in SLLightDirect, SLLightRect, and SLLightSpot.
|
inline |
|
inline |
|
protected |
Ambient light color (RGB 0-1)
|
protected |
Ambient light power (0-N)
|
protected |
flag if light creates shadows or not
|
protected |
Diffuse light color (RGB 0-1)
|
protected |
Diffuse light power (0-N)
|
protected |
flag if percentage-closer filtering for smooth shadows is enabled
|
protected |
OpenGL light number (0-7)
|
protected |
fast attenuation flag for ray tracing
|
protected |
Flag if light is on or off.
|
protected |
Constant light attenuation.
|
protected |
Linear light attenuation.
|
protected |
Quadratic light attenuation.
|
protected |
Used for shadow mapping.
|
protected |
Max. bias at 90 deg. to use to prevent shadow acne.
|
protected |
Min. bias at 0 deg. to use to prevent shadow acne.
|
protected |
Radius to smoothing (1 = 3 * 3; 2 = 5 * 5; ...)
|
protected |
Specular light color (RGB 0-1)
|
protected |
Specular light power (0-N)
|
protected |
cosine of spotCutoff angle
|
protected |
Half the spot cone angle.
|
protected |
Spot attenuation from center to edge of cone.
|
static |
flag if shadows should be displayed with colors for debugging
|
static |
final output gamma value
static global ambient light intensity