From 824cf363f6ab999d2fc38ebdab1f7faae5559ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= Date: Wed, 14 May 2014 11:19:28 +0300 Subject: Added option to use orthographic projection Task-number: QTRD-3078 Change-Id: I07ebc2b7edd542cd28e405dfc80282f18b7a7314 Reviewed-by: Mika Salmela Reviewed-by: Miikka Heikkinen --- src/datavisualization/engine/surface3drenderer.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/datavisualization/engine/surface3drenderer.cpp') diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp index a75cf699..30ffc381 100644 --- a/src/datavisualization/engine/surface3drenderer.cpp +++ b/src/datavisualization/engine/surface3drenderer.cpp @@ -733,7 +733,7 @@ void Surface3DRenderer::render(GLuint defaultFboHandle) cache->sliceSelectionPointer()->render(defaultFboHandle); } if (cache->mainPointerActive() && cache->renderable()) - cache->mainSelectionPointer()->render(defaultFboHandle); + cache->mainSelectionPointer()->render(defaultFboHandle, m_useOrthoProjection); } } } @@ -1040,8 +1040,16 @@ void Surface3DRenderer::drawScene(GLuint defaultFboHandle) // Set up projection matrix QMatrix4x4 projectionMatrix; - projectionMatrix.perspective(45.0f, (GLfloat)m_primarySubViewport.width() - / (GLfloat)m_primarySubViewport.height(), 0.1f, 100.0f); + GLfloat viewPortRatio = (GLfloat)m_primarySubViewport.width() + / (GLfloat)m_primarySubViewport.height(); + 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); + } const Q3DCamera *activeCamera = m_cachedScene->activeCamera(); -- cgit v1.2.3