Qt 6.x
The Qt SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
qssgrenderlayer.cpp
Go to the documentation of this file.
1// Copyright (C) 2008-2012 NVIDIA Corporation.
2// Copyright (C) 2019 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4
5
6#include <QtQuick3DRuntimeRender/private/qssgrenderlayer_p.h>
7#include <QtQuick3DRuntimeRender/private/qssgrendereffect_p.h>
8#include <QtQuick3DRuntimeRender/private/qssglayerrenderdata_p.h>
9
11
14 , firstEffect(nullptr)
15 , antialiasingMode(QSSGRenderLayer::AAMode::NoAA)
16 , antialiasingQuality(QSSGRenderLayer::AAQuality::High)
17 , background(QSSGRenderLayer::Background::Transparent)
18 , lightProbe(nullptr)
19 , probeExposure(1.0f)
20 , probeHorizon(-1.0f)
21 , temporalAAEnabled(false)
22 , temporalAAStrength(0.3f)
23 , ssaaEnabled(false)
24 , ssaaMultiplier(1.5f)
25 , specularAAEnabled(false)
26 , explicitCamera(nullptr)
27 , renderedCamera(nullptr)
28 , tonemapMode(TonemapMode::Linear)
29{
30 flags = { FlagT(LocalState::Active) | FlagT(GlobalState::Active) }; // The layer node is alway active and not dirty.
31}
32
34{
35 delete importSceneNode;
36 importSceneNode = nullptr;
37 delete renderData;
38}
39
41{
42 if (angles != probeOrientationAngles) {
45 }
46}
47
49{
50 // Effects need to be rendered in reverse order as described in the file.
51 inEffect.m_nextEffect = firstEffect;
52 firstEffect = &inEffect;
53}
54
56{
57 for (auto currentEffect = firstEffect; currentEffect != nullptr; currentEffect = currentEffect->m_nextEffect) {
58 if (currentEffect == inEffect)
59 return true;
60 }
61 return false;
62}
63
65{
66 // We create a dummy node to represent the imported scene tree, as we
67 // do absolutely not want to change the node links in that tree!
68 if (importSceneNode == nullptr) {
69 importSceneNode = new QSSGRenderNode(QSSGRenderGraphObject::Type::ImportScene);
70 // Now we can add the dummy node to the layers child list
72 } else {
73 importSceneNode->children.clear(); // Clear the list (or the list will modify the rootNode)
74 }
75
76 // The imported scene root node is now a child of the dummy node
77 auto &importChildren = importSceneNode->children;
78 Q_ASSERT(importChildren.isEmpty());
79 // We don't want the list to modify our node, so we set the tail and head manually.
80 importChildren.m_head = importChildren.m_tail = &rootNode;
81}
82
84{
86 if (&importSceneNode->children.back() == &rootNode)
88 }
89}
90
static QQuaternion fromEulerAngles(const QVector3D &eulerAngles)
QMatrix3x3 toRotationMatrix() const
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
Combined button and popup list for selecting options.
GLbitfield flags
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
QObject::connect nullptr
void clear()
clear will set the head and tail of the list to null.
QSSGRenderEffect * m_nextEffect
QMatrix3x3 probeOrientation
void addEffect(QSSGRenderEffect &inEffect)
void setProbeOrientation(const QVector3D &angles)
QSSGRenderNode * importSceneNode
QSSGLayerRenderData * renderData
void removeImportScene(QSSGRenderNode &rootNode)
bool hasEffect(QSSGRenderEffect *inEffect) const
QVector3D probeOrientationAngles
void setImportScene(QSSGRenderNode &rootNode)
QSSGRenderEffect * firstEffect
std::underlying_type_t< DirtyFlag > FlagT
Definition moc.h:24