Skip to main content
Version: Phaser v4.0.0-rc.6

Phaser.Renderer.WebGL.Shaders

Scope: static

Source: src/renderer/webgl/shaders/index.js#L7

Static functions

MakeApplyFlatLighting

<static> MakeApplyFlatLighting([disable])

Description:

Return a ShaderAdditionConfig for applying lighting to a flat piece of geometry.

Parameters:

nametypeoptionaldefaultdescription
disablebooleanYesfalseWhether to disable the shader addition on creation.

Returns: Phaser.Types.Renderer.WebGL.ShaderAdditionConfig - The shader addition configuration.

Source: src/renderer/webgl/shaders/additionMakers/MakeApplyFlatLighting.js#L9
Since: 4.0.0


MakeApplyLighting

<static> MakeApplyLighting([disable])

Description:

Return a ShaderAdditionConfig for applying lighting to a texture.

The rotation variable must be available in the vertex renderer.

Parameters:

nametypeoptionaldefaultdescription
disablebooleanYesfalseWhether to disable the shader addition on creation.

Returns: Phaser.Types.Renderer.WebGL.ShaderAdditionConfig - The shader addition configuration.

Source: src/renderer/webgl/shaders/additionMakers/MakeApplyLighting.js#L9
Since: 4.0.0


MakeApplyTint

<static> MakeApplyTint([disable])

Description:

Return a ShaderAdditionConfig for applying a tint to a texture.

Parameters:

nametypeoptionaldefaultdescription
disablebooleanYesfalseWhether to disable the shader addition on creation.

Returns: Phaser.Types.Renderer.WebGL.ShaderAdditionConfig - The shader addition configuration.

Source: src/renderer/webgl/shaders/additionMakers/MakeApplyTint.js#L9
Since: 4.0.0


MakeBoundedSampler

<static> MakeBoundedSampler([disable])

Description:

Return a ShaderAdditionConfig for bounded texture sampling.

A bounded sampler will return a transparent pixel

if the texture coordinates are outside the texture bounds.

Parameters:

nametypeoptionaldefaultdescription
disablebooleanYesfalseWhether to disable the shader addition on creation.

Returns: Phaser.Types.Renderer.WebGL.ShaderAdditionConfig - The shader addition configuration.

Source: src/renderer/webgl/shaders/additionMakers/MakeBoundedSampler.js#L9
Since: 4.0.0


MakeDefineLights

<static> MakeDefineLights([disable])

Description:

Return a ShaderAdditionConfig for defining the lights and core lighting

algorithm in the fragment shader.

Parameters:

nametypeoptionaldefaultdescription
disablebooleanYesfalseWhether to disable the shader addition on creation.

Returns: Phaser.Types.Renderer.WebGL.ShaderAdditionConfig - The shader addition configuration.

Source: src/renderer/webgl/shaders/additionMakers/MakeDefineLights.js#L9
Since: 4.0.0


MakeFlatNormal

<static> MakeFlatNormal([disable])

Description:

Return a ShaderAdditionConfig for defining a flat normal.

This is used to light objects without a normal map.

Parameters:

nametypeoptionaldefaultdescription
disablebooleanYesfalseWhether to disable the shader addition on creation.

Returns: Phaser.Types.Renderer.WebGL.ShaderAdditionConfig - The shader addition configuration.

Source: src/renderer/webgl/shaders/additionMakers/MakeFlatNormal.js#L7
Since: 4.0.0


MakeGetNormalFromMap

<static> MakeGetNormalFromMap([disable])

Description:

Return a ShaderAdditionConfig for creating an outInverseRotationMatrix

in the vertex shader, which is used to apply lighting to a texture.

Parameters:

nametypeoptionaldefaultdescription
disablebooleanYesfalseWhether to disable the shader addition on creation.

Returns: Phaser.Types.Renderer.WebGL.ShaderAdditionConfig - The shader addition configuration.

Source: src/renderer/webgl/shaders/additionMakers/MakeGetNormalFromMap.js#L9
Since: 4.0.0


