ya
This commit is contained in:
@@ -60,7 +60,7 @@ impl DirectedEdge for SubmeshDirectedEdgeId{
|
||||
}
|
||||
|
||||
//Vertex <-> Edge <-> Face -> Collide
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug,Clone)]
|
||||
pub enum FEV<M:MeshQuery>{
|
||||
Face(M::Face),
|
||||
Edge(<M::Edge as DirectedEdge>::UndirectedEdge),
|
||||
|
||||
@@ -56,11 +56,11 @@ pub enum SessionPlaybackInstruction{
|
||||
IncreaseTimescale,
|
||||
}
|
||||
|
||||
pub struct FrameState<'a>{
|
||||
pub struct FrameState{
|
||||
pub body:physics::Body,
|
||||
pub camera:physics::PhysicsCamera,
|
||||
pub time:PhysicsTime,
|
||||
pub hit:Option<&'a Hit>,
|
||||
pub hit:Option<Hit>,
|
||||
}
|
||||
|
||||
pub struct Simulation{
|
||||
@@ -77,7 +77,7 @@ impl Simulation{
|
||||
physics,
|
||||
}
|
||||
}
|
||||
pub fn get_frame_state<'a>(&'a self,time:SessionTime,debug_model:Option<&'a Hit>)->FrameState<'a>{
|
||||
pub fn get_frame_state(&self,time:SessionTime,debug_model:Option<Hit>)->FrameState{
|
||||
FrameState{
|
||||
body:self.physics.camera_body(),
|
||||
camera:self.physics.camera(),
|
||||
@@ -150,6 +150,7 @@ enum ViewState{
|
||||
Replay(BotId),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Hit{
|
||||
pub convex_mesh_id:physics::ConvexMeshId<physics::PhysicsModelId>,
|
||||
pub closest_fev:Option<strafesnet_physics::model::FEV<strafesnet_physics::model::TransformedMesh<'static>>>
|
||||
@@ -194,9 +195,9 @@ impl Session{
|
||||
self.simulation.physics.clear();
|
||||
self.geometry_shared=PhysicsData::new(map);
|
||||
}
|
||||
pub fn get_frame_state(&self,time:SessionTime)->Option<FrameState<'_>>{
|
||||
pub fn get_frame_state(&self,time:SessionTime)->Option<FrameState>{
|
||||
match &self.view_state{
|
||||
ViewState::Play=>Some(self.simulation.get_frame_state(time,self.last_ray_hit.as_ref())),
|
||||
ViewState::Play=>Some(self.simulation.get_frame_state(time,self.last_ray_hit.clone())),
|
||||
ViewState::Replay(bot_id)=>self.replays.get(bot_id).map(|replay|
|
||||
replay.simulation.get_frame_state(time,None)
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user