mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-03 17:38:27 +00:00
Prepare to draw mesh
This commit is contained in:
parent
63e1f15e7b
commit
513dcdc590
@ -10,10 +10,11 @@ use winit::{
|
||||
|
||||
use crate::{mesh::Mesh, render::Renderer};
|
||||
|
||||
pub fn run(_: Mesh) -> anyhow::Result<()> {
|
||||
pub fn run(mesh: Mesh) -> anyhow::Result<()> {
|
||||
let event_loop = EventLoop::new()?;
|
||||
|
||||
let mut app = App {
|
||||
mesh,
|
||||
window: None,
|
||||
renderer: None,
|
||||
};
|
||||
@ -23,6 +24,7 @@ pub fn run(_: Mesh) -> anyhow::Result<()> {
|
||||
}
|
||||
|
||||
struct App {
|
||||
mesh: Mesh,
|
||||
window: Option<Arc<Window>>,
|
||||
renderer: Option<Renderer>,
|
||||
}
|
||||
@ -67,7 +69,7 @@ impl ApplicationHandler for App {
|
||||
event_loop.exit();
|
||||
}
|
||||
WindowEvent::RedrawRequested => {
|
||||
renderer.render();
|
||||
renderer.render(&self.mesh);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ use std::sync::Arc;
|
||||
use anyhow::anyhow;
|
||||
use winit::window::Window;
|
||||
|
||||
use crate::mesh::Mesh;
|
||||
|
||||
pub struct Renderer {
|
||||
pub surface: wgpu::Surface<'static>,
|
||||
pub device: wgpu::Device,
|
||||
@ -37,7 +39,7 @@ impl Renderer {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn render(&self) {
|
||||
pub fn render(&self, _: &Mesh) {
|
||||
let frame = self.surface.get_current_texture().unwrap();
|
||||
let view = frame
|
||||
.texture
|
||||
|
Loading…
Reference in New Issue
Block a user