QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
qgsdemterraintilegeometry_p.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsdemterraintilegeometry_p.h
3 --------------------------------------
4 Date : July 2017
5 Copyright : (C) 2017 by Martin Dobias
6 Email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSDEMTERRAINTILEGEOMETRY_P_H
17#define QGSDEMTERRAINTILEGEOMETRY_P_H
18
20
21//
22// W A R N I N G
23// -------------
24//
25// This file is not part of the QGIS API. It exists purely as an
26// implementation detail. This header file may change from version to
27// version without notice, or even be removed.
28//
29
30#define SIP_NO_FILE
31
32#include <Qt3DExtras/qt3dextras_global.h>
33#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
34#include <Qt3DRender/QGeometry>
35#else
36#include <Qt3DCore/QGeometry>
37#endif
38#include <QSize>
39
40#include <QImage>
41
42#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
43namespace Qt3DRender
44{
45 class QAttribute;
46 class QBuffer;
47}
48#else
49namespace Qt3DCore
50{
51 class QAttribute;
52 class QBuffer;
53}
54#endif
55
56namespace QgsRayCastingUtils
57{
58 class Ray3D;
59}
60
66#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
67class DemTerrainTileGeometry : public Qt3DRender::QGeometry
68#else
69class DemTerrainTileGeometry : public Qt3DCore::QGeometry
70#endif
71{
72 Q_OBJECT
73
74 public:
75
80 explicit DemTerrainTileGeometry( int resolution, float side, float vertScale, float skirtHeight, const QByteArray &heightMap, QNode *parent = nullptr );
81
82 bool rayIntersection( const QgsRayCastingUtils::Ray3D &ray, const QMatrix4x4 &worldTransform, QVector3D &intersectionPoint );
83
84#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
85 Qt3DRender::QAttribute *positionAttribute() { return mPositionAttribute; }
86 Qt3DRender::QAttribute *normalAttribute() { return mNormalAttribute; }
87 Qt3DRender::QAttribute *texCoordsAttribute() { return mTexCoordAttribute; }
88 Qt3DRender::QAttribute *indexAttribute() { return mIndexAttribute; }
89#else
90 Qt3DCore::QAttribute *positionAttribute() { return mPositionAttribute; }
91 Qt3DCore::QAttribute *normalAttribute() { return mNormalAttribute; }
92 Qt3DCore::QAttribute *texCoordsAttribute() { return mTexCoordAttribute; }
93 Qt3DCore::QAttribute *indexAttribute() { return mIndexAttribute; }
94#endif
95
96 private:
97 void init();
98
99 int mResolution;
100 float mSide;
101 float mVertScale;
102 float mSkirtHeight;
103 QByteArray mHeightMap;
104#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
105 Qt3DRender::QAttribute *mPositionAttribute = nullptr;
106 Qt3DRender::QAttribute *mNormalAttribute = nullptr;
107 Qt3DRender::QAttribute *mTexCoordAttribute = nullptr;
108 Qt3DRender::QAttribute *mIndexAttribute = nullptr;
109 Qt3DRender::QBuffer *mVertexBuffer = nullptr;
110 Qt3DRender::QBuffer *mIndexBuffer = nullptr;
111#else
112 Qt3DCore::QAttribute *mPositionAttribute = nullptr;
113 Qt3DCore::QAttribute *mNormalAttribute = nullptr;
114 Qt3DCore::QAttribute *mTexCoordAttribute = nullptr;
115 Qt3DCore::QAttribute *mIndexAttribute = nullptr;
116 Qt3DCore::QBuffer *mVertexBuffer = nullptr;
117 Qt3DCore::QBuffer *mIndexBuffer = nullptr;
118#endif
119};
120
122
123#endif // QGSDEMTERRAINTILEGEOMETRY_P_H