Merge branch 'james/dependency-dupes' into 'master'

Upgrade noise crate eliminating duplicate rand dependency

See merge request veloren/veloren!1679
This commit is contained in:
Joshua Barretto 2021-01-05 22:35:54 +00:00
commit 1d55dbd217
4 changed files with 26 additions and 29 deletions

31
Cargo.lock generated
View File

@ -3410,11 +3410,12 @@ dependencies = [
[[package]] [[package]]
name = "noise" name = "noise"
version = "0.6.0" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "337525774dd8a197b613a01ea88058ef0ed023e5ed1e4b7e93de478e1f2bf770" checksum = "82051dd6745d5184c6efb7bc8be14892a7f6d4f3ad6dbf754d1c7d7d5fe24b43"
dependencies = [ dependencies = [
"rand 0.5.6", "rand 0.7.3",
"rand_xorshift 0.2.0",
] ]
[[package]] [[package]]
@ -4201,19 +4202,6 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8"
[[package]]
name = "rand"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9"
dependencies = [
"cloudabi 0.0.3",
"fuchsia-cprng",
"libc",
"rand_core 0.3.1",
"winapi 0.3.9",
]
[[package]] [[package]]
name = "rand" name = "rand"
version = "0.6.5" version = "0.6.5"
@ -4229,7 +4217,7 @@ dependencies = [
"rand_jitter", "rand_jitter",
"rand_os", "rand_os",
"rand_pcg 0.1.2", "rand_pcg 0.1.2",
"rand_xorshift", "rand_xorshift 0.1.1",
"winapi 0.3.9", "winapi 0.3.9",
] ]
@ -4371,6 +4359,15 @@ dependencies = [
"rand_core 0.3.1", "rand_core 0.3.1",
] ]
[[package]]
name = "rand_xorshift"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77d416b86801d23dde1aa643023b775c3a462efc0ed96443add11546cdf1dca8"
dependencies = [
"rand_core 0.5.1",
]
[[package]] [[package]]
name = "raw-cpuid" name = "raw-cpuid"
version = "7.0.3" version = "7.0.3"

View File

@ -18,7 +18,7 @@ fxhash = "0.2.1"
image = { version = "0.23.12", default-features = false, features = ["png"] } image = { version = "0.23.12", default-features = false, features = ["png"] }
itertools = "0.9" itertools = "0.9"
vek = { version = "0.12.0", features = ["serde"] } vek = { version = "0.12.0", features = ["serde"] }
noise = { version = "0.6.0", default-features = false } noise = { version = "0.7", default-features = false }
num = "0.3.1" num = "0.3.1"
ordered-float = "2.0.1" ordered-float = "2.0.1"
hashbrown = { version = "0.9", features = ["rayon", "serde", "nightly"] } hashbrown = { version = "0.9", features = ["rayon", "serde", "nightly"] }

View File

