QGIS API Documentation 3.99.0-Master (a5475b57e34)
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#include <QVector2D>
23#include <QVector3D>
24#include <Qt3DCore/QAttribute>
25#include <Qt3DCore/QBuffer>
26#include <Qt3DCore/QGeometry>
27
28#define SIP_NO_FILE
29
40class _3D_EXPORT QgsBillboardGeometry : public Qt3DCore::QGeometry
41{
42 Q_OBJECT
43
44 Q_PROPERTY( int count READ count NOTIFY countChanged )
45 public:
47 QgsBillboardGeometry( Qt3DCore::QNode *parent = nullptr );
48
57 void setPositions( const QVector<QVector3D> &vertices );
58
67 {
69 QVector3D position;
76 };
77
88 void setBillboardData( const QVector<QgsBillboardGeometry::BillboardAtlasData> &billboards, bool includePixelOffsets = false );
89
91 int count() const;
92
93 signals:
95 void countChanged( int count );
96
97 private:
98 enum class Mode
99 {
100 PositionOnly,
101 PositionAndTextureData,
102 PositionAndTextureDataWithPixelOffsets,
103 };
104 void setMode( Mode mode );
105
106 Qt3DCore::QAttribute *mPositionAttribute = nullptr;
107 Qt3DCore::QAttribute *mAtlasOffsetAttribute = nullptr;
108 Qt3DCore::QAttribute *mAtlasSizeAttribute = nullptr;
109 Qt3DCore::QAttribute *mAtlasPixelOffsetAttribute = nullptr;
110 Qt3DCore::QBuffer *mVertexBuffer = nullptr;
111 int mVertexCount = 0;
112};
113
114#endif // QGSBILLBOARDGEOMETRY_H
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.