update inspector

added general render distance system
This commit is contained in:
2024-05-01 20:48:44 -04:00
parent 1e8aaa502d
commit 7732d5ebda
14 changed files with 627 additions and 156 deletions

View File

@@ -12,3 +12,4 @@ serde = {version="1.0.197", features=["derive"]}
serde_json = "1.0.115"
asset_loader = {path = "../asset_loader"}
rayon = "1.10.0"
bevy-inspector-egui = "0.24.0"

View File

@@ -54,7 +54,7 @@ fn create_tile_collider(
if n_height < pos.y {
create_tile_wall_collider(
idx,
Vec3::new(pos.x, n_height.min(pos.y - 0.5), pos.z),
Vec3::new(pos.x, n_height.min(pos.y - OUTER_RADIUS / 2.), pos.z),
i,
verts,
indices,

View File

@@ -141,9 +141,7 @@ impl HexCoord {
}
pub fn distance(&self, other: &HexCoord) -> i32 {
return (self.hex.x - other.hex.x).abs()
+ (self.hex.y - other.hex.y).abs()
+ (self.hex.z - other.hex.z).abs();
return (self.hex.x - other.hex.x).abs() + (self.hex.y - other.hex.y).abs() + (self.hex.z - other.hex.z).abs();
}
pub fn rotate_around(&self, center: &HexCoord, angle: i32) -> HexCoord {

View File

@@ -11,8 +11,10 @@ pub mod prelude {
use crate::hex_utils::{HexCoord, INNER_RADIUS, OUTER_RADIUS};
use bevy::math::{IVec2, UVec2, Vec2, Vec3};
use bevy::prelude::Resource;
use bevy::prelude::*;
use bevy::render::mesh::MeshVertexAttribute;
use bevy::render::render_resource::VertexFormat;
use bevy_inspector_egui::InspectorOptions;
pub const TEX_MULTI: Vec2 = Vec2::new(1000., 1.);
pub const HEX_CORNERS: [Vec3; 6] = [
@@ -25,30 +27,16 @@ pub mod prelude {
];
pub const HEX_NORMALS: [Vec3; 6] = [
Vec3::new(
INNER_RADIUS / 2.,
0.,
(OUTER_RADIUS + 0.5 * OUTER_RADIUS) / 2.,
),
Vec3::new(INNER_RADIUS / 2., 0., (OUTER_RADIUS + 0.5 * OUTER_RADIUS) / 2.),
Vec3::Z,
Vec3::new(
INNER_RADIUS / -2.,
0.,
(OUTER_RADIUS + 0.5 * OUTER_RADIUS) / 2.,
),
Vec3::new(
INNER_RADIUS / -2.,
0.,
(OUTER_RADIUS + 0.5 * OUTER_RADIUS) / -2.,
),
Vec3::new(INNER_RADIUS / -2., 0., (OUTER_RADIUS + 0.5 * OUTER_RADIUS) / 2.),
Vec3::new(INNER_RADIUS / -2., 0., (OUTER_RADIUS + 0.5 * OUTER_RADIUS) / -2.),
Vec3::NEG_Z,
Vec3::new(
INNER_RADIUS / 2.,
0.,
(OUTER_RADIUS + 0.5 * OUTER_RADIUS) / -2.,
),
Vec3::new(INNER_RADIUS / 2., 0., (OUTER_RADIUS + 0.5 * OUTER_RADIUS) / -2.),
];
#[derive(Resource, Reflect, Default)]
#[reflect(Resource)]
pub struct GenerationConfig {
pub noise_scale: f64,
pub sea_level: f64,
@@ -66,6 +54,7 @@ pub mod prelude {
}
}
#[derive(Reflect, InspectorOptions)]
pub struct GeneratorLayer {
pub strength: f64,
pub min_value: f64,