Class: ShaderGenerator

.brend~ShaderGenerator

Exposes an easy-to-use API for generating a shader function for batch rendering.

You are required to provide an injector map, which maps macros to functions that return a string value for those macros given a renderer.

By default, only one injector is used - the textures per batch %texturesPerBatch% macro. This is replaced by the number of textures passed to the uSamplers textures uniform.

new ShaderGenerator (vertexShaderTemplate, fragmentShaderTemplate, uniforms, templateInjectors, disableVertexShaderTemplate)

WARNING: Do not pass uSamplers in your uniforms. They will be added to your shader instance directly.

Name Type Default Description
vertexShaderTemplate string
fragmentShaderTemplate string
uniforms UniformGroup | Map.<string, object>
templateInjectors Object.<String, PIXI.brend.InjectorFunction> optional
disableVertexShaderTemplate boolean true optional

turn off (true) if you aren't using macros in the vertex shader

Members

_fragmentShaderTemplate protected

_templateInjectors protected

_uniforms protected

_vertexShaderTemplate protected

disableVertexShaderTemplate Boolean

Disable vertex shader templates to speed up shader generation.

Methods

generateFunction ()

Returns:
shader function that can be given to the batch renderer