fix: ci/test
This commit is contained in:
parent
5b8eab0f56
commit
acb295b250
@ -297,6 +297,7 @@ impl WorldAquiferSampler {
|
|||||||
let z = block_z + section_coords::section_to_block(offset_z as i32);
|
let z = block_z + section_coords::section_to_block(offset_z as i32);
|
||||||
|
|
||||||
let n = height_estimator.estimate_height(x, z);
|
let n = height_estimator.estimate_height(x, z);
|
||||||
|
println!("estimate_height({}, {}) = {}", x, z, n);
|
||||||
let o = n + 8;
|
let o = n + 8;
|
||||||
let bl2 = offset_x == 0 && offset_z == 0;
|
let bl2 = offset_x == 0 && offset_z == 0;
|
||||||
|
|
||||||
@ -1504,7 +1505,7 @@ mod random_positions_and_hypot {
|
|||||||
&mut height_estimator,
|
&mut height_estimator,
|
||||||
&env,
|
&env,
|
||||||
);
|
);
|
||||||
assert_eq!(level.max_y, y1);
|
assert_eq!(level.max_y, y1, "Failed at x={}, y={}, z={}", x, y, z);
|
||||||
assert_eq!(level.block, &state);
|
assert_eq!(level.block, &state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,9 +93,6 @@ impl<'a> SurfaceHeightEstimateSampler<'a> {
|
|||||||
&sample_options,
|
&sample_options,
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut low = self.minimum_y;
|
|
||||||
let mut high = upper.ceil() as i32;
|
|
||||||
|
|
||||||
// First find the coarse cell that contains the surface
|
// First find the coarse cell that contains the surface
|
||||||
let cell_height = fts.cell_height();
|
let cell_height = fts.cell_height();
|
||||||
let mut y = (upper / cell_height as f64).floor() as i32 * cell_height;
|
let mut y = (upper / cell_height as f64).floor() as i32 * cell_height;
|
||||||
@ -106,40 +103,20 @@ impl<'a> SurfaceHeightEstimateSampler<'a> {
|
|||||||
&sample_options,
|
&sample_options,
|
||||||
);
|
);
|
||||||
if density > 0.0 {
|
if density > 0.0 {
|
||||||
low = y;
|
return y;
|
||||||
high = (y + cell_height).min(high);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
y -= cell_height;
|
y -= cell_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if y < self.minimum_y {
|
|
||||||
return self.minimum_y;
|
return self.minimum_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Binary search for precise surface
|
|
||||||
while high - low > 1 {
|
|
||||||
let mid = low + (high - low) / 2;
|
|
||||||
let density = ChunkNoiseFunctionComponent::sample_from_stack(
|
|
||||||
&mut self.component_stack[..=fts.density_index()],
|
|
||||||
&Vector3::new(aligned_x, mid, aligned_z),
|
|
||||||
&sample_options,
|
|
||||||
);
|
|
||||||
if density > 0.0 {
|
|
||||||
low = mid;
|
|
||||||
} else {
|
|
||||||
high = mid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return low + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
let surface_y = ChunkNoiseFunctionComponent::sample_from_stack(
|
let surface_y = ChunkNoiseFunctionComponent::sample_from_stack(
|
||||||
&mut self.component_stack,
|
&mut self.component_stack,
|
||||||
&pos,
|
&pos,
|
||||||
&sample_options,
|
&sample_options,
|
||||||
);
|
);
|
||||||
surface_y.floor() as i32 + 1
|
surface_y.floor() as i32
|
||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user