Skip to content

Commit 12b7672

Browse files
committed
!sdf node is an implicit union so make it accept same attributes
1 parent 5d1ad37 commit 12b7672

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

docs/canvas3d.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,8 +1100,12 @@ to alter the boundaries between the combined surfaces (or with trim plane):
11001100
`chamfer=` *DISTANCE*
11011101
: An inset/outset distance for a 45° chamfer.
11021102

1103-
The `!sdf` node also supports providing a custom SDF function with the following
1104-
attribute:
1103+
An `!sdf` node with multiple children represents an implicit `!union` operation
1104+
and so supports the same `smooth`, `fillet` and `chamfer` attributes.
1105+
1106+
Instead of providing a tree of primitive models and operations, an `!sdf` node
1107+
may also be specified as a custom signed distance field function by providing
1108+
the following attribute:
11051109

11061110
`function=` *FUNCTION*
11071111
: A **Flitter** function taking a 3-vector position (in pre-transform model

src/flitter/render/window/canvas3d.pyx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,10 @@ cdef Model get_model(Node node, bint top):
476476
function.objects is not None and callable(f := function.objects[0]):
477477
model = Model._sdf(f, None, minimum, maximum, resolution)
478478
else:
479-
model = Model._boolean('union', [get_model(child, False) for child in node._children], 0, 0, 0)
479+
model = Model._boolean('union', [get_model(child, False) for child in node._children],
480+
node.get_float('smooth', 0),
481+
node.get_float('fillet', 0),
482+
node.get_float('chamfer', 0))
480483
model = Model._sdf(None, model, minimum, maximum, resolution)
481484
elif node.kind is 'mix':
482485
model = Model._mix([get_model(child, False) for child in node._children], node.get_fvec('weights', 0, true_))

0 commit comments

Comments
 (0)