Skip to content

Commit

Permalink
update bevy 0.11 - fix compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
johnny-smitherson committed Oct 23, 2023
1 parent 82416e3 commit 780ba4a
Show file tree
Hide file tree
Showing 20 changed files with 148 additions and 108 deletions.
2 changes: 1 addition & 1 deletion crates/rapier2d-f64/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rapier2d-f64"
version = "0.17.2"
version = "0.18.0"
authors = [ "Sébastien Crozet <[email protected]>" ]
description = "2-dimensional physics engine in Rust."
documentation = "https://docs.rs/rapier2d"
Expand Down
6 changes: 3 additions & 3 deletions crates/rapier2d/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "rapier2d"
version = "0.17.2"
version = "0.18.0"
authors = [ "Sébastien Crozet <[email protected]>" ]
description = "2-dimensional physics engine in Rust."
documentation = "https://docs.rs/rapier2d"
description = "3-dimensional physics engine in Rust."
documentation = "https://docs.rs/rapier3d"
homepage = "https://rapier.rs"
repository = "https://github.com/dimforge/rapier"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion crates/rapier3d-f64/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rapier3d-f64"
version = "0.17.2"
version = "0.18.0"
authors = [ "Sébastien Crozet <[email protected]>" ]
description = "3-dimensional physics engine in Rust."
documentation = "https://docs.rs/rapier3d"
Expand Down
2 changes: 1 addition & 1 deletion crates/rapier3d/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rapier3d"
version = "0.17.2"
version = "0.18.0"
authors = [ "Sébastien Crozet <[email protected]>" ]
description = "3-dimensional physics engine in Rust."
documentation = "https://docs.rs/rapier3d"
Expand Down
13 changes: 8 additions & 5 deletions crates/rapier_testbed2d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,24 @@ bincode = "1"
Inflector = "0.11"
md5 = "0.7"

bevy_egui = "0.18"
bevy_ecs = "0.9"
bevy_egui = "0.22"
bevy_ecs = "0.11"
bevy_core_pipeline = "0.11"
bevy_pbr = "0.11"
bevy_sprite = "0.11"
#bevy_prototype_debug_lines = "0.7"

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = {version = "0.9", default-features = false, features = ["bevy_winit", "render", "x11"]}
bevy = {version = "0.11", default-features = false, features = ["bevy_winit", "x11"]}

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = {version = "0.9", default-features = false, features = ["bevy_winit", "render"]}
bevy = {version = "0.11", default-features = false, features = ["bevy_winit"]}
#bevy_webgl2 = "0.5"

[dependencies.rapier]
package = "rapier2d-f64"
path = "../rapier2d-f64"
version = "0.17.0"
version = "0.18.0"
features = [ "serde-serialize", "debug-render", "profiler" ]
13 changes: 8 additions & 5 deletions crates/rapier_testbed2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,24 @@ bincode = "1"
Inflector = "0.11"
md5 = "0.7"

bevy_egui = "0.18"
bevy_ecs = "0.9"
bevy_egui = "0.22"
bevy_ecs = "0.11"
bevy_core_pipeline = "0.11"
bevy_pbr = "0.11"
bevy_sprite = "0.11"
#bevy_prototype_debug_lines = "0.7"

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = {version = "0.9", default-features = false, features = ["bevy_winit", "render", "x11"]}
bevy = {version = "0.11", default-features = false, features = ["bevy_winit", "x11"]}

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = {version = "0.9", default-features = false, features = ["bevy_winit", "render"]}
bevy = {version = "0.11", default-features = false, features = ["bevy_winit",]}
#bevy_webgl2 = "0.5"

[dependencies.rapier]
package = "rapier2d"
path = "../rapier2d"
version = "0.17.0"
version = "0.18.0"
features = [ "serde-serialize", "debug-render", "profiler" ]
13 changes: 8 additions & 5 deletions crates/rapier_testbed3d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,24 @@ md5 = "0.7"
Inflector = "0.11"
serde = { version = "1", features = [ "derive" ] }

bevy_egui = "0.18"
bevy_ecs = "0.9"
bevy_egui = "0.22"
bevy_ecs = "0.11"
bevy_core_pipeline = "0.11"
bevy_pbr = "0.11"
bevy_sprite = "0.11"
#bevy_prototype_debug_lines = { version = "0.7", features = [ "3d" ] }

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = {version = "0.9", default-features = false, features = ["bevy_winit", "render", "x11"]}
bevy = {version = "0.11", default-features = false, features = ["bevy_winit", "x11"]}

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = {version = "0.9", default-features = false, features = ["bevy_winit", "render"]}
bevy = {version = "0.11", default-features = false, features = ["bevy_winit"]}
#bevy_webgl2 = "0.5"

[dependencies.rapier]
package = "rapier3d-f64"
path = "../rapier3d-f64"
version = "0.17.0"
version = "0.18.0"
features = [ "serde-serialize", "debug-render", "profiler" ]
19 changes: 11 additions & 8 deletions crates/rapier_testbed3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,34 @@ rand = "0.8"
rand_pcg = "0.3"
instant = { version = "0.1", features = [ "web-sys", "now" ]}
bitflags = "1"
glam = { version = "0.20", optional = true } # For Physx
glam = { version = "0.24", optional = true } # For Physx
num_cpus = { version = "1", optional = true }
physx = { version = "0.16", features = [ "glam" ], optional = true }
physx-sys = { version = "0.8", optional = true }
physx = { version = "0.19", features = [ "glam" ], optional = true }
physx-sys = { version = "0.11", optional = true }
crossbeam = "0.8"
bincode = "1"
md5 = "0.7"
Inflector = "0.11"
serde = { version = "1", features = [ "derive" ] }

bevy_egui = "0.18"
bevy_ecs = "0.9"
bevy_egui = "0.22"
bevy_ecs = "0.11"
bevy_core_pipeline = "0.11"
bevy_pbr = "0.11"
bevy_sprite = "0.11"
#bevy_prototype_debug_lines = { version = "0.7", features = [ "3d" ] }

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = {version = "0.9", default-features = false, features = ["bevy_winit", "render", "x11"]}
bevy = {version = "0.11", default-features = false, features = ["bevy_winit", "x11"]}

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = {version = "0.9", default-features = false, features = ["bevy_winit", "render"]}
bevy = {version = "0.11", default-features = false, features = ["bevy_winit"]}
#bevy_webgl2 = "0.5"

[dependencies.rapier]
package = "rapier3d"
path = "../rapier3d"
version = "0.17.0"
version = "0.18.0"
features = [ "serde-serialize", "debug-render", "profiler" ]
2 changes: 1 addition & 1 deletion examples3d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ rand = "0.8"
getrandom = { version = "0.2", features = [ "js" ] }
Inflector = "0.11"
wasm-bindgen = "0.2"
obj-rs = { version = "0.6", default-features = false }
obj-rs = { version = "0.7", default-features = false }
bincode = "1"
serde = "1"

Expand Down
2 changes: 1 addition & 1 deletion examples3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ rand = "0.8"
getrandom = { version = "0.2", features = [ "js" ] }
Inflector = "0.11"
wasm-bindgen = "0.2"
obj-rs = { version = "0.6", default-features = false }
obj-rs = { version = "0.7", default-features = false }
serde = "1"
bincode = "1"

Expand Down
6 changes: 3 additions & 3 deletions src_testbed/camera2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ impl OrbitCameraPlugin {
}
impl Plugin for OrbitCameraPlugin {
fn build(&self, app: &mut App) {
app.add_system(Self::mouse_motion_system)
.add_system(Self::zoom_system)
.add_system(Self::update_transform_system);
app.add_systems(Update, Self::mouse_motion_system)
.add_systems(Update, Self::zoom_system)
.add_systems(Update, Self::update_transform_system);
}
}
6 changes: 3 additions & 3 deletions src_testbed/camera3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ impl OrbitCameraPlugin {
}
impl Plugin for OrbitCameraPlugin {
fn build(&self, app: &mut App) {
app.add_system(Self::mouse_motion_system)
.add_system(Self::zoom_system)
.add_system(Self::update_transform_system);
app.add_systems(Update, Self::mouse_motion_system)
.add_systems(Update, Self::zoom_system)
.add_systems(Update, Self::update_transform_system);
}
}
5 changes: 2 additions & 3 deletions src_testbed/debug_render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@ impl Default for RapierDebugRenderPlugin {
}
}
}

