| 1 | // Copyright (C) 2022 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QQUICK3DLIGHTMAPPER_P_H |
| 5 | #define QQUICK3DLIGHTMAPPER_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtQuick3D/private/qquick3dnode_p.h> |
| 19 | |
| 20 | QT_BEGIN_NAMESPACE |
| 21 | |
| 22 | class Q_QUICK3D_EXPORT QQuick3DLightmapper : public QObject |
| 23 | { |
| 24 | Q_OBJECT |
| 25 | Q_PROPERTY(float opacityThreshold READ opacityThreshold WRITE setOpacityThreshold NOTIFY opacityThresholdChanged) |
| 26 | Q_PROPERTY(float bias READ bias WRITE setBias NOTIFY biasChanged) |
| 27 | Q_PROPERTY(bool adaptiveBiasEnabled READ isAdaptiveBiasEnabled WRITE setAdaptiveBiasEnabled NOTIFY adaptiveBiasEnabledChanged) |
| 28 | Q_PROPERTY(bool indirectLightEnabled READ isIndirectLightEnabled WRITE setIndirectLightEnabled NOTIFY indirectLightEnabledChanged) |
| 29 | Q_PROPERTY(int samples READ samples WRITE setSamples NOTIFY samplesChanged) |
| 30 | Q_PROPERTY(int indirectLightWorkgroupSize READ indirectLightWorkgroupSize WRITE setIndirectLightWorkgroupSize NOTIFY indirectLightWorkgroupSizeChanged) |
| 31 | Q_PROPERTY(int bounces READ bounces WRITE setBounces NOTIFY bouncesChanged) |
| 32 | Q_PROPERTY(float indirectLightFactor READ indirectLightFactor WRITE setIndirectLightFactor NOTIFY indirectLightFactorChanged) |
| 33 | Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged FINAL REVISION(6, 10)) |
| 34 | Q_PROPERTY(float denoiseSigma READ denoiseSigma WRITE setDenoiseSigma NOTIFY denoiseSigmaChanged FINAL REVISION(6, 10)) |
| 35 | Q_PROPERTY(float texelsPerUnit READ texelsPerUnit WRITE setTexelsPerUnit NOTIFY texelsPerUnitChanged FINAL REVISION(6, 10)) |
| 36 | |
| 37 | QML_NAMED_ELEMENT(Lightmapper) |
| 38 | |
| 39 | public: |
| 40 | float opacityThreshold() const; |
| 41 | float bias() const; |
| 42 | bool isAdaptiveBiasEnabled() const; |
| 43 | bool isIndirectLightEnabled() const; |
| 44 | int samples() const; |
| 45 | int indirectLightWorkgroupSize() const; |
| 46 | int bounces() const; |
| 47 | float indirectLightFactor() const; |
| 48 | Q_REVISION(6, 10) QUrl source() const; |
| 49 | Q_REVISION(6, 10) float denoiseSigma() const; |
| 50 | Q_REVISION(6, 10) float texelsPerUnit() const; |
| 51 | |
| 52 | public Q_SLOTS: |
| 53 | void setOpacityThreshold(float opacity); |
| 54 | void setBias(float bias); |
| 55 | void setAdaptiveBiasEnabled(bool enabled); |
| 56 | void setIndirectLightEnabled(bool enabled); |
| 57 | void setSamples(int count); |
| 58 | void setIndirectLightWorkgroupSize(int size); |
| 59 | void setBounces(int count); |
| 60 | void setIndirectLightFactor(float factor); |
| 61 | Q_REVISION(6, 10) void setSource(const QUrl &source); |
| 62 | Q_REVISION(6, 10) void setDenoiseSigma(float newDenoiseSigma); |
| 63 | Q_REVISION(6, 10) void setTexelsPerUnit(float newTexelsPerUnit); |
| 64 | |
| 65 | Q_SIGNALS: |
| 66 | void changed(); |
| 67 | void opacityThresholdChanged(); |
| 68 | void biasChanged(); |
| 69 | void adaptiveBiasEnabledChanged(); |
| 70 | void indirectLightEnabledChanged(); |
| 71 | void samplesChanged(); |
| 72 | void indirectLightWorkgroupSizeChanged(); |
| 73 | void bouncesChanged(); |
| 74 | void indirectLightFactorChanged(); |
| 75 | Q_REVISION(6, 10) void sourceChanged(); |
| 76 | Q_REVISION(6, 10) void denoiseSigmaChanged(); |
| 77 | Q_REVISION(6, 10) void texelsPerUnitChanged(); |
| 78 | |
| 79 | private: |
| 80 | // keep the defaults in sync with the default values in QSSGLightmapperOptions |
| 81 | float m_opacityThreshold = 0.5f; |
| 82 | float m_bias = 0.005f; |
| 83 | bool m_adaptiveBias = true; |
| 84 | bool m_indirectLight = true; |
| 85 | int m_samples = 256; |
| 86 | int m_workgroupSize = 32; |
| 87 | int m_bounces = 3; |
| 88 | float m_indirectFactor = 1.0f; |
| 89 | QUrl m_source = QUrl::fromLocalFile(QStringLiteral("lightmaps.bin" )); |
| 90 | float m_denoiseSigma = 8.f; |
| 91 | float m_texelsPerUnit = 1.f; |
| 92 | }; |
| 93 | |
| 94 | QT_END_NAMESPACE |
| 95 | |
| 96 | #endif // QQUICK3DLIGHTMAPPER_P_H |
| 97 | |