Upgrade bevy 0.15 (#758)
* upgrade bevy 0.15 * use crate dependencies * use puffin pr dependency * suppress needless lifetimes * fix compiler error due to merge --------- Co-authored-by: Sébastien Crozet <sebcrozet@dimforge.com>
This commit is contained in:
@@ -8,6 +8,7 @@ use std::num::NonZeroUsize;
|
||||
use bevy::prelude::*;
|
||||
|
||||
use crate::debug_render::{DebugRenderPipelineResource, RapierDebugRenderPlugin};
|
||||
use crate::graphics::BevyMaterialComponent;
|
||||
use crate::physics::{DeserializedPhysicsSnapshot, PhysicsEvents, PhysicsSnapshot, PhysicsState};
|
||||
use crate::plugin::TestbedPlugin;
|
||||
use crate::{graphics::GraphicsManager, harness::RunState};
|
||||
@@ -436,7 +437,6 @@ impl TestbedApp {
|
||||
|
||||
let mut app = App::new();
|
||||
app.insert_resource(ClearColor(Color::from(Srgba::rgb(0.15, 0.15, 0.15))))
|
||||
.insert_resource(Msaa::Sample4)
|
||||
.insert_resource(AmbientLight {
|
||||
brightness: 0.3,
|
||||
..Default::default()
|
||||
@@ -1092,36 +1092,35 @@ fn setup_graphics_environment(mut commands: Commands) {
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
shadows_enabled: false,
|
||||
..Default::default()
|
||||
},
|
||||
transform: Transform {
|
||||
Transform {
|
||||
translation: Vec3::new(10.0, 2.0, 10.0),
|
||||
rotation: Quat::from_rotation_x(-std::f32::consts::FRAC_PI_4),
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
));
|
||||
|
||||
commands
|
||||
.spawn(Camera3dBundle {
|
||||
transform: Transform::from_matrix(
|
||||
Mat4::look_at_rh(
|
||||
Vec3::new(-30.0, 30.0, 100.0),
|
||||
Vec3::new(0.0, 10.0, 0.0),
|
||||
Vec3::new(0.0, 1.0, 0.0),
|
||||
)
|
||||
.inverse(),
|
||||
),
|
||||
..Default::default()
|
||||
})
|
||||
.insert(OrbitCamera {
|
||||
commands.spawn((
|
||||
Camera3d::default(),
|
||||
Msaa::Sample4,
|
||||
MainCamera,
|
||||
Transform::from_matrix(
|
||||
Mat4::look_at_rh(
|
||||
Vec3::new(-30.0, 30.0, 100.0),
|
||||
Vec3::new(0.0, 10.0, 0.0),
|
||||
Vec3::new(0.0, 1.0, 0.0),
|
||||
)
|
||||
.inverse(),
|
||||
),
|
||||
OrbitCamera {
|
||||
rotate_sensitivity: 0.05,
|
||||
..OrbitCamera::default()
|
||||
})
|
||||
.insert(MainCamera);
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
#[cfg(feature = "dim2")]
|
||||
@@ -1140,14 +1139,14 @@ fn setup_graphics_environment(mut commands: Commands) {
|
||||
// ..Default::default()
|
||||
// });
|
||||
commands
|
||||
.spawn(Camera2dBundle {
|
||||
transform: Transform {
|
||||
.spawn((
|
||||
Camera2d,
|
||||
Transform {
|
||||
translation: Vec3::new(0.0, 0.0, 0.0),
|
||||
rotation: Quat::IDENTITY,
|
||||
scale: Vec3::new(0.01, 0.01, 1.0),
|
||||
},
|
||||
..Camera2dBundle::default()
|
||||
})
|
||||
))
|
||||
.insert(OrbitCamera {
|
||||
zoom: 100.0,
|
||||
pan_sensitivity: 0.02,
|
||||
@@ -1188,7 +1187,7 @@ fn update_testbed(
|
||||
(mut gfx_components, mut cameras, mut material_handles): (
|
||||
Query<&mut Transform>,
|
||||
Query<(&Camera, &GlobalTransform, &mut OrbitCamera)>,
|
||||
Query<&mut Handle<BevyMaterial>>,
|
||||
Query<&mut BevyMaterialComponent>,
|
||||
),
|
||||
keys: Res<ButtonInput<KeyCode>>,
|
||||
) {
|
||||
@@ -1582,7 +1581,7 @@ fn clear(
|
||||
|
||||
#[cfg(feature = "dim2")]
|
||||
fn highlight_hovered_body(
|
||||
_material_handles: &mut Query<&mut Handle<BevyMaterial>>,
|
||||
_material_handles: &mut Query<&mut BevyMaterialComponent>,
|
||||
_graphics_manager: &mut GraphicsManager,
|
||||
_testbed_state: &mut TestbedState,
|
||||
_physics: &PhysicsState,
|
||||
@@ -1595,7 +1594,7 @@ fn highlight_hovered_body(
|
||||
|
||||
#[cfg(feature = "dim3")]
|
||||
fn highlight_hovered_body(
|
||||
material_handles: &mut Query<&mut Handle<BevyMaterial>>,
|
||||
material_handles: &mut Query<&mut BevyMaterialComponent>,
|
||||
graphics_manager: &mut GraphicsManager,
|
||||
testbed_state: &mut TestbedState,
|
||||
physics: &PhysicsState,
|
||||
@@ -1607,7 +1606,7 @@ fn highlight_hovered_body(
|
||||
if let Some(nodes) = graphics_manager.body_nodes_mut(highlighted_body) {
|
||||
for node in nodes {
|
||||
if let Ok(mut handle) = material_handles.get_mut(node.entity) {
|
||||
*handle = node.material.clone_weak()
|
||||
**handle = node.material.clone_weak()
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1644,7 +1643,7 @@ fn highlight_hovered_body(
|
||||
|
||||
for node in graphics_manager.body_nodes_mut(parent_handle).unwrap() {
|
||||
if let Ok(mut handle) = material_handles.get_mut(node.entity) {
|
||||
*handle = selection_material.clone_weak();
|
||||
**handle = selection_material.clone_weak();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user