The sigil-summon module is the core engine (or "summoner") responsible for interpreting the scene graph and managing the rendering lifecycle. It also provides SSR (Server-Side Rendering) support for screen-space effects.
SigilEffectCanvasThe primary composable for rendering screen-space shader effects with SSR support.
@Composable
fun SigilEffectCanvas(
id: String = "sigil-effect-canvas",
width: String = "100%",
height: String = "100%",
config: SigilCanvasConfig = SigilCanvasConfig(),
interactions: InteractionConfig = InteractionConfig(),
fallback: @Composable () -> String = { "" },
content: @Composable () -> String
): String
Parameters:
id: Unique ID for the canvas elementwidth: CSS width of the canvasheight: CSS height of the canvasconfig: Canvas configuration (device pixel ratio, power preference, fallbacks)interactions: Interaction configuration (mouse tracking, etc.)fallback: Composable to render for noscript/no-WebGPU fallbackcontent: Composable lambda containing SigilEffect() callsServer Output: On the JVM, renders an HTML canvas with effect data embedded in the data-sigil-effects attribute as JSON.
SigilEffectRegisters a shader effect within a SigilEffectCanvas.
@Composable
fun SigilEffect(effect: ShaderEffectData): String
CustomShaderEffectConvenience function to create and register a custom shader effect.
@Composable
fun CustomShaderEffect(
id: String,
fragmentShader: String, // WGSL shader code
name: String? = null,
timeScale: Float = 1f,
enableMouseInteraction: Boolean = false,
uniforms: Map<String, UniformValue> = emptyMap()
): String
EffectSummonContextContext registry for Sigil effect composition. Tracks registered effects during composition for serialization (server) or hydration (client).
class EffectSummonContext {
val effects: List<ShaderEffectData> // Collected effects
val canvasConfig: SigilCanvasConfig
val interactionConfig: InteractionConfig
fun registerEffect(effect: ShaderEffectData)
fun buildComposerData(id: String): EffectComposerData
companion object {
fun current(): EffectSummonContext
fun createServerContext(): EffectSummonContext
fun createClientContext(): EffectSummonContext
fun <R> withContext(context: EffectSummonContext, block: () -> R): R
}
}
SigilSummonContextA context class that holds the current state of the engine, including the active scene, renderer, and camera.
MateriaCanvas (Core)The platform-agnostic implementation of the canvas handling logic. It bridges the gap between the abstract scene graph and the platform-specific graphics context (JVM AWT, Android Surface, WebGL/WebGPU).
SigilEffectHydratorHandles client-side hydration of effect canvases rendered on the server.
object SigilEffectHydratorJs {
fun hydrate(canvasId: String)
fun isWebGPUAvailable(): Boolean
fun isWebGLAvailable(): Boolean
fun getAvailableRenderer(): String // "webgpu" | "webgl" | "css"
}
The hydrator:
data-sigil-effects attributedata-sigil-config and data-sigil-interactionsSigil uses a "Summon" concept where nodes are summoned into existence.
