add Clone for Mesh

This commit is contained in:
Quaternions 2024-03-12 21:42:19 -07:00
parent ef922135e6
commit db142d125b

View File

@ -27,6 +27,7 @@ pub trait PolygonIter{
pub trait MapVertexId{
fn map_vertex_id<F:Fn(VertexId)->VertexId>(self,f:F)->Self;
}
#[derive(Clone)]
pub struct PolygonList(Vec<IndexedVertexList>);
impl PolygonList{
pub const fn new(list:Vec<IndexedVertexList>)->Self{
@ -54,6 +55,7 @@ impl MapVertexId for PolygonList{
// }
#[derive(Clone,Copy,Hash,id::Id,PartialEq,Eq)]
pub struct PolygonGroupId(u32);
#[derive(Clone)]
pub enum PolygonGroup{
PolygonList(PolygonList),
//TriangleStrip(TriangleStrip),
@ -89,12 +91,13 @@ impl RenderConfig{
}
}
}
#[derive(Clone)]
pub struct IndexedGraphicsGroup{
//Render pattern material/texture/shader/flat color
pub render:RenderConfigId,
pub groups:Vec<PolygonGroupId>,
}
#[derive(Default)]
#[derive(Clone,Default)]
pub struct IndexedPhysicsGroup{
//the polygons in this group are guaranteed to make a closed convex shape
pub groups:Vec<PolygonGroupId>,
@ -102,6 +105,7 @@ pub struct IndexedPhysicsGroup{
//This is a superset of PhysicsModel and GraphicsModel
#[derive(Clone,Copy,Hash,id::Id,Eq,PartialEq)]
pub struct MeshId(u32);
#[derive(Clone)]
pub struct Mesh{
pub unique_pos:Vec<Planar64Vec3>,//Unit32Vec3
pub unique_normal:Vec<Planar64Vec3>,//Unit32Vec3