fix cubes export layers order

This commit is contained in:
2018-06-09 02:09:39 +02:00
parent 4a9ad0212d
commit 559db7d8e9

View File

@@ -1270,11 +1270,11 @@ void ui::Canvas::export_cubes(std::string data_path)
const int stride = m_width * 4;
auto buffer = std::make_unique<uint8_t[]>(m_width * m_height * 4);
auto flipped = std::make_unique<uint8_t[]>(m_width * m_height * 4);
for (auto i : m_order)
for (int layer = 0; layer < m_order.size(); layer++)
{
for (int plane = 0; plane < 6; plane++)
{
auto& l = m_layers[i];
auto& l = m_layers[m_order[layer]];
l.m_rtt[plane].bindFramebuffer();
glReadPixels(0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, buffer.get());
l.m_rtt[plane].unbindFramebuffer();
@@ -1305,7 +1305,7 @@ void ui::Canvas::export_cubes(std::string data_path)
}
static char name[128];
sprintf(name, "%s-%02d-%d.png", data_path.c_str(), i, plane);
sprintf(name, "%s-%02d-%d.png", data_path.c_str(), layer, plane);
int ret = stbi_write_png(name, m_width, m_height, 4, buffer.get(), 0);