add command line interface handler and implement convert command from pano to jpg
This commit is contained in:
@@ -790,15 +790,20 @@ void ui::Canvas::export_equirectangular_thread(std::string data_path)
|
||||
gl_state gl;
|
||||
|
||||
App::I.async_start();
|
||||
auto pb = std::make_shared<NodeProgressBar>();
|
||||
pb->m_manager = &App::I.layout;
|
||||
pb->init();
|
||||
pb->create();
|
||||
pb->loaded();
|
||||
pb->m_progress->SetWidthP(0);
|
||||
pb->m_title->set_text("Export Pano Image");
|
||||
App::I.layout[App::I.main_id]->add_child(pb);
|
||||
App::I.async_update();
|
||||
|
||||
std::shared_ptr<NodeProgressBar> pb;
|
||||
if (App::I.layout.m_loaded)
|
||||
{
|
||||
pb = std::make_shared<NodeProgressBar>();
|
||||
pb->m_manager = &App::I.layout;
|
||||
pb->init();
|
||||
pb->create();
|
||||
pb->loaded();
|
||||
pb->m_progress->SetWidthP(0);
|
||||
pb->m_title->set_text("Export Pano Image");
|
||||
App::I.layout[App::I.main_id]->add_child(pb);
|
||||
App::I.async_update();
|
||||
}
|
||||
|
||||
// save viewport and clear color states
|
||||
GLint vp[4];
|
||||
@@ -861,11 +866,15 @@ void ui::Canvas::export_equirectangular_thread(std::string data_path)
|
||||
|
||||
progress++;
|
||||
float p = (float)progress / total * 100.f;
|
||||
pb->m_progress->SetWidthP(p);
|
||||
LOG("progress: %f", p);
|
||||
gl.save();
|
||||
App::I.async_update();
|
||||
gl.restore();
|
||||
|
||||
if (App::I.layout.m_loaded)
|
||||
{
|
||||
pb->m_progress->SetWidthP(p);
|
||||
gl.save();
|
||||
App::I.async_update();
|
||||
gl.restore();
|
||||
}
|
||||
}
|
||||
|
||||
//auto data = std::make_unique<uint8_t[]>(m_tmp[0].bytes());
|
||||
@@ -898,15 +907,19 @@ void ui::Canvas::export_equirectangular_thread(std::string data_path)
|
||||
{
|
||||
progress++;
|
||||
float p = (float)progress / total * 100.f;
|
||||
pb->m_progress->SetWidthP(p);
|
||||
LOG("progress: %f", p);
|
||||
gl.save();
|
||||
App::I.async_update();
|
||||
gl.restore();
|
||||
|
||||
if (App::I.layout.m_loaded)
|
||||
{
|
||||
pb->m_progress->SetWidthP(p);
|
||||
gl.save();
|
||||
App::I.async_update();
|
||||
gl.restore();
|
||||
}
|
||||
}
|
||||
|
||||
static char name[128];
|
||||
sprintf(name, "%s/latlong.jpg", data_path.c_str());
|
||||
sprintf(name, "%s", data_path.c_str());
|
||||
LOG("writing %s", name);
|
||||
jpge::params params;
|
||||
params.m_quality = 100;
|
||||
@@ -916,11 +929,15 @@ void ui::Canvas::export_equirectangular_thread(std::string data_path)
|
||||
{
|
||||
progress++;
|
||||
float p = (float)progress / total * 100.f;
|
||||
pb->m_progress->SetWidthP(p);
|
||||
LOG("progress: %f", p);
|
||||
gl.save();
|
||||
App::I.async_update();
|
||||
gl.restore();
|
||||
|
||||
if (App::I.layout.m_loaded)
|
||||
{
|
||||
pb->m_progress->SetWidthP(p);
|
||||
gl.save();
|
||||
App::I.async_update();
|
||||
gl.restore();
|
||||
}
|
||||
}
|
||||
|
||||
//int ret = stbi_write_png(name, m_latlong.getWidth(), m_latlong.getHeight(), 4, latlong_data.get(), m_latlong.stride());
|
||||
@@ -949,8 +966,11 @@ void ui::Canvas::export_equirectangular_thread(std::string data_path)
|
||||
glClearColor(cc[0], cc[1], cc[2], cc[3]);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
pb->destroy();
|
||||
App::I.async_update();
|
||||
if (App::I.layout.m_loaded)
|
||||
{
|
||||
pb->destroy();
|
||||
App::I.async_update();
|
||||
}
|
||||
App::I.async_end();
|
||||
}
|
||||
|
||||
@@ -1242,19 +1262,23 @@ void ui::Canvas::project_open_thread(std::string data_path)
|
||||
}
|
||||
|
||||
gl_state gl;
|
||||
App::I.async_start();
|
||||
auto pb = std::make_shared<NodeProgressBar>();
|
||||
pb->m_manager = &App::I.layout;
|
||||
pb->init();
|
||||
pb->create();
|
||||
pb->loaded();
|
||||
pb->m_progress->SetWidthP(0);
|
||||
pb->m_title->set_text("Opening Pano Project");
|
||||
App::I.layout[App::I.main_id]->add_child(pb);
|
||||
gl.save();
|
||||
App::I.async_update();
|
||||
gl.restore();
|
||||
App::I.async_end();
|
||||
std::shared_ptr<NodeProgressBar> pb;
|
||||
if (App::I.layout.m_loaded)
|
||||
{
|
||||
App::I.async_start();
|
||||
pb = std::make_shared<NodeProgressBar>();
|
||||
pb->m_manager = &App::I.layout;
|
||||
pb->init();
|
||||
pb->create();
|
||||
pb->loaded();
|
||||
pb->m_progress->SetWidthP(0);
|
||||
pb->m_title->set_text("Opening Pano Project");
|
||||
App::I.layout[App::I.main_id]->add_child(pb);
|
||||
gl.save();
|
||||
App::I.async_update();
|
||||
gl.restore();
|
||||
App::I.async_end();
|
||||
}
|
||||
|
||||
LOG("skip thumb");
|
||||
// skip thumbnail
|
||||
@@ -1315,15 +1339,20 @@ void ui::Canvas::project_open_thread(std::string data_path)
|
||||
std::copy(rgba, rgba + (imgw*imgh * 4), snap.image[plane_index].get());
|
||||
delete rgba;
|
||||
}
|
||||
|
||||
progress++;
|
||||
float p = (float)progress / total * 100.f;
|
||||
LOG("progress: %f", p);
|
||||
App::I.async_start();
|
||||
pb->m_progress->SetWidthP(p);
|
||||
gl.save();
|
||||
App::I.async_update();
|
||||
gl.restore();
|
||||
App::I.async_end();
|
||||
|
||||
if (App::I.layout.m_loaded)
|
||||
{
|
||||
App::I.async_start();
|
||||
pb->m_progress->SetWidthP(p);
|
||||
gl.save();
|
||||
App::I.async_update();
|
||||
gl.restore();
|
||||
App::I.async_end();
|
||||
}
|
||||
}
|
||||
|
||||
App::I.async_start();
|
||||
@@ -1333,14 +1362,19 @@ void ui::Canvas::project_open_thread(std::string data_path)
|
||||
m_order.push_back(n_order);
|
||||
App::I.async_end();
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
LOG("project restore from %s", data_path.c_str());
|
||||
App::I.async_start();
|
||||
pb->destroy();
|
||||
gl.save();
|
||||
App::I.async_update();
|
||||
gl.restore();
|
||||
App::I.async_end();
|
||||
|
||||
if (App::I.layout.m_loaded)
|
||||
{
|
||||
App::I.async_start();
|
||||
pb->destroy();
|
||||
gl.save();
|
||||
App::I.async_update();
|
||||
gl.restore();
|
||||
App::I.async_end();
|
||||
}
|
||||
}
|
||||
|
||||
ui::Image ui::Canvas::thumbnail_generate(int w, int h)
|
||||
|
||||
Reference in New Issue
Block a user