class FoxBaseLight
package foxlite.lights
extends FoxObject › FoxBasic
extended by FoxDirectionalLight, FoxPointLight, FoxSpotLight
Constructor
new(x:Float = 0, y:Float = 0, z:Float = 0, color:FlxColor = 0xFFFFFFFF, energy:Float = 1, shadow:Bool = false)
Variables
shadowBias:Float = 0.00025
Applies a small depth offset for the shadow casted by this light to prevent Shadow Acne.
Too high values will cause the shadow to look disconnected from the mesh, tweak this value accordingly
shadowNormalBias:Float = 1.0
Applies an offset slided by the normal for the shadow casted by this light.
Helps to reduce Shadow Acne.
Note: This currently isn't implemented yet
shadowBlur:Float = 1.5
Controls the blurring of the shadow, gives them a softer or harder look
Too high values will cause noticeable blurring artifacts
Note: This value corresponds to the pixel area of the shadowmap
shadow:Bool
If true, this light will cast shadows
Note: If this is set to true, a new texture will be created for this light, this is its shadow map, and it's currently a fixed resolution of 1024x1024
shadowAtlasRect:Vector3D = new Vector3D(0, 0, 1, 1)
Temporary value to store the region of the shadowmap for this light.
This is handled automatically by FoxLightData
Note: This is a Vector3D instead of a Rectangle for fast scaling operations in HScript
shadowAtlasUV:Vector3D = new Vector3D(0, 0, 1, 1)
Same as shadowAtlasRect but as UV coordinates for the shader.
projectionMatrix:Matrix3D = new Matrix3D()
The projection matrix for this light
A Directional Light has an Orthogonal projection, this means the rays are always parallel to the surface, this is used to simulate the sun shadows.
A Point light has a Perspective projection, this means the rays have a depth to them the farther away they are from the light source. This is used to simulate point light source shadows.
viewMatrix:Matrix3D = new Matrix3D()
The view matrix for this light
This is its transform for its POV
viewProjection:Matrix3D = new Matrix3D()
The Transform of this light with its Projection
This is necessary for shadow calculations in the fragment shader, as it's the POV of the light