Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests and benches #43

Merged
merged 5 commits into from
Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
35 changes: 34 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ version = "0.1.0"
authors = ["Norman Paniagua <[email protected]>"]
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"]
Expand All @@ -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]
Expand All @@ -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"]
3 changes: 0 additions & 3 deletions benches/benchmarks/mod.rs

This file was deleted.

11 changes: 7 additions & 4 deletions benches/benchmarks/heightmap.rs → benches/heightmap.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
use criterion::{criterion_group, Criterion};
use gaiku_3d::{
bakers::HeightMapBaker,
use criterion::{criterion_group, criterion_main, Criterion};
use gaiku::{
common::{
chunk::Chunk,
mesh::Mesh,
prelude::*,
texture::{Texture2d, TextureAtlas2d},
Result,
},
formats::GoxReader,
GoxReader, HeightMapBaker,
};

fn get_chunks(name: &str) -> Result<(Vec<Chunk>, Option<TextureAtlas2d<Texture2d>>)> {
Expand Down Expand Up @@ -84,3 +83,7 @@ fn heightmap_benchmark(c: &mut Criterion) {
}

criterion_group!(benches, heightmap_benchmark);

criterion_main! {
benches,
}
10 changes: 0 additions & 10 deletions benches/main.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
use criterion::{criterion_group, Criterion};
use gaiku_3d::{
bakers::MarchingCubesBaker,
use criterion::{criterion_group, criterion_main, Criterion};
use gaiku::{
common::{
chunk::Chunk,
mesh::Mesh,
prelude::*,
texture::{Texture2d, TextureAtlas2d},
Result,
},
formats::GoxReader,
GoxReader, MarchingCubesBaker,
};

fn get_chunks(name: &str) -> Result<(Vec<Chunk>, Option<TextureAtlas2d<Texture2d>>)> {
Expand Down Expand Up @@ -84,3 +83,7 @@ fn marching_cubes_benchmark(c: &mut Criterion) {
}

criterion_group!(benches, marching_cubes_benchmark);

criterion_main! {
benches,
}
11 changes: 7 additions & 4 deletions benches/benchmarks/voxel.rs → benches/voxel.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
use criterion::{criterion_group, Criterion};
use gaiku_3d::{
bakers::VoxelBaker,
use criterion::{criterion_group, criterion_main, Criterion};
use gaiku::{
common::{
chunk::Chunk,
mesh::Mesh,
prelude::*,
texture::{Texture2d, TextureAtlas2d},
Result,
},
formats::GoxReader,
GoxReader, VoxelBaker,
};

fn get_chunks(name: &str) -> Result<(Vec<Chunk>, Option<TextureAtlas2d<Texture2d>>)> {
Expand Down Expand Up @@ -84,3 +83,7 @@ fn voxel_benchmark(c: &mut Criterion) {
}

criterion_group!(benches, voxel_benchmark);

criterion_main! {
benches,
}
19 changes: 15 additions & 4 deletions integrations/gaiku_amethyst/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion integrations/gaiku_amethyst/examples/terrain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down