feat: production-grade 4D primitive catalog, lighting, CI, docs#16
Merged
Conversation
…Mesh4D - Mesh4D: general tetrahedral mesh (merge, weld via spatial hash, transform baking, validation, Gram-determinant cell volumes, face-pairing / watertightness check) - primitives::polytopes: pentachoron (5-cell), hexadecachoron (16-cell), icositetrachoron (24-cell, 96 tets via octahedral cell splitting), hexacosichoron (600-cell: 120 binary-icosahedral-group vertices, 600 cells found as 4-cliques of the edge graph) - primitives::curved: hypersphere (refined 16-cell boundary, O(h²) convergence to 2π²r³), spherinder, cubinder, duocylinder — all built on Dompierre lowest-index prism splitting with shared vertex pools for crack-free seams - fix(tesseract): emit only the 48 boundary tetrahedra instead of all 84 Kuhn tets — the 36 internal membranes wasted ~43% of slice work and rendered as spurious walls from inside; boundary is now watertight - every primitive pinned by structure, watertightness, and closed-form boundary-volume tests (+37 tests)
- ShapeTemplate variants: Hypersphere, Pentachoron, Hexadecachoron, Icositetrachoron, Hexacosichoron, Spherinder, Cubinder, Duocylinder (resolution fields default via serde so scene files stay terse) - bounding_radius() closed-form per variant; ColliderHint maps round shapes to sphere colliders, others to conservative AABBs - scene instantiation uses collider hints instead of hardcoded tesseract-only half-extents - RON round-trip + defaults + collider hint tests (+4 tests)
- scenes/gallery.ron: floor plus all nine primitive exhibits (tesseract, hypersphere, 5-cell, 16-cell, 24-cell, 600-cell, spherinder, cubinder, duocylinder), with a dynamic hypersphere to exercise collider hints - examples/shape_showcase: offscreen GPU renderer for every primitive across three slice offsets and three orientations; writes PPM frames and logs triangle counts, using the real slice + render pipelines - tests/gallery_scene: parses and instantiates the gallery through SceneManager, verifies all primitive variants are present, and builds renderable geometry Verification: - cargo run --example shape_showcase -- .scratchpad/captures-gallery produced 81 captures, zero zero-triangle frames - contact-sheet.png visually checked from central slices - cargo clippy --workspace --all-targets -- -D warnings - RUSTDOCFLAGS=-Dwarnings cargo doc --workspace --no-deps - cargo test --workspace (976 passed)
- RenderUniforms v2: camera position, specular parameters, fog, and up to four point lights (336-byte layout pinned against WGSL) - render.wgsl: two-sided normal handling for arbitrary slice triangle winding, directional + point light Blinn-Phong, W-color blending, and exponential distance fog - render pipeline disables back-face culling, matching the slice shader's non-stable winding - all examples and render system inherit new uniform defaults Verification: - cargo run --example shape_showcase -- .scratchpad/captures-gallery-lit produced 81 captures, zero zero-triangle frames; contact sheet visually checked - cargo clippy --workspace --all-targets -- -D warnings - RUSTDOCFLAGS=-Dwarnings cargo doc --workspace --no-deps - cargo test --workspace (977 passed)
Run cargo fmt --all so CI can enforce formatting consistently across the workspace. Mechanical formatting only.
- GitHub Actions CI: fmt, clippy -D warnings, rustdoc -D warnings, workspace tests - 4d-geometry skill: Mesh4D/watertightness/prism-splitting workflow - headless-visual-verification skill: shape_showcase + invariant capture workflow - production-readiness skill: final PR/release checklist
… round-trips - rust4d_input::ActionMap + CameraAction: default WASD/QE/Space/Shift bindings are now data instead of hardcoded controller matches - CameraController consumes semantic actions, supports custom maps via with_action_map/action_map_mut, and keeps legacy process_keyboard behavior - Lua ECS binding exposes entity_from_bits(bits) and entity:equals(other), with LuaEntity helpers wrapping real hecs::Entity bit patterns even in disconnected stub mode Verification: - cargo test -p rust4d_input -p rust4d_scripting - cargo clippy --workspace --all-targets -- -D warnings - RUSTDOCFLAGS=-Dwarnings cargo doc --workspace --no-deps - cargo test --workspace (984 passed)
- docs/shapes.md: full built-in shape catalog with construction math, cell counts, RON snippets, slice behavior, and verification workflow - README/docs index/examples README link the catalog and shape_showcase - user/developer guides point to the full catalog and update tesseract boundary-cell details - CHANGELOG records PR #15 and the engine-expansion branch Verification: - cargo fmt --all -- --check - cargo clippy --workspace --all-targets -- -D warnings - RUSTDOCFLAGS=-Dwarnings cargo doc --workspace --no-deps - cargo test --workspace (984 passed)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This branch takes Rust4D from a small tesseract/hyperplane renderer to a much more professional 4D engine foundation:
Highlights
4D primitive catalog
Adds
Mesh4Dand built-in primitives:Every primitive is pinned by index validation, watertightness (
Mesh4D::is_watertight), and boundary-volume tests. The 600-cell is generated from binary icosahedral group vertices; cells are the 4-cliques of the edge graph.Bonus geometry fix
The old tesseract emitted 84 tetrahedra from a Kuhn 4-cube decomposition, but 36 were internal membranes. The renderer only needs the 48 boundary tetrahedra. This removes ~43% wasted slice work for the default object and prevents spurious interior walls.
Visual verification
Adds
examples/shape_showcase.rs, rendering every primitive at 3 slice offsets × 3 orientations through the real offscreen GPU slice/render pipelines:Rendering polish
RenderUniformsandrender.wgslnow support:Workflow polish
-D warnings, rustdoc-D warnings, workspace testsdocs/shapes.mdcatalog andCHANGELOG.mdVerification
Final gate run locally:
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningsRUSTDOCFLAGS=-Dwarnings cargo doc --workspace --no-depscargo test --workspace— 984 passedcargo run --example shape_showcase -- .scratchpad/captures-gallery-lit— 81 captures, 0 zero-triangle framesKnown follow-ups
hecs::Worldbridge. This PR adds safe hecs handle bit round-trips, butworld.spawn/query/get/setremain stubs until VM/world ownership is designed.