From 85b133fd57052facab1daeea623835121e76031d Mon Sep 17 00:00:00 2001 From: Ryan Szemplinski Date: Thu, 9 Nov 2023 17:35:43 -0700 Subject: [PATCH 1/5] Believe I have this working for 0.12 now --- .idea/.gitignore | 8 +++ .idea/bevy_polyline.iml | 12 ++++ .idea/modules.xml | 8 +++ .idea/vcs.xml | 6 ++ Cargo.toml | 10 ++-- examples/depth_bias.rs | 3 + examples/linestrip.rs | 3 + examples/minimal.rs | 3 + examples/nbody.rs | 21 +++++-- examples/perspective.rs | 3 + src/lib.rs | 16 ++---- src/material.rs | 66 +++++++++++---------- src/polyline.rs | 118 +++++++++++++++++++++----------------- src/shaders/polyline.wgsl | 2 +- 14 files changed, 173 insertions(+), 106 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/bevy_polyline.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/bevy_polyline.iml b/.idea/bevy_polyline.iml new file mode 100644 index 0000000..7c12fe5 --- /dev/null +++ b/.idea/bevy_polyline.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f7acbfc --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index e8fa50b..7c70b7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,8 +17,8 @@ authors = [ ] [dependencies] -bitflags = "2.3" -bevy = { version = "0.11.0", default-features = false, features = [ +bitflags = "2.4.1" +bevy = { version = "0.12.0", default-features = false, features = [ "bevy_core_pipeline", "bevy_render", "bevy_asset", @@ -26,13 +26,13 @@ bevy = { version = "0.11.0", default-features = false, features = [ [dependencies.naga] features = ["glsl-in", "spv-out", "wgsl-out"] -version = "0.12" +version = "0.14" [dev-dependencies] lazy_static = "1.4.0" rand = "0.8.4" -ringbuffer = "0.14" -bevy = { version = "0.11.0", default-features = false, features = [ +ringbuffer = "0.15" +bevy = { version = "0.12", default-features = false, features = [ "bevy_winit", "bevy_pbr", "x11", diff --git a/examples/depth_bias.rs b/examples/depth_bias.rs index 78a59a6..8f2ad1a 100644 --- a/examples/depth_bias.rs +++ b/examples/depth_bias.rs @@ -1,5 +1,6 @@ use std::f32::consts::TAU; use std::f64::consts::TAU as TAU64; +use bevy::diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}; use bevy::prelude::*; use bevy_polyline::prelude::*; @@ -23,6 +24,8 @@ fn main() { .insert_resource(ClearColor(Color::BLACK)) .insert_resource(Msaa::Sample4) .add_plugins(DefaultPlugins) + .add_plugins(FrameTimeDiagnosticsPlugin::default()) + .add_plugins(LogDiagnosticsPlugin::default()) .add_plugins(PolylinePlugin) .add_systems(Update, (move_camera, rotate_plane)) .add_systems(Startup, setup) diff --git a/examples/linestrip.rs b/examples/linestrip.rs index 27c8cd2..8fd56d9 100644 --- a/examples/linestrip.rs +++ b/examples/linestrip.rs @@ -1,10 +1,13 @@ use bevy::{pbr::PointLightBundle, prelude::*}; +use bevy::diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}; use bevy_polyline::prelude::*; fn main() { App::new() .insert_resource(Msaa::Sample4) .add_plugins(DefaultPlugins) + .add_plugins(FrameTimeDiagnosticsPlugin::default()) + .add_plugins(LogDiagnosticsPlugin::default()) .add_plugins(PolylinePlugin) .add_systems(Startup, setup) .add_systems(Update, rotator_system) diff --git a/examples/minimal.rs b/examples/minimal.rs index eb4c004..de2bb85 100644 --- a/examples/minimal.rs +++ b/examples/minimal.rs @@ -1,9 +1,12 @@ +use bevy::diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}; use bevy::prelude::*; use bevy_polyline::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) + .add_plugins(FrameTimeDiagnosticsPlugin::default()) + .add_plugins(LogDiagnosticsPlugin::default()) .add_plugins(PolylinePlugin) .add_systems(Startup, setup) .run(); diff --git a/examples/nbody.rs b/examples/nbody.rs index 590f748..be46934 100644 --- a/examples/nbody.rs +++ b/examples/nbody.rs @@ -5,13 +5,14 @@ use bevy::{ math::Vec3A, prelude::*, }; +use bevy::window::PresentMode; use bevy_polyline::prelude::*; use lazy_static::*; use rand::{prelude::*, Rng}; -use ringbuffer::{ConstGenericRingBuffer, RingBufferExt, RingBufferWrite}; +use ringbuffer::{ConstGenericRingBuffer, RingBuffer}; -const NUM_BODIES: usize = 512; +const NUM_BODIES: usize = 6; const TRAIL_LENGTH: usize = 1024; const MINIMUM_ANGLE: f32 = 1.483_418_7; // == acos(5 degrees) @@ -23,7 +24,14 @@ fn main() { scale: 1e6, ..Default::default() }) - .add_plugins(DefaultPlugins) + .add_plugins(DefaultPlugins.set(WindowPlugin { + primary_window: Some(Window { + title: "Proc Gen".into(), + present_mode: PresentMode::AutoNoVsync, + ..default() + }), + ..default() + })) .add_plugins(PolylinePlugin) .add_systems(Startup, setup) .add_systems( @@ -101,7 +109,7 @@ fn rotator_system(time: Res