Skip to main content

Module gpu_sdf

Module gpu_sdf 

Source
Expand description

GPU-accelerated Signed Distance Field (SDF) computation (CPU mock).

This module provides:

  • Primitive SDF shapes (SdfPrimitive)
  • CSG boolean operations (SdfOp)
  • A tree-based SDF scene (SdfNode)
  • A volumetric grid (SdfGrid) that can be filled from any SDF function
  • A mock GPU dispatcher (GpuSdfCompute) that evaluates primitives over a grid
  • Free-standing SDF evaluation helpers

Structs§

GpuSdfCompute
Mock GPU dispatcher for SDF field computation.
SdfGrid
A regular 3-D grid that stores SDF values as f32.

Enums§

SdfNode
A node in a CSG (Constructive Solid Geometry) SDF tree.
SdfOp
Boolean / blending operations that combine two SDF values.
SdfPrimitive
A primitive signed distance field shape.

Functions§

sdf_box
Signed distance from point p to an axis-aligned box centred at center with half-extents b.
sdf_cylinder
Signed distance from point p to a finite cylinder (Y-axis aligned) centred at center with radius radius and total height height.
sdf_gradient
Estimate the surface normal at p using central differences on sdf.
sdf_smooth_union
Polynomial smooth-minimum of d1 and d2 with blend radius k.
sdf_sphere
Signed distance from point p to a sphere at center with radius r.
sdf_torus
Signed distance from point p to a torus (Y-axis aligned) centred at center with major radius r_major and minor radius r_minor.