Update name of struct

This commit is contained in:
Hanno Braun 2024-11-06 19:49:15 +01:00
parent 25f49d9bc5
commit 204362bdcc
4 changed files with 11 additions and 11 deletions

View File

@ -8,9 +8,9 @@ use winit::{
window::{Window, WindowAttributes, WindowId},
};
use crate::{geometry::Mesh, render::Renderer};
use crate::{geometry::Operations, render::Renderer};
pub fn run(mesh: Mesh) -> anyhow::Result<()> {
pub fn run(mesh: Operations) -> anyhow::Result<()> {
let event_loop = EventLoop::new()?;
let mut app = App {
@ -24,7 +24,7 @@ pub fn run(mesh: Mesh) -> anyhow::Result<()> {
}
struct App {
mesh: Mesh,
mesh: Operations,
window: Option<Arc<Window>>,
renderer: Option<Renderer>,
}

View File

@ -1,8 +1,8 @@
use std::{collections::BTreeMap, fs::File};
use crate::geometry::{Mesh, Operation, Vertex};
use crate::geometry::{Operation, Operations, Vertex};
pub fn export(mesh: &Mesh) -> anyhow::Result<()> {
pub fn export(mesh: &Operations) -> anyhow::Result<()> {
let mut mesh_vertices = Vec::new();
let mut mesh_triangles = Vec::new();

View File

@ -1,12 +1,12 @@
use crate::math::Point;
#[derive(Default)]
pub struct Mesh {
pub struct Operations {
pub vertices: Vec<Vertex>,
pub triangles: Vec<Triangle>,
}
impl Mesh {
impl Operations {
pub fn vertex(&mut self, point: Point) {
let vertex = Vertex { point };
self.vertices.push(vertex);
@ -17,7 +17,7 @@ impl Mesh {
}
}
impl Operation for Mesh {
impl Operation for Operations {
fn vertices(&self, vertices: &mut Vec<Vertex>) {
vertices.extend(&self.vertices);
}

View File

@ -1,7 +1,7 @@
use crate::{geometry::Mesh, math::Scalar};
use crate::{geometry::Operations, math::Scalar};
pub fn model() -> anyhow::Result<Mesh> {
let mut mesh = Mesh::default();
pub fn model() -> anyhow::Result<Operations> {
let mut mesh = Operations::default();
[
[-0.5, -0.5, -0.5], // 0