From 863b251903cfdfd5f698251e5aa07ce6c87d877a Mon Sep 17 00:00:00 2001 From: lisyarus Date: Fri, 15 Jan 2021 17:56:56 +0300 Subject: [PATCH] Support setting volume data size in cloud example --- examples/cloud.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/examples/cloud.cpp b/examples/cloud.cpp index bf5767b6..41a6605c 100644 --- a/examples/cloud.cpp +++ b/examples/cloud.cpp @@ -21,8 +21,11 @@ #include #include #include +#include #include +#include + using namespace psemek; template @@ -164,7 +167,7 @@ struct cloud_app float step; - float max_density = 6.f; + float max_density = 2.f; geom::interval harmonic_range; util::clock> clock; @@ -187,10 +190,9 @@ struct cloud_app gfx::texture_3d cloud_texture; gfx::texture_3d shadow_texture; - cloud_app() + cloud_app(std::size_t size) : app::app("Cloud") { - std::size_t size = 32; geom::vector cloud_size{2 * size, size, size}; bbox = {{{-2.f, 2.f}, {-1.f, 1.f}, {-1.f, 1.f}}}; @@ -243,7 +245,7 @@ struct cloud_app // can't use template argument deduction for first argument due to gcc bug // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89062 - geom::gradient g(std::make_pair(0.2f, 0.f), geom::easing_type::cubic, std::pair{0.4f, max_density}); + geom::gradient g(std::make_pair(0.2f, 0.f), geom::easing_type::quadratic_out, std::pair{0.3f, max_density}); util::array cloud_data({cloud_size[0], cloud_size[1], cloud_size[2]}); @@ -590,7 +592,18 @@ struct cloud_app } }; -int main() +int main(int argc, char ** argv) { - return app::main(); + if (argc != 1 && argc != 2) + { + std::cout << "Usage: " << argv[0] << " [ size ]\n"; + return 0; + } + + std::size_t size = 32; + if (argc == 2) + { + size = util::from_string(argv[1]); + } + return app::main(size); }