From c035859f7536b808ef3a529a324e9c0ec45a62ab Mon Sep 17 00:00:00 2001 From: shun_iwasawa Date: Oct 18 2017 10:57:54 +0000 Subject: fix z transform --- diff --git a/toonz/sources/toonz/sceneviewer.cpp b/toonz/sources/toonz/sceneviewer.cpp index e2658e5..938c85b 100644 --- a/toonz/sources/toonz/sceneviewer.cpp +++ b/toonz/sources/toonz/sceneviewer.cpp @@ -879,8 +879,10 @@ void SceneViewer::resizeGL(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0, w, 0, h, -4000, 4000); + m_projectionMatrix.setToIdentity(); + m_projectionMatrix.ortho(0, w, 0, h, -4000, 4000); + glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.375, 0.375, 0.0); @@ -1650,7 +1652,8 @@ double SceneViewer::projectToZ(const TPoint &delta) { GLint viewport[4]; double modelview[16], projection[16]; glGetIntegerv(GL_VIEWPORT, viewport); - glGetDoublev(GL_PROJECTION_MATRIX, projection); + for (int i = 0; i < 16; i++) + projection[i] = (double)m_projectionMatrix.constData()[i]; glGetDoublev(GL_MODELVIEW_MATRIX, modelview); double ax, ay, az, bx, by, bz; diff --git a/toonz/sources/toonz/sceneviewer.h b/toonz/sources/toonz/sceneviewer.h index 65da547..d199263 100644 --- a/toonz/sources/toonz/sceneviewer.h +++ b/toonz/sources/toonz/sceneviewer.h @@ -24,6 +24,8 @@ #include "pane.h" #include "previewer.h" +#include + //===================================================================== // Forward declarations @@ -141,6 +143,8 @@ class SceneViewer final : public GLWidgetForHighDpi, bool m_isBusyOnTabletMove; + QMatrix4x4 m_projectionMatrix; + // iwsw commented out temporarily // Ghibli3DLutUtil * m_ghibli3DLutUtil; public: