Implemented Octrees, refactored heap allocations for FreeLists and some spring-cleaning. Builds and runs, octrees fail to form correctly and reinsertion steps are unimplemented.

This commit is contained in:
paladin 2026-09-13 11:22:19 +01:00
parent cf965d489c
commit 905d05bc39
17 changed files with 918 additions and 630 deletions

View file

@ -1,4 +1,4 @@
use crate::render::{MaterialProperties, SimpleTexture};
use crate::render::{MaterialProperties, Texture};
use bytemuck::{Pod, Zeroable};
use glam::camera::lh::proj::directx::perspective;
use glam::{Affine3A, EulerRot, Mat3A, Mat4, Vec3, Vec4};
@ -49,7 +49,7 @@ impl Eye {
bytemuck::cast_slice(&[self.environment]),
);
}
pub(crate) fn new(device: &Device, width: u32, height: u32, skybox: SimpleTexture) -> Eye {
pub(crate) fn new(device: &Device, width: u32, height: u32, skybox: Texture) -> Eye {
let camera_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: Some("Camera Buffer"),
contents: bytemuck::cast_slice(&[
@ -136,7 +136,7 @@ impl Eye {
device: &wgpu::Device,
camera: &wgpu::Buffer,
environment: &wgpu::Buffer,
skybox: SimpleTexture,
skybox: Texture,
) -> wgpu::BindGroup {
device.create_bind_group(&wgpu::BindGroupDescriptor {
layout: &layout,
@ -163,7 +163,7 @@ impl Eye {
label: Some("eye_bind_group"),
})
}
pub fn skybox(&mut self, device: &wgpu::Device, texture: SimpleTexture) {
pub fn skybox(&mut self, device: &wgpu::Device, texture: Texture) {
self.group = Eye::bind_group(
&self.layout,
device,
@ -172,8 +172,9 @@ impl Eye {
texture,
)
}
pub(crate) fn resize(&mut self, width: u32, height: u32) {
self.aspect_ratio = width as f32 / height as f32
pub(crate) fn resize(&mut self, queue: &Queue, width: u32, height: u32) {
self.aspect_ratio = width as f32 / height as f32;
self.write(queue);
}
pub(crate) fn control(&mut self, delta: Vec3) {
self.frame *= Affine3A::from_translation(delta);