SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
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) | |
Construct a new SLLight::SLLight object. More... | |
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 |
Construct a new SLLight::SLLight object.
ambiPower | Ambient light power |
diffPower | Diffuse light power |
specPower | Specular light power |
id | Light ID |
Definition at line 30 of file SLLight.cpp.
|
virtualdefault |
Sets the same color to the ambient and diffuse colors.
|
inline |
|
pure virtual |
Return normally _ambientColor * _ambientPower.
Implemented in SLLightSpot, SLLightRect, and SLLightDirect.
|
pure virtual |
Implemented in SLLightSpot, SLLightRect, and SLLightDirect.
|
pure virtual |
Implemented in SLLightDirect, SLLightSpot, and SLLightRect.
Definition at line 98 of file SLLight.cpp.
|
pure virtual |
Returns normally _diffuseColor * _diffusePower.
Implemented in SLLightSpot, SLLightRect, and SLLightDirect.
|
inlinevirtual |
|
inline |
Definition at line 146 of file SLLight.h.
|
inline |
Definition at line 74 of file SLLight.cpp.
Definition at line 80 of file SLLight.cpp.
Definition at line 86 of file SLLight.cpp.
|
pure virtual |
Implemented in SLLightSpot, SLLightRect, and SLLightDirect.
|
inline |
|
virtual |
SLLight::renderShadowMap renders the shadow map of the light.
Reimplemented in SLLightDirect.
Definition at line 104 of file SLLight.cpp.
|
inline |
|
inline |
|
pure virtual |
Implemented in SLLightSpot, SLLightRect, and SLLightDirect.
|
pure virtual |
Implemented in SLLightSpot, SLLightRect, and SLLightDirect.
|
pure virtual |
Returns normally _specularColor * _specularPower.
Implemented in SLLightSpot, SLLightRect, and SLLightDirect.
Definition at line 92 of file SLLight.cpp.
|
pure virtual |
Implemented in SLLightSpot, SLLightRect, and SLLightDirect.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |
|
static |