No description
  • Rust 85.4%
  • C# 13.1%
  • PowerShell 1.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Meta Vens 1aa1ee2e83 Research: truck B-rep kernel evaluation (facts, torture harness, OCCT STEP checks)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 04:58:39 +02:00
docs Research: truck B-rep kernel evaluation (facts, torture harness, OCCT STEP checks) 2026-10-14 04:58:39 +02:00
examples Rename vg-csg to CultGeometry CSG 2026-08-26 17:38:13 +02:00
src Add signed distance over the ordered brush stream 2026-09-25 16:53:51 +02:00
tests Rename vg-csg to CultGeometry CSG 2026-08-26 17:38:13 +02:00
tools Rename vg-csg to CultGeometry CSG 2026-08-26 17:38:13 +02:00
.gitignore Make extracted vg-csg standalone 2026-05-07 22:52:50 +01:00
Cargo.lock Rename vg-csg to CultGeometry CSG 2026-08-26 17:38:13 +02:00
Cargo.toml Rename vg-csg to CultGeometry CSG 2026-08-26 17:38:13 +02:00
LICENSE Make extracted vg-csg standalone 2026-05-07 22:52:50 +01:00
README.md README: document the signed distance seam 2026-09-25 16:54:10 +02:00

GameCult.Geometry.Csg

The project is known as CultGeometry CSG. Its Rust package is gamecult-geometry-csg, exposed to Rust code as gamecult_geometry_csg.

Lean constructive geometry tooling for Rust/Bevy-math scene blockouts.

CultGeometry CSG is the extracted CSG kernel from VibeGeometry. It is not trying to be a full CAD kernel. It is a small, inspectable machine for agent-authored level and habitat geometry:

  • ordered additive, subtractive, and intersecting brush streams
  • axis-aligned and oriented box CSG through convex plane splitting
  • RealtimeCSG-shaped public vocabulary for operations, branches, trees, and dirty brush generations
  • exact observable parity fixtures where the public RealtimeCSG/demo API surface overlaps
  • mesh-array output suitable for Bevy-side ingestion
  • dirty-frontier and prefix-checkpoint experiments for realtime editing
  • additive habitat primitives used by the current examples

The crate is young and sharp in the places young crates are sharp. It exists so we can build concrete fixtures, profile real edits, and grow the API from working procedural scenes instead of designing the perfect museum label first.

Quick Start

cargo test
cargo run --example csg_room
cargo run --example dream_machine_level
cargo run --example industrial_maintenance_loop

The showpiece examples write OBJ/MTL/SVG artifacts under:

experiments/generated/

Core Shape

use bevy_math::{Quat, Vec3};
use gamecult_geometry_csg::{LevelDsl, MaterialId};

let mut level = LevelDsl::new();
level.solid_box(
    "wall",
    Vec3::new(0.0, 0.0, 1.5),
    Vec3::new(5.0, 0.3, 3.0),
    MaterialId(1),
);
level.cut_oriented_box(
    "angled doorway",
    Vec3::new(0.0, 0.0, 1.2),
    Vec3::new(1.4, 0.8, 2.2),
    Quat::from_rotation_z(0.25),
);

let output = level.assemble();
println!("triangles={}", output.mesh.triangle_count());

Doctrine

CSG is the adjudicator, not the authoring language. Good procedural scenes should still be written in the coordinate system that belongs to the domain: room bay, curved shell segment, manifold face, staging rail, brush tree, dirty frontier. Compile those local claims into CSG brushes late.

That bias is visible in examples/industrial_maintenance_loop.rs, where a curved habitat room is authored in tangent/radial/up space and then lowered into world-space oriented boxes and mesh bands.

Signed Distance

Assembler::distance(p) (and stream_distance over any brush slice) lowers the same ordered brush stream to a scalar field instead of triangles: negative inside, positive outside. Add folds with min, Subtract with max(d, -b), Intersect with max. It is the seam for isosurface meshing and GPU field refinement.

Boxes, oriented boxes and Z cylinders are exact distances. Domes (a half-ellipsoid) and floret arms (max of face planes) are bounds that are exact on the surface and never overestimate. The field honours every operation on every primitive, including the non-box cutters the polygon kernel currently warns about and skips.

Docs

Research and implementation notes live in docs/:

  • docs/realtime-csg-bevy-assembler.md
  • docs/realtime-csg-doctrine.md
  • docs/csg-performance-fixtures.md

License

MIT