diff --git a/src/app.rs b/src/app.rs index d4534d2..00d3aaa 100644 --- a/src/app.rs +++ b/src/app.rs @@ -5,7 +5,7 @@ use winit::{ event_loop::{ControlFlow, EventLoop}, }; -use crate::{camera, render, renderer}; +use crate::{camera, render}; pub(crate) struct App { window: winit::window::Window, @@ -74,7 +74,7 @@ impl App { .with_entry(camera_controller.get_buffer().as_entire_binding()) .build(&self.render_ctx); - let renderer = renderer::Renderer::new(&self.render_ctx, &camera_bind_group_layout); + let renderer = render::Renderer::new(&self.render_ctx, &camera_bind_group_layout); let mut last_render_time = Instant::now(); self.event_loop diff --git a/src/core.rs b/src/core.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/main.rs b/src/main.rs index ef18492..1c2526b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ mod app; mod camera; +mod core; mod render; -mod renderer; fn main() { env_logger::init(); diff --git a/src/render.rs b/src/render.rs index c2152dc..bc9fb61 100644 --- a/src/render.rs +++ b/src/render.rs @@ -1,9 +1,11 @@ mod bind_group; mod context; +mod renderer; mod texture; pub use self::{ bind_group::{BindGroupBuilder, BindGroupLayoutBuilder}, context::Context, + renderer::Renderer, texture::{Texture, TextureBuilder}, }; diff --git a/src/renderer.rs b/src/render/renderer.rs similarity index 96% rename from src/renderer.rs rename to src/render/renderer.rs index dcbb94a..4eeee2d 100644 --- a/src/renderer.rs +++ b/src/render/renderer.rs @@ -1,6 +1,6 @@ -use crate::render::{BindGroupBuilder, BindGroupLayoutBuilder, Context, Texture, TextureBuilder}; +use super::{BindGroupBuilder, BindGroupLayoutBuilder, Context, Texture, TextureBuilder}; -pub(crate) struct Renderer { +pub struct Renderer { clear_color: wgpu::Color, compute_pipeline: wgpu::ComputePipeline, compute_bind_group: wgpu::BindGroup, @@ -12,7 +12,7 @@ pub(crate) struct Renderer { impl Renderer { pub fn new(context: &Context, camera_bind_group_layout: &wgpu::BindGroupLayout) -> Self { log::info!("Creating render shader..."); - let shader_descriptor = wgpu::include_wgsl!("../assets/shaders/shader.wgsl"); + let shader_descriptor = wgpu::include_wgsl!("../../assets/shaders/shader.wgsl"); let shader = context.device.create_shader_module(shader_descriptor); log::info!("Creating render texture..."); @@ -94,7 +94,7 @@ impl Renderer { }); log::info!("Creating compute pipeline..."); - let cs_descriptor = wgpu::include_wgsl!("../assets/shaders/voxel_volume.wgsl"); + let cs_descriptor = wgpu::include_wgsl!("../../assets/shaders/voxel_volume.wgsl"); let cs = context.device.create_shader_module(cs_descriptor); let compute_layout = BindGroupLayoutBuilder::new() .with_entry(