summaryrefslogtreecommitdiffstats
path: root/src/Runtime
diff options
context:
space:
mode:
authorKaj Grönholm <kaj.gronholm@qt.io>2019-05-09 16:00:41 +0300
committerKaj Grönholm <kaj.gronholm@qt.io>2019-05-10 06:34:18 +0000
commit8c6754f8e06ba3fa1c0f23be1eb04dfdc7c9170f (patch)
treea3548bfd970b45c1184ede96aa65729d8b6d9fd5 /src/Runtime
parentb1dd4b02cac875c2fa87c5271a283606aceb9bfe (diff)
Only utilize active cameras
This avoids different cameras being used for rendering and picking. Task-number: QT3DS-3360 Change-Id: I14b9730388ffdc2e11df0f1b0d9a6e29e37edc3a Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/Runtime')
-rw-r--r--src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRendererImplLayerRenderPreparationData.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRendererImplLayerRenderPreparationData.cpp b/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRendererImplLayerRenderPreparationData.cpp
index 72908544..d5aecc57 100644
--- a/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRendererImplLayerRenderPreparationData.cpp
+++ b/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRendererImplLayerRenderPreparationData.cpp
@@ -1255,13 +1255,18 @@ namespace render {
switch (theNode->m_Type) {
case GraphObjectTypes::Camera: {
SCamera *theCamera = static_cast<SCamera *>(theNode);
- SCameraGlobalCalculationResult theResult =
- thePrepResult.SetupCameraForRender(*theCamera);
- wasDataDirty = wasDataDirty || theResult.m_WasDirty;
- if (theCamera->m_Flags.IsGloballyActive())
- m_Camera = theCamera;
- if (theResult.m_ComputeFrustumSucceeded == false) {
- qCCritical(INTERNAL_ERROR, "Failed to calculate camera frustum");
+ if (theCamera->m_Flags.IsActive()) {
+ // Only proceed with camera nodes which are currently active.
+ // SetupCameraForRender() sets the camera used for picking and
+ // updates global state e.g. IsGloballyActive()
+ SCameraGlobalCalculationResult theResult =
+ thePrepResult.SetupCameraForRender(*theCamera);
+ wasDataDirty = wasDataDirty || theResult.m_WasDirty;
+ if (theCamera->m_Flags.IsGloballyActive())
+ m_Camera = theCamera;
+ if (theResult.m_ComputeFrustumSucceeded == false) {
+ qCCritical(INTERNAL_ERROR, "Failed to calculate camera frustum");
+ }
}
} break;
case GraphObjectTypes::Light: {