(x: number, y: number, width: number, height: number, radius: number)
| 22 | } |
| 23 | |
| 24 | function roundedRectSDF(x: number, y: number, width: number, height: number, radius: number): number { |
| 25 | const qx = Math.abs(x) - width + radius |
| 26 | const qy = Math.abs(y) - height + radius |
| 27 | return Math.min(Math.max(qx, qy), 0) + length(Math.max(qx, 0), Math.max(qy, 0)) - radius |
| 28 | } |
| 29 | |
| 30 | function texture(x: number, y: number): Vec2 { |
| 31 | return { x, y } |