chore: clippy fix
This commit is contained in:
committed by
Sébastien Crozet
parent
6b6c349cfa
commit
f9663f894c
@@ -18,6 +18,17 @@ pub struct PhysicsSnapshot {
|
||||
island_manager: Vec<u8>,
|
||||
}
|
||||
|
||||
pub struct DeserializedPhysicsSnapshot {
|
||||
pub timestep_id: usize,
|
||||
pub broad_phase: BroadPhase,
|
||||
pub narrow_phase: NarrowPhase,
|
||||
pub island_manager: IslandManager,
|
||||
pub bodies: RigidBodySet,
|
||||
pub colliders: ColliderSet,
|
||||
pub impulse_joints: ImpulseJointSet,
|
||||
pub multibody_joints: MultibodyJointSet,
|
||||
}
|
||||
|
||||
impl PhysicsSnapshot {
|
||||
pub fn new(
|
||||
timestep_id: usize,
|
||||
@@ -41,28 +52,17 @@ impl PhysicsSnapshot {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn restore(
|
||||
&self,
|
||||
) -> bincode::Result<(
|
||||
usize,
|
||||
BroadPhase,
|
||||
NarrowPhase,
|
||||
IslandManager,
|
||||
RigidBodySet,
|
||||
ColliderSet,
|
||||
ImpulseJointSet,
|
||||
MultibodyJointSet,
|
||||
)> {
|
||||
Ok((
|
||||
self.timestep_id,
|
||||
bincode::deserialize(&self.broad_phase)?,
|
||||
bincode::deserialize(&self.narrow_phase)?,
|
||||
bincode::deserialize(&self.island_manager)?,
|
||||
bincode::deserialize(&self.bodies)?,
|
||||
bincode::deserialize(&self.colliders)?,
|
||||
bincode::deserialize(&self.impulse_joints)?,
|
||||
bincode::deserialize(&self.multibody_joints)?,
|
||||
))
|
||||
pub fn restore(&self) -> bincode::Result<DeserializedPhysicsSnapshot> {
|
||||
Ok(DeserializedPhysicsSnapshot {
|
||||
timestep_id: self.timestep_id,
|
||||
broad_phase: bincode::deserialize(&self.broad_phase)?,
|
||||
narrow_phase: bincode::deserialize(&self.narrow_phase)?,
|
||||
island_manager: bincode::deserialize(&self.island_manager)?,
|
||||
bodies: bincode::deserialize(&self.bodies)?,
|
||||
colliders: bincode::deserialize(&self.colliders)?,
|
||||
impulse_joints: bincode::deserialize(&self.impulse_joints)?,
|
||||
multibody_joints: bincode::deserialize(&self.multibody_joints)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn print_snapshot_len(&self) {
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::num::NonZeroUsize;
|
||||
use bevy::prelude::*;
|
||||
|
||||
use crate::debug_render::{DebugRenderPipelineResource, RapierDebugRenderPlugin};
|
||||
use crate::physics::{PhysicsEvents, PhysicsSnapshot, PhysicsState};
|
||||
use crate::physics::{DeserializedPhysicsSnapshot, PhysicsEvents, PhysicsSnapshot, PhysicsState};
|
||||
use crate::plugin::TestbedPlugin;
|
||||
use crate::ui;
|
||||
use crate::{graphics::GraphicsManager, harness::RunState};
|
||||
@@ -1271,7 +1271,7 @@ fn update_testbed(
|
||||
.action_flags
|
||||
.set(TestbedActionFlags::RESTORE_SNAPSHOT, false);
|
||||
if let Some(snapshot) = &state.snapshot {
|
||||
if let Ok((
|
||||
if let Ok(DeserializedPhysicsSnapshot {
|
||||
timestep_id,
|
||||
broad_phase,
|
||||
narrow_phase,
|
||||
@@ -1280,7 +1280,7 @@ fn update_testbed(
|
||||
colliders,
|
||||
impulse_joints,
|
||||
multibody_joints,
|
||||
)) = snapshot.restore()
|
||||
}) = snapshot.restore()
|
||||
{
|
||||
clear(&mut commands, &mut state, &mut graphics, &mut plugins);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user