QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgspoint3dbillboardmaterial.h
Go to the documentation of this file.
1/***************************************************************************
2 qgspoint3dbillboardmaterial.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#ifndef QGSPOINT3DBILLBOARDMATERIAL_H
16#define QGSPOINT3DBILLBOARDMATERIAL_H
17
18#include "qgis_3d.h"
19#include "qgsmaterial.h"
20
21#include <QObject>
22#include <Qt3DRender/QParameter>
23#include <Qt3DRender/QTexture>
24
25#define SIP_NO_FILE
26
27class QgsMarkerSymbol;
29
41{
42 Q_OBJECT
43
44 public:
50 enum class Mode
51 {
52 SingleTexture,
53 AtlasTexture,
54 AtlasTextureWithPixelOffsets,
55 };
56
60 QgsPoint3DBillboardMaterial( Mode mode = Mode::SingleTexture );
62
64 void setSize( const QSizeF size );
66 QSizeF size() const;
67
69 void setViewportSize( const QSizeF size );
71 QSizeF windowSize() const;
72
74 void useDefaultSymbol( const Qgs3DRenderContext &context, bool selected = false );
75
81 static QImage renderSymbolToImage( const QgsMarkerSymbol *markerSymbol, const Qgs3DRenderContext &context, bool selected = false );
82
84 void setTexture2DFromSymbol( const QgsMarkerSymbol *markerSymbol, const Qgs3DRenderContext &context, bool selected = false );
85
87 void setTexture2DFromImage( const QImage &image );
88
89 private:
91 void setTexture2DFromTextureImage( Qt3DRender::QAbstractTextureImage *textureImage );
92
93 Qt3DRender::QParameter *mSize = nullptr;
94 Qt3DRender::QParameter *mViewportSize = nullptr;
95 Qt3DRender::QParameter *mTexture2D = nullptr;
96};
97
98
99#endif // QGSPOINT3DBILLBOARDMATERIAL_H
Rendering context for preparation of 3D entities.
A marker symbol type, for rendering Point and MultiPoint geometries.
QgsMaterial(Qt3DCore::QNode *parent=nullptr)
Constructor for QgsMaterial, with the specified parent node.
Material of the billboard rendering for points in 3D map view.
void useDefaultSymbol(const Qgs3DRenderContext &context, bool selected=false)
Set default symbol for the texture with context and selected parameter for rendering.
static QImage renderSymbolToImage(const QgsMarkerSymbol *markerSymbol, const Qgs3DRenderContext &context, bool selected=false)
Renders a marker symbol to an image.
QSizeF windowSize() const
Returns the size of the view port.
void setTexture2DFromImage(const QImage &image)
Set the texture2D of the billboard from an image.
~QgsPoint3DBillboardMaterial() override
QSizeF size() const
Returns the billboard size.
void setTexture2DFromSymbol(const QgsMarkerSymbol *markerSymbol, const Qgs3DRenderContext &context, bool selected=false)
Set markerSymbol for the texture with context and selected parameter for rendering.
void setViewportSize(const QSizeF size)
Set the size of the view port.
void setSize(const QSizeF size)
Set the billboard size.
QgsPoint3DBillboardMaterial(Mode mode=Mode::SingleTexture)
Constructor for QgsPoint3DBillboardMaterial, using the specified mode.