import facebook 360 stripe
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -16,3 +16,5 @@ android/android.iml
|
|||||||
android/local.properties
|
android/local.properties
|
||||||
data/brushes
|
data/brushes
|
||||||
data/thumbs
|
data/thumbs
|
||||||
|
PanoPainter.aps
|
||||||
|
panopainter-log.txt
|
||||||
|
|||||||
@@ -809,27 +809,58 @@ void ui::Canvas::import_equirectangular(std::string file_path)
|
|||||||
|
|
||||||
void ui::Canvas::import_equirectangular_thread(std::string file_path)
|
void ui::Canvas::import_equirectangular_thread(std::string file_path)
|
||||||
{
|
{
|
||||||
Texture2D tex;
|
|
||||||
gl_state gl;
|
|
||||||
App::I.async_start();
|
App::I.async_start();
|
||||||
|
|
||||||
|
gl_state gl;
|
||||||
gl.save();
|
gl.save();
|
||||||
snap_history({0,1,2,3,4,5});
|
snap_history({0,1,2,3,4,5});
|
||||||
tex.load_file(file_path);
|
|
||||||
ui::Sphere sphere;
|
Image img;
|
||||||
glDisable(GL_DEPTH_TEST);
|
img.load_file(file_path);
|
||||||
sphere.create<64, 64>(2.f);
|
|
||||||
draw_objects([&](const glm::mat4& camera, const glm::mat4& proj){
|
if (img.width == img.height / 6)
|
||||||
m_sampler.bind(0);
|
{
|
||||||
glActiveTexture(GL_TEXTURE0);
|
Texture2D tex;
|
||||||
tex.bind();
|
static GLint indices[] = { 5, 1, 4, 0, 2, 3 };
|
||||||
ShaderManager::use(ui::kShader::Texture);
|
static GLint formats[] = { GL_RED, GL_RG, GL_RGB, GL_RGBA };
|
||||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
static GLint iformats[] = { GL_R8, GL_RG8, GL_RGB8, GL_RGBA8 };
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, proj * camera *
|
tex.create(img.width, img.width, iformats[img.comp - 1], formats[img.comp - 1]);
|
||||||
glm::eulerAngleY(glm::radians(-90.f)) * glm::scale(glm::vec3(1,-1,1)));
|
int stride = img.width * img.width * img.comp;
|
||||||
sphere.draw_fill();
|
ui::Plane plane;
|
||||||
tex.unbind();
|
plane.create<1>(2, 2);
|
||||||
m_sampler.unbind();
|
draw_objects([&](const glm::mat4& camera, const glm::mat4& proj, int i) {
|
||||||
});
|
tex.update(img.m_data.get() + indices[i] * stride);
|
||||||
|
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, glm::scale(glm::vec3(1, -1, 1)));
|
||||||
|
plane.draw_fill();
|
||||||
|
tex.unbind();
|
||||||
|
m_sampler.unbind();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Texture2D tex;
|
||||||
|
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, int i) {
|
||||||
|
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++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
m_layers[m_current_layer_idx].m_dirty_box[i] = glm::vec4(0, 0, m_width, m_height);
|
m_layers[m_current_layer_idx].m_dirty_box[i] = glm::vec4(0, 0, m_width, m_height);
|
||||||
@@ -1531,7 +1562,7 @@ ui::Image ui::Canvas::thumbnail_read(std::string data_path)
|
|||||||
return std::move(thumb);
|
return std::move(thumb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ui::Canvas::draw_objects(std::function<void(const glm::mat4& camera, const glm::mat4& proj)> observer, Layer& layer)
|
void ui::Canvas::draw_objects(std::function<void(const glm::mat4& camera, const glm::mat4& proj, int i)> observer, Layer& layer)
|
||||||
{
|
{
|
||||||
// save viewport and clear color states
|
// save viewport and clear color states
|
||||||
GLint vp[4];
|
GLint vp[4];
|
||||||
@@ -1550,7 +1581,7 @@ void ui::Canvas::draw_objects(std::function<void(const glm::mat4& camera, const
|
|||||||
glm::mat4 plane_camera = glm::lookAt(glm::vec3(0), m_plane_origin[i], m_plane_tangent[i]);
|
glm::mat4 plane_camera = glm::lookAt(glm::vec3(0), m_plane_origin[i], m_plane_tangent[i]);
|
||||||
layer.m_rtt[i].bindFramebuffer();
|
layer.m_rtt[i].bindFramebuffer();
|
||||||
|
|
||||||
observer(plane_camera, proj);
|
observer(plane_camera, proj, i);
|
||||||
|
|
||||||
layer.m_rtt[i].unbindFramebuffer();
|
layer.m_rtt[i].unbindFramebuffer();
|
||||||
}
|
}
|
||||||
@@ -1562,7 +1593,7 @@ void ui::Canvas::draw_objects(std::function<void(const glm::mat4& camera, const
|
|||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ui::Canvas::draw_objects(std::function<void(const glm::mat4& camera, const glm::mat4& proj)> observer)
|
void ui::Canvas::draw_objects(std::function<void(const glm::mat4& camera, const glm::mat4& proj, int i)> observer)
|
||||||
{
|
{
|
||||||
draw_objects(observer, m_layers[m_current_layer_idx]);
|
draw_objects(observer, m_layers[m_current_layer_idx]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,8 +145,8 @@ public:
|
|||||||
ui::Image thumbnail_generate(int w, int h);
|
ui::Image thumbnail_generate(int w, int h);
|
||||||
ui::Image thumbnail_read(std::string data_path);
|
ui::Image thumbnail_read(std::string data_path);
|
||||||
void preview_generate();
|
void preview_generate();
|
||||||
void draw_objects(std::function<void(const glm::mat4& camera, const glm::mat4& proj)>);
|
void draw_objects(std::function<void(const glm::mat4& camera, const glm::mat4& proj, int i)>);
|
||||||
void draw_objects(std::function<void(const glm::mat4& camera, const glm::mat4& proj)>, Layer& layer);
|
void draw_objects(std::function<void(const glm::mat4& camera, const glm::mat4& proj, int i)>, Layer& layer);
|
||||||
bool ray_intersect(glm::vec3 ray_origin, glm::vec3 ray_dir, glm::vec3 plane_origin,
|
bool ray_intersect(glm::vec3 ray_origin, glm::vec3 ray_dir, glm::vec3 plane_origin,
|
||||||
glm::vec3 plane_normal, glm::vec3 plane_tangent, glm::vec3 &out_hit);
|
glm::vec3 plane_normal, glm::vec3 plane_tangent, glm::vec3 &out_hit);
|
||||||
void point_unproject(glm::vec2 loc, glm::vec4 vp, glm::mat4 camera, glm::mat4 proj,
|
void point_unproject(glm::vec2 loc, glm::vec4 vp, glm::mat4 camera, glm::mat4 proj,
|
||||||
|
|||||||
2
libs/glm
2
libs/glm
Submodule libs/glm updated: 9f1aae08f7...1190ae0b0e
Submodule libs/stb/stb updated: 3e7f2d6ebd...9d9f75eb68
Submodule libs/tinyxml2 updated: 5b733ff481...e1b50439c9
Reference in New Issue
Block a user