Moved renderer to render module
This commit is contained in:
parent
40cdd5766d
commit
a94932836f
|
@ -5,7 +5,7 @@ use winit::{
|
||||||
event_loop::{ControlFlow, EventLoop},
|
event_loop::{ControlFlow, EventLoop},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{camera, render, renderer};
|
use crate::{camera, render};
|
||||||
|
|
||||||
pub(crate) struct App {
|
pub(crate) struct App {
|
||||||
window: winit::window::Window,
|
window: winit::window::Window,
|
||||||
|
@ -74,7 +74,7 @@ impl App {
|
||||||
.with_entry(camera_controller.get_buffer().as_entire_binding())
|
.with_entry(camera_controller.get_buffer().as_entire_binding())
|
||||||
.build(&self.render_ctx);
|
.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();
|
let mut last_render_time = Instant::now();
|
||||||
self.event_loop
|
self.event_loop
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
mod app;
|
mod app;
|
||||||
mod camera;
|
mod camera;
|
||||||
|
mod core;
|
||||||
mod render;
|
mod render;
|
||||||
mod renderer;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
mod bind_group;
|
mod bind_group;
|
||||||
mod context;
|
mod context;
|
||||||
|
mod renderer;
|
||||||
mod texture;
|
mod texture;
|
||||||
|
|
||||||
pub use self::{
|
pub use self::{
|
||||||
bind_group::{BindGroupBuilder, BindGroupLayoutBuilder},
|
bind_group::{BindGroupBuilder, BindGroupLayoutBuilder},
|
||||||
context::Context,
|
context::Context,
|
||||||
|
renderer::Renderer,
|
||||||
texture::{Texture, TextureBuilder},
|
texture::{Texture, TextureBuilder},
|
||||||
};
|
};
|
||||||
|
|
|
@ -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,
|
clear_color: wgpu::Color,
|
||||||
compute_pipeline: wgpu::ComputePipeline,
|
compute_pipeline: wgpu::ComputePipeline,
|
||||||
compute_bind_group: wgpu::BindGroup,
|
compute_bind_group: wgpu::BindGroup,
|
||||||
|
@ -12,7 +12,7 @@ pub(crate) struct Renderer {
|
||||||
impl Renderer {
|
impl Renderer {
|
||||||
pub fn new(context: &Context, camera_bind_group_layout: &wgpu::BindGroupLayout) -> Self {
|
pub fn new(context: &Context, camera_bind_group_layout: &wgpu::BindGroupLayout) -> Self {
|
||||||
log::info!("Creating render shader...");
|
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);
|
let shader = context.device.create_shader_module(shader_descriptor);
|
||||||
|
|
||||||
log::info!("Creating render texture...");
|
log::info!("Creating render texture...");
|
||||||
|
@ -94,7 +94,7 @@ impl Renderer {
|
||||||
});
|
});
|
||||||
|
|
||||||
log::info!("Creating compute pipeline...");
|
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 cs = context.device.create_shader_module(cs_descriptor);
|
||||||
let compute_layout = BindGroupLayoutBuilder::new()
|
let compute_layout = BindGroupLayoutBuilder::new()
|
||||||
.with_entry(
|
.with_entry(
|
Loading…
Reference in New Issue