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
20QT_BEGIN_NAMESPACE
21
22class 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
34 QML_NAMED_ELEMENT(Lightmapper)
35
36public:
37 float opacityThreshold() const;
38 float bias() const;
39 bool isAdaptiveBiasEnabled() const;
40 bool isIndirectLightEnabled() const;
41 int samples() const;
42 int indirectLightWorkgroupSize() const;
43 int bounces() const;
44 float indirectLightFactor() const;
45
46public Q_SLOTS:
47 void setOpacityThreshold(float opacity);
48 void setBias(float bias);
49 void setAdaptiveBiasEnabled(bool enabled);
50 void setIndirectLightEnabled(bool enabled);
51 void setSamples(int count);
52 void setIndirectLightWorkgroupSize(int size);
53 void setBounces(int count);
54 void setIndirectLightFactor(float factor);
55
56Q_SIGNALS:
57 void changed();
58 void opacityThresholdChanged();
59 void biasChanged();
60 void adaptiveBiasEnabledChanged();
61 void indirectLightEnabledChanged();
62 void samplesChanged();
63 void indirectLightWorkgroupSizeChanged();
64 void bouncesChanged();
65 void indirectLightFactorChanged();
66
67private:
68 // keep the defaults in sync with the default values in QSSGLightmapperOptions
69 float m_opacityThreshold = 0.5f;
70 float m_bias = 0.005f;
71 bool m_adaptiveBias = true;
72 bool m_indirectLight = true;
73 int m_samples = 256;
74 int m_workgroupSize = 32;
75 int m_bounces = 3;
76 float m_indirectFactor = 1.0f;
77};
78
79QT_END_NAMESPACE
80
81#endif // QQUICK3DLIGHTMAPPER_P_H
82

source code of qtquick3d/src/quick3d/qquick3dlightmapper_p.h