MakeGetTexCoordOut

<static> MakeGetTexCoordOut([disable])

Description:

Return a ShaderAdditionConfig for getting the texture coordinates

from the vertex shader via the outTexCoord variable.

Parameters:

nametypeoptionaldefaultdescription
disablebooleanYesfalseWhether to disable the shader addition on creation.

Returns: Phaser.Types.Renderer.WebGL.ShaderAdditionConfig - The shader addition configuration.

Source: src/renderer/webgl/shaders/additionMakers/MakeGetTexCoordOut.js#L7
Since: 4.0.0


MakeOutFrame

<static> MakeOutFrame([disable])

Description:

Returns a ShaderAdditionConfig for providing the vertex shader with the inFrame attribute.

Parameters:

nametypeoptionaldefaultdescription
disablebooleanYesfalseWhether to disable the shader addition on creation.

Returns: Phaser.Types.Renderer.WebGL.ShaderAdditionConfig - The shader addition configuration.

Source: src/renderer/webgl/shaders/additionMakers/MakeOutFrame.js#L7
Since: 4.0.0


MakeOutInverseRotation

<static> MakeOutInverseRotation([disable])

Description:

Return a ShaderAdditionConfig for creating an outInverseRotationMatrix

in the vertex shader, which is used to apply lighting to a texture.

The rotation variable must be available in the vertex renderer.

Parameters:

nametypeoptionaldefaultdescription
disablebooleanYesfalseWhether to disable the shader addition on creation.

Returns: Phaser.Types.Renderer.WebGL.ShaderAdditionConfig - The shader addition configuration.

Source: src/renderer/webgl/shaders/additionMakers/MakeOutInverseRotation.js#L9
Since: 4.0.0


MakeRotationDatum

<static> MakeRotationDatum([disable])

Description:

Return a ShaderAdditionConfig for deriving rotation from inTexDatum.

This is useful for shaders that need to know their orientation.

Parameters:

nametypeoptionaldefaultdescription
disablebooleanYesfalseWhether to disable the shader addition on creation.

Returns: Phaser.Types.Renderer.WebGL.ShaderAdditionConfig - The shader addition configuration.

Source: src/renderer/webgl/shaders/additionMakers/MakeRotationDatum.js#L7
Since: 4.0.0


MakeSampleNormal

<static> MakeSampleNormal([disable])

Description:

Return a ShaderAdditionConfig for sampling a normal map

in the context of a TilemapGPULayer shader.

This shader uses a Samples object to collate texture samples.

Parameters:

nametypeoptionaldefaultdescription
disablebooleanYesfalseWhether to disable the shader addition on creation.

Source: src/renderer/webgl/shaders/additionMakers/MakeSampleNormal.js#L7
Since: 4.0.0


MakeTexCoordFrameClamp

<static> MakeTexCoordFrameClamp([disable])

Description:

Returns a ShaderAdditionConfig for clamping coordinates inside a frame.

This prevents bleeding across the edges of the frame.

However, it creates a hard edge at the frame boundary.

Parameters:

nametypeoptionaldefaultdescription
disablebooleanYesfalseWhether to disable the shader addition on creation.

Returns: Phaser.Types.Renderer.WebGL.ShaderAdditionConfig - The shader addition configuration.

Source: src/renderer/webgl/shaders/additionMakers/MakeTexCoordFrameClamp.js#L9
Since: 4.0.0


MakeTexCoordFrameWrap

<static> MakeTexCoordFrameWrap([disable])

Description:

Returns a ShaderAdditionConfig for wrapping coordinates inside a frame.

This makes the texture repeat within the bounds of the frame -

it's what makes a TileSprite work.

Parameters:

nametypeoptionaldefaultdescription
disablebooleanYesfalseWhether to disable the shader addition on creation.

Returns: Phaser.Types.Renderer.WebGL.ShaderAdditionConfig - The shader addition configuration.

Source: src/renderer/webgl/shaders/additionMakers/MakeTexCoordFrameWrap.js#L7
Since: 4.0.0