QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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
65#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
66class DemTerrainTileGeometry : public Qt3DRender::QGeometry
67#else
68class DemTerrainTileGeometry : public Qt3DCore::QGeometry
69#endif
70{
71 Q_OBJECT
72
73 public:
74
79 explicit DemTerrainTileGeometry( int resolution, float side, float vertScale, float skirtHeight, const QByteArray &heightMap, QNode *parent = nullptr );
80
81 bool rayIntersection( const QgsRayCastingUtils::Ray3D &ray, const QMatrix4x4 &worldTransform, QVector3D &intersectionPoint );
82
83#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
84 Qt3DRender::QAttribute *positionAttribute() { return mPositionAttribute; }
85 Qt3DRender::QAttribute *normalAttribute() { return mNormalAttribute; }
86 Qt3DRender::QAttribute *texCoordsAttribute() { return mTexCoordAttribute; }
87 Qt3DRender::QAttribute *indexAttribute() { return mIndexAttribute; }
88#else
89 Qt3DCore::QAttribute *positionAttribute() { return mPositionAttribute; }
90 Qt3DCore::QAttribute *normalAttribute() { return mNormalAttribute; }
91 Qt3DCore::QAttribute *texCoordsAttribute() { return mTexCoordAttribute; }
92 Qt3DCore::QAttribute *indexAttribute() { return mIndexAttribute; }
93#endif
94
95 private:
96 void init();
97
98 int mResolution;
99 float mSide;
100 float mVertScale;
101 float mSkirtHeight;
102 QByteArray mHeightMap;
103#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
104 Qt3DRender::QAttribute *mPositionAttribute = nullptr;
105 Qt3DRender::QAttribute *mNormalAttribute = nullptr;
106 Qt3DRender::QAttribute *mTexCoordAttribute = nullptr;
107 Qt3DRender::QAttribute *mIndexAttribute = nullptr;
108 Qt3DRender::QBuffer *mVertexBuffer = nullptr;
109 Qt3DRender::QBuffer *mIndexBuffer = nullptr;
110#else
111 Qt3DCore::QAttribute *mPositionAttribute = nullptr;
112 Qt3DCore::QAttribute *mNormalAttribute = nullptr;
113 Qt3DCore::QAttribute *mTexCoordAttribute = nullptr;
114 Qt3DCore::QAttribute *mIndexAttribute = nullptr;
115 Qt3DCore::QBuffer *mVertexBuffer = nullptr;
116 Qt3DCore::QBuffer *mIndexBuffer = nullptr;
117#endif
118};
119
121
122#endif // QGSDEMTERRAINTILEGEOMETRY_P_H