API

Interface IEffectCreationOptions

Options to be used when creating an effect.

interface IEffectCreationOptions {
    attributes: string[];
    defines: any;
    disableParallelShaderCompilation?: boolean;
    existingPipelineContext?: IPipelineContext;
    extraInitializationsAsync?: () => Promise<void>;
    fallbacks: Nullable<IEffectFallbacks>;
    indexParameters?: any;
    maxSimultaneousLights?: number;
    multiTarget?: boolean;
    onCompiled: Nullable<(effect: Effect) => void>;
    onError: Nullable<(effect: Effect, errors: string) => void>;
    processCodeAfterIncludes?: Nullable<ShaderCustomProcessingFunction>;
    processFinalCode?: Nullable<ShaderCustomProcessingFunction>;
    samplers: string[];
    shaderLanguage?: ShaderLanguage;
    transformFeedbackVaryings?: Nullable<string[]>;
    uniformBuffersNames?: string[];
    uniformsNames: string[];
}
Index
attributes: string[]

Attributes that will be used in the shader.

defines: any

Define statements that will be set in the shader.

disableParallelShaderCompilation?: boolean

If set to true the shader will not be compiles asynchronously, even if the engine allows it.

existingPipelineContext?: IPipelineContext

Provide an existing pipeline context to avoid creating a new one

extraInitializationsAsync?: () => Promise<void>

Additional async code to run before preparing the effect

Possible fallbacks for this effect to improve performance when needed.

indexParameters?: any

Parameters to be used with Babylons include syntax to iterate over an array (eg. {lights: 10})

maxSimultaneousLights?: number

Max number of lights that can be used in the shader.

multiTarget?: boolean

Is this effect rendering to several color attachments ?

onCompiled: Nullable<(effect: Effect) => void>

Callback that will be called when the shader is compiled.

onError: Nullable<(effect: Effect, errors: string) => void>

Callback that will be called if an error occurs during shader compilation.

processCodeAfterIncludes?: Nullable<ShaderCustomProcessingFunction>

If provided, will be called two times with the vertex and fragment code so that this code can be updated after the #include have been processed

processFinalCode?: Nullable<ShaderCustomProcessingFunction>

If provided, will be called two times with the vertex and fragment code so that this code can be updated before it is compiled by the GPU

samplers: string[]

Sampler texture variable names that will be set in the shader.

shaderLanguage?: ShaderLanguage

The language the shader is written in (default: GLSL)

transformFeedbackVaryings?: Nullable<string[]>
uniformBuffersNames?: string[]

Uniform buffer variable names that will be set in the shader.

uniformsNames: string[]

Uniform variable names that will be set in the shader.