enable depth test when rendering the layers, reduce pan camera speed

This commit is contained in:
2017-05-10 01:53:09 +01:00
parent aada69d447
commit eb8f93af91
2 changed files with 4 additions and 1 deletions

View File

@@ -172,7 +172,7 @@ void CanvasModeCamera::on_MouseEvent(MouseEvent* me, glm::vec2& loc)
break;
case kEventType::MouseMove:
if (m_dragging)
canvas->m_cam_pos.xy = m_pos_start + (me->m_pos - m_drag_start) * glm::vec2(1, -1) * 0.01f;
canvas->m_cam_pos.xy = m_pos_start + (me->m_pos - m_drag_start) * glm::vec2(1, -1) * 0.001f;
break;
case kEventType::MouseCancel:
m_dragging = false;

View File

@@ -2043,6 +2043,8 @@ public:
auto blend = glIsEnabled(GL_BLEND);
glEnable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glClear(GL_DEPTH_BUFFER_BIT);
for (int plane_index = 0; plane_index < 6; plane_index++)
{
auto plane_mvp = proj * camera * glm::scale(glm::vec3(m_canvas->m_order.size())) * m_canvas->m_plane_transform[plane_index] * glm::translate(glm::vec3(0, 0, -1));
@@ -2076,6 +2078,7 @@ public:
}
}
}
glDisable(GL_DEPTH_TEST);
for (auto& mode : *m_canvas->m_mode)
mode->on_Draw(ortho_proj, proj, camera);