Skip to content

Commit 864a184

Browse files
committed
re-work flat cache
1 parent d42528a commit 864a184

File tree

3 files changed

+394
-197
lines changed

3 files changed

+394
-197
lines changed

pumpkin-world/src/generation/chunk_noise_router/density_function/mod.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,35 @@ pub trait NoisePos {
2727
fn z(&self) -> i32;
2828
}
2929

30+
pub struct UnblendedNoisePos {
31+
x: i32,
32+
y: i32,
33+
z: i32,
34+
}
35+
36+
impl UnblendedNoisePos {
37+
pub fn new(x: i32, y: i32, z: i32) -> Self {
38+
Self { x, y, z }
39+
}
40+
}
41+
42+
impl NoisePos for UnblendedNoisePos {
43+
#[inline]
44+
fn x(&self) -> i32 {
45+
self.x
46+
}
47+
48+
#[inline]
49+
fn y(&self) -> i32 {
50+
self.y
51+
}
52+
53+
#[inline]
54+
fn z(&self) -> i32 {
55+
self.z
56+
}
57+
}
58+
3059
pub trait IndexToNoisePos {
3160
fn at(&self, index: usize) -> impl NoisePos;
3261
}

pumpkin-world/src/generation/chunk_noise_router/density_function/test.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,18 @@ impl NoisePos for TestNoisePos {
3131
}
3232
}
3333

34+
// This is a dummy value because we are not actually building chunk-specific functions
35+
static TEST_OPTIONS: ChunkNoiseFunctionBuilderOptions =
36+
ChunkNoiseFunctionBuilderOptions::new(0, 0, 0, 0, 0, 0, 0);
37+
3438
macro_rules! build_function {
35-
($name:expr) => {
39+
($name:expr) => {{
3640
ChunkNoiseFunction::new(
3741
&$name,
3842
ChunkNoiseFunctionWrapperHandler::TestNoiseConfig,
39-
// This is a dummy value because we are not actually building chunk-specific functions
40-
&ChunkNoiseFunctionBuilderOptions::new(0, 0),
43+
&TEST_OPTIONS,
4144
)
42-
};
45+
}};
4346
}
4447

4548
macro_rules! sample_router_function {

0 commit comments

Comments
 (0)