Skip to content

Commit

Permalink
rounded rect sdf2d scale rounding by size
Browse files Browse the repository at this point in the history
close #1107
  • Loading branch information
t3kt committed Jul 22, 2023
1 parent 6ee7ee2 commit 3addb58
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/operators/sdf2d/roundedRectangleSdf2d.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ReturnT thismap(CoordT p, ContextT ctx) {
#ifdef THIS_HAS_INPUT_roundingField
r *= inputOp_roundingField(p, ctx);
#endif
ROUNDNESS_UNIT_BODY();
ReturnT res = createSdf(sdRoundedBox(p, s, r));
#ifdef RAYTK_USE_UV
assignUV(res, vec3(map01(p, -s/2., s/2.), 0.));
Expand Down
Binary file modified src/operators/sdf2d/roundedRectangleSdf2d.tox
Binary file not shown.
18 changes: 17 additions & 1 deletion src/operators/sdf2d/roundedRectangleSdf2d.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
!rop
meta: !meta
opType: raytk.operators.sdf2d.roundedRectangleSdf2d
opVersion: '8'
opVersion: '9'
opStatus: default
opDef: !def
enable: true
Expand Down Expand Up @@ -39,3 +39,19 @@ inputs:
returnType: !returnT
Returntypefloat: true
Returntypevec4: true
elements:
- !opElement
name: codeSwitcher_Roundnessunit
elementType: codeSwitcher
params:
Elementroot: ''
Table: !table
file: src/operators/sdf2d/roundedRectangleSdf2d_roundnessUnits.txt
name: roundnessUnits
Param: Roundnessunit
Autoupdateparams: true
Manageparamstates: false
Alwaysincludeallparams: false
Switchmode: inline
Indexexpr: ''
Placeholder: ROUNDNESS_UNIT_BODY();
3 changes: 3 additions & 0 deletions src/operators/sdf2d/roundedRectangleSdf2d_roundnessUnits.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name label code
dist Distance
ratio Ratio of Scale r *= vmin(s);
Binary file not shown.

0 comments on commit 3addb58

Please sign in to comment.