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,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());
}