From 0cfb77804defd8cc37890bdfc32c7b1d5af3c6b9 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Fri, 22 Sep 2023 09:54:13 +0100 Subject: [PATCH] Implement Default for MaterialID and BrushPlane --- csg/src/brush.rs | 2 ++ editor/src/main.rs | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/csg/src/brush.rs b/csg/src/brush.rs index b8568b7..8b10781 100644 --- a/csg/src/brush.rs +++ b/csg/src/brush.rs @@ -2,6 +2,7 @@ use glam::Vec3; use crate::plane::{Plane, PlaneIntersection}; +#[derive(Default)] pub struct MaterialId(pub String); pub struct TextureProjection { @@ -24,6 +25,7 @@ impl Default for TextureProjection { } } +#[derive(Default)] pub struct BrushPlane { pub plane: Plane, pub material: MaterialId, diff --git a/editor/src/main.rs b/editor/src/main.rs index aa298cb..7d63486 100644 --- a/editor/src/main.rs +++ b/editor/src/main.rs @@ -1,6 +1,6 @@ use csg::{ - brush::{Brush, BrushPlane, MaterialId, TextureProjection}, - glam::{self, Vec3}, + brush::{Brush, BrushPlane}, + glam::{self, Mat3, Vec3}, plane::Plane, }; @@ -20,8 +20,7 @@ fn generate_box_brush(position: Vec3, extent: Vec3) -> Brush { brush_planes.push(BrushPlane { plane: Plane::from_point_normal(point, *normal), - material: MaterialId("Epic".to_string()), - tex_projection: TextureProjection::default(), + ..Default::default() }); println!("Plane: {:?}", brush_planes.last().unwrap().plane);