1 /***************************************************************************
2   qgsbillboardgeometry.h
3   --------------------------------------
4   Date                 : Jul 2019
5   Copyright            : (C) 2019 by Ismail Sunni
6   Email                : imajimatika 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 QGSBILLBOARDGEOMETRY_H
17 #define QGSBILLBOARDGEOMETRY_H
18 
19 #include <QObject>
20 #include <Qt3DRender/QGeometry>
21 #include <Qt3DRender/QBuffer>
22 #include <Qt3DRender/QAttribute>
23 
24 #define SIP_NO_FILE
25 
26 /**
27  * \ingroup 3d
28  * \brief Geometry of the billboard rendering for points in 3D map view.
29  *
30  * \note Not available in Python bindings
31  *
32  * \since QGIS 3.10
33  */
34 class QgsBillboardGeometry : public Qt3DRender::QGeometry
35 {
36     Q_OBJECT
37 
38     Q_PROPERTY( int count READ count NOTIFY countChanged )
39   public:
40     //! Constructor of QgsBillboardGeometry.
41     QgsBillboardGeometry( Qt3DCore::QNode *parent = nullptr );
42 
43     //! Set the points for the billboard with \a vertices.
44     void setPoints( const QVector<QVector3D> &vertices );
45 
46     //! Returns the number of points.
47     int count() const;
48   signals:
49     //! Signal when the number of points changed.
50     void countChanged( int count );
51 
52   private:
53     Qt3DRender::QAttribute *mPositionAttribute = nullptr;
54     Qt3DRender::QBuffer *mVertexBuffer = nullptr;
55     int mVertexCount = 0;
56 };
57 
58 #endif // QGSBILLBOARDGEOMETRY_H
59