veloren/world/src/block/mod.rs

664 lines
22 KiB
Rust
Raw Normal View History

mod natural;
2019-06-09 10:24:18 +00:00
use crate::{
2019-09-04 23:03:49 +00:00
column::{ColumnGen, ColumnSample},
2019-08-24 13:23:42 +00:00
generator::{Generator, TownGen},
util::{RandomField, Sampler, SmallCache},
CONFIG,
2019-06-09 10:24:18 +00:00
};
2019-06-15 10:36:26 +00:00
use common::{
terrain::{structure::StructureBlock, Block, BlockKind, Structure},
2019-06-15 10:36:26 +00:00
vol::{ReadVol, Vox},
};
2019-07-01 18:40:41 +00:00
use std::ops::{Add, Div, Mul, Neg};
2019-06-15 10:36:26 +00:00
use vek::*;
2019-06-09 10:24:18 +00:00
pub struct BlockGen<'a> {
pub column_cache: SmallCache<Option<ColumnSample<'a>>>,
pub column_gen: ColumnGen<'a>,
2019-06-09 10:24:18 +00:00
}
impl<'a> BlockGen<'a> {
pub fn new(column_gen: ColumnGen<'a>) -> Self {
2019-06-09 10:24:18 +00:00
Self {
2019-09-23 02:18:09 +00:00
column_cache: SmallCache::default(),
2019-06-09 10:24:18 +00:00
column_gen,
}
}
pub fn sample_column<'b>(
2019-06-22 15:53:21 +00:00
column_gen: &ColumnGen<'a>,
cache: &'b mut SmallCache<Option<ColumnSample<'a>>>,
2019-06-23 19:43:02 +00:00
wpos: Vec2<i32>,
) -> Option<&'b ColumnSample<'a>> {
2019-06-22 15:53:21 +00:00
cache
2019-06-09 10:24:18 +00:00
.get(Vec2::from(wpos), |wpos| column_gen.get(wpos))
.as_ref()
2019-06-09 10:24:18 +00:00
}
2019-06-21 00:53:11 +00:00
2019-06-22 15:53:21 +00:00
fn get_cliff_height(
column_gen: &ColumnGen<'a>,
2019-09-23 02:18:09 +00:00
cache: &mut SmallCache<Option<ColumnSample<'a>>>,
2019-06-22 15:53:21 +00:00
wpos: Vec2<f32>,
close_cliffs: &[(Vec2<i32>, u32); 9],
cliff_hill: f32,
tolerance: f32,
2019-06-22 15:53:21 +00:00
) -> f32 {
2019-06-23 19:43:02 +00:00
close_cliffs.iter().fold(
0.0f32,
|max_height, (cliff_pos, seed)| match Self::sample_column(
column_gen,
cache,
Vec2::from(*cliff_pos),
) {
2019-09-25 12:00:00 +00:00
Some(cliff_sample)
if cliff_sample.is_cliffs
&& cliff_sample.spawn_rate > 0.5
&& cliff_sample.spawn_rules.cliffs =>
{
2019-06-23 19:43:02 +00:00
let cliff_pos3d = Vec3::from(*cliff_pos);
// Conservative range of height: [15.70, 49.33]
2019-09-24 13:45:38 +00:00
let height = (RandomField::new(seed + 1).get(cliff_pos3d) % 64) as f32
// [0, 63] / (1 + 3 * [0.12, 1.32]) + 3 =
// [0, 63] / (1 + [0.36, 3.96]) + 3 =
// [0, 63] / [1.36, 4.96] + 3 =
// [0, 63] / [1.36, 4.96] + 3 =
// (height min) [0, 0] + 3 = [3, 3]
// (height max) [12.70, 46.33] + 3 = [15.70, 49.33]
2019-09-24 17:56:51 +00:00
/ (1.0 + 3.0 * cliff_sample.chaos)
+ 3.0;
// Conservative range of radius: [8, 47]
2019-06-23 19:43:02 +00:00
let radius = RandomField::new(seed + 2).get(cliff_pos3d) % 48 + 8;
max_height.max(
if cliff_pos.map(|e| e as f32).distance_squared(wpos)
< (radius as f32 + tolerance).powf(2.0)
2019-06-23 19:43:02 +00:00
{
2019-09-24 13:45:38 +00:00
cliff_sample.alt + height * (1.0 - cliff_sample.chaos) + cliff_hill
} else {
0.0
2019-06-23 19:43:02 +00:00
},
)
2019-06-21 00:53:11 +00:00
}
2019-06-23 19:43:02 +00:00
_ => max_height,
},
)
2019-06-21 00:53:11 +00:00
}
2019-06-09 10:24:18 +00:00
2019-07-04 23:14:55 +00:00
pub fn get_z_cache(&mut self, wpos: Vec2<i32>) -> Option<ZCache<'a>> {
let BlockGen {
column_cache,
column_gen,
} = self;
2019-06-09 10:24:18 +00:00
2019-07-05 20:37:38 +00:00
// Main sample
2019-09-23 14:17:06 +00:00
let sample = column_gen.get(wpos)?;
2019-07-04 23:14:55 +00:00
2019-07-05 20:37:38 +00:00
// Tree samples
let mut structures = [None, None, None, None, None, None, None, None, None];
sample
.close_structures
.iter()
.zip(structures.iter_mut())
.for_each(|(close_structure, structure)| {
if let Some(st) = *close_structure {
let st_sample =
Self::sample_column(column_gen, column_cache, Vec2::from(st.pos));
if let Some(st_sample) = st_sample {
let st_sample = st_sample.clone();
let st_info = match st.meta {
None => natural::structure_gen(
column_gen,
column_cache,
st.pos,
st.seed,
&st_sample,
),
Some(meta) => Some(StructureInfo {
pos: Vec3::from(st.pos) + Vec3::unit_z() * st_sample.alt as i32,
seed: st.seed,
meta,
}),
};
if let Some(st_info) = st_info {
*structure = Some((st_info, st_sample));
}
}
2019-07-09 23:51:54 +00:00
}
});
Some(ZCache {
wpos,
sample,
structures,
})
2019-07-04 23:14:55 +00:00
}
pub fn get_with_z_cache(
&mut self,
wpos: Vec3<i32>,
z_cache: Option<&ZCache>,
only_structures: bool,
) -> Option<Block> {
2019-06-22 15:53:21 +00:00
let BlockGen {
column_cache,
column_gen,
} = self;
let world = column_gen.sim;
2019-06-22 15:53:21 +00:00
2019-08-24 13:23:42 +00:00
let sample = &z_cache?.sample;
2019-07-04 23:14:55 +00:00
let &ColumnSample {
2019-06-09 10:24:18 +00:00
alt,
basement,
2019-06-09 10:24:18 +00:00
chaos,
water_level,
warp_factor,
2019-06-09 10:24:18 +00:00
surface_color,
2019-06-23 13:55:54 +00:00
sub_surface_color,
2019-07-01 18:40:41 +00:00
//tree_density,
//forest_kind,
2019-07-09 23:51:54 +00:00
//close_structures,
2019-06-09 10:24:18 +00:00
cave_xy,
cave_alt,
2019-08-20 09:59:15 +00:00
marble,
2019-08-21 17:22:05 +00:00
marble_small,
2019-06-09 10:24:18 +00:00
rock,
2019-07-01 18:40:41 +00:00
//cliffs,
2019-06-21 00:53:11 +00:00
cliff_hill,
close_cliffs,
2019-08-21 18:18:16 +00:00
temp,
humidity,
2019-08-23 21:33:14 +00:00
chunk,
stone_col,
2019-06-18 21:22:31 +00:00
..
2019-08-24 13:23:42 +00:00
} = sample;
2019-07-04 23:14:55 +00:00
let structures = &z_cache?.structures;
2019-06-09 10:24:18 +00:00
let wposf = wpos.map(|e| e as f64);
let (block, height) = if !only_structures {
let (_definitely_underground, height, on_cliff, basement_height, water_height) =
if (wposf.z as f32) < alt - 64.0 * chaos {
// Shortcut warping
(true, alt, false, basement, water_level)
2019-06-23 19:43:02 +00:00
} else {
// Apply warping
let warp = world
.gen_ctx
.warp_nz
.get(wposf.div(24.0))
.mul((chaos - 0.1).max(0.0).min(1.0).powf(2.0))
.mul(16.0);
let warp = Lerp::lerp(0.0, warp, warp_factor);
2019-10-09 19:28:05 +00:00
let surface_height = alt + warp;
let (height, on_cliff) = if (wposf.z as f32) < alt + warp - 10.0 {
// Shortcut cliffs
2019-10-09 19:28:05 +00:00
(surface_height, false)
} else {
let turb = Vec2::new(
world.gen_ctx.fast_turb_x_nz.get(wposf.div(25.0)) as f32,
world.gen_ctx.fast_turb_y_nz.get(wposf.div(25.0)) as f32,
) * 8.0;
let wpos_turb = Vec2::from(wpos).map(|e: i32| e as f32) + turb;
let cliff_height = Self::get_cliff_height(
column_gen,
column_cache,
wpos_turb,
&close_cliffs,
cliff_hill,
0.0,
);
2019-10-09 19:28:05 +00:00
(
surface_height.max(cliff_height),
cliff_height > surface_height + 16.0,
)
};
(
false,
height,
2019-10-09 19:28:05 +00:00
on_cliff,
basement + height - alt,
(if water_level <= alt {
water_level + warp
} else {
water_level
}),
)
2019-06-23 19:43:02 +00:00
};
// Sample blocks
2019-06-09 10:24:18 +00:00
// let stone_col = Rgb::new(195, 187, 201);
2019-08-12 01:53:48 +00:00
// let dirt_col = Rgb::new(79, 67, 60);
2019-06-12 09:02:18 +00:00
let _air = Block::empty();
// let stone = Block::new(2, stone_col);
// let surface_stone = Block::new(1, Rgb::new(200, 220, 255));
// let dirt = Block::new(1, dirt_col);
// let sand = Block::new(1, Rgb::new(180, 150, 50));
// let warm_stone = Block::new(1, Rgb::new(165, 165, 130));
2019-08-12 01:53:48 +00:00
let water = Block::new(BlockKind::Water, Rgb::new(60, 90, 190));
2019-06-09 10:24:18 +00:00
let grass_depth = (1.5 + 2.0 * chaos).min(height - basement_height);
let block = if (wposf.z as f32) < height - grass_depth {
let col = Lerp::lerp(
2020-01-11 19:57:40 +00:00
sub_surface_color,
stone_col.map(|e| e as f32 / 255.0),
(height - grass_depth - wposf.z as f32) * 0.15,
)
.map(|e| (e * 255.0) as u8);
2019-06-12 09:02:18 +00:00
// Underground
if (wposf.z as f32) > alt - 32.0 * chaos {
Some(Block::new(BlockKind::Normal, col))
2019-08-21 18:18:16 +00:00
} else {
Some(Block::new(BlockKind::Dense, col))
}
} else if (wposf.z as f32) < height {
let col = Lerp::lerp(
sub_surface_color,
surface_color,
(wposf.z as f32 - (height - grass_depth))
.div(grass_depth)
.powf(0.5),
);
// Surface
Some(Block::new(
BlockKind::Normal,
col.map(|e| (e * 255.0) as u8),
))
} else if (wposf.z as f32) < height + 0.9
&& temp < CONFIG.desert_temp
&& (wposf.z as f32 > water_height + 3.0)
&& marble > 0.6
&& marble_small > 0.55
&& (marble * 3173.7).fract() < 0.6
2020-01-25 11:14:02 +00:00
&& humidity > CONFIG.desert_hum
{
2020-01-17 22:00:00 +00:00
let treasures = [BlockKind::Chest, BlockKind::Velorite];
2019-10-09 19:28:05 +00:00
let flowers = [
BlockKind::BlueFlower,
BlockKind::PinkFlower,
BlockKind::PurpleFlower,
BlockKind::RedFlower,
BlockKind::WhiteFlower,
BlockKind::YellowFlower,
BlockKind::Sunflower,
BlockKind::Mushroom,
2020-01-25 11:14:02 +00:00
BlockKind::LeafyPlant,
BlockKind::Blueberry,
BlockKind::LingonBerry,
BlockKind::Fern,
];
let grasses = [
BlockKind::LongGrass,
BlockKind::MediumGrass,
BlockKind::ShortGrass,
];
2019-06-09 10:24:18 +00:00
Some(Block::new(
2019-10-09 19:28:05 +00:00
if on_cliff && (height * 1271.0).fract() < 0.015 {
treasures[(height * 731.3) as usize % treasures.len()]
} else if (height * 1271.0).fract() < 0.1 {
flowers[(height * 0.2) as usize % flowers.len()]
} else {
grasses[(height * 103.3) as usize % grasses.len()]
},
Rgb::broadcast(0),
))
} else if (wposf.z as f32) < height + 0.9
&& temp > CONFIG.desert_temp
&& (marble * 4423.5).fract() < 0.0005
{
2020-01-25 11:14:02 +00:00
let large_cacti = [
BlockKind::LargeCactus,
BlockKind::MedFlatCactus,
BlockKind::Welwitch,
];
2019-06-09 10:24:18 +00:00
let small_cacti = [
BlockKind::BarrelCactus,
BlockKind::RoundCactus,
BlockKind::ShortCactus,
BlockKind::ShortFlatCactus,
2020-01-25 11:14:02 +00:00
BlockKind::DeadBush,
];
2019-06-18 11:55:25 +00:00
2019-06-19 14:55:26 +00:00
Some(Block::new(
if (height * 1271.0).fract() < 0.5 {
large_cacti[(height * 0.2) as usize % large_cacti.len()]
} else {
small_cacti[(height * 0.3) as usize % small_cacti.len()]
},
Rgb::broadcast(0),
2019-06-19 14:55:26 +00:00
))
2019-06-09 10:24:18 +00:00
} else {
None
}
.or_else(|| {
// Rocks
if (height + 2.5 - wposf.z as f32).div(7.5).abs().powf(2.0) < rock {
let field0 = RandomField::new(world.seed + 0);
let field1 = RandomField::new(world.seed + 1);
let field2 = RandomField::new(world.seed + 2);
Some(Block::new(
BlockKind::Normal,
stone_col
- Rgb::new(
field0.get(wpos) as u8 % 16,
field1.get(wpos) as u8 % 16,
field2.get(wpos) as u8 % 16,
),
))
} else {
None
}
})
.and_then(|block| {
// Caves
// Underground
let cave = cave_xy.powf(2.0)
* (wposf.z as f32 - cave_alt)
.div(40.0)
.powf(4.0)
.neg()
.add(1.0)
> 0.9993;
if cave && wposf.z as f32 > water_height + 3.0 {
None
} else {
Some(block)
}
})
.or_else(|| {
// Water
if (wposf.z as f32) < water_height {
// Ocean
Some(water)
} else {
None
}
});
2019-06-09 10:24:18 +00:00
(block, height)
} else {
(None, sample.alt)
};
2019-08-23 21:33:14 +00:00
// Structures (like towns)
/*
2019-08-24 22:57:55 +00:00
let block = chunk
.structures
.town
.as_ref()
.and_then(|town| TownGen.get((town, wpos, sample, height)))
.or(block);
*/
2019-08-23 21:33:14 +00:00
2019-08-03 20:44:51 +00:00
let block = structures
.iter()
.find_map(|st| {
let (st, st_sample) = st.as_ref()?;
st.get(wpos, st_sample)
})
.or(block);
2019-09-23 13:32:54 +00:00
Some(block.unwrap_or(Block::empty()))
2019-06-09 10:24:18 +00:00
}
}
2019-07-04 23:14:55 +00:00
pub struct ZCache<'a> {
wpos: Vec2<i32>,
2020-02-08 19:58:42 +00:00
pub sample: ColumnSample<'a>,
structures: [Option<(StructureInfo, ColumnSample<'a>)>; 9],
}
impl<'a> ZCache<'a> {
pub fn get_z_limits(&self, block_gen: &mut BlockGen) -> (f32, f32, f32) {
let cave_depth =
if self.sample.cave_xy.abs() > 0.9 && self.sample.water_level <= self.sample.alt {
(self.sample.alt - self.sample.cave_alt + 8.0).max(0.0)
} else {
0.0
};
let min = self.sample.alt - (self.sample.chaos.min(1.0) * 16.0 + cave_depth);
let min = min - 4.0;
let cliff = BlockGen::get_cliff_height(
&mut block_gen.column_gen,
&mut block_gen.column_cache,
self.wpos.map(|e| e as f32),
&self.sample.close_cliffs,
self.sample.cliff_hill,
32.0,
);
let rocks = if self.sample.rock > 0.0 { 12.0 } else { 0.0 };
2019-09-23 16:05:27 +00:00
let warp = self.sample.chaos * 32.0;
2019-08-03 20:44:51 +00:00
let (structure_min, structure_max) = self
.structures
.iter()
.filter_map(|st| st.as_ref())
2019-09-04 23:03:49 +00:00
.fold((0.0f32, 0.0f32), |(min, max), (st_info, _st_sample)| {
2019-07-09 23:51:54 +00:00
let bounds = st_info.get_bounds();
let st_area = Aabr {
min: Vec2::from(bounds.min),
max: Vec2::from(bounds.max),
};
2019-07-09 23:51:54 +00:00
if st_area.contains_point(self.wpos - st_info.pos) {
2019-08-03 20:44:51 +00:00
(min.min(bounds.min.z as f32), max.max(bounds.max.z as f32))
} else {
2019-08-03 20:44:51 +00:00
(min, max)
}
2019-08-03 20:44:51 +00:00
});
2019-09-26 11:19:21 +00:00
let ground_max = (self.sample.alt + warp + rocks).max(cliff) + 2.0;
2019-08-03 20:44:51 +00:00
let min = min + structure_min;
let max = (ground_max + structure_max).max(self.sample.water_level + 2.0);
2019-08-24 13:23:42 +00:00
// Structures
/*
2019-08-24 13:23:42 +00:00
let (min, max) = self
.sample
.chunk
.structures
.town
.as_ref()
.map(|town| {
let (town_min, town_max) = TownGen.get_z_limits(town, self.wpos, &self.sample);
(town_min.min(min), town_max.max(max))
})
.unwrap_or((min, max));
*/
2019-08-24 13:23:42 +00:00
let structures_only_min_z = ground_max.max(self.sample.water_level + 2.0);
2019-07-04 23:14:55 +00:00
(min, structures_only_min_z, max)
2019-07-04 23:14:55 +00:00
}
}
2019-07-09 23:51:54 +00:00
#[derive(Copy, Clone)]
pub enum StructureMeta {
Pyramid {
height: i32,
},
Volume {
units: (Vec2<i32>, Vec2<i32>),
volume: &'static Structure,
},
}
pub struct StructureInfo {
pos: Vec3<i32>,
seed: u32,
meta: StructureMeta,
}
impl StructureInfo {
fn get_bounds(&self) -> Aabb<i32> {
match self.meta {
StructureMeta::Pyramid { height } => {
let base = 40;
Aabb {
min: Vec3::new(-base - height, -base - height, -base),
max: Vec3::new(base + height, base + height, height),
}
},
2019-07-09 23:51:54 +00:00
StructureMeta::Volume { units, volume } => {
let bounds = volume.get_bounds();
(Aabb {
min: Vec3::from(units.0 * bounds.min.x + units.1 * bounds.min.y)
+ Vec3::unit_z() * bounds.min.z,
max: Vec3::from(units.0 * bounds.max.x + units.1 * bounds.max.y)
+ Vec3::unit_z() * bounds.max.z,
})
.made_valid()
},
2019-07-09 23:51:54 +00:00
}
}
fn get(&self, wpos: Vec3<i32>, sample: &ColumnSample) -> Option<Block> {
match self.meta {
StructureMeta::Pyramid { height } => {
if wpos.z - self.pos.z
< height
- Vec2::from(wpos - self.pos)
.map(|e: i32| (e.abs() / 2) * 2)
.reduce_max()
{
Some(Block::new(BlockKind::Dense, Rgb::new(203, 170, 146)))
2019-07-09 23:51:54 +00:00
} else {
None
}
},
2019-07-09 23:51:54 +00:00
StructureMeta::Volume { units, volume } => {
let rpos = wpos - self.pos;
let block_pos = Vec3::unit_z() * rpos.z
+ Vec3::from(units.0) * rpos.x
+ Vec3::from(units.1) * rpos.y;
volume
.get((block_pos * 128) / 128) // Scaling
2019-08-03 20:44:51 +00:00
.ok()
.and_then(|b| {
block_from_structure(
*b,
volume.default_kind(),
block_pos,
self.pos.into(),
self.seed,
sample,
)
2019-07-09 23:51:54 +00:00
})
},
2019-07-09 23:51:54 +00:00
}
}
}
2019-08-24 22:57:55 +00:00
pub fn block_from_structure(
2019-07-09 23:51:54 +00:00
sblock: StructureBlock,
default_kind: BlockKind,
2019-07-09 23:51:54 +00:00
pos: Vec3<i32>,
structure_pos: Vec2<i32>,
structure_seed: u32,
_sample: &ColumnSample,
2019-08-03 20:44:51 +00:00
) -> Option<Block> {
2019-07-09 23:51:54 +00:00
let field = RandomField::new(structure_seed + 0);
2020-02-06 19:09:34 +00:00
let lerp = ((field.get(Vec3::from(structure_pos)).rem_euclid(256)) as f32 / 255.0) * 0.85
+ ((field.get(pos + std::i32::MAX / 2).rem_euclid(256)) as f32 / 255.0) * 0.15;
2019-07-09 23:51:54 +00:00
match sblock {
StructureBlock::None => None,
2019-08-03 20:44:51 +00:00
StructureBlock::TemperateLeaves => Some(Block::new(
BlockKind::Leaves,
2019-08-17 17:07:25 +00:00
Lerp::lerp(
Rgb::new(0.0, 132.0, 94.0),
Rgb::new(142.0, 181.0, 0.0),
lerp,
)
.map(|e| e as u8),
2019-08-03 20:44:51 +00:00
)),
StructureBlock::PineLeaves => Some(Block::new(
BlockKind::Leaves,
Lerp::lerp(Rgb::new(0.0, 60.0, 50.0), Rgb::new(30.0, 100.0, 10.0), lerp)
.map(|e| e as u8),
2019-08-03 20:44:51 +00:00
)),
2020-01-26 00:22:48 +00:00
StructureBlock::PalmLeavesInner => Some(Block::new(
BlockKind::Leaves,
2019-08-17 17:07:25 +00:00
Lerp::lerp(
2020-01-26 00:22:48 +00:00
Rgb::new(61.0, 166.0, 43.0),
Rgb::new(29.0, 130.0, 32.0),
lerp,
)
.map(|e| e as u8),
)),
StructureBlock::PalmLeavesOuter => Some(Block::new(
BlockKind::Leaves,
Lerp::lerp(
Rgb::new(62.0, 171.0, 38.0),
Rgb::new(45.0, 171.0, 65.0),
2019-08-17 17:07:25 +00:00
lerp,
)
.map(|e| e as u8),
2019-08-03 20:44:51 +00:00
)),
2019-08-15 13:50:46 +00:00
StructureBlock::Water => Some(Block::new(BlockKind::Water, Rgb::new(100, 150, 255))),
2019-08-15 14:23:14 +00:00
StructureBlock::GreenSludge => Some(Block::new(BlockKind::Water, Rgb::new(30, 126, 23))),
2019-08-03 20:44:51 +00:00
StructureBlock::Acacia => Some(Block::new(
BlockKind::Normal,
2019-08-17 17:07:25 +00:00
Lerp::lerp(
Rgb::new(15.0, 126.0, 50.0),
Rgb::new(30.0, 180.0, 10.0),
lerp,
)
.map(|e| e as u8),
2019-08-03 20:44:51 +00:00
)),
2020-03-27 16:50:45 +00:00
StructureBlock::Fruit => Some(if field.get(pos + structure_pos) % 3 > 0 {
Block::empty()
} else {
Block::new(BlockKind::Apple, Rgb::new(194, 30, 37))
}),
2019-10-10 09:11:46 +00:00
StructureBlock::Chest => Some(if structure_seed % 10 < 7 {
Block::empty()
} else {
Block::new(BlockKind::Chest, Rgb::new(0, 0, 0))
}),
2019-09-01 19:04:03 +00:00
StructureBlock::Liana => Some(Block::new(
BlockKind::Liana,
Lerp::lerp(
Rgb::new(0.0, 125.0, 107.0),
Rgb::new(0.0, 155.0, 129.0),
lerp,
)
.map(|e| e as u8),
)),
StructureBlock::Mangrove => Some(Block::new(
BlockKind::Normal,
Lerp::lerp(Rgb::new(32.0, 56.0, 22.0), Rgb::new(57.0, 69.0, 27.0), lerp)
.map(|e| e as u8),
)),
2019-08-03 20:44:51 +00:00
StructureBlock::Hollow => Some(Block::empty()),
2019-08-18 14:33:16 +00:00
StructureBlock::Normal(color) => {
Some(Block::new(default_kind, color)).filter(|block| !block.is_empty())
},
2019-07-09 23:51:54 +00:00
}
}