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.

private@:value(0)__sdfRange:Float = 0

Methods

setBox(sizeX:Float, sizeY:Float, sizeZ:Float):Void

setTorus(radius:Float, thickness:Float):Void

setCappedTorus(radius:Float, thickness:Float, angle:Float):Void

setLink(radius:Float, thickness:Float, length:Float):Void

setHexagonalPrism(thickness:Float, length:Float):Void

setSphere(radius:Float):Void

getSdfRange():Float

Inherited Variables

Defined by FoxPointLight

range:Float

Defined by FoxBaseLight

@:value(new Vector3D(1, 1, 1))color:Vector3D = new Vector3D(1, 1, 1)

colorHex:FlxColor

The light color as a FlxCOlor

energy:Float

@:value(new Vector3D(0, 0, -1))direction:Vector3D = new Vector3D(0, 0, -1)

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

position:Vector3D

@:value(new Vector3D())rotation:Vector3D = new Vector3D()

@:value(new Vector3D(1, 1, 1))scale:Vector3D = new Vector3D(1, 1, 1)

x:Float

y:Float

z:Float

angleX:Float

angleY:Float

angleZ:Float

@: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

@:value(new Vector3D())read onlyglobalPosition:Vector3D = new Vector3D()

@:value(new Vector3D())read onlyglobalRotation:Vector3D = new Vector3D()

@:value(new Vector3D())read onlyglobalScale:Vector3D = new Vector3D()

Defined by FoxBasic

@:value("FoxBasic")name:String = "FoxBasic"

@:value(true)visible:Bool = true

@:value(true)active:Bool = true

@:value(null)scene:FoxScene = null

@:value(false)__destroyed:Bool = false

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

privateget_colorHex():FlxColor

privateset_colorHex(v:FlxColor):FlxColor

Defined by FoxObject

@:value({ z : 0, y : 0, x : 0 })inlinesetPosition(x:Float = 0, y:Float = 0, z:Float = 0):Void

@:value({ z : 0, y : 0, x : 0 })inlinesetRotation(x:Float = 0, y:Float = 0, z:Float = 0):Void

@:value({ z : 0, y : 0, x : 0 })inlinesetAngle(x:Float = 0, y:Float = 0, z:Float = 0):Void

Same as setRotation() but for angle degrees.

inlinesetAngleFromVector(angles:Vector3D):Void

Sets the object's angle degrees from a Vector3D

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

inlinesetRotationQuaternionFromVector(quat:Vector3D):Vector3D

@:value({ z : 1, y : 1, x : 1 })inlinesetScale(x:Float = 1, y:Float = 1, z:Float = 1):Void

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

privateget_globalPosition():Vector3D

privateget_globalRotation():Vector3D

privateget_globalScale():Vector3D

privateget_x():Float

privateget_y():Float

privateget_z():Float

privateinlineset_x(v:Float):Float

privateinlineset_y(v:Float):Float

privateinlineset_z(v:Float):Float

privateset_angleX(v:Float):Float

privateset_angleY(v:Float):Float

privateset_angleZ(v:Float):Float

privateget_angleX():Float

privateget_angleY():Float

privateget_angleZ():Float

Defined by FoxBasic

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.