shaders
The default shader used by the framework. It implements the standard rendering pipeline for sprites, text and geometry.
This shader is automatically loaded by init
and serves as the baseline for all 2D rendering. Copying this file is a good way to start writing custom shaders.
Features:
- Projects vertices using the global
viewProjectionMatrix. - Supports both Sprite and Font rendering (via
getTexColor). - Handles vertex colors (tinting).
- Handles color overrides.
void main() { gl_Position = getProjectedPosition(aPosition);
passVertexData();}The standard vertex entry point.
Projects the vertex position into clip space via getProjectedPosition.
Passes all standard attributes to the fragment stage via passVertexData.
void main() { vec4 texColor = getTexColor(vBytes, vUv);
oColor = texColor * vColor;
oColor.rgb = mix(oColor.rgb, vColorOverride.rgb, vColorOverride.a);}The standard fragment entry point.
Fetches the base color via getTexColor.
Multiplies by the vertex vColor (tint).
Mixes in the vColorOverride.