aephysics.mesh: the triangle mesh and its BVH - #6
Merged
Merged
Conversation
Box3D's mesh.c in Aether: the bounding volume hierarchy built by a binned surface-area heuristic or a median split, falling back to a half split rather than a huge leaf, the nodes in one array with the left child after its parent and the right at an offset, the triangles and materials sorted into the tree's depth-first order; vertex welding through a spatial hash of cells twice the tolerance; edge adjacency flags (concave, inverse concave, both for flat) from a map of vertex pairs; a mesh usable at any scale, mirrored included, with the winding and flags made to match; and the traversals -- overlap, bounds, ray cast front to back along the split axis with the segment-box and ray-triangle tests, shape cast, the character mover's planes, and a box query with a visitor -- with the box-triangle separating axis test in scalar form. The built-in grid, wave, torus, box, hollow box and platform meshes come with it. core gains a long-to-int map (LongMap, open addressing) and the block hash the hull now shares; CastOutput gains its child and material indices. test_mesh.ae: 1,594 checks from test_mesh.c (the valley from dense, strided, welded, clockwise and composed input, the creators) plus the tree's consistency, rays against a grid and a wave at analytic hits, the box query against a scan, overlap, shape cast, the flags of a box and a hollow box, a mirrored scale, the mover. bench/mesh.ae against bench/mesh_box3d.c: the same trees (node counts and heights equal from both splits), equal ray and cast sums, the box query 0.008% more permissive; builds 1.2-1.5x, traversals 1.7-2x.
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.
The eighth layer: Box3D's
mesh.cin Aether, asaephysics.mesh— the static geometry a city is made of.core: a long→int open-addressing map (LongMap) andhash_bytes, which the hull now shares.CastOutputgainschild_indexandmaterial_index.test_mesh.ae: 1,594 checks — the reference'stest_mesh.c(valley from dense / strided / welded / clockwise / composed input, the creators) plus tree consistency, rays against a grid and a wave at analytic hits, box query against a scan, overlap, shape cast, edge flags of a box and a hollow box, a mirrored scale, the mover.bench/mesh.aevsbench/mesh_box3d.c: identical trees from both splits (43,135 / 48,063 nodes, height 16), equal ray and cast results; the box query 0.008% more permissive at SIMD-vs-scalar boundaries. Builds 1.2–1.5×, traversals 1.7–2× (their SIMD box tests).Differences: material indices and flags are ints, not bytes; traversal stack is module scratch; scalar SAT tests; own hash.