sdf/colors
ColoredSDF: SdfExpr paired with per-leaf color and object ID.
Since: Phase 2
csdf-sdf
(csdf-sdf [cn :int] :int)
the combined SdfExpr handle for this colored subtree.
| cn | ColoredSDF handle |
SdfExpr handle.
(sdf-eval (csdf-sdf scene) 0.0 0.0 0.0)
Since: Phase 2
csdf-left
(csdf-left [cn :int] :int)
left colored child handle (0 for leaves). Since: Phase 3
csdf-right
(csdf-right [cn :int] :int)
right colored child handle (0 for leaves and unaries). Since: Phase 3
csdf-r
(csdf-r [cn :int] :float)
red color component of a leaf node. Since: Phase 3
csdf-g
(csdf-g [cn :int] :float)
green color component of a leaf node. Since: Phase 3
csdf-b
(csdf-b [cn :int] :float)
blue color component of a leaf node. Since: Phase 3
csdf-object-id
(csdf-object-id [cn :int] :int)
object ID of a colored node (-1 for interior). Since: Phase 3
csdf-free
(csdf-free [cn :int] :void)
free a ColoredSDF tree and its associated SdfExpr tree.
| cn | ColoredSDF handle; safe to call with 0. |
(csdf-free scene)
Since: Phase 2
colored-sphere
(colored-sphere [cx :float cy :float cz :float r :float cr :float cg :float cb :float objid :int] :int)
sphere centred at (cx,cy,cz) with radius r and RGB color.
| cx cy cz -- centre position | ||
| r | radius (> 0) | |
| cr cg cb -- diffuse RGB color in [0, 1] | ||
| objid | object ID (>= 0; unique per colored leaf in the scene) |
ColoredSDF handle.
(colored-sphere 0.0 0.0 0.0 1.5 1.0 0.0 0.0 1)
Since: Phase 2
colored-box
(colored-box [lx :float ly :float lz :float hx :float hy :float hz :float cr :float cg :float cb :float objid :int] :int)
AABB from (lx,ly,lz) to (hx,hy,hz) with RGB color.
| lx ly lz -- minimum corner | ||
| hx hy hz -- maximum corner | ||
| cr cg cb -- diffuse RGB color in [0, 1] | ||
| objid | object ID (>= 0) |
ColoredSDF handle.
(colored-box -1.0 -1.0 -1.0 1.0 1.0 1.0 0.0 1.0 0.0 2)
Since: Phase 2
colored-cylinder
(colored-cylinder [cx :float cy :float cz :float r :float cr :float cg :float cb :float objid :int] :int)
infinite cylinder through (cx,cy,*) radius r with color.
Since: Phase 2
colored-plane
(colored-plane [nx :float ny :float nz :float d :float cr :float cg :float cb :float objid :int] :int)
infinite plane n.p + d = 0 with given color.
Since: Phase 2
colored-union
(colored-union [a :int b :int] :int)
CSG union of two colored SDFs.
| a b -- ColoredSDF handles |
Combined ColoredSDF handle.
(colored-union
(colored-sphere -1.0 0.0 0.0 0.8 1.0 0.0 0.0 1)
(colored-sphere 1.0 0.0 0.0 0.8 0.0 1.0 0.0 2))
Since: Phase 2
colored-intersection
(colored-intersection [a :int b :int] :int)
CSG intersection of two colored SDFs.
Since: Phase 2
colored-difference
(colored-difference [a :int b :int] :int)
CSG difference: a minus b.
| a | base shape | |
| b | shape to subtract |
Since: Phase 2
colored-smooth-union
(colored-smooth-union [a :int b :int k :float] :int)
smooth union of two colored SDFs (Quilez blend).
| a b -- ColoredSDF handles | ||
| k | blend radius (>= 0) |
Since: Phase 2
colored-translate
(colored-translate [cn :int tx :float ty :float tz :float] :int)
translate a colored SDF by (tx, ty, tz).
| cn | ColoredSDF handle | |
| tx ty tz -- translation vector |
Translated ColoredSDF handle.
(colored-translate my-sphere 0.0 2.0 0.0)
Since: Phase 2
Internal definitions
csdf--make-leaf-- allocate a ColoredSDF leaf.csdf--make-node-- allocate a ColoredSDF interior node.