-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Removed gaiku 2d references - Added Chunkify and ChunkifyMut - Added rustfmt - Replaced mod with named files - Removed unneeded deps - Runned clippy
- Loading branch information
Showing
35 changed files
with
1,947 additions
and
1,985 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,68 @@ | ||
use criterion::{criterion_group, Criterion}; | ||
use gaiku_3d::{ | ||
bakers::HeightMapBaker, | ||
common::{Baker, Chunk, FileFormat}, | ||
formats::GoxReader, | ||
bakers::HeightMapBaker, | ||
common::{Baker, Chunk, Chunkify, FileFormat}, | ||
formats::GoxReader, | ||
}; | ||
|
||
fn get_chunks(name: &str) -> Vec<Chunk> { | ||
let file = format!( | ||
"{}/examples/assets/{}.gox", | ||
env!("CARGO_MANIFEST_DIR"), | ||
name | ||
); | ||
let file = format!( | ||
"{}/examples/assets/{}.gox", | ||
env!("CARGO_MANIFEST_DIR"), | ||
name | ||
); | ||
|
||
GoxReader::read(&file) | ||
GoxReader::read(&file) | ||
} | ||
|
||
fn heightmap_benchmark(c: &mut Criterion) { | ||
let mut group = c.benchmark_group("HeightMap"); | ||
let chunks = get_chunks("terrain"); | ||
let mut group = c.benchmark_group("HeightMap"); | ||
let chunks = get_chunks("terrain"); | ||
|
||
group.bench_function("Terrain", |b| { | ||
b.iter(|| { | ||
let mut meshes = vec![]; | ||
group.bench_function("Terrain", |b| { | ||
b.iter(|| { | ||
let mut meshes = vec![]; | ||
|
||
for chunk in chunks.iter() { | ||
let mesh = HeightMapBaker::bake(chunk); | ||
if let Some(mesh) = mesh { | ||
meshes.push((mesh, chunk.position())); | ||
} | ||
} | ||
}) | ||
}); | ||
for chunk in chunks.iter() { | ||
let mesh = HeightMapBaker::bake(chunk); | ||
if let Some(mesh) = mesh { | ||
meshes.push((mesh, chunk.position())); | ||
} | ||
} | ||
}) | ||
}); | ||
|
||
let chunks = get_chunks("planet"); | ||
let chunks = get_chunks("planet"); | ||
|
||
group.bench_function("Planet", |b| { | ||
b.iter(|| { | ||
let mut meshes = vec![]; | ||
group.bench_function("Planet", |b| { | ||
b.iter(|| { | ||
let mut meshes = vec![]; | ||
|
||
for chunk in chunks.iter() { | ||
let mesh = HeightMapBaker::bake(chunk); | ||
if let Some(mesh) = mesh { | ||
meshes.push((mesh, chunk.position())); | ||
} | ||
} | ||
}) | ||
}); | ||
for chunk in chunks.iter() { | ||
let mesh = HeightMapBaker::bake(chunk); | ||
if let Some(mesh) = mesh { | ||
meshes.push((mesh, chunk.position())); | ||
} | ||
} | ||
}) | ||
}); | ||
|
||
let chunks = get_chunks("small_tree"); | ||
let chunks = get_chunks("small_tree"); | ||
|
||
group.bench_function("Small tree", |b| { | ||
b.iter(|| { | ||
let mut meshes = vec![]; | ||
group.bench_function("Small tree", |b| { | ||
b.iter(|| { | ||
let mut meshes = vec![]; | ||
|
||
for chunk in chunks.iter() { | ||
let mesh = HeightMapBaker::bake(chunk); | ||
if let Some(mesh) = mesh { | ||
meshes.push((mesh, chunk.position())); | ||
} | ||
} | ||
}) | ||
}); | ||
for chunk in chunks.iter() { | ||
let mesh = HeightMapBaker::bake(chunk); | ||
if let Some(mesh) = mesh { | ||
meshes.push((mesh, chunk.position())); | ||
} | ||
} | ||
}) | ||
}); | ||
|
||
group.finish(); | ||
group.finish(); | ||
} | ||
|
||
criterion_group!(benches, heightmap_benchmark); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,68 @@ | ||
use criterion::{criterion_group, Criterion}; | ||
use gaiku_3d::{ | ||
bakers::MarchingCubesBaker, | ||
common::{Baker, Chunk, FileFormat}, | ||
formats::GoxReader, | ||
bakers::MarchingCubesBaker, | ||
common::{Baker, Chunk, Chunkify, FileFormat}, | ||
formats::GoxReader, | ||
}; | ||
|
||
fn get_chunks(name: &str) -> Vec<Chunk> { | ||
let file = format!( | ||
"{}/examples/assets/{}.gox", | ||
env!("CARGO_MANIFEST_DIR"), | ||
name | ||
); | ||
let file = format!( | ||
"{}/examples/assets/{}.gox", | ||
env!("CARGO_MANIFEST_DIR"), | ||
name | ||
); | ||
|
||
GoxReader::read(&file) | ||
GoxReader::read(&file) | ||
} | ||
|
||
fn marching_cubes_benchmark(c: &mut Criterion) { | ||
let mut group = c.benchmark_group("Marching cubes"); | ||
let chunks = get_chunks("terrain"); | ||
let mut group = c.benchmark_group("Marching cubes"); | ||
let chunks = get_chunks("terrain"); | ||
|
||
group.bench_function("Terrain", |b| { | ||
b.iter(|| { | ||
let mut meshes = vec![]; | ||
group.bench_function("Terrain", |b| { | ||
b.iter(|| { | ||
let mut meshes = vec![]; | ||
|
||
for chunk in chunks.iter() { | ||
let mesh = MarchingCubesBaker::bake(chunk); | ||
if let Some(mesh) = mesh { | ||
meshes.push((mesh, chunk.position())); | ||
} | ||
} | ||
}) | ||
}); | ||
for chunk in chunks.iter() { | ||
let mesh = MarchingCubesBaker::bake(chunk); | ||
if let Some(mesh) = mesh { | ||
meshes.push((mesh, chunk.position())); | ||
} | ||
} | ||
}) | ||
}); | ||
|
||
let chunks = get_chunks("planet"); | ||
let chunks = get_chunks("planet"); | ||
|
||
group.bench_function("Planet", |b| { | ||
b.iter(|| { | ||
let mut meshes = vec![]; | ||
group.bench_function("Planet", |b| { | ||
b.iter(|| { | ||
let mut meshes = vec![]; | ||
|
||
for chunk in chunks.iter() { | ||
let mesh = MarchingCubesBaker::bake(chunk); | ||
if let Some(mesh) = mesh { | ||
meshes.push((mesh, chunk.position())); | ||
} | ||
} | ||
}) | ||
}); | ||
for chunk in chunks.iter() { | ||
let mesh = MarchingCubesBaker::bake(chunk); | ||
if let Some(mesh) = mesh { | ||
meshes.push((mesh, chunk.position())); | ||
} | ||
} | ||
}) | ||
}); | ||
|
||
let chunks = get_chunks("small_tree"); | ||
let chunks = get_chunks("small_tree"); | ||
|
||
group.bench_function("Small tree", |b| { | ||
b.iter(|| { | ||
let mut meshes = vec![]; | ||
group.bench_function("Small tree", |b| { | ||
b.iter(|| { | ||
let mut meshes = vec![]; | ||
|
||
for chunk in chunks.iter() { | ||
let mesh = MarchingCubesBaker::bake(chunk); | ||
if let Some(mesh) = mesh { | ||
meshes.push((mesh, chunk.position())); | ||
} | ||
} | ||
}) | ||
}); | ||
for chunk in chunks.iter() { | ||
let mesh = MarchingCubesBaker::bake(chunk); | ||
if let Some(mesh) = mesh { | ||
meshes.push((mesh, chunk.position())); | ||
} | ||
} | ||
}) | ||
}); | ||
|
||
group.finish(); | ||
group.finish(); | ||
} | ||
|
||
criterion_group!(benches, marching_cubes_benchmark); |
Oops, something went wrong.