30#include <Qt3DRender/QCamera>
31#include <Qt3DRender/QCullFace>
123 static int maxZoomLevel(
double tile0width,
double tileResolution,
double maxError );
159 static bool isCullable(
const QgsAABB &bbox,
const QMatrix4x4 &viewProjectionMatrix );
222 static QVector3D
screenPointToWorldPos(
const QPoint &screenPoint,
double depth,
const QSize &screenSize, Qt3DRender::QCamera *camera );
254 return ( ( qRed( pixel ) / 255.0 + qGreen( pixel ) ) / 255.0 + qBlue( pixel ) ) / 255.0;
262 static std::unique_ptr<QgsPointCloudLayer3DRenderer> convert2DPointCloudRendererTo3D(
QgsPointCloudRenderer *renderer );
295 static float screenSpaceError(
float epsilon,
float distance,
int screenSize,
float fov );
309 static void computeBoundingBoxNearFarPlanes(
const QgsAABB &bbox,
const QMatrix4x4 &viewMatrix,
float &fnear,
float &ffar );
328 static QByteArray addDefinesToShaderCode(
const QByteArray &shaderCode,
const QStringList &defines );
338 static QByteArray removeDefinesFromShaderCode(
const QByteArray &shaderCode,
const QStringList &defines );
347 static void decomposeTransformMatrix(
const QMatrix4x4 &matrix, QVector3D &translation, QQuaternion &rotation, QVector3D &scale );
355 static int openGlMaxClipPlanes( QSurface *surface );
363 static QQuaternion rotationFromPitchHeadingAngles(
float pitchAngle,
float headingAngle );
380 static void calculateViewExtent(
const Qt3DRender::QCamera *camera,
float maxRenderingDistance,
float z,
float &minX,
float &maxX,
float &minY,
float &maxY,
float &minZ,
float &maxZ );
404 static std::unique_ptr<Qt3DRender::QCamera> copyCamera( Qt3DRender::QCamera *cam )
SIP_SKIP;
AltitudeClamping
Altitude clamping.
AltitudeBinding
Altitude binding.
Holds information about animation in 3D view.
Entity that encapsulates our 3D scene - contains all other entities (such as terrain) as children.
Rendering context for preparation of 3D entities.
CullingMode
Triangle culling mode.
Miscellaneous utility functions used from 3D code.
static QgsVector3D transformWorldCoordinates(const QgsVector3D &worldPoint1, const QgsVector3D &origin1, const QgsCoordinateReferenceSystem &crs1, const QgsVector3D &origin2, const QgsCoordinateReferenceSystem &crs2, const QgsCoordinateTransformContext &context)
Transforms a world point from (origin1, crs1) to (origin2, crs2).
static Qgs3DTypes::CullingMode cullingModeFromString(const QString &str)
Converts a string to a value from CullingMode enum.
static Qgis::AltitudeClamping altClampingFromString(const QString &str)
Converts a string to a value from AltitudeClamping enum.
static QString matrix4x4toString(const QMatrix4x4 &m)
Converts a 4x4 transform matrix to a string.
static QgsRectangle worldToMapExtent(const QgsAABB &bbox, const QgsVector3D &mapOrigin)
Converts axis aligned bounding box in 3D world coordinates to extent in map coordinates.
static QgsRectangle worldToLayerExtent(const QgsAABB &bbox, const QgsCoordinateReferenceSystem &layerCrs, const QgsVector3D &mapOrigin, const QgsCoordinateReferenceSystem &mapCrs, const QgsCoordinateTransformContext &context)
Converts axis aligned bounding box in 3D world coordinates to extent in map layer CRS.
static void pitchAndYawFromViewVector(QVector3D vect, double &pitch, double &yaw)
Function used to extract the pitch and yaw (also known as heading) angles in degrees from the view ve...
static int maxZoomLevel(double tile0width, double tileResolution, double maxError)
Calculates the highest needed zoom level for tiles in quad-tree given width of the base tile (zoom le...
static QgsAABB mapToWorldExtent(const QgsRectangle &extent, double zMin, double zMax, const QgsVector3D &mapOrigin)
Converts map extent to axis aligned bounding box in 3D world coordinates.
static QgsAABB layerToWorldExtent(const QgsRectangle &extent, double zMin, double zMax, const QgsCoordinateReferenceSystem &layerCrs, const QgsVector3D &mapOrigin, const QgsCoordinateReferenceSystem &mapCrs, const QgsCoordinateTransformContext &context)
Converts extent (in map layer's CRS) to axis aligned bounding box in 3D world coordinates.
static Qgis::AltitudeBinding altBindingFromString(const QString &str)
Converts a string to a value from AltitudeBinding enum.
static double calculateEntityGpuMemorySize(Qt3DCore::QEntity *entity)
Calculates approximate usage of GPU memory by an entity.
static QString cullingModeToString(Qgs3DTypes::CullingMode mode)
Converts a value from CullingMode enum to a string.
static bool isCullable(const QgsAABB &bbox, const QMatrix4x4 &viewProjectionMatrix)
Returns true if bbox is completely outside the current viewing volume.
static QVector2D screenToTextureCoordinates(QVector2D screenXY, QSize winSize)
Converts from screen coordinates to texture coordinates.
static void estimateVectorLayerZRange(QgsVectorLayer *layer, double &zMin, double &zMax)
Try to estimate range of Z values used in the given vector layer and store that in zMin and zMax.
static QgsPhongMaterialSettings phongMaterialFromQt3DComponent(Qt3DExtras::QPhongMaterial *material)
Returns phong material settings object based on the Qt3D material.
static QString altClampingToString(Qgis::AltitudeClamping altClamp)
Converts a value from AltitudeClamping enum to a string.
static QMatrix4x4 stringToMatrix4x4(const QString &str)
Convert a string to a 4x4 transform matrix.
static QgsVector3D worldToMapCoordinates(const QgsVector3D &worldCoords, const QgsVector3D &origin)
Converts 3D world coordinates to map coordinates (applies offset).
static QgsVector3D mapToWorldCoordinates(const QgsVector3D &mapCoords, const QgsVector3D &origin)
Converts map coordinates to 3D world coordinates (applies offset).
static QVector2D textureToScreenCoordinates(QVector2D textureXY, QSize winSize)
Converts from texture coordinates coordinates to screen coordinates.
static bool exportAnimation(const Qgs3DAnimationSettings &animationSettings, Qgs3DMapSettings &mapSettings, int framesPerSecond, const QString &outputDirectory, const QString &fileNameTemplate, const QSize &outputSize, QString &error, QgsFeedback *feedback=nullptr)
Captures 3D animation frames to the selected folder.
static double decodeDepth(const QRgb &pixel)
Decodes the depth value from the pixel's color value The depth value is encoded from OpenGL side (the...
static QVector3D screenPointToWorldPos(const QPoint &screenPoint, double depth, const QSize &screenSize, Qt3DRender::QCamera *camera)
Converts the clicked mouse position to the corresponding 3D world coordinates.
static void waitForFrame(QgsAbstract3DEngine &engine, Qgs3DMapScene *scene)
Waits for a frame to be rendered.
static float clampAltitude(const QgsPoint &p, Qgis::AltitudeClamping altClamp, Qgis::AltitudeBinding altBind, float offset, const QgsPoint ¢roid, const Qgs3DRenderContext &context)
Clamps altitude of a vertex according to the settings, returns Z value.
static QString altBindingToString(Qgis::AltitudeBinding altBind)
Converts a value from AltitudeBinding enum to a string.
static void clampAltitudes(QgsLineString *lineString, Qgis::AltitudeClamping altClamp, Qgis::AltitudeBinding altBind, const QgsPoint ¢roid, float offset, const Qgs3DRenderContext &context)
Clamps altitude of vertices of a linestring according to the settings.
static QgsRay3D rayFromScreenPoint(const QPoint &point, const QSize &windowSize, Qt3DRender::QCamera *camera)
Convert from clicked point on the screen to a ray in world coordinates.
static QImage captureSceneImage(QgsAbstract3DEngine &engine, Qgs3DMapScene *scene)
Captures image of the current 3D scene of a 3D engine.
static void waitForEntitiesLoaded(Qgs3DMapScene *scene)
Waits for all entities in the scene to be loaded.
static void extractPointPositions(const QgsFeature &f, const Qgs3DRenderContext &context, const QgsVector3D &chunkOrigin, Qgis::AltitudeClamping altClamp, QVector< QVector3D > &positions)
Calculates (x,y,z) positions of (multi)point from the given feature.
static QImage captureSceneDepthBuffer(QgsAbstract3DEngine &engine, Qgs3DMapScene *scene)
Captures the depth buffer of the current 3D scene of a 3D engine.
Axis-aligned bounding box - in world coords.
Base class for 3D engine implementation.
Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
A 3-dimensional box composed of x, y, z coordinates.
Object that controls camera movement based on user input.
Encapsulates camera pose in a 3D scene.
Represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
QgsRange which stores a range of double values.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Line string geometry type, with support for z-dimension and m-values.
Basic shading material used for rendering based on the Phong shading model with three color component...
3D renderer that renders all points from a point cloud layer.
Abstract base class for 2d point cloud renderers.
Point geometry type, with support for z-dimension and m-values.
A representation of a ray in 3D.
Responsible for defining parameters of the ray casting operations in 3D map canvases.
Contains the results of ray casting operations in a 3D map canvas.
A rectangle specified with double values.
A 3D vector (similar to QVector3D) with the difference that it uses double precision instead of singl...
Represents a vector layer which manages a vector based dataset.