fix depth export, improve VR UI interaction
This commit is contained in:
@@ -143,13 +143,11 @@ void Canvas::clear(const glm::vec4& c/*={0,0,0,1}*/)
|
||||
snap_history({ 0, 1, 2, 3, 4, 5 });
|
||||
m_layers[m_current_layer_idx]->clear(c);
|
||||
m_unsaved = true;
|
||||
draw_merge();
|
||||
}
|
||||
void Canvas::clear_all()
|
||||
{
|
||||
for (auto& l : m_layers)
|
||||
l->clear({0, 0, 0, 0});
|
||||
draw_merge();
|
||||
}
|
||||
void Canvas::snap_history(const std::vector<int>& planes)
|
||||
{
|
||||
@@ -630,8 +628,6 @@ void Canvas::stroke_draw()
|
||||
stroke_commit();
|
||||
m_current_stroke = nullptr;
|
||||
}
|
||||
|
||||
draw_merge(merge_faces);
|
||||
}
|
||||
bool Canvas::point_trace(glm::vec2 loc, glm::vec3& ray_origin, glm::vec3& ray_dir,
|
||||
glm::vec3& hit_pos, glm::vec2& fb_pos, glm::vec3& hit_normal, int& out_plane_id)
|
||||
@@ -897,13 +893,10 @@ void Canvas::stroke_commit()
|
||||
action->m_canvas = this;
|
||||
//action->m_stroke = std::move(m_current_stroke);
|
||||
ActionManager::add(action);
|
||||
|
||||
draw_merge();
|
||||
}
|
||||
|
||||
void Canvas::draw_merge(std::array<bool, 6> faces /*= SIXPLETTE(false)*/)
|
||||
{
|
||||
return;
|
||||
gl_state gl;
|
||||
gl.save();
|
||||
glViewport(0, 0, m_width, m_height);
|
||||
@@ -1237,7 +1230,6 @@ void Canvas::layer_add(std::string name)
|
||||
m_layers.back()->create(m_width, m_height, name);
|
||||
m_order.push_back(idx);
|
||||
m_current_layer_idx = idx;
|
||||
draw_merge();
|
||||
}
|
||||
void Canvas::layer_remove(int idx) // m_order index
|
||||
{
|
||||
@@ -1249,12 +1241,10 @@ void Canvas::layer_remove(int idx) // m_order index
|
||||
m_layers.erase(m_layers.begin() + n);
|
||||
m_order.erase(m_order.begin() + idx);
|
||||
m_current_layer_idx = m_order[std::min<int>((int)m_layers.size() - 1, idx)];
|
||||
draw_merge();
|
||||
}
|
||||
void Canvas::layer_order(int idx, int pos) // m_order index
|
||||
{
|
||||
std::swap(m_order[idx], m_order[pos]);
|
||||
draw_merge();
|
||||
}
|
||||
void Canvas::layer_merge(int source_idx, int dest_idx) // m_layer index
|
||||
{
|
||||
@@ -1347,7 +1337,6 @@ void Canvas::layer_merge(int source_idx, int dest_idx) // m_layer index
|
||||
action->m_stroke = std::move(m_current_stroke);
|
||||
ActionManager::add(action);
|
||||
*/
|
||||
draw_merge();
|
||||
}
|
||||
void Canvas::resize(int width, int height)
|
||||
{
|
||||
@@ -1367,12 +1356,12 @@ void Canvas::resize(int width, int height)
|
||||
//#endif
|
||||
m_tex2[i].create(width, height, GL_RGBA8);
|
||||
}
|
||||
m_layers_merge.resize(width, height);
|
||||
for (auto& l : m_layers)
|
||||
l->resize(width, height);
|
||||
m_smask.create(width, height, "mask");
|
||||
//m_merge_rtt.create(width, height);
|
||||
//m_merge_tex.create(width, height);
|
||||
m_layers_merge.resize(width, height);
|
||||
m_merge_rtt.create(width, height);
|
||||
m_merge_tex.create(width, height);
|
||||
m_unsaved = true;
|
||||
}
|
||||
|
||||
@@ -1385,13 +1374,13 @@ void Canvas::destroy()
|
||||
m_tex[i].destroy();
|
||||
m_tex2[i].destroy();
|
||||
}
|
||||
m_layers_merge.destroy();
|
||||
for (auto& l : m_layers)
|
||||
l->destroy();
|
||||
m_smask.destroy();
|
||||
m_mixer.destroy();
|
||||
//m_merge_rtt.destroy();
|
||||
//m_merge_tex.destroy();
|
||||
m_layers_merge.destroy();
|
||||
m_merge_rtt.destroy();
|
||||
m_merge_tex.destroy();
|
||||
}
|
||||
|
||||
bool Canvas::create(int width, int height)
|
||||
@@ -1432,15 +1421,14 @@ bool Canvas::create(int width, int height)
|
||||
m_brush_shape.create();
|
||||
m_mesh.create();
|
||||
m_brush_mix.create(8, 8);
|
||||
m_layers_merge.create(width, height, "merge");
|
||||
for (auto& l : m_layers)
|
||||
l->create(width, height, "");
|
||||
m_smask.create(width, height, "mask");
|
||||
//m_smask.clear({1, 1, 1, 1});
|
||||
//m_merge_rtt.create(width, height);
|
||||
//m_merge_tex.create(width, height);
|
||||
m_layers_merge.create(width, height, "merge");
|
||||
m_merge_rtt.create(width, height);
|
||||
m_merge_tex.create(width, height);
|
||||
m_unsaved = true;
|
||||
draw_merge();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1871,6 +1859,8 @@ void Canvas::export_depth_thread(std::string file_name)
|
||||
gl_state gl;
|
||||
gl.save();
|
||||
|
||||
draw_merge();
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user