Reenabling prefab structures.

This has barely any impact on anything but dungeons.  Could probably be
sped up further but not a big deal.
This commit is contained in:
Joshua Yanovski 2022-07-02 18:21:15 -07:00
parent 7cee43b32d
commit 16ffbc92dd
2 changed files with 35 additions and 3 deletions

View File

@ -1833,3 +1833,33 @@ pub struct ColumnSample/*<'a>*/ {
/* pub chunk: &'a SimChunk, */
// pub chunk: core::marker::PhantomData<&'a SimChunk>,
}
pub const DEFAULT_COLUMN_SAMPLE: ColumnSample = ColumnSample {
alt: 0.0,
riverless_alt: 0.0,
basement: 0.0,
chaos: 0.0,
water_level: 0.0,
// warp_factor: 0.0,
surface_color: Rgb::new(0.0, 0.0, 0.0),
sub_surface_color: Rgb::new(0.0, 0.0, 0.0),
tree_density: 0.0,
// forest_kind: ForestKind,
// marble: 0.0,
// marble_mid: 0.0,
// marble_small: 0.0,
rock_density: 0.0,
temp: 0.0,
humidity: 0.0,
spawn_rate: 0.0,
stone_col: Rgb::new(0, 0, 0),
water_dist: None,
gradient: 0.0,
path: None,
cave: None,
snow_cover: false,
cliff_offset: 0.0,
cliff_height: 0.0,
// water_vel: Vec3::new(0.0, 0.0, 0.0),
ice_depth: 0.0,
};

View File

@ -1,6 +1,7 @@
use super::*;
use crate::{
block::block_from_structure,
column::DEFAULT_COLUMN_SAMPLE,
site2::util::Dir,
util::{RandomField, Sampler},
CanvasInfo,
@ -692,7 +693,7 @@ impl<'a, 'b, F: Filler> FillFn<'a, 'b, F> {
// we probably need an evaluator for the primitive tree that gets which point is queried at
// leaf nodes given an input point to make Translate/Rotate work generally
pub fn prefab(&self, p: &'static PrefabStructure, tr: Vec3<i32>, seed: u32) -> impl Fill + Copy + 'b {
let col_sample = None;/*/*if let Some(col_sample) = */self.canvas_info.col(self.canvas_info.wpos)/* {
/* let col_sample = None;/*/*if let Some(col_sample) = */self.canvas_info.col(self.canvas_info.wpos)/* {
col_sample
} else {
// Don't draw--technically we should probably not assume this much about
@ -700,10 +701,11 @@ impl<'a, 'b, F: Filler> FillFn<'a, 'b, F> {
//
// FIXME: Fix this for alternate fillers if it turns out to matter.
return
}*/*/;
}*/*/; */
let index = self.canvas_info.index;
let p_bounds = p.get_bounds().center().xy();
let calendar = self.canvas_info.calendar();
static COLUMN_SAMPLE: ColumnSample = DEFAULT_COLUMN_SAMPLE;
FillVar(move |pos| {
p.get(pos - tr).ok().and_then(|&sb| {
@ -713,7 +715,7 @@ impl<'a, 'b, F: Filler> FillFn<'a, 'b, F> {
pos - tr,
p_bounds,
seed,
col_sample?,
&/*col_sample?*/COLUMN_SAMPLE,
Block::air,
calendar,
)