fix cubes export layers order
This commit is contained in:
@@ -1270,11 +1270,11 @@ void ui::Canvas::export_cubes(std::string data_path)
|
|||||||
const int stride = m_width * 4;
|
const int stride = m_width * 4;
|
||||||
auto buffer = std::make_unique<uint8_t[]>(m_width * m_height * 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);
|
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++)
|
for (int plane = 0; plane < 6; plane++)
|
||||||
{
|
{
|
||||||
auto& l = m_layers[i];
|
auto& l = m_layers[m_order[layer]];
|
||||||
l.m_rtt[plane].bindFramebuffer();
|
l.m_rtt[plane].bindFramebuffer();
|
||||||
glReadPixels(0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, buffer.get());
|
glReadPixels(0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, buffer.get());
|
||||||
l.m_rtt[plane].unbindFramebuffer();
|
l.m_rtt[plane].unbindFramebuffer();
|
||||||
@@ -1305,7 +1305,7 @@ void ui::Canvas::export_cubes(std::string data_path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char name[128];
|
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);
|
int ret = stbi_write_png(name, m_width, m_height, 4, buffer.get(), 0);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user