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
$gl
public
GLState
$gl
$activeRenderTarget
Currently bound render target
private
RenderTarget|null
$activeRenderTarget
= null
$renderTargets
Internal array of render targets
private
array<string, RenderTarget>
$renderTargets
= []
$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
= []
$textures
Internal array of textures
private
array<string, Texture>
$textures
= []
$tickIndex
The current ticke index the resources are accessed with
private
int
$tickIndex
= 0
Methods
__construct()
Constructor
public
__construct(GLState $gl) : void
Parameters
- $gl : GLState
activateRenderTarget()
Activates the given render target
public
activateRenderTarget(RenderTargetResource $resource) : RenderTarget
Parameters
- $resource : RenderTargetResource
Return values
RenderTargetcacheStaticResource()
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
destroyRenderTarget()
Destroys a render target
public
destroyRenderTarget(RenderTargetResource $resource) : void
Parameters
- $resource : RenderTargetResource
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|nullgetActiveRenderTarget()
Returns the currently active render target, throws an exception if none is active
public
getActiveRenderTarget() : RenderTarget
Return values
RenderTargetgetRenderTarget()
Returns the render target for the given resource
public
getRenderTarget(RenderTargetResource $resource) : RenderTarget
Parameters
- $resource : RenderTargetResource
Return values
RenderTargetgetStaticResource()
Returns a generic resource / value or object by name
public
getStaticResource(string $name) : mixed
Parameters
- $name : string
getTexture()
Returns a texture for the given resource
public
getTexture(RenderResource $resource) : Texture
Parameters
- $resource : RenderResource
Return values
TexturegetTextureID()
Returns a texture ID for the given resource The texture ID is the raw GL handle
public
getTextureID(RenderResource $resource) : int
Parameters
- $resource : RenderResource
Return values
intsetCurrentTick()
Sets the current tick index
public
setCurrentTick(int $index) : void
Parameters
- $index : int
setRenderTarget()
Sets a render target to the given handle
public
setRenderTarget(RenderResource $resource, RenderTarget $target) : void
Parameters
- $resource : RenderResource
- $target : RenderTarget
setStaticResource()
Stores a generic resource / value or object by name
public
setStaticResource(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
setTexture()
Sets a texture to the given handle
public
setTexture(RenderResource $resource, Texture $texture) : void
Parameters
- $resource : RenderResource
- $texture : Texture
createRenderTarget()
Creates a missing render target for the given resource
private
createRenderTarget(RenderTargetResource $resource) : void
Parameters
- $resource : RenderTargetResource