CLASSES
TagsA - Z

Effect

Effect

Description

class Effect

Constructor

new Effect(baseName, attributesNames, uniformsNames, samplers, engine, defines, fallbacks, onCompiled, onError, indexParameters)

Parameters

Name Type Description
baseName any The base name of the effect (The name of file without .fragment.fx or .vertex.fx)
attributesNames string[] An array containing the list of attributes.
uniformsNames string[] An array containing the list of uniforms names.
samplers string[] @param samplers
engine any The given engine
optional defines string The list of defines used by this effect.
optional fallbacks EffectFallbacks @param fallbacks
optional onCompiled (effect: Effect) => void Function called when given effect are successfully compiled
optional onError (effect: Effect, errors: string) => void

Members

name : any

The effect name

defines : string

The array of defines used by this effect

onCompiled : (effect: Effect) => void

Function called when given effect are successfully compiled

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

Function called when an error occurs

onBind : (effect: Effect) => void

isSupported : boolean

static ShadersStore : { }

static IncludesShadersStore : { }

Methods

isReady() → boolean

Function to know if effect is ready

getProgram() → WebGLProgram

Return the shader program linked to this effect

getAttributesNames() → string[]

Return attributes names of the effect

getAttributeLocation(index) → number

Return the attribute location at the specified index

Parameters

Name Type Description
index number The given index

getAttributeLocationByName(name) → number

Return the attribute location at the specified name

Parameters

Name Type Description
name string The given name

getAttributesCount() → number

Return the number of attributes

getUniformIndex(uniformName) → number

Return the index of the searched name

Parameters

Name Type Description
uniformName string The given uniform name

getUniform(uniformName) → WebGLUniformLocation

Return searched parameter if exist

Parameters

Name Type Description
uniformName string The given uniform name

getSamplers() → string[]

Return samplers

getCompilationError() → string

Return the program compilation error

getVertexShaderSource() → string

getFragmentShaderSource() → string

setTexture(channel, texture) → void

Set the texture to the effect

Parameters

Name Type Description
channel string @param channel
texture BaseTexture The given texture

setTextureArray(channel, textures) → void

Parameters

Name Type Description
channel string @param channel
textures BaseTexture[]

setTextureFromPostProcess(channel, postProcess) → void

Set the texture to the effect from post process

Parameters

Name Type Description
channel string @param channel
postProcess PostProcess The given post process

setIntArray(uniformName, array) → Effect

Parameters

Name Type Description
uniformName string The given uniform name
array Int32Array

setIntArray2(uniformName, array) → Effect

Parameters

Name Type Description
uniformName string The given uniform name
array Int32Array

setIntArray3(uniformName, array) → Effect

Parameters

Name Type Description
uniformName string The given uniform name
array Int32Array

setIntArray4(uniformName, array) → Effect

Parameters

Name Type Description
uniformName string The given uniform name
array Int32Array

setFloatArray(uniformName, array) → Effect

Parameters

Name Type Description
uniformName string The given uniform name
array Float32Array

setFloatArray2(uniformName, array) → Effect

Parameters

Name Type Description
uniformName string The given uniform name
array Float32Array

setFloatArray3(uniformName, array) → Effect

Parameters

Name Type Description
uniformName string The given uniform name
array Float32Array

setFloatArray4(uniformName, array) → Effect

Parameters

Name Type Description
uniformName string The given uniform name
array Float32Array

setArray(uniformName, array) → Effect

Set the array given by its name

Parameters

Name Type Description
uniformName string The given uniform name
array number[]

setArray2(uniformName, array) → Effect

Parameters

Name Type Description
uniformName string The given uniform name
array number[]

setArray3(uniformName, array) → Effect

Parameters

Name Type Description
uniformName string The given uniform name
array number[]

setArray4(uniformName, array) → Effect

Parameters

Name Type Description
uniformName string The given uniform name
array number[]

setMatrices(uniformName, matrices) → Effect

Set the matrice given by its name

Parameters

Name Type Description
uniformName string The given uniform name
matrices Float32Array The matrices

setMatrix(uniformName, matrix) → Effect

Set the matrix given by its name

Parameters

Name Type Description
uniformName string The given uniform name
matrix Matrix the matrix

setMatrix3x3(uniformName, matrix) → Effect

Parameters

Name Type Description
uniformName string The given uniform name
matrix Float32Array the matrix

setMatrix2x2(uniformName, matrix) → Effect

Parameters

Name Type Description
uniformName string The given uniform name
matrix Float32Array the matrix

setFloat(uniformName, value) → Effect

Set the float given by its name

Parameters

Name Type Description
uniformName string The given uniform name
value number The float

setBool(uniformName, bool) → Effect

Set the boolean given by its name

Parameters

Name Type Description
uniformName string The given uniform name
bool boolean The boolean

setVector2(uniformName, vector2) → Effect

Set the vector2 given by its name

Parameters

Name Type Description
uniformName string The given uniform name
vector2 Vector2 The vector2

setFloat2(uniformName, x, y) → Effect

Set the float2 given by its name

Parameters

Name Type Description
uniformName string The given uniform name
x number The value on x axis
y number The value on y axis

setVector3(uniformName, vector3) → Effect

Set the Vector3 given by its name

Parameters

Name Type Description
uniformName string The given uniform name
vector3 Vector3 The vector3

setFloat3(uniformName, x, y, z) → Effect

Set the float3 given by its name

Parameters

Name Type Description
uniformName string The given uniform name
x number The value on x axis
y number The value on y axis

setVector4(uniformName, vector4) → Effect

Parameters

Name Type Description
uniformName string The given uniform name
vector4 Vector4

setFloat4(uniformName, x, y, z, w) → Effect

Set the float4 given by its name

Parameters

Name Type Description
uniformName string The given uniform name
x number The value on x axis
y number The value on y axis
z number The value on z axis

setColor3(uniformName, color3) → Effect

Set the color3 given by its name

Parameters

Name Type Description
uniformName string The given uniform name
color3 Color3 The color

setColor4(uniformName, color3, alpha) → Effect

Parameters

Name Type Description
uniformName string The given uniform name
color3 Color3 The color
alpha number Alpha is the transparency between 0 and 1.