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

fix clippy + embedded_asset macro failing on crates.io #57

Merged
merged 1 commit into from
Feb 23, 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
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
Loading