Types.GameObjects.Shader
ShaderConfig
<static> ShaderConfig
| name | type | optional | default | description |
|---|---|---|---|---|
| config | string | Phaser.Types.GameObjects.Shader.ShaderQuadConfig | No | The configuration object this Shader will use. It can also be a key that corresponds to a shader in the shader cache, which will be used as fragmentKey in a new config object. | |
| width | number | Yes | 128 | The width of the Game Object. |
| height | number | Yes | 128 | The height of the Game Object. |
Type: object
Member of: Phaser.Types.GameObjects.Shader
Source: src/gameobjects/shader/typedefs/ShaderConfig.js#L1
Since: 3.50.0
ShaderQuadConfig
<static> ShaderQuadConfig
| name | type | optional | description |
|---|---|---|---|
| name | string | No | The name of the render node. This is also used for shaderName if not set. |
| shaderName | string | Yes | The name of the shader. This is used as the stub for the internal shader name. If another shader with the same name exists, that will be used instead, so it's best to use a unique name. |
| fragmentSource | string | Yes | The fragment shader source code. This overrides anything set in fragmentKey. |
| vertexSource | string | Yes | The vertex shader source code. This overrides anything set in vertexKey. |
| fragmentKey | string | Yes | The key of the fragment shader source to use from the shader cache. |
| vertexKey | string | Yes | The key of the vertex shader source to use from the shader cache. |
| setupUniforms | function | Yes | A function that sets any uniform values that the shader needs. It takes two parameters: setUniform and drawingContext. setUniform is a function (name: string, value: any) => void that you can call to set a uniform value. drawingContext is the current drawing context. |
| initialUniforms | object | Yes | An object containing the initial uniform values to set. The keys are the uniform names, and the values are the uniform values. This is used to set up the shader before it is rendered for the first time. |
| shaderAdditions | Array.<Phaser.Types.Renderer.WebGL.ShaderAdditionConfig> | Yes | Additional snippets to add to the shader. An advanced configuration option. You can use updateShaderConfig to edit these at render time, resulting in different shaders. |
| updateShaderConfig | function | Yes | A function that updates the shader configuration. An advanced configuration option. It takes three parameters: drawingContext, gameObject, renderNode. drawingContext is the current drawing context. gameObject is the object which is rendering. renderNode is the ShaderQuad render node which invoked the function. |
Type: object
Member of: Phaser.Types.GameObjects.Shader
Source: src/gameobjects/shader/typedefs/ShaderQuadConfig.js#L1
Since: 4.0.0