class FoxAreaLight
package foxlite.lights
extends FoxPointLight › FoxBaseLight › FoxObject › FoxBasic
Constructor
@:value({ shadow : false, attenuation : 1, range : 5, shape : FoxAreaLightShape.BOX, energy : 1, color : 0xFFFFFFFF, z : 0, y : 0, x : 0 })new(x:Float = 0, y:Float = 0, z:Float = 0, color:FlxColor = 0xFFFFFFFF, energy:Float = 1, shape:FoxAreaLightShape = FoxAreaLightShape.BOX, range:Float = 5, attenuation:Float = 1, shadow:Bool = false)
Variables
@:value(new Vector3D())sdfData:Vector3D = new Vector3D()
The internal data for the light, mostly shape parameters set via this class functions.
Methods
Inherited Variables
Defined by FoxPointLight
Defined by FoxBaseLight
@:value(0.00025)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
@:value(1.0)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
@:value(1.5)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
@:value(new Vector3D(0, 0, 1, 1))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
@:value(new Vector3D(0, 0, 1, 1))shadowAtlasUV:Vector3D = new Vector3D(0, 0, 1, 1)
Same as shadowAtlasRect but as UV coordinates for the shader.
@:value(new Matrix3D())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.
@:value(new Matrix3D())viewMatrix:Matrix3D = new Matrix3D()
The view matrix for this light
This is its transform for its POV
@:value(new Matrix3D())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
Defined by FoxObject
parent:FoxObject
If set, will adapt parent transform. Make sure the parent has a higher priority so it updates in order
@:value(EulerOrder.ZYX)rotationOrder:EulerOrder = EulerOrder.ZYX
This controls the way this object is rotated (via rotation)
The rotation is applied per-axis sequentially, meaning the way one axis rotate can influence the next rotation.
By default, the Z axis rotates first, this makes the object roll.
Then the Y axis is rotated next, this orients the rolled object horizontally, think of it as a swiveling floor fan.
And last, the X axis is rotated, this has the effect of tilting the Y rotation.
This is done in this order so there is no gimbal-lock when converting euler angles from quaternions. However, this order affects camera rotations.
Custom camera controllers should use ZXY order instead so no tilting occurs.
@:value(new Matrix3D())transform:Matrix3D = new Matrix3D()
This is the global transform for this Object, it encodes position, rotation and scale in a 4x4 matrix
Defined by FoxBasic
animation:FoxAnimationPlayer
An animation controller for this basic. Although properties have to be manually linked, this is intended to be a general-purpose animator for this object
Inherited Methods
Defined by FoxPointLight
Defined by FoxBaseLight
Defined by FoxObject
@:value({ z : 0, y : 0, x : 0 })setAngle(x:Float = 0, y:Float = 0, z:Float = 0):Void
Same as setRotation() but for angle degrees.
getAngle(?output:Vector3D):Vector3D
Gets the object's rotation as degrees, as a Vector3D
Parameters:
output | (Optional) the output vector to store the angles without allocating a new one |
|---|
Returns:
a Vector3D containing angleX, angleY and angleZ
@:value({ w : 1, z : 0, y : 0, x : 0 })setRotationQuaternion(x:Float = 0, y:Float = 0, z:Float = 0, w:Float = 1):Vector3D
Sets the object's rotation from a Quaternion, which is needed for accurate rotation representation when interpolating.
How dows it work? hell if i know
copyComponentsFrom(object:FoxObject):Void
Copies position, rotation and scale from another FoxObject,
so the other object's components doesn't affect this one when changing them
Defined by FoxBasic
physicsUpdate(dt:Float):Void
Called when a physics frame occurs, this is a constant update regardless of framerate for a consistant physics simulation.
pushDrawData(scene:FoxScene):Void
This function gets called when the scene starts building draw groups.
It should call the scene's addToDrawGroups() function for every drawable of this object.
Override this with your custom draw data function.
Note: Internal use only, it is a performance critical operation, keep it fast.
computeBounds(output:BoundingBox):Void
Gets the bounding box of all meshes and models inside groups
In FoxBasic this is just a template, do the actual implementation in
your models and groups
Parameters:
output | the Bounding Box where to store the result |
|---|
testAndCull(camera:FoxCamera):Void
Performs frustum culling by checking the bounding box against a camera frustum
isVisible():Bool
Template function that returns the final visibility for the basic. Frustum culling can affect this.
isActive():Bool
Template function that returns the final activated state for the basic. Frustum culling can affect this.