formatting: Using canonical formatting on whole project

This commit is contained in:
2026-11-22 17:16:32 +01:00
parent 2910314df3
commit dd0e102348
44 changed files with 1526 additions and 3376 deletions
+15 -30
View File
@@ -17,8 +17,7 @@ use vxls_voxel_cache::tables::FixedStructureTable;
/// When the player moves, crossing a chunk boundary, chunks behind disapear, chunks in front
/// appear. The torroidal nature of the table (modulo on the coordinates) allows reusing the
/// disapearing chunks for the new chunks appearing in front.
pub struct ToroidalStructureTable
{
pub struct ToroidalStructureTable {
/// Size of the torroidal structure : how many chunks in each direction can be rendered at once
extent: (usize, usize, usize),
@@ -31,8 +30,7 @@ pub struct ToroidalStructureTable
#[derive(Debug, Clone, Copy, Zeroable, Pod)]
#[repr(C)]
struct ToroidalInvalidationImmediates
{
struct ToroidalInvalidationImmediates {
extent: [u32; 3],
_pad1: u32,
previous_offset: [i32; 3],
@@ -41,16 +39,14 @@ struct ToroidalInvalidationImmediates
_pad3: u32,
}
impl ToroidalStructureTable
{
impl ToroidalStructureTable {
pub fn new(
device: &wgpu::Device,
extent: (usize, usize, usize),
initial_position: Vec3,
max_requests: usize,
producer_id: u32,
) -> Self
{
) -> Self {
let size = extent.0 * extent.1 * extent.2;
assert!(size <= (u32::MAX as usize));
@@ -121,16 +117,14 @@ impl ToroidalStructureTable
queue: &wgpu::Queue,
encoder: &mut CommandEncoder,
new_position: Vec3,
) -> Vec<StructureAnchor>
{
) -> Vec<StructureAnchor> {
let previous_offset = self.current_offset;
let new_offset = Self::offset_from_center(self.extent, new_position);
self.current_offset = new_offset;
self.position = new_position;
let mut retired = Vec::new();
if previous_offset != new_offset
{
if previous_offset != new_offset {
let size = self.extent.0 * self.extent.1 * self.extent.2;
let new_anchors: Vec<StructureAnchor> = (0..size)
.map(|slot| {
@@ -183,8 +177,7 @@ impl ToroidalStructureTable
}
/// Returns the world position encoded in a table anchor.
pub fn position_for_anchor(&self, anchor: StructureAnchor) -> (isize, isize, isize)
{
pub fn position_for_anchor(&self, anchor: StructureAnchor) -> (isize, isize, isize) {
let (x, y, z, _version) = anchor.world();
(x as isize, y as isize, z as isize)
}
@@ -193,8 +186,7 @@ impl ToroidalStructureTable
///
/// The render shader uses this to advance its table slot incrementally, so
/// the ray traversal does not have to perform an integer modulo per chunk.
pub fn base_slot(&self) -> [u32; 3]
{
pub fn base_slot(&self) -> [u32; 3] {
let (ox, oy, oz) = self.current_offset;
let (ex, ey, ez) = self.extent;
[
@@ -208,8 +200,7 @@ impl ToroidalStructureTable
extent: (usize, usize, usize),
slot: usize,
offset: (isize, isize, isize),
) -> (isize, isize, isize)
{
) -> (isize, isize, isize) {
let (ex, ey, ez) = (extent.0 as isize, extent.1 as isize, extent.2 as isize);
let id = slot as isize;
@@ -226,8 +217,7 @@ impl ToroidalStructureTable
)
}
fn offset_from_center(extent: (usize, usize, usize), position: Vec3) -> (isize, isize, isize)
{
fn offset_from_center(extent: (usize, usize, usize), position: Vec3) -> (isize, isize, isize) {
(
position.x.floor() as isize - (extent.0 as isize / 2),
position.y.floor() as isize - (extent.1 as isize / 2),
@@ -237,13 +227,11 @@ impl ToroidalStructureTable
// Function calls through to fixed_structure_table
pub fn raytrace_bind_group(&self) -> &wgpu::BindGroup
{
pub fn raytrace_bind_group(&self) -> &wgpu::BindGroup {
self.fixed_structure_table.raytrace_bind_group()
}
pub fn raytrace_bind_group_layout(&self) -> &wgpu::BindGroupLayout
{
pub fn raytrace_bind_group_layout(&self) -> &wgpu::BindGroupLayout {
self.fixed_structure_table.raytrace_bind_group_layout()
}
@@ -264,8 +252,7 @@ impl ToroidalStructureTable
device: &wgpu::Device,
encoder: &mut vxls_profiler::ScopeEncoder<wgpu::CommandEncoder>,
request_buffer: &vxls_voxel_cache::requests::CacheRequestBuffer,
)
{
) {
self.fixed_structure_table
.gather_requests(device, encoder, request_buffer);
}
@@ -280,8 +267,7 @@ where
device: &wgpu::Device,
encoder: &mut vxls_profiler::ScopeEncoder<CommandEncoder>,
insertion: &vxls_voxel_cache::insertion::CacheInsertionData<N>,
)
{
) {
self.fixed_structure_table
.validate_insertion(device, encoder, insertion);
}
@@ -291,8 +277,7 @@ where
encoder: &mut vxls_profiler::ScopeEncoder<CommandEncoder>,
cache_evictor: &vxls_voxel_cache::eviction::CacheEvictor,
invalid_timestamp: u32,
)
{
) {
self.fixed_structure_table
.invalidate(encoder, cache_evictor, invalid_timestamp);
}