PIXI.ShaderSystem

class ShaderSystem implements PIXI.ISystem

System plugin to the renderer to manage shaders.

Constructor


new PIXI.ShaderSystem(renderer: PIXI.Renderer) → {}
Parameters:
Name Type Description
renderer PIXI.Renderer

The renderer this System works for.

Summary


Properties from ShaderSystem

WebGLRenderingContext
protected gl

Methods from ShaderSystem

PIXI.GLProgram
bind(shader: PIXI.Shader, dontSync: boolean)
void
destroy()

Destroys this System and removes all its textures.

PIXI.GLProgram
generateProgram(shader: PIXI.Shader)
PIXI.GLProgram
getGlProgram()

Returns the underlying GLShade rof the currently bound shader.

void
reset()

Resets ShaderSystem state, does not affect WebGL state.

void
setUniforms(uniforms: Dict)
syncUniformBufferGroup(group: PIXI.UniformGroup, name: string)
void
syncUniformGroup(group: PIXI.UniformGroup, syncData: any)
void
syncUniforms(group: PIXI.UniformGroup, glProgram: PIXI.GLProgram, syncData: any)
UniformsSyncCallback
protected createSyncBufferGroup(group: PIXI.UniformGroup, glProgram: PIXI.GLProgram, name: string)

Protected Properties


gl ShaderSystem.ts:26
protected gl: WebGLRenderingContext

The current WebGL rendering context.

Public Methods


bind ShaderSystem.ts:81
bind(shader: PIXI.Shader, dontSync: boolean) → {PIXI.GLProgram}

Changes the current shader to the one given in parameter.

Parameters:
Name Type Attributes Description
shader PIXI.Shader

the new shader

dontSync boolean

<optional>

false if the shader should automatically sync its uniforms.

Returns:
Type Description
PIXI.GLProgram

the glProgram that belongs to the shader.

destroy ShaderSystem.ts:312
destroy() → {void}

Destroys this System and removes all its textures.

Returns:
Type Description
void
generateProgram ShaderSystem.ts:288
generateProgram(shader: PIXI.Shader) → {PIXI.GLProgram}

Generates a glProgram version of the Shader provided.

Parameters:
Name Type Description
shader PIXI.Shader

The shader that the glProgram will be based on.

Returns:
Type Description
PIXI.GLProgram

A shiny new glProgram!

getGlProgram ShaderSystem.ts:272
getGlProgram() → {PIXI.GLProgram}

Returns the underlying GLShade rof the currently bound shader.

This can be handy for when you to have a little more control over the setting of your uniforms.

Returns:
Type Description
PIXI.GLProgram

The glProgram for the currently bound Shader for this context

reset ShaderSystem.ts:305
reset() → {void}

Resets ShaderSystem state, does not affect WebGL state.

Returns:
Type Description
void
setUniforms ShaderSystem.ts:114
setUniforms(uniforms: Dict) → {void}

Uploads the uniforms values to the currently bound shader.

Parameters:
Name Type Description
uniforms Dict<any>

the uniforms values that be applied to the current shader

Returns:
Type Description
void
syncUniformBufferGroup ShaderSystem.ts:171
syncUniformBufferGroup(group: PIXI.UniformGroup, name: string) → {}

Syncs uniform buffers

Parameters:
Name Type Attributes Description
group PIXI.UniformGroup

the uniform buffer group to sync

name string

<optional>

the name of the uniform buffer

syncUniformGroup ShaderSystem.ts:127
syncUniformGroup(group: PIXI.UniformGroup, syncData: any) → {void}

Syncs uniforms on the group

Parameters:
Name Type Attributes Description
group PIXI.UniformGroup

the uniform group to sync

syncData any

<optional>

this is data that is passed to the sync function and any nested sync functions

Returns:
Type Description
void
syncUniforms ShaderSystem.ts:144
syncUniforms(group: PIXI.UniformGroup, glProgram: PIXI.GLProgram, syncData: any) → {void}

Overrideable by the @pixi/unsafe-eval package to use static syncUniforms instead.

Parameters:
Name Type Description
group PIXI.UniformGroup
glProgram PIXI.GLProgram
syncData any
Returns:
Type Description
void

Protected Methods


createSyncBufferGroup ShaderSystem.ts:201
protected createSyncBufferGroup(group: PIXI.UniformGroup, glProgram: PIXI.GLProgram, name: string) → {UniformsSyncCallback}

Will create a function that uploads a uniform buffer using the STD140 standard. The upload function will then be cached for future calls If a group is manually managed, then a simple upload function is generated

Parameters:
Name Type Description
group PIXI.UniformGroup

the uniform buffer group to sync

glProgram PIXI.GLProgram

the gl program to attach the uniform bindings to

name string

the name of the uniform buffer (must exist on the shader)

Returns:
Type Description
UniformsSyncCallback

Powered by webdoc!