1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the Qt API. It exists purely as an
9// implementation detail. This header file may change from version to
10// version without notice, or even be removed.
11//
12// We mean it.
13//
14
15#ifndef HEIGHTFIELDGEOMETRY_H
16#define HEIGHTFIELDGEOMETRY_H
17
18#include <QtQuick3D/private/qquick3dgeometry_p.h>
19
20// Workaround for QTBUG-94099, ensures qml_register_types...() is exported
21#include "qtquick3dhelpersglobal_p.h"
22
23QT_BEGIN_NAMESPACE
24
25class HeightFieldGeometry : public QQuick3DGeometry
26{
27 Q_OBJECT
28 Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged REVISION(6, 5))
29 Q_PROPERTY(bool smoothShading READ smoothShading WRITE setSmoothShading NOTIFY smoothShadingChanged)
30 Q_PROPERTY(QVector3D extents READ extents WRITE setExtents NOTIFY extentsChanged)
31 QML_NAMED_ELEMENT(HeightFieldGeometry)
32public:
33 HeightFieldGeometry();
34
35 const QUrl &source() const;
36 void setSource(const QUrl &newSource);
37
38 bool smoothShading() const;
39 void setSmoothShading(bool smooth);
40 const QVector3D &extents() const;
41 void setExtents(const QVector3D &newExtents);
42
43signals:
44 void sourceChanged();
45 void smoothShadingChanged();
46 void extentsChanged();
47
48private:
49 void updateData();
50 QVector3D m_extents = { 100, 100, 100 };
51 QUrl m_heightMapSource;
52 bool m_smoothShading = true;
53 bool m_extentsSetExplicitly = false;
54
55#if QT_DEPRECATED_SINCE(6, 5)
56 Q_PROPERTY(QUrl heightMap READ source WRITE setSource NOTIFY sourceChanged)
57#endif
58};
59
60QT_END_NAMESPACE
61
62#endif
63

source code of qtquick3d/src/helpers/heightfieldgeometry_p.h