mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fine, removing box syntax.
This commit is contained in:
parent
398c18359d
commit
b69020b68e
@ -1,6 +1,5 @@
|
||||
#![deny(unsafe_code)]
|
||||
#![feature(
|
||||
box_syntax,
|
||||
const_generics,
|
||||
euclidean_division,
|
||||
bind_by_move_pattern_guards,
|
||||
|
@ -92,7 +92,9 @@ pub fn cdf_irwin_hall<const N: usize>(weights: &[f32; N], samples: [f32; N]) ->
|
||||
/// index (i.e. its position in a sorted list of value returned by the noise function applied to
|
||||
/// every chunk in the game). Second component is the cached value of the noise function that
|
||||
/// generated the index.
|
||||
pub type InverseCdf = Box<[(f32, f32); WORLD_SIZE.x * WORLD_SIZE.y]>;
|
||||
///
|
||||
/// NOTE: Length should always be WORLD_SIZE.x * WORLD_SIZE.y.
|
||||
pub type InverseCdf = Box<[(f32, f32)]>;
|
||||
|
||||
/// Computes the position Vec2 of a SimChunk from an index, where the index was generated by
|
||||
/// uniform_noise.
|
||||
@ -156,7 +158,7 @@ pub fn uniform_noise(f: impl Fn(usize, Vec2<f64>) -> f32) -> InverseCdf {
|
||||
// NOTE: Currently there doesn't seem to be a way to create a large fixed-size
|
||||
// array on the heap without overflowing the stack unless you use placement box (at least on
|
||||
// debug mode). So I want to keep using this until a better alternative is made available.
|
||||
let mut uniform_noise = box [(0.0, 0.0); WORLD_SIZE.x * WORLD_SIZE.y];
|
||||
let mut uniform_noise = vec![(0.0, 0.0); WORLD_SIZE.x * WORLD_SIZE.y].into_boxed_slice();
|
||||
let total = (WORLD_SIZE.x * WORLD_SIZE.y) as f32;
|
||||
for (noise_idx, (chunk_idx, noise_val)) in noise.into_iter().enumerate() {
|
||||
uniform_noise[chunk_idx] = ((1 + noise_idx) as f32 / total, noise_val);
|
||||
|
Loading…
Reference in New Issue
Block a user