From 16ffbc92dd5eae03c67470a3fda006d6c46a69fe Mon Sep 17 00:00:00 2001 From: Joshua Yanovski Date: Sat, 2 Jul 2022 18:21:15 -0700 Subject: [PATCH] Reenabling prefab structures. This has barely any impact on anything but dungeons. Could probably be sped up further but not a big deal. --- world/src/column/mod.rs | 30 ++++++++++++++++++++++++++++++ world/src/site2/gen.rs | 8 +++++--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/world/src/column/mod.rs b/world/src/column/mod.rs index 228c651a0a..63d3170fd9 100644 --- a/world/src/column/mod.rs +++ b/world/src/column/mod.rs @@ -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, +}; diff --git a/world/src/site2/gen.rs b/world/src/site2/gen.rs index a9afe0c8f7..2297c4c2f8 100644 --- a/world/src/site2/gen.rs +++ b/world/src/site2/gen.rs @@ -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, 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, )