QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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
34#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
35#include <Qt3DRender/QGeometry>
36#else
37#include <Qt3DCore/QGeometry>
38#endif
39#include <QSize>
40
41#include <QImage>
42
43#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
44namespace Qt3DRender
45{
46 class QAttribute;
47 class QBuffer;
48} // namespace Qt3DRender
49#else
50namespace Qt3DCore
51{
52 class QAttribute;
53 class QBuffer;
54} // namespace Qt3DCore
55#endif
56
57class QgsRay3D;
59
64#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
65class DemTerrainTileGeometry : public Qt3DRender::QGeometry
66#else
67class DemTerrainTileGeometry : public Qt3DCore::QGeometry
68#endif
69{
70 Q_OBJECT
71
72 public:
77 explicit DemTerrainTileGeometry( int resolution, float side, float vertScale, float skirtHeight, const QByteArray &heightMap, QNode *parent = nullptr );
78
79 bool rayIntersection( const QgsRay3D &ray, const QgsRayCastContext &context, const QMatrix4x4 &worldTransform, QVector3D &intersectionPoint );
80
81#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
82 Qt3DRender::QAttribute *positionAttribute() { return mPositionAttribute; }
83 Qt3DRender::QAttribute *normalAttribute() { return mNormalAttribute; }
84 Qt3DRender::QAttribute *texCoordsAttribute() { return mTexCoordAttribute; }
85 Qt3DRender::QAttribute *indexAttribute() { return mIndexAttribute; }
86#else
87 Qt3DCore::QAttribute *positionAttribute() { return mPositionAttribute; }
88 Qt3DCore::QAttribute *normalAttribute() { return mNormalAttribute; }
89 Qt3DCore::QAttribute *texCoordsAttribute() { return mTexCoordAttribute; }
90 Qt3DCore::QAttribute *indexAttribute() { return mIndexAttribute; }
91#endif
92
93 private:
94 void init();
95
96 int mResolution;
97 float mSide;
98 float mVertScale;
99 float mSkirtHeight;
100 QByteArray mHeightMap;
101#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
102 Qt3DRender::QAttribute *mPositionAttribute = nullptr;
103 Qt3DRender::QAttribute *mNormalAttribute = nullptr;
104 Qt3DRender::QAttribute *mTexCoordAttribute = nullptr;
105 Qt3DRender::QAttribute *mIndexAttribute = nullptr;
106 Qt3DRender::QBuffer *mVertexBuffer = nullptr;
107 Qt3DRender::QBuffer *mIndexBuffer = nullptr;
108#else
109 Qt3DCore::QAttribute *mPositionAttribute = nullptr;
110 Qt3DCore::QAttribute *mNormalAttribute = nullptr;
111 Qt3DCore::QAttribute *mTexCoordAttribute = nullptr;
112 Qt3DCore::QAttribute *mIndexAttribute = nullptr;
113 Qt3DCore::QBuffer *mVertexBuffer = nullptr;
114 Qt3DCore::QBuffer *mIndexBuffer = nullptr;
115#endif
116};
117
119
120#endif // QGSDEMTERRAINTILEGEOMETRY_P_H
A representation of a ray in 3D.
Definition qgsray3d.h:31
Responsible for defining parameters of the ray casting operations in 3D map canvases.