Voxel cache rewrite

This commit is contained in:
2026-10-30 17:32:12 +01:00
parent 92d61b75a8
commit 570ec62bdf
31 changed files with 1537 additions and 533 deletions
+9 -3
View File
@@ -5,9 +5,6 @@ use bytemuck::Pod;
use bytemuck::Zeroable;
use itertools::Itertools;
use crate::voxel_cache::data::ExplicitNTreeNode;
use crate::voxel_cache::data::StructurePointer;
#[derive(Debug, Clone, Copy, PartialEq, Pod, Zeroable)]
#[repr(C)]
pub struct Color(pub f32, pub f32, pub f32, pub f32);
@@ -32,6 +29,15 @@ impl Color
c.3 /= count as f32;
c
}
pub fn as_packed_u32(&self) -> u32
{
let mapped_r = (self.0 * 255.0) as u32;
let mapped_g = (self.1 * 255.0) as u32;
let mapped_b = (self.2 * 255.0) as u32;
let mapped_a = (self.3 * 255.0) as u32;
mapped_r | (mapped_g << 8) | (mapped_b << 16) | (mapped_a << 24)
}
}
#[derive(Debug, Clone)]