summaryrefslogtreecommitdiffstats
path: root/src/datavisualization/engine/bars3drenderer.cpp
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2014-05-14 11:19:28 +0300
committerTomi Korpipää <tomi.korpipaa@digia.com>2014-05-14 11:27:55 +0300
commit824cf363f6ab999d2fc38ebdab1f7faae5559ad0 (patch)
tree7e86d13dae8619bffb2a22bd56a07de538d2f0ca /src/datavisualization/engine/bars3drenderer.cpp
parent5f9be2bd06a3f0f8286325ad1eb323aa692126eb (diff)
Added option to use orthographic projection
Task-number: QTRD-3078 Change-Id: I07ebc2b7edd542cd28e405dfc80282f18b7a7314 Reviewed-by: Mika Salmela <mika.salmela@digia.com> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'src/datavisualization/engine/bars3drenderer.cpp')
-rw-r--r--src/datavisualization/engine/bars3drenderer.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp
index 661c3f3e..459f8c25 100644
--- a/src/datavisualization/engine/bars3drenderer.cpp
+++ b/src/datavisualization/engine/bars3drenderer.cpp
@@ -445,8 +445,16 @@ void Bars3DRenderer::drawSlicedScene()
// Set up projection matrix
QMatrix4x4 projectionMatrix;
- projectionMatrix.perspective(35.0f, (GLfloat)m_secondarySubViewport.width()
- / (GLfloat)m_secondarySubViewport.height(), 0.1f, 100.0f);
+ GLfloat viewPortRatio = (GLfloat)m_primarySubViewport.width()
+ / (GLfloat)m_primarySubViewport.height();
+ if (m_useOrthoProjection) {
+ GLfloat orthoRatio = 2.0f / m_autoScaleAdjustment;
+ projectionMatrix.ortho(-viewPortRatio * orthoRatio, viewPortRatio * orthoRatio,
+ -orthoRatio, orthoRatio,
+ 0.0f, 100.0f);
+ } else {
+ projectionMatrix.perspective(35.0f, viewPortRatio, 0.1f, 100.0f);
+ }
// Set view matrix
QMatrix4x4 viewMatrix;
@@ -923,7 +931,14 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
QMatrix4x4 projectionMatrix;
GLfloat viewPortRatio = (GLfloat)m_primarySubViewport.width()
/ (GLfloat)m_primarySubViewport.height();
- projectionMatrix.perspective(45.0f, viewPortRatio, 0.1f, 100.0f);
+ if (m_useOrthoProjection) {
+ GLfloat orthoRatio = 2.0f;
+ projectionMatrix.ortho(-viewPortRatio * orthoRatio, viewPortRatio * orthoRatio,
+ -orthoRatio, orthoRatio,
+ 0.0f, 100.0f);
+ } else {
+ projectionMatrix.perspective(45.0f, viewPortRatio, 0.1f, 100.0f);
+ }
// Get the view matrix
QMatrix4x4 viewMatrix = activeCamera->d_ptr->viewMatrix();