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>,
|
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 {
|
impl PhysicsSnapshot {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
timestep_id: usize,
|
timestep_id: usize,
|
||||||
@@ -41,28 +52,17 @@ impl PhysicsSnapshot {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn restore(
|
pub fn restore(&self) -> bincode::Result<DeserializedPhysicsSnapshot> {
|
||||||
&self,
|
Ok(DeserializedPhysicsSnapshot {
|
||||||
) -> bincode::Result<(
|
timestep_id: self.timestep_id,
|
||||||
usize,
|
broad_phase: bincode::deserialize(&self.broad_phase)?,
|
||||||
BroadPhase,
|
narrow_phase: bincode::deserialize(&self.narrow_phase)?,
|
||||||
NarrowPhase,
|
island_manager: bincode::deserialize(&self.island_manager)?,
|
||||||
IslandManager,
|
bodies: bincode::deserialize(&self.bodies)?,
|
||||||
RigidBodySet,
|
colliders: bincode::deserialize(&self.colliders)?,
|
||||||
ColliderSet,
|
impulse_joints: bincode::deserialize(&self.impulse_joints)?,
|
||||||
ImpulseJointSet,
|
multibody_joints: bincode::deserialize(&self.multibody_joints)?,
|
||||||
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 print_snapshot_len(&self) {
|
pub fn print_snapshot_len(&self) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use std::num::NonZeroUsize;
|
|||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
|
|
||||||
use crate::debug_render::{DebugRenderPipelineResource, RapierDebugRenderPlugin};
|
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::plugin::TestbedPlugin;
|
||||||
use crate::ui;
|
use crate::ui;
|
||||||
use crate::{graphics::GraphicsManager, harness::RunState};
|
use crate::{graphics::GraphicsManager, harness::RunState};
|
||||||
@@ -1271,7 +1271,7 @@ fn update_testbed(
|
|||||||
.action_flags
|
.action_flags
|
||||||
.set(TestbedActionFlags::RESTORE_SNAPSHOT, false);
|
.set(TestbedActionFlags::RESTORE_SNAPSHOT, false);
|
||||||
if let Some(snapshot) = &state.snapshot {
|
if let Some(snapshot) = &state.snapshot {
|
||||||
if let Ok((
|
if let Ok(DeserializedPhysicsSnapshot {
|
||||||
timestep_id,
|
timestep_id,
|
||||||
broad_phase,
|
broad_phase,
|
||||||
narrow_phase,
|
narrow_phase,
|
||||||
@@ -1280,7 +1280,7 @@ fn update_testbed(
|
|||||||
colliders,
|
colliders,
|
||||||
impulse_joints,
|
impulse_joints,
|
||||||
multibody_joints,
|
multibody_joints,
|
||||||
)) = snapshot.restore()
|
}) = snapshot.restore()
|
||||||
{
|
{
|
||||||
clear(&mut commands, &mut state, &mut graphics, &mut plugins);
|
clear(&mut commands, &mut state, &mut graphics, &mut plugins);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user