From e95421c2ed20d67bafa122904cdd26ecf771d010 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Sat, 12 Jan 2019 18:01:23 +0100 Subject: [PATCH] fix spacebar bug, fix ios depth buffer error, parallelize raytracing --- src/app_events.cpp | 2 +- src/canvas.cpp | 2 +- src/node_panel_grid.cpp | 10 ++++++++++ src/pch.h | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/app_events.cpp b/src/app_events.cpp index 560c7ee..e5426ef 100644 --- a/src/app_events.cpp +++ b/src/app_events.cpp @@ -281,7 +281,7 @@ bool App::gesture_end() } bool App::key_down(kKey key) { - if (key == kKey::KeySpacebar) + if (key == kKey::KeySpacebar && vr_active) canvas->m_canvas->m_cam_rot = vr_rot; redraw = true; keys[(int)key] = true; diff --git a/src/canvas.cpp b/src/canvas.cpp index 679a936..f1c9204 100644 --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -2208,7 +2208,7 @@ void Canvas::draw_objects(std::function(fb.getWidth() * fb.getHeight() * 4); +#if _WIN32 + concurrency::parallel_for(int(0), fb.getHeight(), [&](int y) +#elif __IOS__ || __OSX__ + dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + dispatch_apply(count, queue, ^(size_t i) +#else for (int y = 0; y < fb.getHeight(); y++) +#endif { for (int x = 0; x < fb.getWidth(); x++) { @@ -321,6 +328,9 @@ void NodePanelGrid::bake_uvs() } } } +#if _WIN32 || __IOS__ || __OSX__ + ); +#endif //stbi_write_jpg("bake-out.jpg", fb.getWidth(), fb.getHeight(), 4, data_out.get(), 75); m_texture.update(data_out.get()); } diff --git a/src/pch.h b/src/pch.h index cbd96b7..30ddd05 100644 --- a/src/pch.h +++ b/src/pch.h @@ -66,6 +66,7 @@ #include #include #include + #include #define SHADER_VERSION "#version 150\n" #define PP_OS "win"