pub struct Island {
pub voxels: Vec<(IVec3, VoxColor)>,
pub bbox: (IVec3, IVec3),
}Expand description
One detached voxel region: everything a caller needs to extract it from the grid and hand it to a debris system.
Fields§
§voxels: Vec<(IVec3, VoxColor)>Every solid voxel of the component, grid-local coordinates plus the colour it had at detection time (untextured interior cells inherit the nearest colour above them in the column).
bbox: (IVec3, IVec3)Inclusive grid-local bounds of voxels.
Implementations§
Source§impl Island
impl Island
Sourcepub fn extract(&self, grid: &mut Grid, bake: BakeMode)
pub fn extract(&self, grid: &mut Grid, bake: BakeMode)
DT.1 — carve this island’s voxels out of grid, then re-bake
the touched region so lighting on the newly exposed faces is
correct: one Grid::set_rect carve per contiguous column
segment (the voxel list is stored run-major, so coalescing is a
single pass) and one Grid::bake_bbox over the island bbox
(its internal padding relights the surroundings; the edits and
the bake bump the touched chunk versions). After extraction, a
re-run of detect_islands over the same region finds
nothing.
Mip ladders are NOT regenerated — the same contract as
every edit primitive (Grid::bake_bbox documents it too): a
caller rendering distant chunks must remip the touched columns
(Vxl::remip_bbox) exactly as it already does for its carves,
or mip-N keeps drawing the extracted island beyond
mip_scan_dist while its sprite twin falls next to it.
Sourcepub fn to_kv6(&self) -> Kv6
pub fn to_kv6(&self) -> Kv6
DT.1 — build the island’s KV6 sprite model: dims are the
inclusive bbox extent, voxels sit at bbox-relative positions,
and colours are the detected ones with the high byte normalised
to 0x80 (full-bright — the sprite paths do their own
lighting, and a baked brightness byte would double-darken).
Surface-only (Kv6::from_fn): the interior is invisible in
flight, and a shatter samples Self::voxels, not the model.
The model pivot is the bbox centre (from_fn’s convention) —
pose it with Self::world_pivot.
Sourcepub fn world_origin(&self, transform: &GridTransform) -> DVec3
pub fn world_origin(&self, transform: &GridTransform) -> DVec3
DT.1 — the world-space position of the island’s minimum
corner (bbox.0, voxel corner), through the grid transform
with voxel_world_size honoured (SC).
Sourcepub fn world_pivot(&self, transform: &GridTransform) -> DVec3
pub fn world_pivot(&self, transform: &GridTransform) -> DVec3
DT.1 — the world-space position of the island’s bbox centre
— where Self::to_kv6’s pivot sits, i.e. the position a
debris system spawns the sprite instance at so the model lands
exactly over the voxels it replaced.
Source§impl Island
impl Island
Sourcepub fn split(&self, pattern: FracturePattern, seed: u64) -> Vec<Island>
pub fn split(&self, pattern: FracturePattern, seed: u64) -> Vec<Island>
DT.5 — partition this island into fragments per pattern: a
disjoint cover of the original voxels (colours ride along),
each fragment with a recomputed bbox, deterministic in
(island, pattern, seed). FracturePattern::Whole returns
the island unsplit; degenerate cases (an island smaller than a
cell, all sites in one plate) collapse gracefully to fewer
fragments. A fragment may be internally disconnected (a
Voronoi cell straddling a concave gap) — it falls as one piece
(accepted v1 simplification).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Island
impl RefUnwindSafe for Island
impl Send for Island
impl Sync for Island
impl Unpin for Island
impl UnsafeUnpin for Island
impl UnwindSafe for Island
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more