Fix deprecated imports

This commit is contained in:
tygyh 2022-07-15 16:17:19 +02:00
parent cbe4d9d807
commit fb7bdd8bf8
10 changed files with 18 additions and 21 deletions

View File

@ -29,7 +29,7 @@ use common::{
volumes::vol_grid_2d::{VolGrid2d, VolGrid2dError},
};
use common_base::{prof_span, span};
use core::{f32, fmt::Debug, i32, marker::PhantomData, time::Duration};
use core::{f32, fmt::Debug, marker::PhantomData, time::Duration};
use crossbeam_channel as channel;
use enum_iterator::IntoEnumIterator;
use guillotiere::AtlasAllocator;

View File

@ -1,7 +1,7 @@
use iced::{
layout, Clipboard, Element, Event, Hasher, Layout, Length, Point, Rectangle, Size, Widget,
};
use std::{hash::Hash, u32};
use std::hash::Hash;
// Note: it might be more efficient to make this generic over the content type?

View File

@ -1,7 +1,7 @@
use iced::{
layout, Clipboard, Element, Event, Hasher, Layout, Length, Point, Rectangle, Size, Widget,
};
use std::{hash::Hash, u32};
use std::hash::Hash;
// TODO: decouple from image/compound graphic widgets (they could still use
// common types, but the info we want here for the background is a subset of

View File

@ -50,7 +50,7 @@ use conrod_core::{
widget::{self, id::Generator},
Rect, Scalar, UiBuilder, UiCell,
};
use core::{convert::TryInto, f32, f64, ops::Range};
use core::{convert::TryInto, f64, ops::Range};
use graphic::TexId;
use hashbrown::hash_map::Entry;
use std::time::Duration;

View File

@ -189,7 +189,7 @@ pub fn block_from_structure(
let field = RandomField::new(structure_seed);
let lerp = ((field.get(Vec3::from(structure_pos)).rem_euclid(256)) as f32 / 255.0) * 0.8
+ ((field.get(pos + std::i32::MAX / 2).rem_euclid(256)) as f32 / 255.0) * 0.2;
+ ((field.get(pos + i32::MAX / 2).rem_euclid(256)) as f32 / 255.0) * 0.2;
match sblock {
StructureBlock::None => None,

View File

@ -15,10 +15,7 @@ use common::{
};
use noise::NoiseFn;
use serde::Deserialize;
use std::{
f32,
ops::{Add, Div, Mul, Sub},
};
use std::ops::{Add, Div, Mul, Sub};
use tracing::error;
use vek::*;
@ -535,7 +532,7 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
// 0.0 = not near river, 1.0 = in middle of river
let near_center = ((river_dist / (river_width * 0.5)) as f32)
.min(1.0)
.mul(f32::consts::PI)
.mul(std::f32::consts::PI)
.cos()
.add(1.0)
.mul(0.5);
@ -743,7 +740,7 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
const MIN_DEPTH: f32 = 1.0;
let near_center = ((river_dist / (river_width * 0.5)) as f32)
.min(1.0)
.mul(f32::consts::PI)
.mul(std::f32::consts::PI)
.cos()
.add(1.0)
.mul(0.5);

View File

@ -18,7 +18,7 @@ use rayon::prelude::*;
use std::{
cmp::{Ordering, Reverse},
collections::BinaryHeap,
f32, f64, fmt, mem,
f32, fmt, mem,
time::Instant,
u32,
};
@ -555,8 +555,8 @@ fn get_max_slope(
rock_strength_nz: &(impl NoiseFn<[f64; 3]> + Sync),
height_scale: impl Fn(usize) -> Alt + Sync,
) -> Box<[f64]> {
let min_max_angle = (15.0 / 360.0 * 2.0 * f64::consts::PI).tan();
let max_max_angle = (60.0 / 360.0 * 2.0 * f64::consts::PI).tan();
let min_max_angle = (15.0 / 360.0 * 2.0 * std::f64::consts::PI).tan();
let max_max_angle = (60.0 / 360.0 * 2.0 * std::f64::consts::PI).tan();
let max_angle_range = max_max_angle - min_max_angle;
h.par_iter()
.enumerate()
@ -572,7 +572,7 @@ fn get_max_slope(
// Logistic regression. Make sure x ∈ (0, 1).
let logit = |x: f64| x.ln() - (-x).ln_1p();
// 0.5 + 0.5 * tanh(ln(1 / (1 - 0.1) - 1) / (2 * (sqrt(3)/pi)))
let logistic_2_base = 3.0f64.sqrt() * f64::consts::FRAC_2_PI;
let logistic_2_base = 3.0f64.sqrt() * std::f64::consts::FRAC_2_PI;
// Assumes μ = 0, σ = 1
let logistic_cdf = |x: f64| (x / logistic_2_base).tanh() * 0.5 + 0.5;
@ -860,7 +860,7 @@ fn erode(
// max angle of slope depends on rock strength, which is computed from noise
// function. TODO: Make more principled.
let mid_slope = (30.0 / 360.0 * 2.0 * f64::consts::PI).tan();
let mid_slope = (30.0 / 360.0 * 2.0 * std::f64::consts::PI).tan();
type SimdType = f32;
type MaskType = m32;

View File

@ -10,7 +10,7 @@ use common::{
},
vol::RectVolSize,
};
use std::{f32, f64};
use std::f64;
use vek::*;
/// A sample function that grabs the connections at a chunk.

View File

@ -63,7 +63,7 @@ use rand_chacha::ChaChaRng;
use rayon::prelude::*;
use serde::{Deserialize, Serialize};
use std::{
f32, f64,
f32,
fs::File,
io::{BufReader, BufWriter},
ops::{Add, Div, Mul, Neg, Sub},
@ -652,7 +652,7 @@ impl WorldSim {
// Logistic regression. Make sure x ∈ (0, 1).
let logit = |x: f64| x.ln() - (-x).ln_1p();
// 0.5 + 0.5 * tanh(ln(1 / (1 - 0.1) - 1) / (2 * (sqrt(3)/pi)))
let logistic_2_base = 3.0f64.sqrt() * f64::consts::FRAC_2_PI;
let logistic_2_base = 3.0f64.sqrt() * std::f64::consts::FRAC_2_PI;
// Assumes μ = 0, σ = 1
let logistic_cdf = |x: f64| (x / logistic_2_base).tanh() * 0.5 + 0.5;
@ -2281,7 +2281,7 @@ impl SimChunk {
// Logistic regression. Make sure x ∈ (0, 1).
let logit = |x: f64| x.ln() - x.neg().ln_1p();
// 0.5 + 0.5 * tanh(ln(1 / (1 - 0.1) - 1) / (2 * (sqrt(3)/pi)))
let logistic_2_base = 3.0f64.sqrt().mul(f64::consts::FRAC_2_PI);
let logistic_2_base = 3.0f64.sqrt().mul(std::f64::consts::FRAC_2_PI);
// Assumes μ = 0, σ = 1
let logistic_cdf = |x: f64| x.div(logistic_2_base).tanh().mul(0.5).add(0.5);

View File

@ -92,7 +92,7 @@ impl Site {
let base_spawn_rules = SpawnRules {
trees: max_warp == 1.0,
max_warp,
paths: max_warp > std::f32::EPSILON,
paths: max_warp > f32::EPSILON,
waypoints: true,
};
self.plots