Fix compilation on different feature-sets

This commit is contained in:
Tobias Berger 2022-09-19 13:58:47 +02:00
parent 8fa5393a41
commit a4fc8286b1
Signed by: toby
GPG key ID: 2D05EFAB764D6A88
5 changed files with 62 additions and 53 deletions

View file

@ -37,82 +37,90 @@ impl From<BiomeType> for Biome {
fn from(biome_type: BiomeType) -> Biome {
match biome_type {
BiomeType::IceCap => Biome {
name: "Ice Cap".into(),
color: Color::rgb_u8(253, 244, 235),
min_altitude: World::MIN_ALTITUDE,
max_altitude: World::MAX_ALTITUDE,
min_rainfall: World::MIN_RAINFALL,
max_rainfall: World::MAX_RAINFALL,
name: "Ice Cap".into(),
#[cfg(feature = "render")]
color: Color::rgb_u8(253, 244, 235),
min_altitude: World::MIN_ALTITUDE,
max_altitude: World::MAX_ALTITUDE,
min_rainfall: World::MIN_RAINFALL,
max_rainfall: World::MAX_RAINFALL,
min_temperature: World::MIN_TEMPERATURE,
max_temperature: -15.0,
},
BiomeType::Ocean => Biome {
name: "Ocean".into(),
color: Color::rgb_u8(28, 66, 84),
min_altitude: World::MIN_ALTITUDE,
max_altitude: 0.0,
min_rainfall: World::MIN_RAINFALL,
max_rainfall: World::MAX_RAINFALL,
name: "Ocean".into(),
#[cfg(feature = "render")]
color: Color::rgb_u8(28, 66, 84),
min_altitude: World::MIN_ALTITUDE,
max_altitude: 0.0,
min_rainfall: World::MIN_RAINFALL,
max_rainfall: World::MAX_RAINFALL,
min_temperature: -15.0,
max_temperature: World::MAX_TEMPERATURE,
},
BiomeType::Grassland => Biome {
name: "Grassland".into(),
color: Color::rgb_u8(167, 177, 84),
min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE,
min_rainfall: 25.0,
max_rainfall: 1475.0,
name: "Grassland".into(),
#[cfg(feature = "render")]
color: Color::rgb_u8(167, 177, 84),
min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE,
min_rainfall: 25.0,
max_rainfall: 1475.0,
min_temperature: -5.0,
max_temperature: World::MAX_TEMPERATURE,
},
BiomeType::Forest => Biome {
name: "Forest".into(),
color: Color::rgb_u8(76, 132, 55),
min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE,
min_rainfall: 975.0,
max_rainfall: 2475.0,
name: "Forest".into(),
#[cfg(feature = "render")]
color: Color::rgb_u8(76, 132, 55),
min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE,
min_rainfall: 975.0,
max_rainfall: 2475.0,
min_temperature: -5.0,
max_temperature: World::MAX_TEMPERATURE,
},
BiomeType::Taiga => Biome {
name: "Taiga".into(),
color: Color::rgb_u8(43, 63, 40),
min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE,
min_rainfall: 475.0,
max_rainfall: World::MAX_RAINFALL,
name: "Taiga".into(),
#[cfg(feature = "render")]
color: Color::rgb_u8(43, 63, 40),
min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE,
min_rainfall: 475.0,
max_rainfall: World::MAX_RAINFALL,
min_temperature: -15.0,
max_temperature: -0.0,
},
BiomeType::Tundra => Biome {
name: "Tundra ".into(),
color: Color::rgb_u8(139, 139, 128),
min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE,
min_rainfall: World::MIN_RAINFALL,
max_rainfall: 725.0,
name: "Tundra ".into(),
#[cfg(feature = "render")]
color: Color::rgb_u8(139, 139, 128),
min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE,
min_rainfall: World::MIN_RAINFALL,
max_rainfall: 725.0,
min_temperature: -20.0,
max_temperature: -0.0,
},
BiomeType::Desert => Biome {
name: "Desert ".into(),
color: Color::rgb_u8(253, 225, 171),
min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE,
min_rainfall: World::MIN_RAINFALL,
max_rainfall: 125.0,
name: "Desert ".into(),
#[cfg(feature = "render")]
color: Color::rgb_u8(253, 225, 171),
min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE,
min_rainfall: World::MIN_RAINFALL,
max_rainfall: 125.0,
min_temperature: -5.0,
max_temperature: World::MAX_TEMPERATURE,
},
BiomeType::Rainforest => Biome {
name: "Rainforest".into(),
color: Color::rgb_u8(59, 103, 43),
min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE,
min_rainfall: 1975.0,
max_rainfall: World::MAX_RAINFALL,
name: "Rainforest".into(),
#[cfg(feature = "render")]
color: Color::rgb_u8(59, 103, 43),
min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE,
min_rainfall: 1975.0,
max_rainfall: World::MAX_RAINFALL,
min_temperature: -5.0,
max_temperature: World::MAX_TEMPERATURE,
},

View file

@ -35,7 +35,7 @@
pub mod world;
pub use world::*;
pub mod biome;
pub use biome::Biome;
pub use biome::*;
pub mod world_manager;
pub use world_manager::*;
pub mod math_util;

View file

@ -1,12 +1,12 @@
// TODO: Logging doesn't seem to work here? Figure out why and fix
use {
crate::{
biome::BiomeType,
cartesian_coordinates,
mix_values,
perlin,
random_point_in_sphere,
Biome,
BiomeType,
CartesianError,
RepeatNum,
},

View file

@ -4,7 +4,7 @@ use bevy::log::debug;
use bevy::utils::default;
#[cfg(feature = "render")]
use {
crate::TerrainCell,
crate::{Biome, TerrainCell},
bevy::{
asset::{Assets, HandleId},
render::render_resource::Extent3d,
@ -12,7 +12,7 @@ use {
},
};
use {
crate::{Biome, World, WorldGenError},
crate::{World, WorldGenError},
bevy::log::warn,
rand::random,
std::{

View file

@ -100,6 +100,7 @@ use {
markers::{InfoPanel, ToolbarButton},
third_party::PanCam,
},
planet::Biome,
resources::CursorMapPosition,
ui_helpers::{toolbar_button, toolbar_button_text},
};
@ -109,7 +110,7 @@ use {
log::LogSettings,
utils::{default, tracing::Level},
},
planet::{Biome, WorldManager},
planet::WorldManager,
plugins::WorldPlugins,
};