Implement Default for MaterialID and BrushPlane

This commit is contained in:
Jarrod Doyle 2023-09-22 09:54:13 +01:00
parent 8488a75bd0
commit 0cfb77804d
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
2 changed files with 5 additions and 4 deletions

View File

@ -2,6 +2,7 @@ use glam::Vec3;
use crate::plane::{Plane, PlaneIntersection}; use crate::plane::{Plane, PlaneIntersection};
#[derive(Default)]
pub struct MaterialId(pub String); pub struct MaterialId(pub String);
pub struct TextureProjection { pub struct TextureProjection {
@ -24,6 +25,7 @@ impl Default for TextureProjection {
} }
} }
#[derive(Default)]
pub struct BrushPlane { pub struct BrushPlane {
pub plane: Plane, pub plane: Plane,
pub material: MaterialId, pub material: MaterialId,

View File

@ -1,6 +1,6 @@
use csg::{ use csg::{
brush::{Brush, BrushPlane, MaterialId, TextureProjection}, brush::{Brush, BrushPlane},
glam::{self, Vec3}, glam::{self, Mat3, Vec3},
plane::Plane, plane::Plane,
}; };
@ -20,8 +20,7 @@ fn generate_box_brush(position: Vec3, extent: Vec3) -> Brush {
brush_planes.push(BrushPlane { brush_planes.push(BrushPlane {
plane: Plane::from_point_normal(point, *normal), plane: Plane::from_point_normal(point, *normal),
material: MaterialId("Epic".to_string()), ..Default::default()
tex_projection: TextureProjection::default(),
}); });
println!("Plane: {:?}", brush_planes.last().unwrap().plane); println!("Plane: {:?}", brush_planes.last().unwrap().plane);