mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix deprecated imports
This commit is contained in:
parent
cbe4d9d807
commit
fb7bdd8bf8
@ -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;
|
||||
|
@ -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?
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user