Multiple color gradient options

This commit is contained in:
Joshua Barretto 2021-08-29 13:57:36 +01:00
parent 3592b5e7bb
commit 643807e5ff
5 changed files with 42 additions and 14 deletions

View File

@ -17,13 +17,18 @@
Water: None, Water: None,
GreenSludge: None, GreenSludge: None,
// Leaves all actually get interpolated. // Leaves all actually get interpolated.
TemperateLeaves: (start: (0, 70, 45), end: (90, 140, 0)), TemperateLeaves: [
PineLeaves: (start: (0, 60, 50), end: (30, 80, 10)), (start: (0, 91, 68), end: (124, 173, 0)),
PalmLeavesInner: (start: (70, 140, 43), end: (55, 140, 32)), //(start: (178, 216, 0), end: (255, 185, 63)),
PalmLeavesOuter: (start: (60, 130, 38), end: (30, 130, 65)), //(start: (142, 164, 0), end: (142, 164, 0)),
Acacia: (start: (30, 100, 0), end: (90, 110, 20)), //(start: (168, 81, 0), end: (54, 150, 31)),
Liana: (start: (0, 125, 107), end: (0, 155, 129)), ],
Mangrove: (start: (15, 80, 10), end: (20, 120, 47)), PineLeaves: [(start: (0, 60, 50), end: (30, 80, 10))],
PalmLeavesInner: [(start: (70, 140, 43), end: (55, 140, 32))],
PalmLeavesOuter: [(start: (60, 130, 38), end: (30, 130, 65))],
Acacia: [(start: (30, 100, 0), end: (90, 110, 20))],
Liana: [(start: (0, 125, 107), end: (0, 155, 129))],
Mangrove: [(start: (15, 80, 10), end: (20, 120, 47))],
) )
// Water blocks ignore color now so this isn't used, but just in case this color was worth // Water blocks ignore color now so this isn't used, but just in case this color was worth

View File

@ -22,6 +22,7 @@ default-publish = ["default"]
default = ["worldgen", "persistent_world"] default = ["worldgen", "persistent_world"]
tracy = ["common-frontend/tracy"] tracy = ["common-frontend/tracy"]
plugins = ["server/plugins"] plugins = ["server/plugins"]
hot-reloading = ["server/hot-reloading"]
[dependencies] [dependencies]
server = { package = "veloren-server", path = "../server", default-features = false, features = ["simd"] } server = { package = "veloren-server", path = "../server", default-features = false, features = ["simd"] }

View File

@ -9,6 +9,7 @@ worldgen = []
simd = ["vek/platform_intrinsics"] simd = ["vek/platform_intrinsics"]
plugins = ["common-state/plugins"] plugins = ["common-state/plugins"]
persistent_world = [] persistent_world = []
hot-reloading = ["common/hot-reloading"]
default = ["worldgen", "plugins", "persistent_world", "simd"] default = ["worldgen", "plugins", "persistent_world", "simd"]

View File

@ -1,6 +1,6 @@
use crate::{ use crate::{
column::{ColumnGen, ColumnSample}, column::{ColumnGen, ColumnSample},
util::{FastNoise, RandomField, Sampler, SmallCache}, util::{FastNoise, RandomField, RandomPerm, Sampler, SmallCache},
IndexRef, IndexRef,
}; };
use common::terrain::{ use common::terrain::{
@ -16,7 +16,7 @@ pub struct Colors {
// TODO(@Sharp): After the merge, construct enough infrastructure to make it convenient to // TODO(@Sharp): After the merge, construct enough infrastructure to make it convenient to
// define mapping functions over the input; i.e. we should be able to interpret some fields as // define mapping functions over the input; i.e. we should be able to interpret some fields as
// defining App<Abs<Fun, Type>, Arg>, where Fun : (Context, Arg) → (S, Type). // defining App<Abs<Fun, Type>, Arg>, where Fun : (Context, Arg) → (S, Type).
pub structure_blocks: structure::structure_block::PureCases<Option<Range<(u8, u8, u8)>>>, pub structure_blocks: structure::structure_block::PureCases<Option<Vec<Range<(u8, u8, u8)>>>>,
} }
pub struct BlockGen<'a> { pub struct BlockGen<'a> {
@ -289,10 +289,19 @@ pub fn block_from_structure(
| StructureBlock::PalmLeavesInner | StructureBlock::PalmLeavesInner
| StructureBlock::PalmLeavesOuter | StructureBlock::PalmLeavesOuter
| StructureBlock::Acacia | StructureBlock::Acacia
| StructureBlock::Mangrove => sblock | StructureBlock::Mangrove => {
.elim_case_pure(&index.colors.block.structure_blocks) let ranges = sblock
.as_ref() .elim_case_pure(&index.colors.block.structure_blocks)
.map(|range| { .as_ref()
.map(Vec::as_slice)
.unwrap_or(&[]);
let range = if ranges.len() == 0 {
None
} else {
ranges.get(RandomPerm::new(structure_seed).get(13) as usize % ranges.len())
};
range.map(|range| {
Block::new( Block::new(
BlockKind::Leaves, BlockKind::Leaves,
Rgb::<f32>::lerp( Rgb::<f32>::lerp(
@ -302,6 +311,7 @@ pub fn block_from_structure(
) )
.map(|e| e as u8), .map(|e| e as u8),
) )
}), })
},
} }
} }

View File

@ -151,6 +151,17 @@ pub fn apply_scatter_to(canvas: &mut Canvas, rng: &mut impl Rng) {
None, None,
) )
}), }),
(Pumpkin, false, |c, _| {
(
close(c.temp, CONFIG.temperate_temp, 0.5).min(close(
c.humidity,
CONFIG.forest_hum,
0.5,
)) * MUSH_FACT
* 500.0,
Some((512.0, 0.05)),
)
}),
// Collectable Objects // Collectable Objects
// Only spawn twigs in temperate forests // Only spawn twigs in temperate forests
(Twigs, false, |c, _| { (Twigs, false, |c, _| {