GKShaderLoader class
Loads and caches fragment shaders for GK effects.
Shaders are loaded from the packages/glow_effects/lib/shaders/glsl/ asset
path. The underlying FragmentProgram is cached per shader name so that
subsequent loads avoid redundant compilation, while each call still
returns a fresh FragmentShader instance.
{@tool snippet}
final shader = await GKShaderLoader.load('glitch');
shader.setFloat(0, elapsed);
canvas.drawRect(rect, Paint()..shader = shader);
{@end-tool}
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
clearCache(
) → void - Clears the shader cache, releasing all compiled FragmentPrograms.
-
load(
String shaderName) → Future< FragmentShader> -
Loads a fragment shader by
shaderName. -
preload(
List< String> shaderNames) → Future<void> - Preloads one or more shaders into the cache.