fully implement bevy asset loader

This commit is contained in:
2024-07-31 22:54:55 -04:00
parent 601ede338f
commit 3f174d4e2f
15 changed files with 64 additions and 105 deletions

View File

@@ -16,7 +16,11 @@ bevy_rapier3d = { version = "0.27.0", features = ["simd-stable", "parallel"] }
rayon = "1.10.0"
buildings = { path = "../buildings" }
shared = { path = "../shared" }
bevy_asset_loader = {version ="0.21.0", features = ["standard_dynamic_assets", "3d"]}
bevy_asset_loader = { version = "0.21.0", features = [
"standard_dynamic_assets",
"3d",
] }
ron = "0.8.1"
[features]
tracing = ["bevy/trace_tracy", "world_generation/tracing", "buildings/tracing"]

View File

@@ -199,6 +199,9 @@ fn rts_camera_system(
cam_targets.anim_time = cam_targets.anim_time.min(1.);
}
cam_pos.y = f32::lerp(cam_pos.y, desired_height, cam_targets.anim_time);
if cam_pos.y < min_height {
cam_pos.y = min_height;
}
let t = cam_pos.y.remap(cam_cfg.min_height, cam_cfg.max_height, 0., 1.);
if cam_targets.rotate_time < 1. {

View File

@@ -1,7 +1,6 @@
#[cfg(feature = "tracing")]
use bevy::log::*;
use bevy::{
asset::LoadState,
pbr::{ExtendedMaterial, NotShadowCaster},
prelude::*,
};
@@ -11,7 +10,7 @@ use bevy_inspector_egui::quick::ResourceInspectorPlugin;
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
use shared::states::{AssetLoadState, GameplayState, MenuState};
use world_generation::{
biome_asset::{BiomeAsset, BiomeAssetLoadState, BiomeAssetPlugin},
biome_asset::{BiomeAsset, BiomeAssetPlugin},
biome_painter::*,
heightmap::generate_heightmap,
hex_utils::{offset_to_index, SHORT_DIAGONAL},
@@ -65,7 +64,7 @@ impl Plugin for MapInitPlugin {
LoadingStateConfig::new(AssetLoadState::Loading)
.with_dynamic_assets_file::<StandardDynamicAssetCollection>("phos.assets.ron")
.load_collection::<PhosAssets>()
.load_collection::<BiomePainterAsset>()
.load_collection::<BiomePainterAsset>(),
);
app.add_systems(Startup, load_textures.run_if(in_state(AssetLoadState::FinalizeAssets)));