mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix warnings in examples and benchmarks.
This commit is contained in:
parent
1d6d0ea03d
commit
49e7e55cd6
@ -47,7 +47,7 @@ use std::{
|
|||||||
use uvth::{ThreadPool, ThreadPoolBuilder};
|
use uvth::{ThreadPool, ThreadPoolBuilder};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use world::{
|
use world::{
|
||||||
sim::{FileOpts, WorldOpts, WORLD_SIZE},
|
sim::{FileOpts, WorldOpts, DEFAULT_WORLD_MAP, WORLD_SIZE},
|
||||||
World,
|
World,
|
||||||
};
|
};
|
||||||
const CLIENT_TIMEOUT: f64 = 20.0; // Seconds
|
const CLIENT_TIMEOUT: f64 = 20.0; // Seconds
|
||||||
@ -116,11 +116,7 @@ impl Server {
|
|||||||
opts.clone()
|
opts.clone()
|
||||||
} else {
|
} else {
|
||||||
// Load default map from assets.
|
// Load default map from assets.
|
||||||
//
|
FileOpts::LoadAsset(DEFAULT_WORLD_MAP.into())
|
||||||
// TODO: Consider using some naming convention to automatically change this
|
|
||||||
// with changing versions, or at least keep it in a constant somewhere that's
|
|
||||||
// easy to change.
|
|
||||||
FileOpts::LoadAsset("world.map.veloren_0_5_0_0".into())
|
|
||||||
},
|
},
|
||||||
..WorldOpts::default()
|
..WorldOpts::default()
|
||||||
},
|
},
|
||||||
|
@ -6,7 +6,7 @@ use criterion::{black_box, criterion_group, criterion_main, Benchmark, Criterion
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use veloren_voxygen::mesh::Meshable;
|
use veloren_voxygen::mesh::Meshable;
|
||||||
use world::World;
|
use world::{sim, World};
|
||||||
|
|
||||||
const CENTER: Vec2<i32> = Vec2 { x: 512, y: 512 };
|
const CENTER: Vec2<i32> = Vec2 { x: 512, y: 512 };
|
||||||
const GEN_SIZE: i32 = 4;
|
const GEN_SIZE: i32 = 4;
|
||||||
@ -14,7 +14,17 @@ const GEN_SIZE: i32 = 4;
|
|||||||
pub fn criterion_benchmark(c: &mut Criterion) {
|
pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
// Generate chunks here to test
|
// Generate chunks here to test
|
||||||
let mut terrain = TerrainGrid::new().unwrap();
|
let mut terrain = TerrainGrid::new().unwrap();
|
||||||
let world = World::generate(42);
|
let world = World::generate(
|
||||||
|
42,
|
||||||
|
sim::WorldOpts {
|
||||||
|
// NOTE: If this gets too expensive, we can turn it off.
|
||||||
|
// TODO: Consider an option to turn off all erosion as well, or even provide altitude
|
||||||
|
// directly with a closure.
|
||||||
|
seed_elements: true,
|
||||||
|
world_file: sim::FileOpts::LoadAsset(sim::DEFAULT_WORLD_MAP.into()),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
);
|
||||||
(0..GEN_SIZE)
|
(0..GEN_SIZE)
|
||||||
.flat_map(|x| (0..GEN_SIZE).map(move |y| Vec2::new(x, y)))
|
.flat_map(|x| (0..GEN_SIZE).map(move |y| Vec2::new(x, y)))
|
||||||
.map(|offset| offset + CENTER)
|
.map(|offset| offset + CENTER)
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
use common::{terrain::TerrainChunkSize, vol::RectVolSize};
|
use common::{terrain::TerrainChunkSize, vol::RectVolSize};
|
||||||
// use self::Mode::*;
|
// use self::Mode::*;
|
||||||
use std::{f32, f64, path::PathBuf};
|
use std::{f64, path::PathBuf};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use veloren_world::{
|
use veloren_world::{
|
||||||
sim::{self, MapConfig, MapDebug, RiverKind, WorldOpts, WORLD_SIZE},
|
sim::{self, MapConfig, MapDebug, WorldOpts, WORLD_SIZE},
|
||||||
util::Sampler,
|
|
||||||
World, CONFIG,
|
World, CONFIG,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -57,7 +56,7 @@ fn main() {
|
|||||||
let mut gain = CONFIG.mountain_scale;
|
let mut gain = CONFIG.mountain_scale;
|
||||||
// The Z component during normal calculations is multiplied by gain; thus,
|
// The Z component during normal calculations is multiplied by gain; thus,
|
||||||
let mut lgain = 1.0;
|
let mut lgain = 1.0;
|
||||||
let mut scale = (WORLD_SIZE.x as f64 / W as f64);
|
let mut scale = WORLD_SIZE.x as f64 / W as f64;
|
||||||
|
|
||||||
// Right-handed coordinate system: light is going left, down, and "backwards" (i.e. on the
|
// Right-handed coordinate system: light is going left, down, and "backwards" (i.e. on the
|
||||||
// map, where we translate the y coordinate on the world map to z in the coordinate system,
|
// map, where we translate the y coordinate on the world map to z in the coordinate system,
|
||||||
|
@ -215,6 +215,13 @@ pub enum WorldFile {
|
|||||||
/// Data for the most recent map type. Update this when you add a new map verson.
|
/// Data for the most recent map type. Update this when you add a new map verson.
|
||||||
pub type ModernMap = WorldMap_0_5_0;
|
pub type ModernMap = WorldMap_0_5_0;
|
||||||
|
|
||||||
|
/// The default world map.
|
||||||
|
///
|
||||||
|
/// TODO: Consider using some naming convention to automatically change this
|
||||||
|
/// with changing versions, or at least keep it in a constant somewhere that's
|
||||||
|
/// easy to change.
|
||||||
|
pub const DEFAULT_WORLD_MAP: &'static str = "world.map.veloren_0_5_0_0";
|
||||||
|
|
||||||
impl WorldFileLegacy {
|
impl WorldFileLegacy {
|
||||||
#[inline]
|
#[inline]
|
||||||
/// Idea: each map type except the latest knows how to transform
|
/// Idea: each map type except the latest knows how to transform
|
||||||
|
Loading…
Reference in New Issue
Block a user