Voxel cache rewrite
This commit is contained in:
+9
-3
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user