summaryrefslogtreecommitdiffstats
path: root/src/datavis3d/engine/bars3drenderer.cpp
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2013-08-15 13:41:41 +0300
committerTomi Korpipää <tomi.korpipaa@digia.com>2013-08-15 13:53:59 +0300
commitd916ae58fcaf3d34481b672d916eb454d646010d (patch)
tree9df86ebc023ee7a30bbc8c469e9528c4b41b99f0 /src/datavis3d/engine/bars3drenderer.cpp
parentaa1f1539b73edc06dafd9fd157070bbfaf2a2ef6 (diff)
High aspect-ratio shadows fix
Task-number: QTRD-2178 Change-Id: I463d177e82d0da1bdd2a803a1f597b3e650e084c Change-Id: I463d177e82d0da1bdd2a803a1f597b3e650e084c Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com> Reviewed-by: Pasi Keränen <pasi.keranen@digia.com>
Diffstat (limited to 'src/datavis3d/engine/bars3drenderer.cpp')
-rw-r--r--src/datavis3d/engine/bars3drenderer.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/datavis3d/engine/bars3drenderer.cpp b/src/datavis3d/engine/bars3drenderer.cpp
index fee2b883..b071aa8e 100644
--- a/src/datavis3d/engine/bars3drenderer.cpp
+++ b/src/datavis3d/engine/bars3drenderer.cpp
@@ -512,7 +512,6 @@ void Bars3dRenderer::drawScene(CameraHelper *camera,
// Get light position (rotate light with camera, a bit above it (as set in defaultLightPos))
QVector3D lightPos = camera->calculateLightPosition(defaultLightPos);
- //lightPos = QVector3D(0.0f, 4.0f, zComp); // center of bars, 4.0f above - for testing
// Skip depth rendering if we're in slice mode
// TODO: Fix this, causes problems if depth rendering is off in slice mode
@@ -537,8 +536,8 @@ void Bars3dRenderer::drawScene(CameraHelper *camera,
// Get the depth view matrix
// It may be possible to hack lightPos here if we want to make some tweaks to shadow
- QVector3D depthLightPos = lightPos;
- depthLightPos.setY(lightPos.y() - 0.5f);
+ QVector3D depthLightPos = camera->calculateLightPosition(
+ QVector3D(0.0f, 0.0f, zComp), 0.0f, 1.5f / m_autoScaleAdjustment);
depthViewMatrix.lookAt(depthLightPos, QVector3D(0.0f, -m_yAdjustment, zComp),
QVector3D(0.0f, 1.0f, 0.0f));
// TODO: Why does depthViewMatrix.column(3).y() goes to zero when we're directly above? That causes the scene to be not drawn from above -> must be fixed
@@ -546,7 +545,7 @@ void Bars3dRenderer::drawScene(CameraHelper *camera,
// Set the depth projection matrix
#ifndef USE_WIDER_SHADOWS
// Use this for perspective shadows
- depthProjectionMatrix.perspective(20.0f, (GLfloat)m_mainViewPort.width()
+ depthProjectionMatrix.perspective(15.0f, (GLfloat)m_mainViewPort.width()
/ (GLfloat)m_mainViewPort.height(), 3.0f, 100.0f);
#else
// Use these for orthographic shadows