fix spacebar bug, fix ios depth buffer error, parallelize raytracing

This commit is contained in:
2019-01-12 18:01:23 +01:00
parent d5b5946b3d
commit e95421c2ed
4 changed files with 13 additions and 2 deletions

View File

@@ -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;

View File

@@ -2208,7 +2208,7 @@ void Canvas::draw_objects(std::function<void(const glm::mat4& camera, const glm:
GLuint rboID;
glGenRenderbuffers(1, &rboID);
glBindRenderbuffer(GL_RENDERBUFFER, rboID);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, layer.w, layer.h);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, layer.w, layer.h);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
glm::mat4 proj = glm::perspective(glm::radians(90.f), 1.f, .01f, 1000.f);

View File

@@ -281,7 +281,14 @@ void NodePanelGrid::bake_uvs()
auto light_dir = glm::normalize(light_pos);
auto data_out = std::make_unique<uint8_t[]>(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());
}

View File

@@ -66,6 +66,7 @@
#include <shlobj.h>
#include <shlwapi.h>
#include <openvr.h>
#include <ppl.h>
#define SHADER_VERSION "#version 150\n"
#define PP_OS "win"