impl Plugin for RapierDebugRenderPlugin {
fn build(&self, app: &mut App) {
app.add_plugin(crate::lines::DebugLinesPlugin::with_depth_test(
app.add_plugins(crate::lines::DebugLinesPlugin::with_depth_test(
self.depth_test,
))
.insert_resource(DebugRenderPipelineResource(DebugRenderPipeline::new(
Default::default(),
!DebugRenderMode::RIGID_BODY_AXES & !DebugRenderMode::COLLIDER_AABBS,
)))
.add_system_to_stage(CoreStage::Update, debug_render_scene);
.add_systems(Update, debug_render_scene);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src_testbed/graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ use rapier::math::{Isometry, Real, Vector};
//#[cfg(feature = "dim2")]
//use crate::objects::polyline::Polyline;
// use crate::objects::mesh::Mesh;
use bevy_pbr::StandardMaterial;
use bevy_sprite::ColorMaterial;
use rand::{Rng, SeedableRng};
use rand_pcg::Pcg32;
use std::collections::HashMap;
Expand Down
32 changes: 20 additions & 12 deletions src_testbed/lines/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ use bevy::render::MainWorld;
*/
use bevy::{
asset::{Assets, HandleUntyped},
pbr::{NotShadowCaster, NotShadowReceiver},
prelude::*,
reflect::TypeUuid,
render::{
mesh::{/*Indices,*/ Mesh, VertexAttributeValues},
render_phase::AddRenderCommand,
render_resource::PrimitiveTopology,
render_resource::Shader,
RenderSet,
},
};
use bevy_pbr::{NotShadowCaster, NotShadowReceiver};

mod render_dim;

Expand All @@ -38,8 +39,8 @@ mod render_dim;
#[cfg(feature = "dim3")]
mod dim {
pub(crate) use super::render_dim::r3d::{queue, DebugLinePipeline, DrawDebugLines};
pub(crate) use bevy::core_pipeline::core_3d::Opaque3d as Phase;
use bevy::{asset::Handle, render::mesh::Mesh};
pub(crate) use bevy_core_pipeline::core_3d::Opaque3d as Phase;

pub(crate) type MeshHandle = Handle<Mesh>;
pub(crate) fn from_handle(from: &MeshHandle) -> &Handle<Mesh> {
Expand All @@ -54,8 +55,9 @@ mod dim {
#[cfg(feature = "dim2")]
mod dim {
pub(crate) use super::render_dim::r2d::{queue, DebugLinePipeline, DrawDebugLines};
pub(crate) use bevy::core_pipeline::core_2d::Transparent2d as Phase;
use bevy::{asset::Handle, render::mesh::Mesh, sprite::Mesh2dHandle};
use bevy::{asset::Handle, render::mesh::Mesh};
pub(crate) use bevy_core_pipeline::core_2d::Transparent2d as Phase;
use bevy_sprite::Mesh2dHandle;

pub(crate) type MeshHandle = Mesh2dHandle;
pub(crate) fn from_handle(from: &MeshHandle) -> &Handle<Mesh> {
Expand Down Expand Up @@ -120,27 +122,33 @@ impl DebugLinesPlugin {
Self { depth_test: val }
}
}

use bevy::render::render_phase::DrawFunctions;
use bevy::render::Render;
impl Plugin for DebugLinesPlugin {
fn build(&self, app: &mut App) {
use bevy::render::{render_resource::SpecializedMeshPipelines, RenderApp, RenderStage};
use bevy::render::{render_resource::SpecializedMeshPipelines, RenderApp};
let mut shaders = app.world.get_resource_mut::<Assets<Shader>>().unwrap();
shaders.set_untracked(
DEBUG_LINES_SHADER_HANDLE,
Shader::from_wgsl(dim::SHADER_FILE),
Shader::from_wgsl(dim::SHADER_FILE, file!()),
);
app.init_resource::<DebugLines>();
app.add_startup_system(setup)
.add_system_to_stage(CoreStage::PostUpdate, update.label("draw_lines"));

app.init_resource::<DrawFunctions<dim::Phase>>();

app.add_systems(Startup, setup)
.add_systems(PostUpdate, update);

app.sub_app_mut(RenderApp)
.init_resource::<DrawFunctions<dim::Phase>>()
.add_render_command::<dim::Phase, dim::DrawDebugLines>()
.insert_resource(DebugLinesConfig {
depth_test: self.depth_test,
})
.init_resource::<dim::DebugLinePipeline>()
.init_resource::<SpecializedMeshPipelines<dim::DebugLinePipeline>>()
.add_system_to_stage(RenderStage::Extract, extract)
.add_system_to_stage(RenderStage::Queue, dim::queue);
.add_systems(Render, extract.in_set(RenderSet::ExtractCommands))
.add_systems(Render, dim::queue.in_set(RenderSet::Queue));

info!("Loaded {} debug lines plugin.", dim::DIMMENSION);
}
Expand Down Expand Up @@ -176,7 +184,7 @@ fn setup(mut cmds: Commands, mut meshes: ResMut<Assets<Mesh>>) {
// https://github.com/Toqozz/bevy_debug_lines/issues/16
//mesh.set_indices(Some(Indices::U16(Vec::with_capacity(MAX_POINTS_PER_MESH))));

cmds.spawn_bundle((
cmds.spawn((
dim::into_handle(meshes.add(mesh)),
NotShadowCaster,
NotShadowReceiver,
Expand Down
Loading

0 comments on commit 780ba4a

Please sign in to comment.