pub struct AabbNode {
pub box_min: [f32; 3],
pub box_max: [f32; 3],
pub face_index: i32,
pub split_direction_flags: u32,
pub left: Option<Box<AabbNode>>,
pub right: Option<Box<AabbNode>>,
}Expand description
A node in the AABB binary search tree used for spatial face queries.
Each node occupies 40 bytes on disk: 6×f32 bounding box, right/left child
pointers, face index, and split direction flags. Internal nodes partition
space along an axis (encoded in split_direction_flags)
and have two children. Leaf nodes reference a single face by index.
Binary layout (40 bytes):
| Offset | Size | Field |
|---|---|---|
| +0x00 | 12 | box_min (3×f32) |
| +0x0C | 12 | box_max (3×f32) |
| +0x18 | 4 | right_child (u32, content-relative offset, 0 = leaf) |
| +0x1C | 4 | left_child (u32, content-relative offset, 0 = leaf) |
| +0x20 | 4 | face_index (i32, -1 for internal nodes) |
| +0x24 | 4 | split_direction_flags (u32, axis bitmask) |
Verified via Ghidra AABB struct (size 40), operator_new(0x28) in
Parse_AABB, and ResetAABBTree (0x004a0260).
See docs/notes/mdl_mdx.md §AABB Tree Node Layout.
Fields§
§box_min: [f32; 3]Axis-aligned bounding box minimum corner.
box_max: [f32; 3]Axis-aligned bounding box maximum corner.
face_index: i32Face index for leaf nodes (>= 0). Internal nodes use -1.
split_direction_flags: u32Split plane direction flags (internal nodes only, 0 for leaves).
Bitmask encoding which axis the split occurred on: 1=+X, 2=+Y, 4=+Z, 8=-X, 16=-Y, 32=-Z.
left: Option<Box<AabbNode>>Left child subtree (None for leaf nodes).
right: Option<Box<AabbNode>>Right child subtree (None for leaf nodes).