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 0.13 #61

Merged
merged 3 commits into from
Jun 24, 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
10 changes: 3 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "bevy_polyline"
version = "0.8.1"
version = "0.9.0"
description = "Polyline Rendering for Bevy"
license = "MIT OR Apache-2.0"
repository = "https://github.com/ForesightMiningSoftwareCorporation/bevy_polyline"
Expand All @@ -18,21 +18,17 @@ authors = [

[dependencies]
bitflags = "2.3"
bevy = { version = "0.12", default-features = false, features = [
bevy = { version = "0.13", default-features = false, features = [
"bevy_core_pipeline",
"bevy_render",
"bevy_asset",
] }

[dependencies.naga]
features = ["glsl-in", "spv-out", "wgsl-out"]
version = "0.13"

[dev-dependencies]
lazy_static = "1.4.0"
rand = "0.8.4"
ringbuffer = "0.15"
bevy = { version = "0.12", default-features = false, features = [
bevy = { version = "0.13", default-features = false, features = [
"bevy_winit",
"bevy_pbr",
"x11",
Expand Down
10 changes: 5 additions & 5 deletions examples/depth_bias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ fn rotate_plane(time: Res<Time>, mut animated: Query<(&mut Transform, &Rotating)
}
}

fn move_camera(input: Res<Input<KeyCode>>, mut camera: Query<&mut Transform, With<Camera>>) {
fn move_camera(input: Res<ButtonInput<KeyCode>>, mut camera: Query<&mut Transform, With<Camera>>) {
if let Ok(mut camera_transform) = camera.get_single_mut() {
let trans = &mut camera_transform.translation;
let go_forward = input.any_pressed([KeyCode::Up, KeyCode::I, KeyCode::W]);
let go_backward = input.any_pressed([KeyCode::Down, KeyCode::K, KeyCode::S]);
let go_forward = input.any_pressed([KeyCode::ArrowUp, KeyCode::KeyI, KeyCode::KeyW]);
let go_backward = input.any_pressed([KeyCode::ArrowDown, KeyCode::KeyK, KeyCode::KeyS]);
if go_forward && trans.x > 10.0 {
trans.x -= 2.0;
} else if go_backward && trans.x < 500.0 {
Expand All @@ -65,8 +65,8 @@ fn setup(
.insert(Transform::from_xyz(100.0, 0.0, 0.0).looking_at(Vec3::ZERO, Vec3::Y));
commands.spawn((
PbrBundle {
mesh: meshes.add(shape::Box::new(0.01, 100.0, 10000.0).into()),
material: pbr_materials.add(Color::WHITE.into()),
mesh: meshes.add(Cuboid::from_size(Vec3::new(0.01, 100.0, 10000.0)).mesh()),
material: pbr_materials.add(Color::WHITE),
..default()
},
Rotating(30.0),
Expand Down
9 changes: 5 additions & 4 deletions examples/linestrip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,17 @@ fn setup(

// circular base
commands.spawn(PbrBundle {
mesh: meshes.add(shape::Circle::new(4.0).into()),
material: standard_materials.add(Color::WHITE.into()),
mesh: meshes.add(Circle::new(4.0)),
material: standard_materials.add(Color::WHITE),
transform: Transform::from_rotation(Quat::from_rotation_x(-std::f32::consts::FRAC_PI_2))
.with_translation(Vec3::new(0.0, -0.5, 0.0)),
..default()
});
// cube
commands.spawn(PbrBundle {
mesh: meshes.add(shape::Cube { size: 1.0 }.into()),
material: standard_materials.add(Color::rgb_u8(124, 144, 255).into()),
mesh: meshes.add(Cuboid::from_size(Vec3::ONE)),
material: standard_materials.add(Color::rgb_u8(124, 144, 255)),
transform: Transform::from_xyz(0.0, 0.0, 0.0),
..default()
});

Expand Down
2 changes: 1 addition & 1 deletion examples/nbody.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ fn update_trails(
mut polylines: ResMut<Assets<Polyline>>,
mut query: Query<(&Body, &mut Trail, &Handle<Polyline>)>,
) {
query.for_each_mut(|(body, mut trail, polyline)| {
query.iter_mut().for_each(|(body, mut trail, polyline)| {
if let Some(position) = trail.0.back() {
let last_vec = *position - body.position;
let last_last_vec = if let Some(position) = trail.0.get_signed(-2) {
Expand Down
18 changes: 9 additions & 9 deletions examples/perspective.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,28 @@ fn setup(

fn move_camera(
mut q: Query<&mut Transform, With<Camera>>,
keyboard_input: Res<Input<KeyCode>>,
keyboard_input: Res<ButtonInput<KeyCode>>,
time: Res<Time>,
) {
let speed = 5.0;
for mut t in &mut q {
let mut dir = Vec3::ZERO;
if keyboard_input.pressed(KeyCode::W) {
if keyboard_input.pressed(KeyCode::KeyW) {
dir.z -= 1.0;
}
if keyboard_input.pressed(KeyCode::S) {
if keyboard_input.pressed(KeyCode::KeyS) {
dir.z += 1.0;
}
if keyboard_input.pressed(KeyCode::A) {
if keyboard_input.pressed(KeyCode::KeyA) {
dir.x -= 1.0;
}
if keyboard_input.pressed(KeyCode::D) {
if keyboard_input.pressed(KeyCode::KeyD) {
dir.x += 1.0;
}
if keyboard_input.pressed(KeyCode::Q) {
if keyboard_input.pressed(KeyCode::KeyQ) {
dir.y -= 1.0;
}
if keyboard_input.pressed(KeyCode::E) {
if keyboard_input.pressed(KeyCode::KeyE) {
dir.y += 1.0;
}
t.translation += dir * time.delta_seconds() * speed;
Expand All @@ -71,10 +71,10 @@ fn move_camera(

fn toggle_perspective(
mut polyline_materials: ResMut<Assets<PolylineMaterial>>,
keyboard_input: Res<Input<KeyCode>>,
keyboard_input: Res<ButtonInput<KeyCode>>,
) {
for (_, mat) in polyline_materials.iter_mut() {
if keyboard_input.just_pressed(KeyCode::X) {
if keyboard_input.just_pressed(KeyCode::KeyX) {
mat.perspective = !mat.perspective;
}
}
Expand Down
Loading
Loading