ShadowCasterCache3D
Package: Libraries.Game.Graphics.Trees · Inherits from: Libraries.Language.Object
ShadowCasterCache3D remembers which static items are within a point light's reach. Static items do not move, so the list stays correct until the light moves, its reach changes, or a static item is added or removed. RenderTree3D counts those changes as its static version, and the cache keeps the version it was built from.
Example Code
use Libraries.Game.Graphics.Trees.ShadowCasterCache3D
ShadowCasterCache3D cache
cache:Set(0, 5, 0, 20, 1)
output cache:Matches(0, 5, 0, 20, 1)
output cache:Matches(0, 5, 0, 20, 2)
Actions
GetStatics()
This action returns the remembered static items. The array itself is returned, not a copy, so the render tree can fill it again in place.
Returns
Libraries.Containers.Array<Libraries.Interface.Item3D>: The array of static items within the light's reach.
Matches(number x, number y, number z, number range, integer staticVersion)
This action returns true if the cache was built for a light at this position and reach, from this version of the static items.
Parameters
xnumber: The x coordinate of the light.ynumber: The y coordinate of the light.znumber: The z coordinate of the light.rangenumber: How far the light reaches.staticVersioninteger: The render tree's static version.
Returns
boolean: True if the cache was built for these values.
Set(number x, number y, number z, number range, integer staticVersion)
This action records what the cache was built for.
Parameters
xnumber: The x coordinate of the light.ynumber: The y coordinate of the light.znumber: The z coordinate of the light.rangenumber: How far the light reaches.staticVersioninteger: The render tree's static version.