QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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} // namespace Qt3DRender
48#else
49namespace Qt3DCore
50{
51 class QAttribute;
52 class QBuffer;
53} // namespace Qt3DCore
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:
78 explicit DemTerrainTileGeometry( int resolution, float side, float vertScale, float skirtHeight, const QByteArray &heightMap, QNode *parent = nullptr );
79
80 bool rayIntersection( const QgsRayCastingUtils::Ray3D &ray, const QMatrix4x4 &worldTransform, QVector3D &intersectionPoint );
81
82#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
83 Qt3DRender::QAttribute *positionAttribute() { return mPositionAttribute; }
84 Qt3DRender::QAttribute *normalAttribute() { return mNormalAttribute; }
85 Qt3DRender::QAttribute *texCoordsAttribute() { return mTexCoordAttribute; }
86 Qt3DRender::QAttribute *indexAttribute() { return mIndexAttribute; }
87#else
88 Qt3DCore::QAttribute *positionAttribute() { return mPositionAttribute; }
89 Qt3DCore::QAttribute *normalAttribute() { return mNormalAttribute; }
90 Qt3DCore::QAttribute *texCoordsAttribute() { return mTexCoordAttribute; }
91 Qt3DCore::QAttribute *indexAttribute() { return mIndexAttribute; }
92#endif
93
94 private:
95 void init();
96
97 int mResolution;
98 float mSide;
99 float mVertScale;
100 float mSkirtHeight;
101 QByteArray mHeightMap;
102#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
103 Qt3DRender::QAttribute *mPositionAttribute = nullptr;
104 Qt3DRender::QAttribute *mNormalAttribute = nullptr;
105 Qt3DRender::QAttribute *mTexCoordAttribute = nullptr;
106 Qt3DRender::QAttribute *mIndexAttribute = nullptr;
107 Qt3DRender::QBuffer *mVertexBuffer = nullptr;
108 Qt3DRender::QBuffer *mIndexBuffer = nullptr;
109#else
110 Qt3DCore::QAttribute *mPositionAttribute = nullptr;
111 Qt3DCore::QAttribute *mNormalAttribute = nullptr;
112 Qt3DCore::QAttribute *mTexCoordAttribute = nullptr;
113 Qt3DCore::QAttribute *mIndexAttribute = nullptr;
114 Qt3DCore::QBuffer *mVertexBuffer = nullptr;
115 Qt3DCore::QBuffer *mIndexBuffer = nullptr;
116#endif
117};
118
120
121#endif // QGSDEMTERRAINTILEGEOMETRY_P_H