QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsbillboardgeometry.h
Go to the documentation of this file.
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 "qgis_3d.h"
20
21#include <QObject>
22
23#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
24#include <Qt3DRender/QGeometry>
25#include <Qt3DRender/QBuffer>
26#include <Qt3DRender/QAttribute>
27#else
28#include <Qt3DCore/QGeometry>
29#include <Qt3DCore/QBuffer>
30#include <Qt3DCore/QAttribute>
31#endif
32#include <QVector3D>
33#include <QVector2D>
34
35#define SIP_NO_FILE
36
37
48#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
49class _3D_EXPORT QgsBillboardGeometry : public Qt3DRender::QGeometry
50#else
51class _3D_EXPORT QgsBillboardGeometry : public Qt3DCore::QGeometry
52#endif
53{
54 Q_OBJECT
55
56 Q_PROPERTY( int count READ count NOTIFY countChanged )
57 public:
59 QgsBillboardGeometry( Qt3DCore::QNode *parent = nullptr );
60
69 void setPositions( const QVector<QVector3D> &vertices );
70
79 {
81 QVector3D position;
88 };
89
100 void setBillboardData( const QVector<QgsBillboardGeometry::BillboardAtlasData> &billboards, bool includePixelOffsets = false );
101
103 int count() const;
104
105 signals:
107 void countChanged( int count );
108
109 private:
110 enum class Mode
111 {
112 PositionOnly,
113 PositionAndTextureData,
114 PositionAndTextureDataWithPixelOffsets,
115 };
116 void setMode( Mode mode );
117
118#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
119 Qt3DRender::QAttribute *mPositionAttribute = nullptr;
120 Qt3DRender::QAttribute *mAtlasOffsetAttribute = nullptr;
121 Qt3DRender::QAttribute *mAtlasSizeAttribute = nullptr;
122 Qt3DRender::QAttribute *mAtlasPixelOffsetAttribute = nullptr;
123 Qt3DRender::QBuffer *mVertexBuffer = nullptr;
124#else
125 Qt3DCore::QAttribute *mPositionAttribute = nullptr;
126 Qt3DCore::QAttribute *mAtlasOffsetAttribute = nullptr;
127 Qt3DCore::QAttribute *mAtlasSizeAttribute = nullptr;
128 Qt3DCore::QAttribute *mAtlasPixelOffsetAttribute = nullptr;
129 Qt3DCore::QBuffer *mVertexBuffer = nullptr;
130#endif
131 int mVertexCount = 0;
132};
133
134#endif // QGSBILLBOARDGEOMETRY_H
Geometry of the billboard rendering for points in 3D map view.
void countChanged(int count)
Signal when the number of points changed.
void setBillboardData(const QVector< QgsBillboardGeometry::BillboardAtlasData > &billboards, bool includePixelOffsets=false)
Set the position and texture data for the billboard.
void setPositions(const QVector< QVector3D > &vertices)
Sets the vertex positions for the billboards.
QgsBillboardGeometry(Qt3DCore::QNode *parent=nullptr)
Constructor of QgsBillboardGeometry.
Contains the billboard positions and texture information.
QPoint pixelOffset
Optional pixel offset for billboard.
QVector3D position
Vertex position for billboard placement.
QVector2D textureAtlasOffset
Texture atlas offset for associated billboard texture.
QVector2D textureAtlasSize
Texture atlas size for associated billboard texture.