From 1b51e21ecd32fd674810bc2ed5bbe0fc612754a7 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 26 Oct 2023 16:28:07 -0700 Subject: [PATCH] implement PhysicsMesh --- src/model_physics.rs | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/model_physics.rs b/src/model_physics.rs index 241467c..9de1c02 100644 --- a/src/model_physics.rs +++ b/src/model_physics.rs @@ -21,12 +21,9 @@ struct FaceRefs{ verts:Vec, } struct EdgeRefs{ - f0:FaceId,//left - f1:FaceId,//right - v0:VertId,//bottom - v1:VertId,//top - v0f:FaceId,//bottom capping face - v1f:FaceId,//top capping face + faces:[FaceId;2],//left, right + verts:[VertId;2],//bottom, top + vert_faces:[FaceId;2],//bottom, top } struct VertRefs{ faces:Vec, @@ -39,23 +36,23 @@ pub struct PhysicsMesh{ vert_topology:Vec, } impl PhysicsMesh{ - pub fn face_edges(face_id:FaceId)->Vec{ - todo!() + pub fn face_edges(&self,face_id:FaceId)->&Vec{ + &self.face_topology[face_id.0].edges } - pub fn edge_side_faces(edge_id:EdgeId)->[FaceId;2]{ - todo!() + pub fn edge_side_faces(&self,edge_id:EdgeId)->&[FaceId;2]{ + &self.edge_topology[edge_id.0].faces } - pub fn edge_end_faces(edge_id:EdgeId)->[FaceId;2]{ - todo!() + pub fn edge_end_faces(&self,edge_id:EdgeId)->&[FaceId;2]{ + &self.edge_topology[edge_id.0].vert_faces } - pub fn edge_verts(edge_id:EdgeId)->[VertId;2]{ - todo!() + pub fn edge_verts(&self,edge_id:EdgeId)->&[VertId;2]{ + &self.edge_topology[edge_id.0].verts } - pub fn vert_edges(vert_id:VertId)->Vec{ - todo!() + pub fn vert_edges(&self,vert_id:VertId)->&Vec{ + &self.vert_topology[vert_id.0].edges } - pub fn vert_faces(vert_id:VertId)->Vec{ - todo!() + pub fn vert_faces(&self,vert_id:VertId)->&Vec{ + &self.vert_topology[vert_id.0].faces } }