Update dependencies
This commit is contained in:
@@ -6,6 +6,9 @@ use rapier::pipeline::{
|
||||
DebugRenderBackend, DebugRenderMode, DebugRenderObject, DebugRenderPipeline,
|
||||
};
|
||||
|
||||
#[derive(Resource)]
|
||||
pub struct DebugRenderPipelineResource(pub DebugRenderPipeline);
|
||||
|
||||
pub struct RapierDebugRenderPlugin {
|
||||
depth_test: bool,
|
||||
}
|
||||
@@ -23,10 +26,10 @@ impl Plugin for RapierDebugRenderPlugin {
|
||||
app.add_plugin(crate::lines::DebugLinesPlugin::with_depth_test(
|
||||
self.depth_test,
|
||||
))
|
||||
.insert_resource(DebugRenderPipeline::new(
|
||||
.insert_resource(DebugRenderPipelineResource(DebugRenderPipeline::new(
|
||||
Default::default(),
|
||||
!DebugRenderMode::RIGID_BODY_AXES & !DebugRenderMode::COLLIDER_AABBS,
|
||||
))
|
||||
)))
|
||||
.add_system_to_stage(CoreStage::Update, debug_render_scene);
|
||||
}
|
||||
}
|
||||
@@ -57,12 +60,12 @@ impl<'a> DebugRenderBackend for BevyLinesRenderBackend<'a> {
|
||||
}
|
||||
|
||||
fn debug_render_scene(
|
||||
mut pipeline: ResMut<DebugRenderPipeline>,
|
||||
mut pipeline: ResMut<DebugRenderPipelineResource>,
|
||||
harness: NonSend<Harness>,
|
||||
mut lines: ResMut<DebugLines>,
|
||||
) {
|
||||
let mut backend = BevyLinesRenderBackend { lines: &mut *lines };
|
||||
pipeline.render(
|
||||
pipeline.0.render(
|
||||
&mut backend,
|
||||
&harness.physics.bodies,
|
||||
&harness.physics.colliders,
|
||||
|
||||
@@ -73,6 +73,7 @@ mod dim {
|
||||
pub(crate) const DEBUG_LINES_SHADER_HANDLE: HandleUntyped =
|
||||
HandleUntyped::weak_from_u64(Shader::TYPE_UUID, 17477439189930443325);
|
||||
|
||||
#[derive(Resource)]
|
||||
pub(crate) struct DebugLinesConfig {
|
||||
depth_test: bool,
|
||||
}
|
||||
@@ -275,7 +276,7 @@ pub(crate) struct RenderDebugLinesMesh;
|
||||
/// );
|
||||
/// }
|
||||
/// ```
|
||||
#[derive(Default)]
|
||||
#[derive(Default, Resource)]
|
||||
pub struct DebugLines {
|
||||
pub positions: Vec<[f32; 3]>,
|
||||
//pub colors: Vec<[f32; 4]>,
|
||||
|
||||
@@ -26,6 +26,7 @@ pub mod r3d {
|
||||
|
||||
use crate::lines::{DebugLinesConfig, RenderDebugLinesMesh, DEBUG_LINES_SHADER_HANDLE};
|
||||
|
||||
#[derive(Resource)]
|
||||
pub(crate) struct DebugLinePipeline {
|
||||
mesh_pipeline: MeshPipeline,
|
||||
shader: Handle<Shader>,
|
||||
@@ -208,6 +209,7 @@ pub mod r2d {
|
||||
|
||||
use crate::lines::{RenderDebugLinesMesh, DEBUG_LINES_SHADER_HANDLE};
|
||||
|
||||
#[derive(Resource)]
|
||||
pub(crate) struct DebugLinePipeline {
|
||||
mesh_pipeline: Mesh2dPipeline,
|
||||
shader: Handle<Shader>,
|
||||
|
||||
@@ -44,7 +44,7 @@ impl EntityWithGraphics {
|
||||
color: Point3<f32>,
|
||||
sensor: bool,
|
||||
) -> Self {
|
||||
let entity = commands.spawn().id();
|
||||
let entity = commands.spawn_empty().id();
|
||||
|
||||
let scale = collider_mesh_scale(shape);
|
||||
let mesh = prefab_meshs
|
||||
@@ -108,7 +108,7 @@ impl EntityWithGraphics {
|
||||
};
|
||||
|
||||
let mut entity_commands = commands.entity(entity);
|
||||
entity_commands.insert_bundle(bundle);
|
||||
entity_commands.insert(bundle);
|
||||
|
||||
if sensor {
|
||||
entity_commands.insert(Wireframe);
|
||||
|
||||
@@ -97,6 +97,7 @@ bitflags! {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Resource)]
|
||||
pub struct TestbedState {
|
||||
pub running: RunMode,
|
||||
pub draw_colls: bool,
|
||||
@@ -122,6 +123,7 @@ pub struct TestbedState {
|
||||
camera_locked: bool, // Used so that the camera can remain the same before and after we change backend or press the restart button.
|
||||
}
|
||||
|
||||
#[derive(Resource)]
|
||||
struct SceneBuilders(Vec<(&'static str, fn(&mut Testbed))>);
|
||||
|
||||
#[cfg(feature = "other-backends")]
|
||||
@@ -369,23 +371,26 @@ impl TestbedApp {
|
||||
"Rapier: 3D demos".to_string()
|
||||
};
|
||||
|
||||
let mut app = App::new();
|
||||
let window_plugin = WindowPlugin {
|
||||
window: WindowDescriptor {
|
||||
title,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
app.insert_resource(WindowDescriptor {
|
||||
title,
|
||||
..Default::default()
|
||||
})
|
||||
.insert_resource(ClearColor(Color::rgb(0.15, 0.15, 0.15)))
|
||||
.insert_resource(Msaa { samples: 4 })
|
||||
.insert_resource(AmbientLight {
|
||||
brightness: 0.3,
|
||||
..Default::default()
|
||||
})
|
||||
.add_plugins(DefaultPlugins)
|
||||
.add_plugin(OrbitCameraPlugin)
|
||||
.add_plugin(WireframePlugin)
|
||||
.add_plugin(bevy_egui::EguiPlugin)
|
||||
.add_plugin(debug_render::RapierDebugRenderPlugin::default());
|
||||
let mut app = App::new();
|
||||
app.insert_resource(ClearColor(Color::rgb(0.15, 0.15, 0.15)))
|
||||
.insert_resource(Msaa { samples: 4 })
|
||||
.insert_resource(AmbientLight {
|
||||
brightness: 0.3,
|
||||
..Default::default()
|
||||
})
|
||||
.add_plugins(DefaultPlugins.set(window_plugin))
|
||||
.add_plugin(OrbitCameraPlugin)
|
||||
.add_plugin(WireframePlugin)
|
||||
.add_plugin(bevy_egui::EguiPlugin)
|
||||
.add_plugin(debug_render::RapierDebugRenderPlugin::default());
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
app.add_plugin(bevy_webgl2::WebGL2Plugin);
|
||||
@@ -995,7 +1000,7 @@ fn draw_contacts(_nf: &NarrowPhase, _colliders: &ColliderSet) {
|
||||
fn setup_graphics_environment(mut commands: Commands) {
|
||||
const HALF_SIZE: f32 = 100.0;
|
||||
|
||||
commands.spawn_bundle(DirectionalLightBundle {
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
illuminance: 10000.0,
|
||||
// Configure the projection to better fit the scene
|
||||
@@ -1020,7 +1025,7 @@ fn setup_graphics_environment(mut commands: Commands) {
|
||||
});
|
||||
|
||||
commands
|
||||
.spawn_bundle(Camera3dBundle {
|
||||
.spawn(Camera3dBundle {
|
||||
transform: Transform::from_matrix(
|
||||
Mat4::look_at_rh(
|
||||
Vec3::new(-30.0, 30.0, 100.0),
|
||||
@@ -1053,7 +1058,7 @@ fn setup_graphics_environment(mut commands: Commands) {
|
||||
// ..Default::default()
|
||||
// });
|
||||
commands
|
||||
.spawn_bundle(Camera2dBundle {
|
||||
.spawn(Camera2dBundle {
|
||||
transform: Transform {
|
||||
translation: Vec3::new(0.0, 0.0, 0.0),
|
||||
rotation: Quat::IDENTITY,
|
||||
|
||||
Reference in New Issue
Block a user