ProgramTemplate

class ProgramTemplate

Helper class to create and manage a program template.

Constructor


new ProgramTemplate(vertexTemplateSrc: string, fragmentTemplateSrc: string, name: string) → {}
Parameters:
Name Type Attributes Default Description
vertexTemplateSrc string

<optional>

vertex shader template

fragmentTemplateSrc string

<optional>

fragment shader template

name string 'pixi-shader-template'

name of the shader template. This is used to generate the names for generated programs.

Summary


Properties from ProgramTemplate

fragmentMacroData

The macros used in the fragment shader

fragmentTemplateSrc

The fragment shader template

name

The name for generated programs

programCache

The cache of generated programs for each passed macro value.

vertexMacroData

The macros used in the vertex shader

vertexTemplateSrc

The vertex shader template

Methods from ProgramTemplate

PIXI.Program
generateProgram(data: MacroData, name: string)

Generates a shader program from this template and passed macro-data.

TemplateData
protected extractData(templateSrc: string)

Extracts the macros used in the template source.

string
protected processData(templateSrc: string, macros: TemplateData, data: MacroData)

Evaluates the macros in the template and generates the shader's source.

Public Properties


fragmentMacroData ProgramTemplate.ts:63
fragmentMacroData

The macros used in the fragment shader

fragmentTemplateSrc ProgramTemplate.ts:43
fragmentTemplateSrc

The fragment shader template

name ProgramTemplate.ts:48
name

The name for generated programs

programCache ProgramTemplate.ts:53
programCache

The cache of generated programs for each passed macro value.

vertexMacroData ProgramTemplate.ts:58
vertexMacroData

The macros used in the vertex shader

vertexTemplateSrc ProgramTemplate.ts:38
vertexTemplateSrc

The vertex shader template

Public Methods


generateProgram ProgramTemplate.ts:69
generateProgram(data: MacroData, name: string) → {PIXI.Program}

Generates a shader program from this template and passed macro-data.

Parameters:
Name Type Description
data MacroData

data providing the values of the macros in the shader template

name string

optional name, if another name is desired

Returns:
Type Description
PIXI.Program

the generated shader program

Protected Methods


extractData ProgramTemplate.ts:95
protected extractData(templateSrc: string) → {TemplateData}

Extracts the macros used in the template source.

Parameters:
Name Type Description
templateSrc string

the shader template source

Returns:
Type Description
TemplateData
processData ProgramTemplate.ts:128
protected processData(templateSrc: string, macros: TemplateData, data: MacroData) → {string}

Evaluates the macros in the template and generates the shader's source.

Parameters:
Name Type Description
templateSrc string

template source

macros TemplateData

data defining the macros in the template source

data MacroData

data providing the values for the macros

Returns:
Type Description
string

the generated shader source


Powered by webdoc!