mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix meshing benchmark.
This commit is contained in:
parent
c95e07db3b
commit
051cd4934e
@ -15,7 +15,7 @@ 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, sim::WorldOpts {
|
let (world, index) = World::generate(42, sim::WorldOpts {
|
||||||
// NOTE: If this gets too expensive, we can turn it off.
|
// 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
|
// TODO: Consider an option to turn off all erosion as well, or even provide altitude
|
||||||
// directly with a closure.
|
// directly with a closure.
|
||||||
@ -23,10 +23,11 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
|||||||
world_file: sim::FileOpts::LoadAsset(sim::DEFAULT_WORLD_MAP.into()),
|
world_file: sim::FileOpts::LoadAsset(sim::DEFAULT_WORLD_MAP.into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
|
let index = index.as_index_ref();
|
||||||
(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)
|
||||||
.map(|pos| (pos, world.generate_chunk(pos, || false).unwrap()))
|
.map(|pos| (pos, world.generate_chunk(index, pos, || false).unwrap()))
|
||||||
.for_each(|(key, chunk)| {
|
.for_each(|(key, chunk)| {
|
||||||
terrain.insert(key, Arc::new(chunk.0));
|
terrain.insert(key, Arc::new(chunk.0));
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user