mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-06 10:58:28 +00:00
Prepare for rendering list of operations
This commit is contained in:
parent
4c98cc736b
commit
0896ffdcbc
@ -111,12 +111,9 @@ impl ApplicationHandler for App {
|
|||||||
WindowEvent::RedrawRequested => {
|
WindowEvent::RedrawRequested => {
|
||||||
let selected_operation =
|
let selected_operation =
|
||||||
self.ops.operations.get(self.selected_op);
|
self.ops.operations.get(self.selected_op);
|
||||||
let last_operation = self.ops.operations.last();
|
|
||||||
|
|
||||||
if let (Some(selected), Some(last)) =
|
if let Some(selected) = selected_operation {
|
||||||
(selected_operation, last_operation)
|
if let Err(err) = renderer.render(selected, &self.ops) {
|
||||||
{
|
|
||||||
if let Err(err) = renderer.render(selected, last) {
|
|
||||||
eprintln!("Render error: {err}");
|
eprintln!("Render error: {err}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ use std::sync::Arc;
|
|||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use winit::window::Window;
|
use winit::window::Window;
|
||||||
|
|
||||||
use crate::geometry::Operation;
|
use crate::geometry::{Operation, OpsLog};
|
||||||
|
|
||||||
use super::{geometry::Geometry, pipelines::Pipelines, text::TextRenderer};
|
use super::{geometry::Geometry, pipelines::Pipelines, text::TextRenderer};
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ impl Renderer {
|
|||||||
pub fn render(
|
pub fn render(
|
||||||
&mut self,
|
&mut self,
|
||||||
selected_operation: &impl Operation,
|
selected_operation: &impl Operation,
|
||||||
last_operation: &impl Operation,
|
last_operation: &OpsLog,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let vertices = Geometry::vertices(&self.device, selected_operation);
|
let vertices = Geometry::vertices(&self.device, selected_operation);
|
||||||
let triangles = Geometry::triangles(&self.device, selected_operation);
|
let triangles = Geometry::triangles(&self.device, selected_operation);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::geometry::Operation;
|
use crate::geometry::{Operation, OpsLog};
|
||||||
|
|
||||||
pub struct TextRenderer {
|
pub struct TextRenderer {
|
||||||
text_atlas: glyphon::TextAtlas,
|
text_atlas: glyphon::TextAtlas,
|
||||||
@ -66,7 +66,7 @@ impl TextRenderer {
|
|||||||
queue: &wgpu::Queue,
|
queue: &wgpu::Queue,
|
||||||
surface_config: &wgpu::SurfaceConfiguration,
|
surface_config: &wgpu::SurfaceConfiguration,
|
||||||
_selected_operation: &impl Operation,
|
_selected_operation: &impl Operation,
|
||||||
_last_operation: &impl Operation,
|
_last_operation: &OpsLog,
|
||||||
render_pass: &mut wgpu::RenderPass,
|
render_pass: &mut wgpu::RenderPass,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let mut buffer = glyphon::Buffer::new(
|
let mut buffer = glyphon::Buffer::new(
|
||||||
|
Loading…
Reference in New Issue
Block a user