VISU - PHP Game Framework

PipelineResources
in package

Table of Contents

Properties

$gl  : GLState
$activeRenderTarget  : RenderTarget|null
Currently bound render target
$renderTargets  : array<string, RenderTarget>
Internal array of render targets
$resourceUseTick  : array<string, int>
A map storing the tick each resource was last accessed
$staticStorage  : array<string, mixed>
Holder of mixed generic static resources
$textures  : array<string, Texture>
Internal array of textures
$tickIndex  : int
The current ticke index the resources are accessed with

Methods

__construct()  : void
Constructor
activateRenderTarget()  : RenderTarget
Activates the given render target
cacheStaticResource()  : mixed
Cacehs a generic resource / value or object by name This is the same as getStaticResource but you provide a callback which is called if the resource is not found.
collectGarbage()  : void
Collects all garbage and removes all unused resources
destroyRenderTarget()  : void
Destroys a render target
findTextureByName()  : Texture|null
Returns a texture by its name, will return null if not found This will also update the resource use tick
getActiveRenderTarget()  : RenderTarget
Returns the currently active render target, throws an exception if none is active
getRenderTarget()  : RenderTarget
Returns the render target for the given resource
getStaticResource()  : mixed
Returns a generic resource / value or object by name
getTexture()  : Texture
Returns a texture for the given resource
getTextureID()  : int
Returns a texture ID for the given resource The texture ID is the raw GL handle
setCurrentTick()  : void
Sets the current tick index
setRenderTarget()  : void
Sets a render target to the given handle
setStaticResource()  : void
Stores a generic resource / value or object by name
setTexture()  : void
Sets a texture to the given handle
createRenderTarget()  : void
Creates a missing render target for the given resource

Properties

$resourceUseTick

A map storing the tick each resource was last accessed

private array<string, int> $resourceUseTick = []

$staticStorage

Holder of mixed generic static resources

private array<string, mixed> $staticStorage = []

$tickIndex

The current ticke index the resources are accessed with

private int $tickIndex = 0

Methods

cacheStaticResource()

Cacehs a generic resource / value or object by name This is the same as getStaticResource but you provide a callback which is called if the resource is not found.

public cacheStaticResource(string $name, callable $callback) : mixed
Parameters
$name : string
$callback : callable

collectGarbage()

Collects all garbage and removes all unused resources

public collectGarbage() : void

findTextureByName()

Returns a texture by its name, will return null if not found This will also update the resource use tick

public findTextureByName(string $name) : Texture|null
Parameters
$name : string
Return values
Texture|null

getStaticResource()

Returns a generic resource / value or object by name

public getStaticResource(string $name) : mixed
Parameters
$name : string

setCurrentTick()

Sets the current tick index

public setCurrentTick(int $index) : void
Parameters
$index : int

setStaticResource()

Stores a generic resource / value or object by name

public setStaticResource(string $name, mixed $value) : void
Parameters
$name : string
$value : mixed

        
On this page

Search results