add file picking for osx and ios and implement equirectangular import
This commit is contained in:
@@ -800,6 +800,45 @@ void ui::Canvas::clear_context()
|
||||
}
|
||||
};
|
||||
|
||||
void ui::Canvas::import_equirectangular(std::string file_path)
|
||||
{
|
||||
std::thread t(&ui::Canvas::import_equirectangular_thread, this, file_path);
|
||||
t.detach();
|
||||
}
|
||||
|
||||
void ui::Canvas::import_equirectangular_thread(std::string file_path)
|
||||
{
|
||||
Texture2D tex;
|
||||
gl_state gl;
|
||||
App::I.async_start();
|
||||
gl.save();
|
||||
snap_history({0,1,2,3,4,5});
|
||||
tex.load_file(file_path);
|
||||
ui::Sphere sphere;
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
sphere.create<64, 64>(2.f);
|
||||
draw_objects([&](const glm::mat4& camera, const glm::mat4& proj){
|
||||
m_sampler.bind(0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
tex.bind();
|
||||
ShaderManager::use(ui::kShader::Texture);
|
||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
ShaderManager::u_mat4(kShaderUniform::MVP, proj * camera *
|
||||
glm::eulerAngleY(glm::radians(-90.f)) * glm::scale(glm::vec3(1,-1,1)));
|
||||
sphere.draw_fill();
|
||||
tex.unbind();
|
||||
m_sampler.unbind();
|
||||
});
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
m_dirty_box[i] = glm::vec4(0, 0, m_width, m_height);
|
||||
m_dirty_face[i] = true;
|
||||
}
|
||||
App::I.async_update();
|
||||
gl.restore();
|
||||
App::I.async_end();
|
||||
}
|
||||
|
||||
void ui::Canvas::export_equirectangular(std::string file_path)
|
||||
{
|
||||
std::thread t(&ui::Canvas::export_equirectangular_thread, this, file_path);
|
||||
|
||||
Reference in New Issue
Block a user