Mirgrate to bevy 0.14.0
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use bevy::ecs::system::CommandQueue;
|
||||
use bevy::ecs::world::CommandQueue;
|
||||
use bevy::prelude::*;
|
||||
use bevy::tasks::*;
|
||||
use bevy::utils::futures;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#[cfg(feature = "tracing")]
|
||||
use bevy::log::*;
|
||||
use bevy::{
|
||||
asset::LoadState,
|
||||
asset::{AssetEvents, LoadState},
|
||||
pbr::{ExtendedMaterial, NotShadowCaster},
|
||||
prelude::*,
|
||||
};
|
||||
@@ -97,7 +97,7 @@ fn load_textures(
|
||||
|
||||
let water_material = water_materials.add(ExtendedMaterial {
|
||||
base: StandardMaterial {
|
||||
base_color: Color::CYAN.with_a(0.8),
|
||||
base_color: Color::srgba(0., 0.5, 1., 0.8),
|
||||
alpha_mode: AlphaMode::Blend,
|
||||
..Default::default()
|
||||
},
|
||||
@@ -112,10 +112,10 @@ fn load_textures(
|
||||
});
|
||||
commands.insert_resource(WaterInspect(water_material.clone()));
|
||||
commands.insert_resource(ChunkAtlas {
|
||||
handle: main_tex.clone(),
|
||||
handle: main_tex,
|
||||
is_loaded: false,
|
||||
chunk_material_handle: Handle::default(),
|
||||
water_material: water_material,
|
||||
water_material,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -147,13 +147,12 @@ fn check_asset_load(
|
||||
return;
|
||||
}
|
||||
|
||||
if asset_server.load_state(atlas.handle.clone()) != LoadState::Loaded {
|
||||
if asset_server.load_state(atlas.handle.id()) != LoadState::Loaded {
|
||||
return;
|
||||
}
|
||||
if asset_server.load_state(painter.handle.clone()) != LoadState::Loaded {
|
||||
if asset_server.load_state(painter.handle.id()) != LoadState::Loaded {
|
||||
return;
|
||||
}
|
||||
|
||||
next_state.set(AssetLoadState::FinalizeAssets);
|
||||
}
|
||||
|
||||
@@ -170,7 +169,7 @@ fn finalize_biome_painter(
|
||||
return;
|
||||
}
|
||||
|
||||
let painter_asset = biome_painters.get(painter.handle.clone()).unwrap();
|
||||
let painter_asset = biome_painters.get(painter.handle.id()).unwrap();
|
||||
let biome_painter = painter_asset.build(&biome_assets);
|
||||
commands.insert_resource(biome_painter);
|
||||
next_generator_state.set(GeneratorState::GenerateHeightmap);
|
||||
@@ -182,7 +181,7 @@ fn finalize_texture(
|
||||
mut chunk_materials: ResMut<Assets<ExtendedMaterial<StandardMaterial, ChunkMaterial>>>,
|
||||
mut next_load_state: ResMut<NextState<AssetLoadState>>,
|
||||
) {
|
||||
let image = images.get_mut(&atlas.handle).unwrap();
|
||||
let image = images.get_mut(atlas.handle.id()).unwrap();
|
||||
|
||||
let array_layers = image.height() / image.width();
|
||||
image.reinterpret_stacked_2d_as_array(array_layers);
|
||||
@@ -264,7 +263,6 @@ fn create_heightmap(
|
||||
cam_t.translation = heightmap.get_center();
|
||||
|
||||
commands.entity(cam_entity).insert(CameraBounds::from_size(config.size));
|
||||
|
||||
commands.insert_resource(heightmap);
|
||||
commands.insert_resource(config);
|
||||
next_state.set(GeneratorState::SpawnMap);
|
||||
|
||||
@@ -55,7 +55,7 @@ impl Plugin for PhosGamePlugin {
|
||||
|
||||
app.insert_resource(WireframeConfig {
|
||||
global: false,
|
||||
default_color: Color::hex("FF0064").unwrap(),
|
||||
default_color: Srgba::hex("FF0064").unwrap().into(),
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ fn init_game(mut commands: Commands, mut materials: ResMut<Assets<StandardMateri
|
||||
});
|
||||
|
||||
let sphere_mat = StandardMaterial {
|
||||
base_color: Color::CYAN,
|
||||
base_color: Color::srgb(1., 1., 0.),
|
||||
..default()
|
||||
};
|
||||
let handle = materials.add(sphere_mat);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use bevy::asset::Asset;
|
||||
use bevy::math::VectorSpace;
|
||||
use bevy::pbr::MaterialExtension;
|
||||
use bevy::prelude::*;
|
||||
use bevy::reflect::Reflect;
|
||||
use bevy::render::color::Color;
|
||||
use bevy::render::render_resource::{AsBindGroup, ShaderRef, ShaderType};
|
||||
|
||||
#[derive(Asset, Reflect, AsBindGroup, Debug, Clone, Default)]
|
||||
@@ -14,7 +15,7 @@ pub struct WaterMaterial {
|
||||
pub struct WaterSettings {
|
||||
pub offset: f32,
|
||||
pub scale: f32,
|
||||
pub deep_color: Color,
|
||||
pub deep_color: Vec3,
|
||||
}
|
||||
|
||||
impl Default for WaterSettings {
|
||||
@@ -22,7 +23,7 @@ impl Default for WaterSettings {
|
||||
Self {
|
||||
offset: 0.0,
|
||||
scale: 1.0,
|
||||
deep_color: Color::BLACK,
|
||||
deep_color: Vec3::ZERO,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ pub fn paint_chunk(
|
||||
let height = chunk.heights[idx];
|
||||
let biome_id = chunk.biome_id[idx];
|
||||
let biome = &painter.biomes[biome_id];
|
||||
let mapper = mappers.get(biome.tile_mapper.clone());
|
||||
let mapper = mappers.get(biome.tile_mapper.id());
|
||||
let tile_handle = mapper.unwrap().sample_tile(height);
|
||||
let tile = tiles.get(tile_handle).unwrap();
|
||||
chunk.textures[idx] = [tile.texture_id, tile.side_texture_id];
|
||||
|
||||
Reference in New Issue
Block a user