QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 #include <Qt3DRender/qgeometry.h>
34 #include <QSize>
35 
36 #include <QImage>
37 
38 namespace Qt3DRender
39 {
40 
41  class QAttribute;
42  class QBuffer;
43 
44 } // Qt3DRender
45 
46 namespace QgsRayCastingUtils
47 {
48  class Ray3D;
49 }
50 
56 class DemTerrainTileGeometry : public Qt3DRender::QGeometry
57 {
58  Q_OBJECT
59 
60  public:
61 
66  explicit DemTerrainTileGeometry( int resolution, float side, float vertScale, float skirtHeight, const QByteArray &heightMap, QNode *parent = nullptr );
67 
68  bool rayIntersection( const QgsRayCastingUtils::Ray3D &ray, const QMatrix4x4 &worldTransform, QVector3D &intersectionPoint );
69 
70  private:
71  void init();
72 
73  int mResolution;
74  float mSide;
75  float mVertScale;
76  float mSkirtHeight;
77  QByteArray mHeightMap;
78  Qt3DRender::QAttribute *mPositionAttribute = nullptr;
79  Qt3DRender::QAttribute *mNormalAttribute = nullptr;
80  Qt3DRender::QAttribute *mTexCoordAttribute = nullptr;
81  Qt3DRender::QAttribute *mIndexAttribute = nullptr;
82  Qt3DRender::QBuffer *mVertexBuffer = nullptr;
83  Qt3DRender::QBuffer *mIndexBuffer = nullptr;
84 };
85 
87 
88 #endif // QGSDEMTERRAINTILEGEOMETRY_P_H
Qt3DRender
Definition: qgs3dmapscene.h:25