QGIS API Documentation
4.3.0-Master (52aa6503bed)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
3d
qgstessellatedpolygongeometry.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgstessellatedpolygongeometry.h
3
--------------------------------------
4
Date : July 2017
5
Copyright : (C) 2017 by Martin Dobias
6
Email : wonder dot sk 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 QGSTESSELLATEDPOLYGONGEOMETRY_H
17
#define QGSTESSELLATEDPOLYGONGEOMETRY_H
18
19
#include "
qgsfeatureid.h
"
20
21
#include <Qt3DCore/QGeometry>
22
23
#define SIP_NO_FILE
24
25
class
Qgs3DSceneExporter
;
26
class
QgsPolygon
;
27
class
QgsPointXY
;
28
29
namespace
Qt3DCore
30
{
31
class
QBuffer;
32
}
33
34
45
class
QgsTessellatedPolygonGeometry
:
public
Qt3DCore::QGeometry
46
{
47
Q_OBJECT
48
public
:
50
QgsTessellatedPolygonGeometry
(
bool
_withNormals =
true
,
bool
invertNormals
=
false
,
bool
addBackFaces
=
false
,
bool
addTextureCoords =
false
,
bool
withTangents =
false
, QNode *parent =
nullptr
);
51
53
bool
invertNormals
()
const
{
return
mInvertNormals; }
55
void
setInvertNormals
(
bool
invert ) { mInvertNormals = invert; }
56
61
bool
addBackFaces
()
const
{
return
mAddBackFaces; }
62
67
void
setAddBackFaces
(
bool
add ) { mAddBackFaces = add; }
68
73
void
setAddTextureCoords
(
bool
add ) { mAddTextureCoords = add; }
74
80
void
setVertexBufferData
(
const
QByteArray &vertexBufferData,
int
vertexCount,
const
QVector<QgsFeatureId> &triangleIndexFids,
const
QVector<uint> &
triangleIndexStartingIndices
);
81
86
void
setIndexBufferData
(
const
QByteArray &indexBufferData,
size_t
indexCount );
87
92
QgsFeatureId
triangleIndexToFeatureId
( uint triangleIndex )
const
;
93
95
QVector<QgsFeatureId>
featureIds
()
const
{
return
mTriangleIndexFids; }
96
98
QVector<uint>
triangleIndexStartingIndices
()
const
{
return
mTriangleIndexStartingIndices; }
99
100
friend
class
Qgs3DSceneExporter
;
101
102
private
:
103
Qt3DCore::QAttribute *mPositionAttribute =
nullptr
;
104
Qt3DCore::QAttribute *mNormalAttribute =
nullptr
;
105
Qt3DCore::QAttribute *mTangentAttribute =
nullptr
;
106
Qt3DCore::QAttribute *mTextureCoordsAttribute =
nullptr
;
107
Qt3DCore::QBuffer *mVertexBuffer =
nullptr
;
108
Qt3DCore::QBuffer *mIndexBuffer =
nullptr
;
109
Qt3DCore::QAttribute *mIndexAttribute =
nullptr
;
110
111
QVector<QgsFeatureId> mTriangleIndexFids;
112
QVector<uint> mTriangleIndexStartingIndices;
113
114
bool
mWithNormals =
true
;
115
bool
mInvertNormals =
false
;
116
bool
mAddBackFaces =
false
;
117
bool
mAddTextureCoords =
false
;
118
bool
mWithTangents =
false
;
119
};
120
121
#endif
// QGSTESSELLATEDPOLYGONGEOMETRY_H
Qgs3DSceneExporter
Entity that handles the exporting of 3D scenes.
Definition
qgs3dsceneexporter.h:61
QgsPointXY
Represents a 2D point.
Definition
qgspointxy.h:62
QgsPolygon
Polygon geometry type.
Definition
qgspolygon.h:37
QgsTessellatedPolygonGeometry::featureIds
QVector< QgsFeatureId > featureIds() const
Returns included feature ids.
Definition
qgstessellatedpolygongeometry.h:95
QgsTessellatedPolygonGeometry::setVertexBufferData
void setVertexBufferData(const QByteArray &vertexBufferData, int vertexCount, const QVector< QgsFeatureId > &triangleIndexFids, const QVector< uint > &triangleIndexStartingIndices)
Initializes vertex buffer (and other members) from data that were already tessellated.
Definition
qgstessellatedpolygongeometry.cpp:101
QgsTessellatedPolygonGeometry::setInvertNormals
void setInvertNormals(bool invert)
Sets whether the normals of triangles will be inverted (useful for fixing clockwise / counter-clockwi...
Definition
qgstessellatedpolygongeometry.h:55
QgsTessellatedPolygonGeometry::QgsTessellatedPolygonGeometry
QgsTessellatedPolygonGeometry(bool _withNormals=true, bool invertNormals=false, bool addBackFaces=false, bool addTextureCoords=false, bool withTangents=false, QNode *parent=nullptr)
Constructor.
Definition
qgstessellatedpolygongeometry.cpp:25
QgsTessellatedPolygonGeometry::triangleIndexToFeatureId
QgsFeatureId triangleIndexToFeatureId(uint triangleIndex) const
Returns ID of the feature to which given triangle index belongs (used for picking).
Definition
qgstessellatedpolygongeometry.cpp:152
QgsTessellatedPolygonGeometry::addBackFaces
bool addBackFaces() const
Returns whether also triangles facing the other side will be created.
Definition
qgstessellatedpolygongeometry.h:61
QgsTessellatedPolygonGeometry::Qgs3DSceneExporter
friend class Qgs3DSceneExporter
Definition
qgstessellatedpolygongeometry.h:100
QgsTessellatedPolygonGeometry::setAddBackFaces
void setAddBackFaces(bool add)
Sets whether also triangles facing the other side will be created.
Definition
qgstessellatedpolygongeometry.h:67
QgsTessellatedPolygonGeometry::setAddTextureCoords
void setAddTextureCoords(bool add)
Sets whether the texture coordinates will be generated.
Definition
qgstessellatedpolygongeometry.h:73
QgsTessellatedPolygonGeometry::invertNormals
bool invertNormals() const
Returns whether the normals of triangles will be inverted (useful for fixing clockwise / counter-cloc...
Definition
qgstessellatedpolygongeometry.h:53
QgsTessellatedPolygonGeometry::triangleIndexStartingIndices
QVector< uint > triangleIndexStartingIndices() const
Returns triangle index for features. For a feature featureIds()[i], matching triangles start at trian...
Definition
qgstessellatedpolygongeometry.h:98
QgsTessellatedPolygonGeometry::setIndexBufferData
void setIndexBufferData(const QByteArray &indexBufferData, size_t indexCount)
Sets index buffer data.
Definition
qgstessellatedpolygongeometry.cpp:116
Qt3DCore
Definition
qgsabstract3drenderer.h:33
qgsfeatureid.h
QgsFeatureId
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
Definition
qgsfeatureid.h:32
Generated on
for QGIS API Documentation by
1.17.0