Skip to content

Commit

Permalink
update to bevy 0.14 (#11)
Browse files Browse the repository at this point in the history
* update to bevy 0.14

* clean up cargo.toml

* bump version

* Update Cargo.toml
  • Loading branch information
IceSentry authored Oct 7, 2024
1 parent 25905b4 commit 15d202c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 23 deletions.
17 changes: 6 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_fsl_box_frame"
version = "0.3.0"
version = "0.4.0"
description = "A gizmo for manipulating an OBB via 3D picking"
edition = "2021"
authors = ["Duncan Fairbanks <duncan.fairbanks@fslabs.ca>"]
Expand All @@ -16,25 +16,20 @@ categories = ["game-development"]

[dependencies]
approx = "0.5"
bevy_polyline = "0.9"
bevy_polyline = "0.10"
parry3d = "0.13"
bevy = { version = "0.13", default-features = false, features = [
bevy = { version = "0.14", default-features = false, features = [
"bevy_asset",
"bevy_pbr",
] }
bevy_mod_picking = { version = "0.19", default_features = false }
nalgebra = { version = "0.32", features = ["glam025"] }
bevy_mod_picking = { version = "0.20", default-features = false }
nalgebra = { version = "0.32", features = ["glam027"] }

[dev-dependencies]
bevy = { version = "0.13", default-features = false, features = [
bevy = { version = "0.14", default-features = false, features = [
"bevy_asset",
"bevy_pbr",
"bevy_winit",
"x11",
"tonemapping_luts",
] }

[[example]]
name = "demo"
path = "examples/demo.rs"
required-features = ["bevy/bevy_winit", "bevy/x11", "bevy/tonemapping_luts"]
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
profile = "default"
channel = "1.76"
channel = "1.79"
4 changes: 2 additions & 2 deletions src/box_frame.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{drag_face::Dragging, solid_color_material::SolidColorMaterial};
use bevy::{ecs::system::EntityCommands, prelude::*, utils::FloatOrd};
use bevy::{color::palettes::css::RED, ecs::system::EntityCommands, math::FloatOrd, prelude::*};
use bevy_mod_picking::prelude::{Pickable, PointerButton};
use bevy_polyline::prelude::{Polyline, PolylineBundle, PolylineMaterial};
use parry3d::{bounding_volume::Aabb, shape::Ball};
Expand Down Expand Up @@ -80,7 +80,7 @@ impl BoxFrameVisuals {
}),

handle_mesh: meshes.add(Sphere::new(1.0).mesh()),
handle_material: materials.add(Color::RED),
handle_material: materials.add(RED),
handle_scale: |e| 0.05 * median3(e),
handle_hover_scale: 1.2,
}
Expand Down
2 changes: 1 addition & 1 deletion src/drag_face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub(crate) fn drag_face(
initial_coord: frame.faces()[face],
drag_ray: Ray3d {
origin: world_position,
direction: Direction3d::new(world_normal).unwrap(),
direction: Dir3::new(world_normal).unwrap(),
},
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/picking_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ pub(crate) fn box_frame_backend(
continue;
};

let cam_view_mask = view_mask.copied().unwrap_or_default();
let cam_view_mask = view_mask.unwrap_or_default();

let ray = parry3d::query::Ray::new(ray.origin.into(), ray.direction.xyz().into());

let mut picks = Vec::new();
for (frame_entity, frame, frame_transform, frame_view_mask) in &box_frames {
let frame_view_mask = frame_view_mask.copied().unwrap_or_default();
if !frame_view_mask.intersects(&cam_view_mask) {
let frame_view_mask = frame_view_mask.unwrap_or_default();
if !frame_view_mask.intersects(cam_view_mask) {
continue;
}

Expand Down
11 changes: 6 additions & 5 deletions src/solid_color_material.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use bevy::{
asset::Asset,
prelude::{AlphaMode, Color, Handle, Material, Shader},
color::{LinearRgba, Srgba},
prelude::{AlphaMode, Handle, Material, Shader},
reflect::TypePath,
render::render_resource::{AsBindGroup, ShaderRef},
};
Expand All @@ -12,7 +13,7 @@ pub(crate) const SHADER_HANDLE: Handle<Shader> = Handle::weak_from_u128(78254136
#[derive(Asset, AsBindGroup, Clone, Debug, TypePath)]
pub struct SolidColorMaterial {
#[uniform(0)]
pub color: Color,
pub color: LinearRgba,
pub alpha_mode: AlphaMode,
}

Expand All @@ -26,10 +27,10 @@ impl Material for SolidColorMaterial {
}
}

impl From<Color> for SolidColorMaterial {
fn from(color: Color) -> Self {
impl From<Srgba> for SolidColorMaterial {
fn from(color: Srgba) -> Self {
Self {
color,
color: color.into(),
alpha_mode: AlphaMode::Opaque,
}
}
Expand Down

0 comments on commit 15d202c

Please sign in to comment.