Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to bevy 0.14 #8

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 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 <[email protected]>"]
Expand All @@ -16,17 +16,17 @@ categories = ["3D", "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",
Expand Down
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 @@ -60,7 +60,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