39 :
SLNode(
"LightDirect Node"),
40 _arrowRadius(arrowLength * 0.1f),
41 _arrowLength(arrowLength),
42 _doSunPowerAdaptation(false),
45 _doCascadedShadows(doCascadedShadows)
50 "LightDirect Mesh Mat",
97 :
SLNode(
"Directional Light"),
98 SLLight(ambiPower, diffPower, specPower),
99 _arrowRadius(arrowLength * 0.1f),
100 _arrowLength(arrowLength),
101 _doSunPowerAdaptation(false),
102 _sunLightPowerMin(0),
104 _doCascadedShadows(doCascadedShadows)
111 "LightDirect Mesh Mat",
255 SLRay shadowRay(lightDist, L, ray);
256 root3D->
hitRec(&shadowRay);
258 if (shadowRay.
length < lightDist)
284 SLRay shadowRay(lightDist, L, ray);
285 root3D->
hitRec(&shadowRay);
287 if (shadowRay.
length < lightDist)
320 return sunColor * standardPower * cosZenithAngle;
#define SL_EXIT_MSG(message)
static const SLint SL_MAX_LIGHTS
max. number of used lights
@ CLUT_DAYLIGHT
daylight from sunrise to sunset with noon in the middle
SLArrow is creates an arrow mesh based on its SLRevolver methods.
Toplevel holder of the assets meshes, materials, textures and shaders.
Active or visible camera node class.
void deleteData(SLbool deleteAlsoOnGPU)
Delete all data (CVImages and GPU textures)
SLCol4f getTexelf(SLfloat u, SLfloat v, SLuint imgIndex=0)
SLGLTexture::getTexelf returns a pixel color from u & v texture coordinates.
SLbool _doSunPowerAdaptation
Flag for sun power scaling.
~SLLightDirect() override
SLCol4f ambient() override
Returns the product of the ambient light color and the ambient light power.
SLLightDirect(SLAssetManager *assetMgr, SLScene *s, SLfloat arrowLength=0.5f, SLbool hasMesh=true, SLbool doCascadedShadows=false)
Construct a new SLLightDirect::SLLightDirect object.
SLfloat _sunLightPowerMin
Min. zenith power scale factor for sun.
SLfloat shadowTest(SLRay *ray, const SLVec3f &L, SLfloat lightDist, SLNode *root3D) override
SLCol4f specular() override
Returns the product of the specular light color and the specular light power.
bool hitRec(SLRay *ray) override
void renderShadowMap(SLSceneView *sv, SLNode *root) override
SLLight::renderShadowMap renders the shadow map of the light.
SLCol4f diffuse() override
Returns the product of the diffuse light color and the diffuse light power.
SLfloat _arrowLength
Length of direction line.
void createShadowMap(float clipNear=0.1f, float clipFar=20.0f, SLVec2f size=SLVec2f(8, 8), SLVec2i texSize=SLVec2i(1024, 1024)) override
SLfloat _arrowRadius
The sphere lights radius.
void drawMesh(SLSceneView *sv) override
SLCol4f calculateSunLight(SLfloat standardPower)
Calculates the sunlight color depending on the zenith angle.
SLfloat shadowTestMC(SLRay *ray, const SLVec3f &L, SLfloat lightDist, SLNode *root3D) override
bool _doCascadedShadows
Cascaded shadow.
SLTexColorLUT _sunLightColorLUT
Sun light color LUT.
void createShadowMapAutoSize(SLCamera *camera, SLVec2i texSize=SLVec2i(1024, 1024), int numCascades=4) override
void statsRec(SLNodeStats &stats) override
SLLightDirect::statsRec updates the statistic parameters.
Abstract Light class for OpenGL light sources.
SLint _id
OpenGL light number (0-7)
SLCol4f _ambientColor
Ambient light color (RGB 0-1)
SLShadowMap * _shadowMap
Used for shadow mapping.
SLfloat _diffusePower
Diffuse light power (0-N)
SLbool _isOn
Flag if light is on or off.
SLfloat _specularPower
Specular light power (0-N)
SLCol4f _diffuseColor
Diffuse light color (RGB 0-1)
SLfloat _ambientPower
Ambient light power (0-N)
SLbool _createsShadows
flag if light creates shadows or not
SLCol4f _specularColor
Specular light color (RGB 0-1)
Defines a standard CG material with textures and a shader program.
SLbool hasAlpha()
Returns true if there is any transparency in diffuse alpha or textures.
void emissive(const SLCol4f &emis)
virtual void preShade(SLRay *ray)
SLNode represents a node in a hierarchical scene graph.
virtual void drawMesh(SLSceneView *sv)
Draws the single mesh.
SLVec3f forwardOS() const
bool _castsShadows
flag if meshes of node should cast shadows
virtual void addMesh(SLMesh *mesh)
virtual void statsRec(SLNodeStats &stats)
SLMesh * _mesh
pointer to a single mesh
virtual bool hitRec(SLRay *ray)
void translate(const SLVec3f &vec, SLTransformSpace relativeTo=TS_object)
Ray class with ray and intersection properties.
SLRayType type
PRIMARY, REFLECTED, REFRACTED, SHADOW.
SLMesh * hitMesh
Points to the intersected mesh.
SLVec3f dir
Direction vector of ray in WS.
SLfloat length
length from origin to an intersection
SLVec3f hitNormal
Surface normal at intersection point.
The SLScene class represents the top level instance holding the scene structure.
SLNode * singleNodeSelected()
Returns the node if only one is selected. See also SLMesh::selectNodeMesh.
SceneView class represents a dynamic real time 3D view onto the scene.
void camera(SLCamera *camera)
Class for standard and cascaded shadow mapping.
void drawFrustum()
SLShadowMap::drawFrustum draws the volume affected by the shadow map.
void renderShadows(SLSceneView *sv, SLNode *root)
T dot(const SLVec3 &v) const
Struct for scene graph statistics.
SLuint numBytes
NO. of bytes allocated.