Skip to content

Commit

Permalink
Fix crashes on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
sebcrozet committed Oct 29, 2023
1 parent 780ba4a commit 23a7ed5
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 838 deletions.
4 changes: 2 additions & 2 deletions crates/rapier_testbed2d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ bevy_sprite = "0.11"

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = {version = "0.11", default-features = false, features = ["bevy_winit", "x11"]}
bevy = {version = "0.11", default-features = false, features = ["bevy_asset", "bevy_winit", "x11", "tonemapping_luts", "ktx2", "zstd", "bevy_render", "bevy_pbr", "bevy_gizmos"]}

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = {version = "0.11", default-features = false, features = ["bevy_winit"]}
bevy = {version = "0.11", default-features = false, features = ["bevy_asset", "bevy_winit", "tonemapping_luts", "ktx2", "zstd", "bevy_render", "bevy_pbr", "bevy_gizmos"]}
#bevy_webgl2 = "0.5"

[dependencies.rapier]
Expand Down
4 changes: 2 additions & 2 deletions crates/rapier_testbed2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ bevy_sprite = "0.11"

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = {version = "0.11", default-features = false, features = ["bevy_winit", "x11"]}
bevy = {version = "0.11", default-features = false, features = ["bevy_sprite", "bevy_winit", "x11", "tonemapping_luts", "ktx2", "zstd", "bevy_render", "bevy_pbr", "bevy_gizmos"]}

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = {version = "0.11", default-features = false, features = ["bevy_winit",]}
bevy = {version = "0.11", default-features = false, features = ["bevy_sprite", "bevy_winit", "tonemapping_luts", "ktx2", "zstd", "bevy_render", "bevy_pbr", "bevy_gizmos"]}
#bevy_webgl2 = "0.5"

[dependencies.rapier]
Expand Down
4 changes: 2 additions & 2 deletions crates/rapier_testbed3d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ bevy_sprite = "0.11"

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = {version = "0.11", default-features = false, features = ["bevy_winit", "x11"]}
bevy = {version = "0.11", default-features = false, features = ["bevy_winit", "x11", "tonemapping_luts", "ktx2", "zstd", "bevy_render", "bevy_pbr", "bevy_gizmos"]}

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = {version = "0.11", default-features = false, features = ["bevy_winit"]}
bevy = {version = "0.11", default-features = false, features = ["bevy_winit", "tonemapping_luts", "ktx2", "zstd", "bevy_render", "bevy_pbr", "bevy_gizmos"]}
#bevy_webgl2 = "0.5"

[dependencies.rapier]
Expand Down
4 changes: 2 additions & 2 deletions crates/rapier_testbed3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ bevy_sprite = "0.11"

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = {version = "0.11", default-features = false, features = ["bevy_winit", "x11"]}
bevy = {version = "0.11", default-features = false, features = ["bevy_winit", "x11", "tonemapping_luts", "ktx2", "zstd", "bevy_render", "bevy_pbr", "bevy_gizmos"]}

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = {version = "0.11", default-features = false, features = ["bevy_winit"]}
bevy = {version = "0.11", default-features = false, features = ["bevy_winit", "tonemapping_luts", "ktx2", "zstd", "bevy_render", "bevy_pbr", "bevy_gizmos"]}
#bevy_webgl2 = "0.5"

[dependencies.rapier]
Expand Down
19 changes: 7 additions & 12 deletions src_testbed/debug_render.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::harness::Harness;
use crate::lines::DebugLines;
use bevy::gizmos::gizmos::Gizmos;
use bevy::prelude::*;
use rapier::math::{Point, Real};
use rapier::pipeline::{
Expand All @@ -22,10 +22,7 @@ impl Default for RapierDebugRenderPlugin {
}
impl Plugin for RapierDebugRenderPlugin {
fn build(&self, app: &mut App) {
app.add_plugins(crate::lines::DebugLinesPlugin::with_depth_test(
self.depth_test,
))
.insert_resource(DebugRenderPipelineResource(DebugRenderPipeline::new(
app.insert_resource(DebugRenderPipelineResource(DebugRenderPipeline::new(
Default::default(),
!DebugRenderMode::RIGID_BODY_AXES & !DebugRenderMode::COLLIDER_AABBS,
)))
Expand All @@ -34,25 +31,23 @@ impl Plugin for RapierDebugRenderPlugin {
}

struct BevyLinesRenderBackend<'a> {
lines: &'a mut DebugLines,
gizmos: Gizmos<'a>,
}

impl<'a> DebugRenderBackend for BevyLinesRenderBackend<'a> {
#[cfg(feature = "dim2")]
fn draw_line(&mut self, _: DebugRenderObject, a: Point<Real>, b: Point<Real>, color: [f32; 4]) {
self.lines.line_colored(
self.gizmos.line(
[a.x as f32, a.y as f32, 1.0e-8 as f32].into(),
[b.x as f32, b.y as f32, 1.0e-8 as f32].into(),
0.0,
Color::hsla(color[0], color[1], color[2], color[3]),
)
}
#[cfg(feature = "dim3")]
fn draw_line(&mut self, _: DebugRenderObject, a: Point<Real>, b: Point<Real>, color: [f32; 4]) {
self.lines.line_colored(
self.gizmos.line(
[a.x as f32, a.y as f32, a.z as f32].into(),
[b.x as f32, b.y as f32, b.z as f32].into(),
0.0,
Color::hsla(color[0], color[1], color[2], color[3]),
)
}
Expand All @@ -61,9 +56,9 @@ impl<'a> DebugRenderBackend for BevyLinesRenderBackend<'a> {
fn debug_render_scene(
mut pipeline: ResMut<DebugRenderPipelineResource>,
harness: NonSend<Harness>,
mut lines: ResMut<DebugLines>,
gizmos: Gizmos,
) {
let mut backend = BevyLinesRenderBackend { lines: &mut *lines };
let mut backend = BevyLinesRenderBackend { gizmos };
pipeline.0.render(
&mut backend,
&harness.physics.bodies,
Expand Down
2 changes: 1 addition & 1 deletion src_testbed/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod camera3d;
mod debug_render;
mod graphics;
pub mod harness;
mod lines;
// mod lines;
pub mod objects;
pub mod physics;
#[cfg(all(feature = "dim3", feature = "other-backends"))]
Expand Down
53 changes: 0 additions & 53 deletions src_testbed/lines/debuglines.wgsl

This file was deleted.

32 changes: 0 additions & 32 deletions src_testbed/lines/debuglines2d.wgsl

This file was deleted.

Loading

0 comments on commit 23a7ed5

Please sign in to comment.