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,
GreenSludge: None,
// Leaves all actually get interpolated.
TemperateLeaves: (start: (0, 70, 45), end: (90, 140, 0)),
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)),
TemperateLeaves: [
(start: (0, 91, 68), end: (124, 173, 0)),
//(start: (178, 216, 0), end: (255, 185, 63)),
//(start: (142, 164, 0), end: (142, 164, 0)),
//(start: (168, 81, 0), end: (54, 150, 31)),
],
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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
use crate::{
column::{ColumnGen, ColumnSample},
util::{FastNoise, RandomField, Sampler, SmallCache},
util::{FastNoise, RandomField, RandomPerm, Sampler, SmallCache},
IndexRef,
};
use common::terrain::{
@ -16,7 +16,7 @@ pub struct Colors {
// 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
// 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> {
@ -289,10 +289,19 @@ pub fn block_from_structure(
| StructureBlock::PalmLeavesInner
| StructureBlock::PalmLeavesOuter
| StructureBlock::Acacia
| StructureBlock::Mangrove => sblock
.elim_case_pure(&index.colors.block.structure_blocks)
.as_ref()
.map(|range| {
| StructureBlock::Mangrove => {
let ranges = sblock
.elim_case_pure(&index.colors.block.structure_blocks)
.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(
BlockKind::Leaves,
Rgb::<f32>::lerp(
@ -302,6 +311,7 @@ pub fn block_from_structure(
)
.map(|e| e as u8),
)
}),
})
},
}
}

View File

@ -151,6 +151,17 @@ pub fn apply_scatter_to(canvas: &mut Canvas, rng: &mut impl Rng) {
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
// Only spawn twigs in temperate forests
(Twigs, false, |c, _| {