Skip to content

Commit

Permalink
Merge pull request #57 from ForesightMiningSoftwareCorporation/nil/fi…
Browse files Browse the repository at this point in the history
…x-things

fix clippy + embedded_asset macro failing on crates.io
  • Loading branch information
bonsairobo authored Feb 23, 2024
2 parents a7afeac + c6a01f4 commit d3be581
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion 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.0"
version = "0.8.1"
description = "Polyline Rendering for Bevy"
license = "MIT OR Apache-2.0"
repository = "https://github.com/ForesightMiningSoftwareCorporation/bevy_polyline"
Expand Down
2 changes: 1 addition & 1 deletion examples/nbody.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn main() {
Update,
((nbody_system, update_trails).chain(), rotator_system),
)
.add_plugins(FrameTimeDiagnosticsPlugin::default())
.add_plugins(FrameTimeDiagnosticsPlugin)
.add_plugins(LogDiagnosticsPlugin::default())
.run();
}
Expand Down
2 changes: 1 addition & 1 deletion examples/perspective.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fn toggle_perspective(
mut polyline_materials: ResMut<Assets<PolylineMaterial>>,
keyboard_input: Res<Input<KeyCode>>,
) {
for (_, mut mat) in polyline_materials.iter_mut() {
for (_, mat) in polyline_materials.iter_mut() {
if keyboard_input.just_pressed(KeyCode::X) {
mat.perspective = !mat.perspective;
}
Expand Down
14 changes: 9 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(clippy::type_complexity)]
#![allow(clippy::too_many_arguments)]

use bevy::{asset::embedded_asset, prelude::*};
use bevy::{asset::load_internal_asset, prelude::*};
use material::PolylineMaterialPlugin;
use polyline::{PolylineBasePlugin, PolylineRenderPlugin};

Expand All @@ -15,12 +15,16 @@ pub mod prelude {
}
pub struct PolylinePlugin;

pub const SHADER_HANDLE: Handle<Shader> = Handle::weak_from_u128(12823766040132746065);

impl Plugin for PolylinePlugin {
fn build(&self, app: &mut bevy::prelude::App) {
#[cfg(target_family = "windows")]
embedded_asset!(app, "src\\", "shaders\\polyline.wgsl");
#[cfg(not(target_family = "windows"))]
embedded_asset!(app, "src/", "shaders/polyline.wgsl");
load_internal_asset!(
app,
SHADER_HANDLE,
"shaders/polyline.wgsl",
Shader::from_wgsl
);

app.add_plugins((
PolylineBasePlugin,
Expand Down
3 changes: 1 addition & 2 deletions src/polyline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,10 @@ impl FromWorld for PolylinePipeline {
label: Some("polyline_layout"),
});

let assets = world.resource_mut::<AssetServer>();
PolylinePipeline {
view_layout,
polyline_layout,
shader: assets.load("embedded://bevy_polyline/shaders/polyline.wgsl"),
shader: crate::SHADER_HANDLE,
}
}
}
Expand Down

0 comments on commit d3be581

Please sign in to comment.