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:
@@ -18,6 +18,9 @@ members = [
|
|||||||
]
|
]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
|
[workspace.lints.clippy]
|
||||||
|
needless_lifetimes = "allow"
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
#wrapped2d = { git = "https://github.com/Bastacyclop/rust_box2d.git" }
|
#wrapped2d = { git = "https://github.com/Bastacyclop/rust_box2d.git" }
|
||||||
#xurdf = { path = "../xurdf/xurdf" }
|
#xurdf = { path = "../xurdf/xurdf" }
|
||||||
@@ -38,6 +41,10 @@ resolver = "2"
|
|||||||
#parry2d-f64 = { git = "https://github.com/dimforge/parry", branch = "master" }
|
#parry2d-f64 = { git = "https://github.com/dimforge/parry", branch = "master" }
|
||||||
#parry3d-f64 = { git = "https://github.com/dimforge/parry", branch = "master" }
|
#parry3d-f64 = { git = "https://github.com/dimforge/parry", branch = "master" }
|
||||||
|
|
||||||
|
# See https://github.com/EmbarkStudios/puffin/pull/234
|
||||||
|
puffin_egui = { git = "https://github.com/tedsteen/puffin.git", rev = "11771ebe00fd257aedbb545df3339ad597b1cc34" }
|
||||||
|
|
||||||
|
|
||||||
# # For feature unstable-puffin-pr-235
|
# # For feature unstable-puffin-pr-235
|
||||||
# # See https://github.com/dimforge/rapier/issues/760.
|
# # See https://github.com/dimforge/rapier/issues/760.
|
||||||
# puffin_egui = { version = "0.29", optional = true, git = "https://github.com/Vrixyz/puffin.git", branch = "expose_ui_options" }
|
# puffin_egui = { version = "0.29", optional = true, git = "https://github.com/Vrixyz/puffin.git", branch = "expose_ui_options" }
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ maintenance = { status = "actively-developed" }
|
|||||||
rust.unexpected_cfgs = { level = "warn", check-cfg = [
|
rust.unexpected_cfgs = { level = "warn", check-cfg = [
|
||||||
'cfg(feature, values("dim3", "f64"))',
|
'cfg(feature, values("dim3", "f64"))',
|
||||||
] }
|
] }
|
||||||
|
clippy = { needless_lifetimes = "allow" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["dim2", "f32"]
|
default = ["dim2", "f32"]
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ maintenance = { status = "actively-developed" }
|
|||||||
rust.unexpected_cfgs = { level = "warn", check-cfg = [
|
rust.unexpected_cfgs = { level = "warn", check-cfg = [
|
||||||
'cfg(feature, values("dim2", "f64"))',
|
'cfg(feature, values("dim2", "f64"))',
|
||||||
] }
|
] }
|
||||||
|
clippy = { needless_lifetimes = "allow" }
|
||||||
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["dim3", "f32"]
|
default = ["dim3", "f32"]
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ required-features = ["dim2"]
|
|||||||
rust.unexpected_cfgs = { level = "warn", check-cfg = [
|
rust.unexpected_cfgs = { level = "warn", check-cfg = [
|
||||||
'cfg(feature, values("dim3", "f32"))',
|
'cfg(feature, values("dim3", "f32"))',
|
||||||
] }
|
] }
|
||||||
|
clippy = { needless_lifetimes = "allow" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["dim2"]
|
default = ["dim2"]
|
||||||
@@ -41,11 +42,8 @@ unstable-puffin-pr-235 = []
|
|||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
features = ["parallel", "profiler_ui"]
|
features = ["parallel", "profiler_ui"]
|
||||||
|
|
||||||
[lints.clippy]
|
|
||||||
needless_lifetimes = "allow"
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nalgebra = { version = "0.33", features = ["rand", "glam027"] }
|
nalgebra = { version = "0.33", features = ["rand", "glam029"] }
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
rand_pcg = "0.3"
|
rand_pcg = "0.3"
|
||||||
web-time = { version = "1.1" }
|
web-time = { version = "1.1" }
|
||||||
@@ -56,19 +54,20 @@ crossbeam = "0.8"
|
|||||||
bincode = "1"
|
bincode = "1"
|
||||||
Inflector = "0.11"
|
Inflector = "0.11"
|
||||||
md5 = "0.7"
|
md5 = "0.7"
|
||||||
bevy_egui = "0.29"
|
bevy_egui = "0.31"
|
||||||
bevy_ecs = "0.14"
|
bevy_ecs = "0.15"
|
||||||
bevy_core_pipeline = "0.14"
|
bevy_core_pipeline = "0.15"
|
||||||
bevy_pbr = "0.14"
|
bevy_pbr = "0.15"
|
||||||
bevy_sprite = "0.14"
|
bevy_sprite = "0.15"
|
||||||
profiling = "1.0"
|
profiling = "1.0"
|
||||||
puffin_egui = { version = "0.29", optional = true }
|
puffin_egui = { version = "0.29", optional = true }
|
||||||
|
|
||||||
# Dependencies for native only.
|
# Dependencies for native only.
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
bevy = { version = "0.14", default-features = false, features = [
|
bevy = { version = "0.15", default-features = false, features = [
|
||||||
"bevy_asset",
|
"bevy_asset",
|
||||||
"bevy_winit",
|
"bevy_winit",
|
||||||
|
"bevy_window",
|
||||||
"x11",
|
"x11",
|
||||||
"tonemapping_luts",
|
"tonemapping_luts",
|
||||||
"ktx2",
|
"ktx2",
|
||||||
@@ -80,9 +79,10 @@ bevy = { version = "0.14", default-features = false, features = [
|
|||||||
|
|
||||||
# Dependencies for WASM only.
|
# Dependencies for WASM only.
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
bevy = { version = "0.14", default-features = false, features = [
|
bevy = { version = "0.15", default-features = false, features = [
|
||||||
"bevy_asset",
|
"bevy_asset",
|
||||||
"bevy_winit",
|
"bevy_winit",
|
||||||
|
"bevy_window",
|
||||||
"tonemapping_luts",
|
"tonemapping_luts",
|
||||||
"ktx2",
|
"ktx2",
|
||||||
"zstd",
|
"zstd",
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ required-features = ["dim2"]
|
|||||||
rust.unexpected_cfgs = { level = "warn", check-cfg = [
|
rust.unexpected_cfgs = { level = "warn", check-cfg = [
|
||||||
'cfg(feature, values("dim3", "f64"))',
|
'cfg(feature, values("dim3", "f64"))',
|
||||||
] }
|
] }
|
||||||
|
clippy = { needless_lifetimes = "allow" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["dim2"]
|
default = ["dim2"]
|
||||||
@@ -41,11 +42,8 @@ unstable-puffin-pr-235 = []
|
|||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
features = ["parallel", "other-backends", "profiler_ui"]
|
features = ["parallel", "other-backends", "profiler_ui"]
|
||||||
|
|
||||||
[lints.clippy]
|
|
||||||
needless_lifetimes = "allow"
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nalgebra = { version = "0.33", features = ["rand", "glam027"] }
|
nalgebra = { version = "0.33", features = ["rand", "glam029"] }
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
rand_pcg = "0.3"
|
rand_pcg = "0.3"
|
||||||
web-time = { version = "1.1" }
|
web-time = { version = "1.1" }
|
||||||
@@ -56,19 +54,20 @@ crossbeam = "0.8"
|
|||||||
bincode = "1"
|
bincode = "1"
|
||||||
Inflector = "0.11"
|
Inflector = "0.11"
|
||||||
md5 = "0.7"
|
md5 = "0.7"
|
||||||
bevy_egui = "0.29"
|
bevy_egui = "0.31"
|
||||||
bevy_ecs = "0.14"
|
bevy_ecs = "0.15"
|
||||||
bevy_core_pipeline = "0.14"
|
bevy_core_pipeline = "0.15"
|
||||||
bevy_pbr = "0.14"
|
bevy_pbr = "0.15"
|
||||||
bevy_sprite = "0.14"
|
bevy_sprite = "0.15"
|
||||||
profiling = "1.0"
|
profiling = "1.0"
|
||||||
puffin_egui = { version = "0.29", optional = true }
|
puffin_egui = { version = "0.29", optional = true }
|
||||||
|
|
||||||
# Dependencies for native only.
|
# Dependencies for native only.
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
bevy = { version = "0.14", default-features = false, features = [
|
bevy = { version = "0.15", default-features = false, features = [
|
||||||
"bevy_sprite",
|
"bevy_sprite",
|
||||||
"bevy_winit",
|
"bevy_winit",
|
||||||
|
"bevy_window",
|
||||||
"x11",
|
"x11",
|
||||||
"tonemapping_luts",
|
"tonemapping_luts",
|
||||||
"ktx2",
|
"ktx2",
|
||||||
@@ -80,9 +79,10 @@ bevy = { version = "0.14", default-features = false, features = [
|
|||||||
|
|
||||||
# Dependencies for WASM only.
|
# Dependencies for WASM only.
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
bevy = { version = "0.14", default-features = false, features = [
|
bevy = { version = "0.15", default-features = false, features = [
|
||||||
"bevy_sprite",
|
"bevy_sprite",
|
||||||
"bevy_winit",
|
"bevy_winit",
|
||||||
|
"bevy_window",
|
||||||
"tonemapping_luts",
|
"tonemapping_luts",
|
||||||
"ktx2",
|
"ktx2",
|
||||||
"zstd",
|
"zstd",
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ rust.unexpected_cfgs = { level = "warn", check-cfg = [
|
|||||||
# but easier to just ignore it here.
|
# but easier to just ignore it here.
|
||||||
'cfg(feature, values("other-backends"))',
|
'cfg(feature, values("other-backends"))',
|
||||||
] }
|
] }
|
||||||
|
clippy = { needless_lifetimes = "allow" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["dim3"]
|
default = ["dim3"]
|
||||||
@@ -43,11 +44,8 @@ unstable-puffin-pr-235 = []
|
|||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
features = ["parallel", "profiler_ui"]
|
features = ["parallel", "profiler_ui"]
|
||||||
|
|
||||||
[lints.clippy]
|
|
||||||
needless_lifetimes = "allow"
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nalgebra = { version = "0.33", features = ["rand", "glam027"] }
|
nalgebra = { version = "0.33", features = ["rand", "glam029"] }
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
rand_pcg = "0.3"
|
rand_pcg = "0.3"
|
||||||
web-time = { version = "1.1" }
|
web-time = { version = "1.1" }
|
||||||
@@ -58,18 +56,19 @@ bincode = "1"
|
|||||||
md5 = "0.7"
|
md5 = "0.7"
|
||||||
Inflector = "0.11"
|
Inflector = "0.11"
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
bevy_egui = "0.29"
|
bevy_egui = "0.31"
|
||||||
bevy_ecs = "0.14"
|
bevy_ecs = "0.15"
|
||||||
bevy_core_pipeline = "0.14"
|
bevy_core_pipeline = "0.15"
|
||||||
bevy_pbr = "0.14"
|
bevy_pbr = "0.15"
|
||||||
bevy_sprite = "0.14"
|
bevy_sprite = "0.15"
|
||||||
profiling = "1.0"
|
profiling = "1.0"
|
||||||
puffin_egui = { version = "0.29", optional = true, git = "https://github.com/Vrixyz/puffin.git", branch = "expose_ui_options" }
|
puffin_egui = { version = "0.29", optional = true, git = "https://github.com/Vrixyz/puffin.git", branch = "expose_ui_options" }
|
||||||
|
|
||||||
# Dependencies for native only.
|
# Dependencies for native only.
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
bevy = { version = "0.14", default-features = false, features = [
|
bevy = { version = "0.15", default-features = false, features = [
|
||||||
"bevy_winit",
|
"bevy_winit",
|
||||||
|
"bevy_window",
|
||||||
"x11",
|
"x11",
|
||||||
"tonemapping_luts",
|
"tonemapping_luts",
|
||||||
"ktx2",
|
"ktx2",
|
||||||
@@ -81,8 +80,10 @@ bevy = { version = "0.14", default-features = false, features = [
|
|||||||
|
|
||||||
# Dependencies for WASM only.
|
# Dependencies for WASM only.
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
bevy = { version = "0.14", default-features = false, features = [
|
bevy = { version = "0.15", default-features = false, features = [
|
||||||
"bevy_winit",
|
"bevy_winit",
|
||||||
|
"bevy_window",
|
||||||
|
"bevy_window",
|
||||||
"tonemapping_luts",
|
"tonemapping_luts",
|
||||||
"ktx2",
|
"ktx2",
|
||||||
"zstd",
|
"zstd",
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ required-features = ["dim3"]
|
|||||||
rust.unexpected_cfgs = { level = "warn", check-cfg = [
|
rust.unexpected_cfgs = { level = "warn", check-cfg = [
|
||||||
'cfg(feature, values("dim2", "f64"))',
|
'cfg(feature, values("dim2", "f64"))',
|
||||||
] }
|
] }
|
||||||
|
clippy = { needless_lifetimes = "allow" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["dim3"]
|
default = ["dim3"]
|
||||||
@@ -41,11 +42,8 @@ unstable-puffin-pr-235 = []
|
|||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
features = ["parallel", "other-backends", "profiler_ui"]
|
features = ["parallel", "other-backends", "profiler_ui"]
|
||||||
|
|
||||||
[lints.clippy]
|
|
||||||
needless_lifetimes = "allow"
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nalgebra = { version = "0.33", features = ["rand", "glam027"] }
|
nalgebra = { version = "0.33", features = ["rand", "glam029"] }
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
rand_pcg = "0.3"
|
rand_pcg = "0.3"
|
||||||
web-time = { version = "1.1" }
|
web-time = { version = "1.1" }
|
||||||
@@ -59,18 +57,19 @@ bincode = "1"
|
|||||||
md5 = "0.7"
|
md5 = "0.7"
|
||||||
Inflector = "0.11"
|
Inflector = "0.11"
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
bevy_egui = "0.29"
|
bevy_egui = "0.31"
|
||||||
bevy_ecs = "0.14"
|
bevy_ecs = "0.15"
|
||||||
bevy_core_pipeline = "0.14"
|
bevy_core_pipeline = "0.15"
|
||||||
bevy_pbr = "0.14"
|
bevy_pbr = "0.15"
|
||||||
bevy_sprite = "0.14"
|
bevy_sprite = "0.15"
|
||||||
profiling = "1.0"
|
profiling = "1.0"
|
||||||
puffin_egui = { version = "0.29", optional = true }
|
puffin_egui = { version = "0.29", optional = true }
|
||||||
|
|
||||||
# Dependencies for native only.
|
# Dependencies for native only.
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
bevy = { version = "0.14", default-features = false, features = [
|
bevy = { version = "0.15", default-features = false, features = [
|
||||||
"bevy_winit",
|
"bevy_winit",
|
||||||
|
"bevy_window",
|
||||||
"x11",
|
"x11",
|
||||||
"tonemapping_luts",
|
"tonemapping_luts",
|
||||||
"ktx2",
|
"ktx2",
|
||||||
@@ -82,7 +81,7 @@ bevy = { version = "0.14", default-features = false, features = [
|
|||||||
|
|
||||||
# Dependencies for WASM only.
|
# Dependencies for WASM only.
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
bevy = { version = "0.14", default-features = false, features = [
|
bevy = { version = "0.15", default-features = false, features = [
|
||||||
"bevy_winit",
|
"bevy_winit",
|
||||||
"tonemapping_luts",
|
"tonemapping_luts",
|
||||||
"ktx2",
|
"ktx2",
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ impl OrbitCameraPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if mouse_button_input.pressed(camera.rotate_button) {
|
if mouse_button_input.pressed(camera.rotate_button) {
|
||||||
camera.x -= delta.x * camera.rotate_sensitivity * time.delta_seconds();
|
camera.x -= delta.x * camera.rotate_sensitivity * time.delta_secs();
|
||||||
camera.y -= delta.y * camera.rotate_sensitivity * time.delta_seconds();
|
camera.y -= delta.y * camera.rotate_sensitivity * time.delta_secs();
|
||||||
camera.y = camera
|
camera.y = camera
|
||||||
.y
|
.y
|
||||||
.max(*camera.pitch_range.start())
|
.max(*camera.pitch_range.start())
|
||||||
@@ -87,7 +87,7 @@ impl OrbitCameraPlugin {
|
|||||||
let up_dir = transform.rotation * Vec3::Y;
|
let up_dir = transform.rotation * Vec3::Y;
|
||||||
let pan_vector = (delta.x * right_dir + delta.y * up_dir)
|
let pan_vector = (delta.x * right_dir + delta.y * up_dir)
|
||||||
* camera.pan_sensitivity
|
* camera.pan_sensitivity
|
||||||
* time.delta_seconds();
|
* time.delta_secs();
|
||||||
camera.center += pan_vector;
|
camera.center += pan_vector;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ use std::collections::HashMap;
|
|||||||
pub type BevyMaterial = bevy_sprite::ColorMaterial;
|
pub type BevyMaterial = bevy_sprite::ColorMaterial;
|
||||||
#[cfg(feature = "dim3")]
|
#[cfg(feature = "dim3")]
|
||||||
pub type BevyMaterial = StandardMaterial;
|
pub type BevyMaterial = StandardMaterial;
|
||||||
|
#[cfg(feature = "dim2")]
|
||||||
|
pub type BevyMaterialComponent = MeshMaterial2d<BevyMaterial>;
|
||||||
|
#[cfg(feature = "dim3")]
|
||||||
|
pub type BevyMaterialComponent = MeshMaterial3d<BevyMaterial>;
|
||||||
|
|
||||||
pub type InstancedMaterials = HashMap<Point3<usize>, Handle<BevyMaterial>>;
|
pub type InstancedMaterials = HashMap<Point3<usize>, Handle<BevyMaterial>>;
|
||||||
pub const SELECTED_OBJECT_MATERIAL_KEY: Point3<usize> = point![42, 42, 42];
|
pub const SELECTED_OBJECT_MATERIAL_KEY: Point3<usize> = point![42, 42, 42];
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ use rapier::math::{Isometry, Real, Vector};
|
|||||||
use crate::graphics::{BevyMaterial, InstancedMaterials, SELECTED_OBJECT_MATERIAL_KEY};
|
use crate::graphics::{BevyMaterial, InstancedMaterials, SELECTED_OBJECT_MATERIAL_KEY};
|
||||||
#[cfg(feature = "dim2")]
|
#[cfg(feature = "dim2")]
|
||||||
use {
|
use {
|
||||||
bevy_sprite::MaterialMesh2dBundle,
|
|
||||||
na::{Point2, Vector2},
|
na::{Point2, Vector2},
|
||||||
rapier::geometry::{Ball, Cuboid},
|
rapier::geometry::{Ball, Cuboid},
|
||||||
};
|
};
|
||||||
@@ -46,6 +45,7 @@ impl EntityWithGraphics {
|
|||||||
let selection_material = bevy_sprite::ColorMaterial {
|
let selection_material = bevy_sprite::ColorMaterial {
|
||||||
color: Color::from(Srgba::rgb(1.0, 0.0, 0.0)),
|
color: Color::from(Srgba::rgb(1.0, 0.0, 0.0)),
|
||||||
texture: None,
|
texture: None,
|
||||||
|
..default()
|
||||||
};
|
};
|
||||||
#[cfg(feature = "dim3")]
|
#[cfg(feature = "dim3")]
|
||||||
let selection_material = StandardMaterial {
|
let selection_material = StandardMaterial {
|
||||||
@@ -112,6 +112,7 @@ impl EntityWithGraphics {
|
|||||||
let material = bevy_sprite::ColorMaterial {
|
let material = bevy_sprite::ColorMaterial {
|
||||||
color: bevy_color,
|
color: bevy_color,
|
||||||
texture: None,
|
texture: None,
|
||||||
|
..default()
|
||||||
};
|
};
|
||||||
#[cfg(feature = "dim3")]
|
#[cfg(feature = "dim3")]
|
||||||
let material = StandardMaterial {
|
let material = StandardMaterial {
|
||||||
@@ -127,19 +128,17 @@ impl EntityWithGraphics {
|
|||||||
|
|
||||||
if let Some(mesh) = mesh {
|
if let Some(mesh) = mesh {
|
||||||
#[cfg(feature = "dim2")]
|
#[cfg(feature = "dim2")]
|
||||||
let bundle = MaterialMesh2dBundle {
|
let bundle = (
|
||||||
mesh: mesh.into(),
|
Mesh2d(mesh),
|
||||||
material: material_handle.clone_weak(),
|
MeshMaterial2d(material_handle.clone_weak()),
|
||||||
transform,
|
transform,
|
||||||
..Default::default()
|
);
|
||||||
};
|
|
||||||
#[cfg(feature = "dim3")]
|
#[cfg(feature = "dim3")]
|
||||||
let bundle = PbrBundle {
|
let bundle = (
|
||||||
mesh,
|
Mesh2d(mesh),
|
||||||
material: material_handle.clone_weak(),
|
MeshMaterial3d(material_handle.clone_weak()),
|
||||||
transform,
|
transform,
|
||||||
..Default::default()
|
);
|
||||||
};
|
|
||||||
|
|
||||||
let mut entity_commands = commands.entity(entity);
|
let mut entity_commands = commands.entity(entity);
|
||||||
entity_commands.insert(bundle);
|
entity_commands.insert(bundle);
|
||||||
|
|||||||
@@ -8,6 +8,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::graphics::BevyMaterialComponent;
|
||||||
use crate::physics::{DeserializedPhysicsSnapshot, PhysicsEvents, PhysicsSnapshot, PhysicsState};
|
use crate::physics::{DeserializedPhysicsSnapshot, PhysicsEvents, PhysicsSnapshot, PhysicsState};
|
||||||
use crate::plugin::TestbedPlugin;
|
use crate::plugin::TestbedPlugin;
|
||||||
use crate::{graphics::GraphicsManager, harness::RunState};
|
use crate::{graphics::GraphicsManager, harness::RunState};
|
||||||
@@ -436,7 +437,6 @@ impl TestbedApp {
|
|||||||
|
|
||||||
let mut app = App::new();
|
let mut app = App::new();
|
||||||
app.insert_resource(ClearColor(Color::from(Srgba::rgb(0.15, 0.15, 0.15))))
|
app.insert_resource(ClearColor(Color::from(Srgba::rgb(0.15, 0.15, 0.15))))
|
||||||
.insert_resource(Msaa::Sample4)
|
|
||||||
.insert_resource(AmbientLight {
|
.insert_resource(AmbientLight {
|
||||||
brightness: 0.3,
|
brightness: 0.3,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@@ -1092,36 +1092,35 @@ fn setup_graphics_environment(mut commands: Commands) {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
|
|
||||||
commands.spawn(DirectionalLightBundle {
|
commands.spawn((
|
||||||
directional_light: DirectionalLight {
|
DirectionalLight {
|
||||||
shadows_enabled: false,
|
shadows_enabled: false,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
transform: Transform {
|
Transform {
|
||||||
translation: Vec3::new(10.0, 2.0, 10.0),
|
translation: Vec3::new(10.0, 2.0, 10.0),
|
||||||
rotation: Quat::from_rotation_x(-std::f32::consts::FRAC_PI_4),
|
rotation: Quat::from_rotation_x(-std::f32::consts::FRAC_PI_4),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
..Default::default()
|
));
|
||||||
});
|
|
||||||
|
|
||||||
commands
|
commands.spawn((
|
||||||
.spawn(Camera3dBundle {
|
Camera3d::default(),
|
||||||
transform: Transform::from_matrix(
|
Msaa::Sample4,
|
||||||
Mat4::look_at_rh(
|
MainCamera,
|
||||||
Vec3::new(-30.0, 30.0, 100.0),
|
Transform::from_matrix(
|
||||||
Vec3::new(0.0, 10.0, 0.0),
|
Mat4::look_at_rh(
|
||||||
Vec3::new(0.0, 1.0, 0.0),
|
Vec3::new(-30.0, 30.0, 100.0),
|
||||||
)
|
Vec3::new(0.0, 10.0, 0.0),
|
||||||
.inverse(),
|
Vec3::new(0.0, 1.0, 0.0),
|
||||||
),
|
)
|
||||||
..Default::default()
|
.inverse(),
|
||||||
})
|
),
|
||||||
.insert(OrbitCamera {
|
OrbitCamera {
|
||||||
rotate_sensitivity: 0.05,
|
rotate_sensitivity: 0.05,
|
||||||
..OrbitCamera::default()
|
..OrbitCamera::default()
|
||||||
})
|
},
|
||||||
.insert(MainCamera);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "dim2")]
|
#[cfg(feature = "dim2")]
|
||||||
@@ -1140,14 +1139,14 @@ fn setup_graphics_environment(mut commands: Commands) {
|
|||||||
// ..Default::default()
|
// ..Default::default()
|
||||||
// });
|
// });
|
||||||
commands
|
commands
|
||||||
.spawn(Camera2dBundle {
|
.spawn((
|
||||||
transform: Transform {
|
Camera2d,
|
||||||
|
Transform {
|
||||||
translation: Vec3::new(0.0, 0.0, 0.0),
|
translation: Vec3::new(0.0, 0.0, 0.0),
|
||||||
rotation: Quat::IDENTITY,
|
rotation: Quat::IDENTITY,
|
||||||
scale: Vec3::new(0.01, 0.01, 1.0),
|
scale: Vec3::new(0.01, 0.01, 1.0),
|
||||||
},
|
},
|
||||||
..Camera2dBundle::default()
|
))
|
||||||
})
|
|
||||||
.insert(OrbitCamera {
|
.insert(OrbitCamera {
|
||||||
zoom: 100.0,
|
zoom: 100.0,
|
||||||
pan_sensitivity: 0.02,
|
pan_sensitivity: 0.02,
|
||||||
@@ -1188,7 +1187,7 @@ fn update_testbed(
|
|||||||
(mut gfx_components, mut cameras, mut material_handles): (
|
(mut gfx_components, mut cameras, mut material_handles): (
|
||||||
Query<&mut Transform>,
|
Query<&mut Transform>,
|
||||||
Query<(&Camera, &GlobalTransform, &mut OrbitCamera)>,
|
Query<(&Camera, &GlobalTransform, &mut OrbitCamera)>,
|
||||||
Query<&mut Handle<BevyMaterial>>,
|
Query<&mut BevyMaterialComponent>,
|
||||||
),
|
),
|
||||||
keys: Res<ButtonInput<KeyCode>>,
|
keys: Res<ButtonInput<KeyCode>>,
|
||||||
) {
|
) {
|
||||||
@@ -1582,7 +1581,7 @@ fn clear(
|
|||||||
|
|
||||||
#[cfg(feature = "dim2")]
|
#[cfg(feature = "dim2")]
|
||||||
fn highlight_hovered_body(
|
fn highlight_hovered_body(
|
||||||
_material_handles: &mut Query<&mut Handle<BevyMaterial>>,
|
_material_handles: &mut Query<&mut BevyMaterialComponent>,
|
||||||
_graphics_manager: &mut GraphicsManager,
|
_graphics_manager: &mut GraphicsManager,
|
||||||
_testbed_state: &mut TestbedState,
|
_testbed_state: &mut TestbedState,
|
||||||
_physics: &PhysicsState,
|
_physics: &PhysicsState,
|
||||||
@@ -1595,7 +1594,7 @@ fn highlight_hovered_body(
|
|||||||
|
|
||||||
#[cfg(feature = "dim3")]
|
#[cfg(feature = "dim3")]
|
||||||
fn highlight_hovered_body(
|
fn highlight_hovered_body(
|
||||||
material_handles: &mut Query<&mut Handle<BevyMaterial>>,
|
material_handles: &mut Query<&mut BevyMaterialComponent>,
|
||||||
graphics_manager: &mut GraphicsManager,
|
graphics_manager: &mut GraphicsManager,
|
||||||
testbed_state: &mut TestbedState,
|
testbed_state: &mut TestbedState,
|
||||||
physics: &PhysicsState,
|
physics: &PhysicsState,
|
||||||
@@ -1607,7 +1606,7 @@ fn highlight_hovered_body(
|
|||||||
if let Some(nodes) = graphics_manager.body_nodes_mut(highlighted_body) {
|
if let Some(nodes) = graphics_manager.body_nodes_mut(highlighted_body) {
|
||||||
for node in nodes {
|
for node in nodes {
|
||||||
if let Ok(mut handle) = material_handles.get_mut(node.entity) {
|
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() {
|
for node in graphics_manager.body_nodes_mut(parent_handle).unwrap() {
|
||||||
if let Ok(mut handle) = material_handles.get_mut(node.entity) {
|
if let Ok(mut handle) = material_handles.get_mut(node.entity) {
|
||||||
*handle = selection_material.clone_weak();
|
**handle = selection_material.clone_weak();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -363,13 +363,13 @@ fn profiling_ui(ui: &mut Ui, counters: &Counters) {
|
|||||||
counters.step_time_ms(),
|
counters.step_time_ms(),
|
||||||
(1000.0 / counters.step_time_ms()).round()
|
(1000.0 / counters.step_time_ms()).round()
|
||||||
))
|
))
|
||||||
.id_source("total")
|
.id_salt("total")
|
||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
egui::CollapsingHeader::new(format!(
|
egui::CollapsingHeader::new(format!(
|
||||||
"Collision detection: {:.2}ms",
|
"Collision detection: {:.2}ms",
|
||||||
counters.collision_detection_time_ms()
|
counters.collision_detection_time_ms()
|
||||||
))
|
))
|
||||||
.id_source("collision detection")
|
.id_salt("collision detection")
|
||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
ui.label(format!(
|
ui.label(format!(
|
||||||
"Broad-phase: {:.2}ms",
|
"Broad-phase: {:.2}ms",
|
||||||
@@ -381,7 +381,7 @@ fn profiling_ui(ui: &mut Ui, counters: &Counters) {
|
|||||||
));
|
));
|
||||||
});
|
});
|
||||||
egui::CollapsingHeader::new(format!("Solver: {:.2}ms", counters.solver_time_ms()))
|
egui::CollapsingHeader::new(format!("Solver: {:.2}ms", counters.solver_time_ms()))
|
||||||
.id_source("solver")
|
.id_salt("solver")
|
||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
ui.label(format!(
|
ui.label(format!(
|
||||||
"Velocity assembly: {:.2}ms",
|
"Velocity assembly: {:.2}ms",
|
||||||
@@ -401,7 +401,7 @@ fn profiling_ui(ui: &mut Ui, counters: &Counters) {
|
|||||||
));
|
));
|
||||||
});
|
});
|
||||||
egui::CollapsingHeader::new(format!("CCD: {:.2}ms", counters.ccd_time_ms()))
|
egui::CollapsingHeader::new(format!("CCD: {:.2}ms", counters.ccd_time_ms()))
|
||||||
.id_source("ccd")
|
.id_salt("ccd")
|
||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
ui.label(format!("# of substeps: {}", counters.ccd.num_substeps));
|
ui.label(format!("# of substeps: {}", counters.ccd.num_substeps));
|
||||||
ui.label(format!(
|
ui.label(format!(
|
||||||
|
|||||||
Reference in New Issue
Block a user