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

View file

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

View file

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

View file

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

View file

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