QGIS API Documentation  3.6.0-Noosa (5873452)
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 #include <Qt3DExtras/qt3dextras_global.h>
31 #include <Qt3DRender/qgeometry.h>
32 #include <QSize>
33 
34 #include <QImage>
35 
36 namespace Qt3DRender
37 {
38 
39  class QAttribute;
40  class QBuffer;
41 
42 } // Qt3DRender
43 
44 namespace QgsRayCastingUtils
45 {
46  class Ray3D;
47 }
48 
54 class DemTerrainTileGeometry : public Qt3DRender::QGeometry
55 {
56  public:
57 
62  explicit DemTerrainTileGeometry( int resolution, float side, float vertScale, float skirtHeight, const QByteArray &heightMap, QNode *parent = nullptr );
63 
64  bool rayIntersection( const QgsRayCastingUtils::Ray3D &ray, const QMatrix4x4 &worldTransform, QVector3D &intersectionPoint );
65 
66  private:
67  void init();
68 
69  int mResolution;
70  float mSide;
71  float mVertScale;
72  float mSkirtHeight;
73  QByteArray mHeightMap;
74  Qt3DRender::QAttribute *mPositionAttribute = nullptr;
75  Qt3DRender::QAttribute *mNormalAttribute = nullptr;
76  Qt3DRender::QAttribute *mTexCoordAttribute = nullptr;
77  Qt3DRender::QAttribute *mIndexAttribute = nullptr;
78  Qt3DRender::QBuffer *mVertexBuffer = nullptr;
79  Qt3DRender::QBuffer *mIndexBuffer = nullptr;
80 };
81 
83 
84 #endif // QGSDEMTERRAINTILEGEOMETRY_P_H