1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QSSGPOINTLIGHT_H
5#define QSSGPOINTLIGHT_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/qquick3dabstractlight_p.h>
19
20#include <QColor>
21
22QT_BEGIN_NAMESPACE
23
24class Q_QUICK3D_EXPORT QQuick3DPointLight : public QQuick3DAbstractLight
25{
26 Q_OBJECT
27 Q_PROPERTY(float constantFade READ constantFade WRITE setConstantFade NOTIFY constantFadeChanged)
28 Q_PROPERTY(float linearFade READ linearFade WRITE setLinearFade NOTIFY linearFadeChanged)
29 Q_PROPERTY(float quadraticFade READ quadraticFade WRITE setQuadraticFade NOTIFY quadraticFadeChanged)
30
31 QML_NAMED_ELEMENT(PointLight)
32
33public:
34 explicit QQuick3DPointLight(QQuick3DNode *parent = nullptr);
35 ~QQuick3DPointLight() override {}
36
37 float constantFade() const;
38 float linearFade() const;
39 float quadraticFade() const;
40
41public Q_SLOTS:
42 void setConstantFade(float constantFade);
43 void setLinearFade(float linearFade);
44 void setQuadraticFade(float quadraticFade);
45
46Q_SIGNALS:
47 void constantFadeChanged();
48 void linearFadeChanged();
49 void quadraticFadeChanged();
50
51protected:
52 QSSGRenderGraphObject *updateSpatialNode(QSSGRenderGraphObject *node) override;
53
54private:
55 float m_constantFade = 1.0f;
56 float m_linearFade = 0.0f;
57 float m_quadraticFade = 1.0f;
58};
59
60QT_END_NAMESPACE
61#endif // QSSGPOINTLIGHT_H
62

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