MaterialOptions
Index
Properties
optionalcolor
fragmentSource
Add custom fragment shader
*Note: Excalibur image alpha's are pre-multiplied
Pre-built varyings:
in vec2 v_uv
- UV coordinatein vec2 v_screenuv
- UV coordinate
Pre-built uniforms:
uniform sampler2D u_graphic
- The current graphic displayed by the GraphicsComponentuniform vec2 u_resolution
- The current resolution of the screenuniform vec2 u_size;
- The current size of the graphicuniform vec4 u_color
- The current color of the materialuniform float u_opacity
- The current opacity of the graphics context
optionalgraphicsContext
Excalibur graphics context to create the material (only WebGL is supported at the moment)
optionalimages
Add additional images to the material, you are limited by the GPU's maximum texture slots
Specify a dictionary of uniform sampler names to ImageSource
optionalname
Name the material for debugging
optionalvertexSource
Optionally specify a vertex shader
If none supplied the default will be used
#version 300 es // vertex position in local space in vec2 a_position; in vec2 a_uv; out vec2 v_uv; // orthographic projection matrix uniform mat4 u_matrix; // world space transform matrix uniform mat4 u_transform; void main() { // Set the vertex position using the ortho & transform matrix gl_Position = u_matrix * u_transform * vec4(a_position, 0.0, 1.0); // Pass through the UV coord to the fragment shader v_uv = a_uv; }
Add custom color, by default ex.Color.Transparent