QGeometryRenderer Class

class Qt3DRender::QGeometryRenderer

Encapsulates geometry rendering. More...

Header: #include <QGeometryRenderer>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
Instantiated By: GeometryRenderer
Inherits: Qt3DCore::QBoundingVolume
Inherited By:

Qt3DExtras::QConeMesh, Qt3DExtras::QCuboidMesh, Qt3DExtras::QCylinderMesh, Qt3DExtras::QExtrudedTextMesh, Qt3DExtras::QPlaneMesh, Qt3DExtras::QSphereMesh, Qt3DExtras::QTorusMesh, and Qt3DRender::QMesh

Public Types

enum PrimitiveType { Points, Lines, LineLoop, LineStrip, Triangles, …, Patches }

Properties

Public Functions

QGeometryRenderer(Qt3DCore::QNode *parent = nullptr)
int firstInstance() const
int firstVertex() const
Qt3DCore::QGeometry *geometry() const
int indexBufferByteOffset() const
int indexOffset() const
int instanceCount() const
bool primitiveRestartEnabled() const
Qt3DRender::QGeometryRenderer::PrimitiveType primitiveType() const
int restartIndexValue() const
float sortIndex() const
int vertexCount() const
int verticesPerPatch() const

Public Slots

void setFirstInstance(int firstInstance)
void setFirstVertex(int firstVertex)
void setGeometry(Qt3DCore::QGeometry *geometry)
void setIndexBufferByteOffset(int offset)
void setIndexOffset(int indexOffset)
void setInstanceCount(int instanceCount)
void setPrimitiveRestartEnabled(bool enabled)
void setPrimitiveType(Qt3DRender::QGeometryRenderer::PrimitiveType primitiveType)
void setRestartIndexValue(int index)
void setSortIndex(float sortIndex)
void setVertexCount(int vertexCount)
void setVerticesPerPatch(int verticesPerPatch)

Signals

void firstInstanceChanged(int firstInstance)
void firstVertexChanged(int firstVertex)
void geometryChanged(Qt3DCore::QGeometry *geometry)
void indexBufferByteOffsetChanged(int offset)
void indexOffsetChanged(int indexOffset)
void instanceCountChanged(int instanceCount)
void primitiveRestartEnabledChanged(bool primitiveRestartEnabled)
void primitiveTypeChanged(Qt3DRender::QGeometryRenderer::PrimitiveType primitiveType)
void restartIndexValueChanged(int restartIndexValue)
void sortIndexChanged(float sortIndex)
void vertexCountChanged(int vertexCount)
void verticesPerPatchChanged(int verticesPerPatch)

Detailed Description

A Qt3DRender::QGeometryRenderer holds all the information necessary to draw a Qt3DCore::QGeometry. A QGeometry holds the coordinates of the geometry data - QGeometryRenderer specifies how to interpret that data.

Member Type Documentation

enum QGeometryRenderer::PrimitiveType

The type of the primitive.

ConstantValueDescription
Qt3DRender::QGeometryRenderer::Points0x0000List of points
Qt3DRender::QGeometryRenderer::Lines0x0001List of lines
Qt3DRender::QGeometryRenderer::LineLoop0x0002Connected group of lines connected at ends forming a loop
Qt3DRender::QGeometryRenderer::LineStrip0x0003Connected group of lines
Qt3DRender::QGeometryRenderer::Triangles0x0004List of triangles
Qt3DRender::QGeometryRenderer::TriangleStrip0x0005List of connected triangles
Qt3DRender::QGeometryRenderer::TriangleFan0x0006List of connected triagles where all triangles share the first vertex
Qt3DRender::QGeometryRenderer::LinesAdjacency0x000AAllows geometry shader to access adjacent lines in a line list
Qt3DRender::QGeometryRenderer::TrianglesAdjacency0x000CAllows geometry shader to access adjacent triangles in a triangle list
Qt3DRender::QGeometryRenderer::LineStripAdjacency0x000BAllows geometry shader to access adjacent lines in a line strip
Qt3DRender::QGeometryRenderer::TriangleStripAdjacency0x000DAllows geometry shader to access adjacent triangles in a triangle strip
Qt3DRender::QGeometryRenderer::Patches0x000EOnly primitive type accepted by tesselation shader where a patch consists of arbitrary number of vertices