@ -10,7 +10,7 @@ use common::{
use tracing::{debug, error, warn}; use tracing::{debug, error, warn};
// use faster::*; // use faster::*;
use itertools::izip; use itertools::izip;
use noise::{NoiseFn, Point3}; use noise::NoiseFn;
use num::{Float, Zero}; use num::{Float, Zero};
use ordered_float::NotNan; use ordered_float::NotNan;
use packed_simd::m32; use packed_simd::m32;
@ -551,7 +551,7 @@ pub fn get_rivers<F: fmt::Debug + Float + Into<f64>, G: Float + Into<f64>>(
fn get_max_slope( fn get_max_slope(
map_size_lg: MapSizeLg, map_size_lg: MapSizeLg,
h: &[Alt], h: &[Alt],
rock_strength_nz: &(impl NoiseFn<Point3<f64>> + Sync), rock_strength_nz: &(impl NoiseFn<[f64; 3]> + Sync),
height_scale: impl Fn(usize) -> Alt + Sync, height_scale: impl Fn(usize) -> Alt + Sync,
) -> Box<[f64]> { ) -> Box<[f64]> {
let min_max_angle = (15.0 / 360.0 * 2.0 * f64::consts::PI).tan(); let min_max_angle = (15.0 / 360.0 * 2.0 * f64::consts::PI).tan();
@ -697,7 +697,7 @@ fn erode(
max_g: f32, max_g: f32,
kdsed: f64, kdsed: f64,
_seed: &RandomField, _seed: &RandomField,
rock_strength_nz: &(impl NoiseFn<Point3<f64>> + Sync), rock_strength_nz: &(impl NoiseFn<[f64; 3]> + Sync),
uplift: impl Fn(usize) -> f32 + Sync, uplift: impl Fn(usize) -> f32 + Sync,
n_f: impl Fn(usize) -> f32 + Sync, n_f: impl Fn(usize) -> f32 + Sync,
m_f: impl Fn(usize) -> f32 + Sync, m_f: impl Fn(usize) -> f32 + Sync,
@ -2525,7 +2525,7 @@ pub fn do_erosion(
_max_uplift: f32, _max_uplift: f32,
n_steps: usize, n_steps: usize,
seed: &RandomField, seed: &RandomField,
rock_strength_nz: &(impl NoiseFn<Point3<f64>> + Sync), rock_strength_nz: &(impl NoiseFn<[f64; 3]> + Sync),
oldh: impl Fn(usize) -> f32 + Sync, oldh: impl Fn(usize) -> f32 + Sync,
oldb: impl Fn(usize) -> f32 + Sync, oldb: impl Fn(usize) -> f32 + Sync,
is_ocean: impl Fn(usize) -> bool + Sync, is_ocean: impl Fn(usize) -> bool + Sync,

View File

@ -3,7 +3,7 @@ use common::{
terrain::{neighbors, uniform_idx_as_vec2, vec2_as_uniform_idx, MapSizeLg, TerrainChunkSize}, terrain::{neighbors, uniform_idx_as_vec2, vec2_as_uniform_idx, MapSizeLg, TerrainChunkSize},
vol::RectVolSize, vol::RectVolSize,
}; };
use noise::{MultiFractal, NoiseFn, Perlin, Point2, Point3, Point4, Seedable}; use noise::{MultiFractal, NoiseFn, Perlin, Seedable};
use num::Float; use num::Float;
use rayon::prelude::*; use rayon::prelude::*;
use std::{f32, f64, ops::Mul, u32}; use std::{f32, f64, ops::Mul, u32};
@ -652,8 +652,8 @@ impl Seedable for HybridMulti {
} }
/// 2-dimensional `HybridMulti` noise /// 2-dimensional `HybridMulti` noise
impl NoiseFn<Point2<f64>> for HybridMulti { impl NoiseFn<[f64; 2]> for HybridMulti {
fn get(&self, mut point: Point2<f64>) -> f64 { fn get(&self, mut point: [f64; 2]) -> f64 {
// First unscaled octave of function; later octaves are scaled. // First unscaled octave of function; later octaves are scaled.
point = mul2(point, self.frequency); point = mul2(point, self.frequency);
// Offset and bias to scale into [offset - 1.0, 1.0 + offset] range. // Offset and bias to scale into [offset - 1.0, 1.0 + offset] range.
@ -692,8 +692,8 @@ impl NoiseFn<Point2<f64>> for HybridMulti {
} }
/// 3-dimensional `HybridMulti` noise /// 3-dimensional `HybridMulti` noise
impl NoiseFn<Point3<f64>> for HybridMulti { impl NoiseFn<[f64; 3]> for HybridMulti {
fn get(&self, mut point: Point3<f64>) -> f64 { fn get(&self, mut point: [f64; 3]) -> f64 {
// First unscaled octave of function; later octaves are scaled. // First unscaled octave of function; later octaves are scaled.
point = mul3(point, self.frequency); point = mul3(point, self.frequency);
// Offset and bias to scale into [offset - 1.0, 1.0 + offset] range. // Offset and bias to scale into [offset - 1.0, 1.0 + offset] range.
@ -732,8 +732,8 @@ impl NoiseFn<Point3<f64>> for HybridMulti {
} }
/// 4-dimensional `HybridMulti` noise /// 4-dimensional `HybridMulti` noise
impl NoiseFn<Point4<f64>> for HybridMulti { impl NoiseFn<[f64; 4]> for HybridMulti {
fn get(&self, mut point: Point4<f64>) -> f64 { fn get(&self, mut point: [f64; 4]) -> f64 {
// First unscaled octave of function; later octaves are scaled. // First unscaled octave of function; later octaves are scaled.
point = mul4(point, self.frequency); point = mul4(point, self.frequency);
// Offset and bias to scale into [offset - 1.0, 1.0 + offset] range. // Offset and bias to scale into [offset - 1.0, 1.0 + offset] range.