Metadata-Version: 2.4
Name: sdfii
Version: 0.1.0
Summary: Python frontend for the sdfii Zig SDF engine
Project-URL: Homepage, https://github.com/femtomc/sdfii
Project-URL: Repository, https://github.com/femtomc/sdfii
Author-email: femtomc <mccoybecker@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: 3d,game-engine,sdf,signed-distance-field,terminal
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Games/Entertainment
Classifier: Topic :: Multimedia :: Graphics :: 3D Rendering
Requires-Python: >=3.14
Description-Content-Type: text/markdown

# sdfii

A game engine built on signed distance functions.

Geometry is defined by composable SDF primitives. Physics is differentiable
end-to-end. Audio uses TidalCycles-style pattern algebra. The runtime layer
is reactive, based on the Syndicate model.

Concise, expressive, and intensely programmable. Bon appetit!

## Quick start (Python)

```bash
pip install sdfii
```

```python
import sdfii

# Build a scene from SDF primitives.
scene = sdfii.smooth_union(
    sdfii.sphere(radius=0.5),
    sdfii.box(0.8, 0.8, 0.8).translate(0.5, 0.5, 0),
    k=0.3,
)

# Compile and render in the terminal.
with sdfii.Engine() as engine:
    engine.compile(scene)
    engine.build_scene()
    sdfii.terminal_render(engine, width=120, height=40, dt=1 / 60)
```

## Quick start (Zig)

```zig
const sdf = @import("sdf");

var builder = sdf.ExprBuilder.init(allocator);
const sphere = try builder.primitive(.sphere, &.{ .radius = 0.5 });
const box = try builder.primitive(.box, &.{ .size = .{ 1, 1, 1 } });
const scene = try builder.binary(.union_, sphere, box);
const program = try sdf.compile(allocator, scene);
const d = sdf.eval(program, .{ 0, 0.5, 0 });
```

## Modules

| Module | What it does |
|--------|--------------|
| [`sdf`](native/sdfii/sdf/) | Expression trees, compilation to flat tapes, interval analysis |
| [`scene`](native/sdfii/scene/) | Incremental scene compilation with dirty detection |
| [`query`](native/sdfii/query/) | Distance, gradient, contact, raycast, sweep queries |
| [`physics`](native/sdfii/physics/) | Differentiable compliant contact simulation |
| [`dataspace`](native/sdfii/dataspace/) | Reactive assertion store (Syndicate model) |
| [`ecs`](native/sdfii/ecs/) | Sparse-set entity storage with reactive change tracking |
| [`world`](native/sdfii/world/) | Batched mutation protocol over the ECS kernel |
| [`engine`](native/sdfii/engine/) | Frame orchestrator, C ABI surface |
| [`audio`](native/sdfii/audio/) | TidalCycles-style pattern algebra for audio synthesis |
| [`gamelib`](native/sdfii/gamelib/) | Animation, navigation, inverse design, WoS PDE solving |
| [`backend`](native/sdfii/backend/) | Compute backend selection and routing |
| [`raymarch`](native/sdfii/raymarch/) | CPU sphere tracer for terminal and headless rendering |
| [`gpu`](native/sdfii/gpu/) | CUDA and Metal ray marching backends |
| [`testing`](native/sdfii/testing/) | Property-based testing with byte-stream shrinking |
| [`ffi`](native/sdfii/ffi/) | Shared `extern struct` definitions for the C boundary |
| [`assets`](native/sdfii/assets/) | Authored SDF geometry catalog with change fingerprinting |

## Building

Requires Zig 0.14+.

```
cd native/sdfii
zig build
zig build test
```

GPU backends build separately: `gpu/cuda/` (requires nvcc) and
`gpu/metal/` (macOS, requires Metal framework).

## License

MIT. See `LICENSE`.
