dialog WIP paths consolidation and rendering

This commit is contained in:
Jonas H
2026-03-28 10:34:19 +01:00
parent 4c3ebca96e
commit 11b31169b1
70 changed files with 2658 additions and 485 deletions

View File

@@ -1,14 +1,17 @@
pub mod billboard;
mod bind_group;
mod debug_overlay;
mod pipeline;
mod shadow;
mod types;
pub use billboard::{BillboardDrawCall, BillboardPipeline};
pub use types::{DrawCall, Pipeline, Spotlight, SpotlightRaw, Uniforms, MAX_SPOTLIGHTS};
use crate::entity::EntityHandle;
use crate::debug::DebugMode;
use crate::paths;
use crate::postprocess::{create_blit_pipeline, create_fullscreen_quad, LowResFramebuffer};
use crate::texture::{DitherTextures, FlowmapTexture};
use pipeline::{
@@ -34,6 +37,7 @@ pub struct Renderer
wireframe_pipeline: Option<wgpu::RenderPipeline>,
debug_lines_pipeline: Option<wgpu::RenderPipeline>,
debug_overlay: Option<debug_overlay::DebugOverlay>,
billboard_pipeline: BillboardPipeline,
wireframe_supported: bool,
uniform_buffer: wgpu::Buffer,
@@ -162,7 +166,7 @@ impl Renderer
};
let flowmap_texture =
match FlowmapTexture::load(&device, &queue, "textures/terrain_flowmap.exr")
match FlowmapTexture::load(&device, &queue, &paths::textures::terrain_flowmap())
{
Ok(texture) =>
{
@@ -179,7 +183,7 @@ impl Renderer
}
};
let blue_noise_data = image::open("textures/blue_noise.png")
let blue_noise_data = image::open(&paths::textures::blue_noise())
.expect("Failed to load blue noise texture")
.to_luma8();
let blue_noise_size = blue_noise_data.dimensions();
@@ -490,6 +494,8 @@ impl Renderer
&bind_group_layout,
));
let billboard_pipeline = BillboardPipeline::new(&device, config.format);
let debug_overlay = Some(debug_overlay::DebugOverlay::new(&device, config.format));
let shadow_bind_group_layout =
@@ -518,6 +524,7 @@ impl Renderer
wireframe_pipeline,
debug_lines_pipeline,
debug_overlay,
billboard_pipeline,
wireframe_supported,
uniform_buffer,
bind_group_layout,
@@ -561,6 +568,7 @@ impl Renderer
camera_position: glam::Vec3,
player_position: glam::Vec3,
draw_calls: &[DrawCall],
billboard_calls: &[BillboardDrawCall],
time: f32,
delta_time: f32,
debug_mode: DebugMode,
@@ -939,6 +947,14 @@ impl Renderer
}
}
self.billboard_pipeline.render(
&mut encoder,
&self.queue,
&self.framebuffer.view,
&self.framebuffer.depth_view,
billboard_calls,
);
self.queue.submit(std::iter::once(encoder.finish()));
let frame = match self.surface.get_current_texture()
@@ -1049,7 +1065,7 @@ impl Renderer
match crate::texture::HeightmapTexture::load(
&self.device,
&self.queue,
"textures/terrain_heightmap.exr",
&paths::textures::terrain_heightmap(),
)
{
Ok(heightmap) =>
@@ -1151,6 +1167,7 @@ pub fn render(
camera_position: glam::Vec3,
player_position: glam::Vec3,
draw_calls: &[DrawCall],
billboard_calls: &[BillboardDrawCall],
time: f32,
delta_time: f32,
debug_mode: DebugMode,
@@ -1165,6 +1182,7 @@ pub fn render(
camera_position,
player_position,
draw_calls,
billboard_calls,
time,
delta_time,
debug_mode,