QGIS API Documentation 3.99.0-Master (e9821da5c6b)
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
30
41class _3D_EXPORT QgsBillboardGeometry : public Qt3DCore::QGeometry
42{
43 Q_OBJECT
44
45 Q_PROPERTY( int count READ count NOTIFY countChanged )
46 public:
48 QgsBillboardGeometry( Qt3DCore::QNode *parent = nullptr );
49
58 void setPositions( const QVector<QVector3D> &vertices );
59
68 {
70 QVector3D position;
77 };
78
89 void setBillboardData( const QVector<QgsBillboardGeometry::BillboardAtlasData> &billboards, bool includePixelOffsets = false );
90
92 int count() const;
93
94 signals:
96 void countChanged( int count );
97
98 private:
99 enum class Mode
100 {
101 PositionOnly,
102 PositionAndTextureData,
103 PositionAndTextureDataWithPixelOffsets,
104 };
105 void setMode( Mode mode );
106
107 Qt3DCore::QAttribute *mPositionAttribute = nullptr;
108 Qt3DCore::QAttribute *mAtlasOffsetAttribute = nullptr;
109 Qt3DCore::QAttribute *mAtlasSizeAttribute = nullptr;
110 Qt3DCore::QAttribute *mAtlasPixelOffsetAttribute = nullptr;
111 Qt3DCore::QBuffer *mVertexBuffer = nullptr;
112 int mVertexCount = 0;
113};
114
115#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.