No matching definitions.

sdf/colors

src/sdf/colors.tur

ColoredSDF: SdfExpr paired with per-leaf color and object ID.

Since: Phase 2

defn

csdf-sdf

(csdf-sdf [cn :int] :int)

the combined SdfExpr handle for this colored subtree.

cnColoredSDF handle

SdfExpr handle.

(sdf-eval (csdf-sdf scene) 0.0 0.0 0.0)

Since: Phase 2

defn

csdf-left

(csdf-left [cn :int] :int)

left colored child handle (0 for leaves). Since: Phase 3

defn

csdf-right

(csdf-right [cn :int] :int)

right colored child handle (0 for leaves and unaries). Since: Phase 3

defn

csdf-r

(csdf-r [cn :int] :float)

red color component of a leaf node. Since: Phase 3

defn

csdf-g

(csdf-g [cn :int] :float)

green color component of a leaf node. Since: Phase 3

defn

csdf-b

(csdf-b [cn :int] :float)

blue color component of a leaf node. Since: Phase 3

defn

csdf-object-id

(csdf-object-id [cn :int] :int)

object ID of a colored node (-1 for interior). Since: Phase 3

defn

csdf-free

(csdf-free [cn :int] :void)

free a ColoredSDF tree and its associated SdfExpr tree.

cnColoredSDF handle; safe to call with 0.
(csdf-free scene)

Since: Phase 2

defn

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
rradius (> 0)
cr cg cb -- diffuse RGB color in [0, 1]
objidobject 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

defn

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]
objidobject 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

defn

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

defn

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

defn

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

defn

colored-intersection

(colored-intersection [a :int b :int] :int)

CSG intersection of two colored SDFs.

Since: Phase 2

defn

colored-difference

(colored-difference [a :int b :int] :int)

CSG difference: a minus b.

abase shape
bshape to subtract

Since: Phase 2

defn

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
kblend radius (>= 0)

Since: Phase 2

defn

colored-translate

(colored-translate [cn :int tx :float ty :float tz :float] :int)

translate a colored SDF by (tx, ty, tz).

cnColoredSDF 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.