16#ifndef QGSTESSELLATEDPOLYGONGEOMETRY_H
17#define QGSTESSELLATEDPOLYGONGEOMETRY_H
21#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
22#include <Qt3DRender/QGeometry>
24#include <Qt3DCore/QGeometry>
36#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
61#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
96 void setPolygons(
const QList<QgsPolygon *> &polygons,
const QList<QgsFeatureId> &featureIds,
const QgsPointXY &origin,
float extrusionHeight,
const QList<float> &extrusionHeightPerPolygon = QList<float>() );
103 void setData(
const QByteArray &vertexBufferData,
int vertexCount,
const QVector<QgsFeatureId> &triangleIndexFids,
const QVector<uint> &triangleIndexStartingIndices );
115 bool rayIntersection(
const QgsRayCastingUtils::Ray3D &ray,
const QMatrix4x4 &worldTransform, QVector3D &intersectionPoint,
QgsFeatureId &fid );
120#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
121 Qt3DRender::QAttribute *mPositionAttribute =
nullptr;
122 Qt3DRender::QAttribute *mNormalAttribute =
nullptr;
123 Qt3DRender::QAttribute *mTextureCoordsAttribute =
nullptr;
124 Qt3DRender::QBuffer *mVertexBuffer =
nullptr;
126 Qt3DCore::QAttribute *mPositionAttribute =
nullptr;
127 Qt3DCore::QAttribute *mNormalAttribute =
nullptr;
128 Qt3DCore::QAttribute *mTextureCoordsAttribute =
nullptr;
129 Qt3DCore::QBuffer *mVertexBuffer =
nullptr;
132 QVector<QgsFeatureId> mTriangleIndexFids;
133 QVector<uint> mTriangleIndexStartingIndices;
135 bool mWithNormals =
true;
136 bool mInvertNormals =
false;
137 bool mAddBackFaces =
false;
138 bool mAddTextureCoords =
false;
Entity that handles the exporting of 3D scene.
A class to represent a 2D point.
bool rayIntersection(const QgsRayCastingUtils::Ray3D &ray, const QMatrix4x4 &worldTransform, QVector3D &intersectionPoint, QgsFeatureId &fid)
Tests whether the geometry is intersected by ray.
void setPolygons(const QList< QgsPolygon * > &polygons, const QList< QgsFeatureId > &featureIds, const QgsPointXY &origin, float extrusionHeight, const QList< float > &extrusionHeightPerPolygon=QList< float >())
Initializes vertex buffer from given polygons. Takes ownership of passed polygon geometries.
void setInvertNormals(bool invert)
Sets whether the normals of triangles will be inverted (useful for fixing clockwise / counter-clockwi...
QgsFeatureId triangleIndexToFeatureId(uint triangleIndex) const
Returns ID of the feature to which given triangle index belongs (used for picking).
QgsTessellatedPolygonGeometry(bool _withNormals=true, bool invertNormals=false, bool addBackFaces=false, bool addTextureCoords=false, QNode *parent=nullptr)
Constructor.
bool addBackFaces() const
Returns whether also triangles facing the other side will be created.
void setData(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.
void setAddBackFaces(bool add)
Sets whether also triangles facing the other side will be created.
void setAddTextureCoords(bool add)
Sets whether the texture coordinates will be generated.
bool invertNormals() const
Returns whether the normals of triangles will be inverted (useful for fixing clockwise / counter-cloc...
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features