SDFShape
Defined in: packages/sigma/src/rendering/nodes/types.ts:104
Definition of a Signed Distance Field shape. Shapes provide GLSL code that computes the signed distance from a point to the shape’s boundary (negative inside, 0 on boundary, positive outside).
Properties
glsl
glsl:
string
Defined in: packages/sigma/src/rendering/nodes/types.ts:119
GLSL function code that computes the signed distance field. Function signature: float sdf_{name}(vec2 uv, …) where … represents the shape-specific uniforms as additional parameters.
Param
Normalized coordinates in [-1, 1] range, (0, 0) at center
Returns
Signed distance (negative inside, 0 on boundary, positive outside)
inradiusFactor?
optionalinradiusFactor?:number
Defined in: packages/sigma/src/rendering/nodes/types.ts:138
Ratio of inradius to circumradius for this shape. This indicates how “deep” the shape goes relative to the bounding circle.
- Circle: 1.0 (inradius equals circumradius)
- Square: 1.0 (inscribed circle touches all sides)
- Triangle: 0.5 (inradius is half the circumradius for equilateral)
- Diamond: ~0.707 (√2/2 for a square rotated 45°)
Used by layers like border to correctly calculate fill sizes. Defaults to 1.0 if not specified.
name
name:
string
Defined in: packages/sigma/src/rendering/nodes/types.ts:109
Unique identifier for this shape (e.g., “circle”, “square”). Used to generate the GLSL function name: sdf_{name}
uniforms
uniforms:
UniformSpecification[]
Defined in: packages/sigma/src/rendering/nodes/types.ts:125
Additional uniforms required by this shape (e.g., u_cornerRadius, u_rotation). Each uniform’s value is already set when the shape is created.