silence lints
This commit is contained in:
parent
3e5e51401a
commit
82f95cf070
2 changed files with 2 additions and 28 deletions
|
@ -1,5 +1,4 @@
|
|||
use bevy::{
|
||||
ecs::schedule::SystemSet,
|
||||
prelude::{Query, Vec3, Window, With},
|
||||
window::PrimaryWindow,
|
||||
};
|
||||
|
@ -13,14 +12,6 @@ pub mod lights;
|
|||
pub mod planet;
|
||||
pub mod ui;
|
||||
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq, SystemSet)]
|
||||
pub enum Label {
|
||||
Geometry,
|
||||
Glamor,
|
||||
Input,
|
||||
Action,
|
||||
}
|
||||
|
||||
pub fn disable_mouse_trap(mut window: Query<&mut Window, With<PrimaryWindow>>) {
|
||||
let mut window = window.get_single_mut().unwrap();
|
||||
window.cursor.grab_mode = bevy::window::CursorGrabMode::None;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
//use core::slice::SlicePattern;
|
||||
|
||||
use bevy::{
|
||||
prelude::{shape::Icosphere, *},
|
||||
render::{color::Color, mesh::Indices},
|
||||
|
@ -10,8 +8,6 @@ use noise::{HybridMulti, NoiseFn, SuperSimplex};
|
|||
use rand::{Rng, SeedableRng};
|
||||
use wgpu::PrimitiveTopology;
|
||||
|
||||
use crate::Label;
|
||||
|
||||
pub const PLANET_RADIUS: f32 = 4_000.0;
|
||||
pub const PLANET_HUE: f32 = 31.0;
|
||||
pub const PLANET_SATURATION: f32 = 1.0;
|
||||
|
@ -129,20 +125,13 @@ fn gen_planet(sphere: Icosphere) -> (Mesh, Collider) {
|
|||
|
||||
let mut rng = rand::rngs::StdRng::seed_from_u64(57);
|
||||
let mut colors = Vec::new();
|
||||
for triangle in tri_list.chunks_exact(3) {
|
||||
let mut lens = 0.0;
|
||||
for &v in triangle {
|
||||
let v = Vec3::new(v[0], v[1], v[2]);
|
||||
lens += v.length();
|
||||
}
|
||||
let v = lens / 3.0;
|
||||
//let l = val_norm(v, min - 500.0, max); //.powi(2);
|
||||
for _triangle in tri_list.chunks_exact(3) {
|
||||
let l = 0.41;
|
||||
let jitter = rng.gen_range(-0.0..=360.0f32);
|
||||
let h = jitter;
|
||||
let color = Color::hsl(h, PLANET_SATURATION, l).as_linear_rgba_f32();
|
||||
for _ in 0..3 {
|
||||
colors.push(color.clone());
|
||||
colors.push(color);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,9 +140,3 @@ fn gen_planet(sphere: Icosphere) -> (Mesh, Collider) {
|
|||
|
||||
(mesh, collider)
|
||||
}
|
||||
|
||||
/// remaps v in low..high to 0..1
|
||||
fn val_norm(v: f32, low: f32, high: f32) -> f32 {
|
||||
// q = (p-A)*(D-C)/(B-A) + C, C = 0, D = 1
|
||||
(v - low) / (high - low)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue