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

@ -38,6 +38,7 @@ impl From<BiomeType> for Biome {
match biome_type { match biome_type {
BiomeType::IceCap => Biome { BiomeType::IceCap => Biome {
name: "Ice Cap".into(), name: "Ice Cap".into(),
#[cfg(feature = "render")]
color: Color::rgb_u8(253, 244, 235), color: Color::rgb_u8(253, 244, 235),
min_altitude: World::MIN_ALTITUDE, min_altitude: World::MIN_ALTITUDE,
max_altitude: World::MAX_ALTITUDE, max_altitude: World::MAX_ALTITUDE,
@ -48,6 +49,7 @@ impl From<BiomeType> for Biome {
}, },
BiomeType::Ocean => Biome { BiomeType::Ocean => Biome {
name: "Ocean".into(), name: "Ocean".into(),
#[cfg(feature = "render")]
color: Color::rgb_u8(28, 66, 84), color: Color::rgb_u8(28, 66, 84),
min_altitude: World::MIN_ALTITUDE, min_altitude: World::MIN_ALTITUDE,
max_altitude: 0.0, max_altitude: 0.0,
@ -58,6 +60,7 @@ impl From<BiomeType> for Biome {
}, },
BiomeType::Grassland => Biome { BiomeType::Grassland => Biome {
name: "Grassland".into(), name: "Grassland".into(),
#[cfg(feature = "render")]
color: Color::rgb_u8(167, 177, 84), color: Color::rgb_u8(167, 177, 84),
min_altitude: 0.0, min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE, max_altitude: World::MAX_ALTITUDE,
@ -68,6 +71,7 @@ impl From<BiomeType> for Biome {
}, },
BiomeType::Forest => Biome { BiomeType::Forest => Biome {
name: "Forest".into(), name: "Forest".into(),
#[cfg(feature = "render")]
color: Color::rgb_u8(76, 132, 55), color: Color::rgb_u8(76, 132, 55),
min_altitude: 0.0, min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE, max_altitude: World::MAX_ALTITUDE,
@ -78,6 +82,7 @@ impl From<BiomeType> for Biome {
}, },
BiomeType::Taiga => Biome { BiomeType::Taiga => Biome {
name: "Taiga".into(), name: "Taiga".into(),
#[cfg(feature = "render")]
color: Color::rgb_u8(43, 63, 40), color: Color::rgb_u8(43, 63, 40),
min_altitude: 0.0, min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE, max_altitude: World::MAX_ALTITUDE,
@ -88,6 +93,7 @@ impl From<BiomeType> for Biome {
}, },
BiomeType::Tundra => Biome { BiomeType::Tundra => Biome {
name: "Tundra ".into(), name: "Tundra ".into(),
#[cfg(feature = "render")]
color: Color::rgb_u8(139, 139, 128), color: Color::rgb_u8(139, 139, 128),
min_altitude: 0.0, min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE, max_altitude: World::MAX_ALTITUDE,
@ -98,6 +104,7 @@ impl From<BiomeType> for Biome {
}, },
BiomeType::Desert => Biome { BiomeType::Desert => Biome {
name: "Desert ".into(), name: "Desert ".into(),
#[cfg(feature = "render")]
color: Color::rgb_u8(253, 225, 171), color: Color::rgb_u8(253, 225, 171),
min_altitude: 0.0, min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE, max_altitude: World::MAX_ALTITUDE,
@ -108,6 +115,7 @@ impl From<BiomeType> for Biome {
}, },
BiomeType::Rainforest => Biome { BiomeType::Rainforest => Biome {
name: "Rainforest".into(), name: "Rainforest".into(),
#[cfg(feature = "render")]
color: Color::rgb_u8(59, 103, 43), color: Color::rgb_u8(59, 103, 43),
min_altitude: 0.0, min_altitude: 0.0,
max_altitude: World::MAX_ALTITUDE, max_altitude: World::MAX_ALTITUDE,

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,
}; };