fix spacebar bug, fix ios depth buffer error, parallelize raytracing
This commit is contained in:
@@ -281,7 +281,7 @@ bool App::gesture_end()
|
|||||||
}
|
}
|
||||||
bool App::key_down(kKey key)
|
bool App::key_down(kKey key)
|
||||||
{
|
{
|
||||||
if (key == kKey::KeySpacebar)
|
if (key == kKey::KeySpacebar && vr_active)
|
||||||
canvas->m_canvas->m_cam_rot = vr_rot;
|
canvas->m_canvas->m_cam_rot = vr_rot;
|
||||||
redraw = true;
|
redraw = true;
|
||||||
keys[(int)key] = true;
|
keys[(int)key] = true;
|
||||||
|
|||||||
@@ -2208,7 +2208,7 @@ void Canvas::draw_objects(std::function<void(const glm::mat4& camera, const glm:
|
|||||||
GLuint rboID;
|
GLuint rboID;
|
||||||
glGenRenderbuffers(1, &rboID);
|
glGenRenderbuffers(1, &rboID);
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, 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);
|
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||||
|
|
||||||
glm::mat4 proj = glm::perspective(glm::radians(90.f), 1.f, .01f, 1000.f);
|
glm::mat4 proj = glm::perspective(glm::radians(90.f), 1.f, .01f, 1000.f);
|
||||||
|
|||||||
@@ -281,7 +281,14 @@ void NodePanelGrid::bake_uvs()
|
|||||||
auto light_dir = glm::normalize(light_pos);
|
auto light_dir = glm::normalize(light_pos);
|
||||||
|
|
||||||
auto data_out = std::make_unique<uint8_t[]>(fb.getWidth() * fb.getHeight() * 4);
|
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++)
|
for (int y = 0; y < fb.getHeight(); y++)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
for (int x = 0; x < fb.getWidth(); x++)
|
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);
|
//stbi_write_jpg("bake-out.jpg", fb.getWidth(), fb.getHeight(), 4, data_out.get(), 75);
|
||||||
m_texture.update(data_out.get());
|
m_texture.update(data_out.get());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user