ShaderPreprocessor

class ShaderPreprocessor

Provides a high-level API to manage program template and generate shaders by passing macro data for the shader templates.

Constructor


new ShaderPreprocessor() → {}

Public Methods


from ShaderPreprocessor.ts:28
static from(vertexTemplateSrc: string, fragmentTemplateSrc: string, name: string) → {ProgramTemplate}

Creates a program template for given shader template sources. It will return a memoized instance if the same sources are used together twice.

Parameters:
Name Type Attributes Description
vertexTemplateSrc string

vertex template source

fragmentTemplateSrc string

fragment template source

name string

<optional>

the name of the template

Returns:
Type Description
ProgramTemplate
generateShader ShaderPreprocessor.ts:12
static generateShader(vertexTemplateSrc: string, fragmentTemplateSrc: string, name: Record<string, any>) → {PIXI.Shader}
Parameters:
Name Type Description
vertexTemplateSrc string

the vertex shader template source

fragmentTemplateSrc string

the fragment shader template source

name Record<string, any>

custom name of the shader, if desired

Returns:
Type Description
PIXI.Shader

Powered by webdoc!