1// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QT3DRENDER_QSPOTLIGHT_H
5#define QT3DRENDER_QSPOTLIGHT_H
6
7#include <Qt3DRender/qabstractlight.h>
8
9QT_BEGIN_NAMESPACE
10
11namespace Qt3DRender {
12
13class QSpotLightPrivate;
14
15class Q_3DRENDERSHARED_EXPORT QSpotLight : public QAbstractLight
16{
17 Q_OBJECT
18 Q_PROPERTY(float constantAttenuation READ constantAttenuation WRITE setConstantAttenuation NOTIFY constantAttenuationChanged)
19 Q_PROPERTY(float linearAttenuation READ linearAttenuation WRITE setLinearAttenuation NOTIFY linearAttenuationChanged)
20 Q_PROPERTY(float quadraticAttenuation READ quadraticAttenuation WRITE setQuadraticAttenuation NOTIFY quadraticAttenuationChanged)
21 Q_PROPERTY(QVector3D localDirection READ localDirection WRITE setLocalDirection NOTIFY localDirectionChanged)
22 Q_PROPERTY(float cutOffAngle READ cutOffAngle WRITE setCutOffAngle NOTIFY cutOffAngleChanged)
23
24public:
25 explicit QSpotLight(Qt3DCore::QNode *parent = nullptr);
26 ~QSpotLight();
27
28 QVector3D localDirection() const;
29 float cutOffAngle() const;
30
31 float constantAttenuation() const;
32 float linearAttenuation() const;
33 float quadraticAttenuation() const;
34
35public Q_SLOTS:
36 void setConstantAttenuation(float value);
37 void setLinearAttenuation(float value);
38 void setQuadraticAttenuation(float value);
39 void setLocalDirection(const QVector3D &localDirection);
40 void setCutOffAngle(float cutOffAngle);
41
42Q_SIGNALS:
43 void constantAttenuationChanged(float constantAttenuation);
44 void linearAttenuationChanged(float linearAttenuation);
45 void quadraticAttenuationChanged(float quadraticAttenuation);
46 void localDirectionChanged(const QVector3D &localDirection);
47 void cutOffAngleChanged(float cutOffAngle);
48
49protected:
50 explicit QSpotLight(QSpotLightPrivate &dd, Qt3DCore::QNode *parent = nullptr);
51
52private:
53 Q_DECLARE_PRIVATE(QSpotLight)
54};
55
56} // namespace Qt3DRender
57
58QT_END_NAMESPACE
59
60#endif // QT3DRENDER_QSPOTLIGHT_H
61

source code of qt3d/src/render/lights/qspotlight.h