diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e969476..d96be4c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -37,4 +37,10 @@ jobs: with: command: test toolchain: nightly - args: --verbose --all-features + args: --verbose --all-features --all + - name: Bench + uses: actions-rs/cargo@v1 + with: + command: bench + toolchain: nightly + args: --verbose --all-features --all diff --git a/Cargo.toml b/Cargo.toml index 4220e9c..2013266 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,9 +4,10 @@ version = "0.1.0" authors = ["Norman Paniagua "] edition = "2018" description = "3d agnostic framework (game engine) terrain engine." -exclude = ["gaiku-3d/examples/*"] +exclude = ["examples/*", "integrations/*/examples/*"] keywords = ["3d", "terrain", "engine", "gaiku"] categories = ["game-engines"] +resolver = "2" [features] default = ["voxel"] @@ -33,6 +34,7 @@ gaiku_format_gox = { path = "crates/gaiku_format_gox", version = "0.1.0", option gaiku_format_png = { path = "crates/gaiku_format_png", version = "0.1.0", optional = true } [dev-dependencies] +criterion = "0.3.4" obj-exporter = "0.2.0" [workspace] @@ -44,3 +46,34 @@ members = [ [profile.release] lto = true + +[[bench]] +name = "heightmap" +harness = false +required-features = ["heightmap", "gox"] + +[[bench]] +name = "marching_cubes" +harness = false +required-features = ["marching_cubes", "gox"] + +[[bench]] +name = "voxel" +harness = false +required-features = ["voxel", "gox"] + +[[example]] +name = "heightmap" +required-features = ["heightmap", "gox"] + +[[example]] +name = "marching_cubes" +required-features = ["marching_cubes", "gox"] + +[[example]] +name = "voxel" +required-features = ["voxel", "gox"] + +[[example]] +name = "texture" +required-features = ["png"] diff --git a/benches/benchmarks/mod.rs b/benches/benchmarks/mod.rs deleted file mode 100644 index d37d698..0000000 --- a/benches/benchmarks/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod heightmap; -pub mod marching_cubes; -pub mod voxel; diff --git a/benches/benchmarks/heightmap.rs b/benches/heightmap.rs similarity index 93% rename from benches/benchmarks/heightmap.rs rename to benches/heightmap.rs index 3313e32..7397ae9 100644 --- a/benches/benchmarks/heightmap.rs +++ b/benches/heightmap.rs @@ -1,6 +1,5 @@ -use criterion::{criterion_group, Criterion}; -use gaiku_3d::{ - bakers::HeightMapBaker, +use criterion::{criterion_group, criterion_main, Criterion}; +use gaiku::{ common::{ chunk::Chunk, mesh::Mesh, @@ -8,7 +7,7 @@ use gaiku_3d::{ texture::{Texture2d, TextureAtlas2d}, Result, }, - formats::GoxReader, + GoxReader, HeightMapBaker, }; fn get_chunks(name: &str) -> Result<(Vec, Option>)> { @@ -84,3 +83,7 @@ fn heightmap_benchmark(c: &mut Criterion) { } criterion_group!(benches, heightmap_benchmark); + +criterion_main! { + benches, +} diff --git a/benches/main.rs b/benches/main.rs deleted file mode 100644 index 48b8023..0000000 --- a/benches/main.rs +++ /dev/null @@ -1,10 +0,0 @@ -use benchmarks::*; -use criterion::criterion_main; - -mod benchmarks; - -criterion_main! { - heightmap::benches, - marching_cubes::benches, - voxel::benches, -} diff --git a/benches/benchmarks/marching_cubes.rs b/benches/marching_cubes.rs similarity index 93% rename from benches/benchmarks/marching_cubes.rs rename to benches/marching_cubes.rs index 591b351..2819e02 100644 --- a/benches/benchmarks/marching_cubes.rs +++ b/benches/marching_cubes.rs @@ -1,6 +1,5 @@ -use criterion::{criterion_group, Criterion}; -use gaiku_3d::{ - bakers::MarchingCubesBaker, +use criterion::{criterion_group, criterion_main, Criterion}; +use gaiku::{ common::{ chunk::Chunk, mesh::Mesh, @@ -8,7 +7,7 @@ use gaiku_3d::{ texture::{Texture2d, TextureAtlas2d}, Result, }, - formats::GoxReader, + GoxReader, MarchingCubesBaker, }; fn get_chunks(name: &str) -> Result<(Vec, Option>)> { @@ -84,3 +83,7 @@ fn marching_cubes_benchmark(c: &mut Criterion) { } criterion_group!(benches, marching_cubes_benchmark); + +criterion_main! { + benches, +} diff --git a/benches/benchmarks/voxel.rs b/benches/voxel.rs similarity index 93% rename from benches/benchmarks/voxel.rs rename to benches/voxel.rs index 99ffd07..7f2d7cf 100644 --- a/benches/benchmarks/voxel.rs +++ b/benches/voxel.rs @@ -1,6 +1,5 @@ -use criterion::{criterion_group, Criterion}; -use gaiku_3d::{ - bakers::VoxelBaker, +use criterion::{criterion_group, criterion_main, Criterion}; +use gaiku::{ common::{ chunk::Chunk, mesh::Mesh, @@ -8,7 +7,7 @@ use gaiku_3d::{ texture::{Texture2d, TextureAtlas2d}, Result, }, - formats::GoxReader, + GoxReader, VoxelBaker, }; fn get_chunks(name: &str) -> Result<(Vec, Option>)> { @@ -84,3 +83,7 @@ fn voxel_benchmark(c: &mut Criterion) { } criterion_group!(benches, voxel_benchmark); + +criterion_main! { + benches, +} diff --git a/integrations/gaiku_amethyst/Cargo.toml b/integrations/gaiku_amethyst/Cargo.toml index bbc1cd2..0d7e5c5 100644 --- a/integrations/gaiku_amethyst/Cargo.toml +++ b/integrations/gaiku_amethyst/Cargo.toml @@ -8,10 +8,21 @@ edition = "2018" amethyst_rendy = "0.15.3" gaiku_common = { path = "../../crates/gaiku_common", version = "0.1.0" } -[features] -empty = ["amethyst/empty"] -metal = ["amethyst/metal"] -vulkan = ["amethyst/vulkan"] +[target.'cfg(not(target_os = "macos"))'.dependencies.amethyst_rendy] +version = "0.15.3" +features = ["vulkan"] + +[target.'cfg(target_os = "macos")'.dependencies.amethyst_rendy] +version = "0.15.3" +features = ["metal"] + +[target.'cfg(not(target_os = "macos"))'.dev_dependencies.amethyst] +version = "0.15.3" +features = ["vulkan"] + +[target.'cfg(target_os = "macos")'.dev_dependencies.amethyst] +version = "0.15.3" +features = ["metal"] [[example]] name = "terrain" diff --git a/integrations/gaiku_amethyst/examples/terrain.rs b/integrations/gaiku_amethyst/examples/terrain.rs index 84538c3..8b21181 100644 --- a/integrations/gaiku_amethyst/examples/terrain.rs +++ b/integrations/gaiku_amethyst/examples/terrain.rs @@ -23,7 +23,9 @@ use amethyst::{ utils::application_root_dir, }; -use gaiku_3d::{bakers::VoxelBaker, common::chunk::Chunk, formats::GoxReader}; +use gaiku_baker_voxel::VoxelBaker; +use gaiku_common::chunk::Chunk; +use gaiku_format_gox::GoxReader; use gaiku_amethyst::prelude::*;