Property Documentation

firstInstance : int

Holds the base instance.

Access functions:

int firstInstance() const
void setFirstInstance(int firstInstance)

Notifier signal:

void firstInstanceChanged(int firstInstance)

firstVertex : int

Holds the base vertex.

Access functions:

int firstVertex() const
void setFirstVertex(int firstVertex)

Notifier signal:

void firstVertexChanged(int firstVertex)

geometry : Qt3DCore::QGeometry*

Holds the geometry.

Access functions:

Qt3DCore::QGeometry *geometry() const
void setGeometry(Qt3DCore::QGeometry *geometry)

Notifier signal:

void geometryChanged(Qt3DCore::QGeometry *geometry)

indexBufferByteOffset : int

Holds the byte offset into the index buffer.

Access functions:

int indexBufferByteOffset() const
void setIndexBufferByteOffset(int offset)

Notifier signal:

void indexBufferByteOffsetChanged(int offset)

indexOffset : int

Holds the base vertex.

Access functions:

int indexOffset() const
void setIndexOffset(int indexOffset)

Notifier signal:

void indexOffsetChanged(int indexOffset)

instanceCount : int

Holds the instance count.

Access functions:

int instanceCount() const
void setInstanceCount(int instanceCount)

Notifier signal:

void instanceCountChanged(int instanceCount)

primitiveRestartEnabled : bool

Holds the primitive restart flag.

Access functions:

bool primitiveRestartEnabled() const
void setPrimitiveRestartEnabled(bool enabled)

Notifier signal:

void primitiveRestartEnabledChanged(bool primitiveRestartEnabled)

primitiveType : PrimitiveType

Holds the primitive type.

Access functions:

Qt3DRender::QGeometryRenderer::PrimitiveType primitiveType() const
void setPrimitiveType(Qt3DRender::QGeometryRenderer::PrimitiveType primitiveType)

Notifier signal:

void primitiveTypeChanged(Qt3DRender::QGeometryRenderer::PrimitiveType primitiveType)

restartIndexValue : int

Holds the restart index.

Access functions:

int restartIndexValue() const
void setRestartIndexValue(int index)

Notifier signal:

void restartIndexValueChanged(int restartIndexValue)

[since 6.0] sortIndex : float

Overrides the sorting index when depth sorting is enabled.

If depth sorting is enabled on the frame graph, the renderer will sort objects based on how far the center of the bounding volume is from the camera and render objects from the furthest to the closest.

This property can be used to override the depth index and precisely control the order in which objects are rendered. This is useful when all objects are at the same physical distance from the camera.

The actual values are not significant, only that they define an order to sort the objects. These are sorted such as the object with the smallest value is drawn first, then the second smallest, and so on.

Note: Setting this to -1.f will disable the explicit sorting for this entity and revert to using the distance from the center of the bounding volume.

This property was introduced in Qt 6.0.

Access functions:

float sortIndex() const
void setSortIndex(float sortIndex)

Notifier signal:

void sortIndexChanged(float sortIndex)

See also Qt3DRender::QSortPolicy.

vertexCount : int

Holds the primitive count.

Access functions:

int vertexCount() const
void setVertexCount(int vertexCount)

Notifier signal:

void vertexCountChanged(int vertexCount)

verticesPerPatch : int

Holds vertices per patch.

Access functions:

int verticesPerPatch() const
void setVerticesPerPatch(int verticesPerPatch)

Notifier signal:

void verticesPerPatchChanged(int verticesPerPatch)

Member Function Documentation

[explicit] QGeometryRenderer::QGeometryRenderer(Qt3DCore::QNode *parent = nullptr)

Constructs a new QGeometryRenderer with parent.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.