Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QQuick3DGeometry Class Reference

\qmltype Geometry \inherits Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DGeometry More...

#include <qquick3dgeometry.h>

+ Inheritance diagram for QQuick3DGeometry:
+ Collaboration diagram for QQuick3DGeometry:

Classes

struct  Attribute
 
struct  TargetAttribute
 

Public Types

enum class  PrimitiveType {
  Points , LineStrip , Lines , TriangleStrip ,
  TriangleFan , Triangles
}
 

Signals

void geometryNodeDirty ()
 
 Q_REVISION (6, 7) void geometryChanged()
 
- Signals inherited from QQuick3DObject
void parentChanged ()
 
void childrenChanged ()
 
void stateChanged ()
 
- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked.
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 This signal is emitted after the object's name has been changed.
 

Public Member Functions

 QQuick3DGeometry (QQuick3DObject *parent=nullptr)
 
 ~QQuick3DGeometry () override
 
QByteArray vertexData () const
 Returns the vertex buffer data set by setVertexData.
 
QByteArray indexData () const
 Returns the index buffer data.
 
int attributeCount () const
 Returns the number of attributes defined for this geometry.
 
Attribute attribute (int index) const
 Returns attribute definition number index.
 
PrimitiveType primitiveType () const
 Returns the primitive type used when rendering.
 
QVector3D boundsMin () const
 
QVector3D boundsMax () const
 
int stride () const
 
void setVertexData (const QByteArray &data)
 Sets the vertex buffer data.
 
void setVertexData (int offset, const QByteArray &data)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Updates a subset of the vertex buffer.
 
void setIndexData (const QByteArray &data)
 Sets the index buffer to data.
 
void setIndexData (int offset, const QByteArray &data)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Updates a subset of the index buffer.
 
void setStride (int stride)
 Sets the stride of the vertex buffer to stride, measured in bytes.
 
void setBounds (const QVector3D &min, const QVector3D &max)
 Sets the bounding volume of the geometry to the cube defined by the points min and max.
 
void setPrimitiveType (PrimitiveType type)
 Sets the primitive type used for rendering to type.
 
void addAttribute (Attribute::Semantic semantic, int offset, Attribute::ComponentType componentType)
 Adds vertex attribute description.
 
void addAttribute (const Attribute &att)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Adds vertex attribute description.
 
 Q_REVISION (6, 3) int subsetCount() const
 
 Q_REVISION (6, 3) QVector3D subsetBoundsMin(int subset) const
 
 Q_REVISION (6, 3) QVector3D subsetBoundsMax(int subset) const
 
 Q_REVISION (6, 3) int subsetOffset(int subset) const
 
 Q_REVISION (6, 3) int subsetCount(int subset) const
 
 Q_REVISION (6, 3) QString subsetName(int subset) const
 
 Q_REVISION (6, 3) void addSubset(int offset
 
 Q_REVISION (6, 6) QByteArray targetData() const
 
 Q_REVISION (6, 6) void setTargetData(const QByteArray &data)
 
 Q_REVISION (6, 6) void setTargetData(int offset
 
 Q_REVISION (6, 6) TargetAttribute targetAttribute(int index) const
 
 Q_REVISION (6, 6) int targetAttributeCount() const
 
 Q_REVISION (6, 6) void addTargetAttribute(quint32 targetId
 
 Q_REVISION (6, 6) void addTargetAttribute(const TargetAttribute &att)
 
void clear ()
 Resets the geometry to its initial state, clearing previously set vertex and index data as well as attributes.
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 Constructs an object with parent object parent.
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects.
 
virtual bool event (QEvent *event)
 This virtual function receives events to an object and should return true if the event e was recognized and processed.
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 Filters events if this object has been installed as an event filter for the watched object.
 
QString objectName () const
 
Q_WEAK_OVERLOAD void setObjectName (const QString &name)
 Sets the object's name to name.
 
void setObjectName (QAnyStringView name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false.
 
bool isWindowType () const
 Returns true if the object is a window; otherwise returns false.
 
bool isQuickItemType () const
 Returns true if the object is a QQuickItem; otherwise returns false.
 
bool signalsBlocked () const noexcept
 Returns true if signals are blocked; otherwise returns false.
 
bool blockSignals (bool b) noexcept
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it).
 
QThreadthread () const
 Returns the thread in which the object lives.
 
bool moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
 Changes the thread affinity for this object and its children and returns true on success.
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds.
 
int startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 Kills the timer with timer identifier, id.
 
void killTimer (Qt::TimerId id)
 
template<typename T >
findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object.
 
template<typename T >
QList< T > findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects.
 
template<typename T >
findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T >
QList< T > findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
const QObjectListchildren () const
 Returns a list of child objects.
 
void setParent (QObject *parent)
 Makes the object a child of parent.
 
void installEventFilter (QObject *filterObj)
 Installs an event filter filterObj on this object.
 
void removeEventFilter (QObject *obj)
 Removes an event filter object obj from this object.
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 Dumps a tree of children to the debug output.
 
void dumpObjectInfo () const
 Dumps information about signal connections, etc.
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value.
 
bool setProperty (const char *name, QVariant &&value)
 
QVariant property (const char *name) const
 Returns the value of the object's name property.
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 Returns a pointer to the parent object.
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.
 
- Public Member Functions inherited from QQmlParserStatus
 QQmlParserStatus ()
 
virtual ~QQmlParserStatus ()
 

Public Attributes

int count
 
int const QVector3DboundsMin
 Returns the minimum coordinate of the bounding volume.
 
int const QVector3D const QVector3DboundsMax
 Returns the maximum coordinate of the bounding volume.
 
int const QVector3D const QVector3D const QStringname = {})
 
const QByteArraydata
 
Attribute::Semantic semantic
 
Attribute::Semantic int offset
 
Attribute::Semantic int int stride = 0)
 Returns the byte stride of the vertex buffer.
 

Protected Member Functions

QSSGRenderGraphObjectupdateSpatialNode (QSSGRenderGraphObject *node) override
 
void markAllDirty () override
 
- Protected Member Functions inherited from QQuick3DObject
virtual void itemChange (ItemChange, const ItemChangeData &)
 
 QQuick3DObject (QQuick3DObjectPrivate &dd, QQuick3DObject *parent=nullptr)
 
void classBegin () override
 Invoked after class creation, but before any properties have been set.
 
void componentComplete () override
 Invoked after the root component that caused this instantiation has completed construction.
 
bool isComponentComplete () const
 
virtual void preSync ()
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr.
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal.
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 This event handler can be reimplemented in a subclass to receive timer events for the object.
 
virtual void childEvent (QChildEvent *event)
 This event handler can be reimplemented in a subclass to receive child events.
 
virtual void customEvent (QEvent *event)
 This event handler can be reimplemented in a subclass to receive custom events.
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 

Additional Inherited Members

- Public Slots inherited from QQuick3DObject
void update ()
 
void setParentItem (QQuick3DObject *parentItem)
 
- Public Slots inherited from QObject
void deleteLater ()
 \threadsafe
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 \threadsafe
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 \threadsafe
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 Disconnect a connection.
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Properties inherited from QQuick3DObject
QQuick3DObjectparent
 \qmlproperty Object3D QtQuick3D::Object3D::parent This property holds the parent of the Object3D in a 3D scene.
 
- Properties inherited from QObject
QString objectName
 the name of this object
 

Detailed Description

\qmltype Geometry \inherits Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DGeometry

Base type for custom geometry.

Custom geometry allows using application-generated vertex and index data, that can possibly change dynamically as well. To use custom geometry, do not assign a {.mesh} file as the \l{Model::source}{source} to a Model. Instead, set its \l{Model::geometry}{geometry} property to reference a Geometry object.

A typical way of implementing custom geometry is by creating a \l QQuick3DGeometry subclass in C++ and registering the new type for use with QML.

It is also possible to use the built-in custom geometry provider \l GridGeometry in the Helpers module. The following is an example of \l GridGeometry. Any application-provided Geometry subclass can be taken into use in the same manner.

import QtQuick3D.Helpers
Model {
geometry: GridGeometry {
}
materials: [
DefaultMaterial {
diffuseColor: "white"
lighting: DefaultMaterial.NoLighting
}
]
}
See also
{Qt Quick 3D - Custom Geometry Example}, Model, QQuick3DGeometry

\inmodule QtQuick3D \inherits QQuick3DObject

Since
5.15

Base class for defining custom geometry.

The QQuick3DGeometry can be used to specify custom geometry for a Model in the Qt Quick 3D scene.

While not strictly required, the typical usage is to inherit from this class. The subclass is then exposed to QML by registering it to the type system. The \l{Model::geometry}{geometry} property of a Model can then be set to reference an instance of the registered type.

The high-level structure of such a class is typically similar to the following:

class CustomGeometry : public QQuick3DGeometry
{
public:
CustomGeometry() { rebuildGeometry(); }
void setSomething() {
// Change relevant internal data.
// ...
// Then rebuild the vertex and index data and pass it to QQuick3DGeometry.
rebuildGeometry();
// Finally, trigger an update. This is relevant in case nothing else
// is changing in the scene; this way we make sure a new frame will
// be rendered.
update();
}
private:
void rebuildGeometry()
{
QByteArray vertices;
...
setPrimitiveType(Lines);
setVertexBuffer(vertices);
setIndexBuffer(indices);
setStride(3 * sizeof(float)); // e.g. when having 3 components per vertex
setBounds(...); // minimum and maximum extents, for picking
addAttribute(PositionSemantic, 0, F32Type);
...
}
};
\inmodule QtCore
Definition qbytearray.h:57
\qmltype Geometry \inherits Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DGeometry
GLsizei GLenum const void * indices

This class can then be registered as a QML type and used with \l {QtQuick3D::Model}{Model}.

In Qt 5 type registration happened with qmlRegisterType:

qmlRegisterType<CustomGeometry>("Example", 1, 0, "CustomGeometry");

In Qt 6 the default approach is to use automatic registration with the help of the build system. Instead of calling qmlRegisterType, the {.pro} file can now contain:

CONFIG += qmltypes
QML_IMPORT_NAME = Example
QML_IMPORT_MAJOR_VERSION = 1

With CMake, automatic registration is the default behavior, so no special settings are needed beyond basic QML module setup:

qt_add_qml_module(application
URI Example
VERSION 1.0
)
const char * VERSION

The class implementation should add QML_NAMED_ELEMENT:

class CustomGeometry : public QQuick3DGeometry
{
QML_NAMED_ELEMENT(CustomGeometry)
...
};
#define QML_NAMED_ELEMENT(NAME)
#define Q_OBJECT

The QML code can then use the custom type:

import Example 1.0
Model {
id: customModel
geometry: CustomGeometry {
}
}

At minimum, a custom geometry should have the following specified:

\list

  • vertex data,
  • vertex stride,
  • primitive type,
  • an attribute with PositionSemantic. \endlist

These are sufficient to render the mesh. For indexed drawing, the index buffer data and an attribute with IndexSemantic needs to be specified as well. In order to support picking (input), the class must specify the bounding volume using setBounds(). For proper lighting, an attribute with NormalSemantic is needed. When the material uses texturing, at least one set of UV coordinates must be provided and described in an TexCoord0Semantic or TexCoord1Semantic attribute. Some materials may require tangents and binormals as well.

As a concrete, minimal example, the following class would provide geometry for a single triangle:

class ExampleGeometry : public QQuick3DGeometry
{
QML_NAMED_ELEMENT(ExampleGeometry)
public:
ExampleGeometry();
private:
void updateData();
};
ExampleGeometry::ExampleGeometry()
{
updateData();
}
void ExampleGeometry::updateData()
{
v.resize(3 * 3 * sizeof(float));
float *p = reinterpret_cast<float *>(v.data());
// a triangle, front face = counter-clockwise
*p++ = -1.0f; *p++ = -1.0f; *p++ = 0.0f;
*p++ = 1.0f; *p++ = -1.0f; *p++ = 0.0f;
*p++ = 0.0f; *p++ = 1.0f; *p++ = 0.0f;
setStride(3 * sizeof(float));
0,
}
void resize(qsizetype size)
Sets the size of the byte array to size bytes.
void setPrimitiveType(PrimitiveType type)
Sets the primitive type used for rendering to type.
void setStride(int stride)
Sets the stride of the vertex buffer to stride, measured in bytes.
void addAttribute(Attribute::Semantic semantic, int offset, Attribute::ComponentType componentType)
Adds vertex attribute description.
void setVertexData(const QByteArray &data)
Sets the vertex buffer data.
GLsizei const GLfloat * v
[13]
GLfloat GLfloat p
[1]

Depending on the lighting in the scene, the result of referencing this geometry from a Model:

Note
Vertex data is expected to follow OpenGL conventions. This means the data must be provided with the assumption that the Y axis is pointing up in the normalized device coordinate system, and that front faces have a counter clockwise winding.
See also
Model, Geometry

Definition at line 13 of file qquick3dgeometry.h.

Member Enumeration Documentation

◆ PrimitiveType

Enumerator
Points 
LineStrip 
Lines 
TriangleStrip 
TriangleFan 
Triangles 

Definition at line 24 of file qquick3dgeometry.h.

Constructor & Destructor Documentation

◆ QQuick3DGeometry()

QQuick3DGeometry::QQuick3DGeometry ( QQuick3DObject * parent = nullptr)
explicit

Definition at line 231 of file qquick3dgeometry.cpp.

◆ ~QQuick3DGeometry()

QQuick3DGeometry::~QQuick3DGeometry ( )
override

Definition at line 237 of file qquick3dgeometry.cpp.

Member Function Documentation

◆ addAttribute() [1/2]

void QQuick3DGeometry::addAttribute ( Attribute::Semantic semantic,
int offset,
Attribute::ComponentType componentType )

Adds vertex attribute description.

Each attribute has a semantic, which specifies the usage of the attribute and the number of components it has, an offset from the beginning to the vertex to the attribute location inside a vertex and a componentType specifying the datatype and size of the attribute.

The semantic can be one of the following:

\value PositionSemantic The attribute is a position. 3 components: x, y, and z \value NormalSemantic The attribute is a normal vector. 3 components: x, y, and z \value TexCoord0Semantic The attribute is a texture coordinate. 2 components: u and v \value TexCoord1Semantic The attribute is a texture coordinate. 2 components: u and v \value TangentSemantic The attribute is a tangent vector. 3 components: x, y, and z \value BinormalSemantic The attribute is a binormal vector. 3 components: x, y, and z \value JointSemantic The attribute is a joint index vector for \l {Vertex Skinning}{skinning}. 4 components: joint index 1-4 \value WeightSemantic The attribute is a weight vector for \l {Vertex Skinning}{skinning}. 4 components: joint weight 1-4 \value ColorSemantic The attribute is a vertex color vector. 4 components: r, g, b, and a \value TargetPositionSemantic The attribute is a position for the first \l {Morphing Animation}{morph target}. 3 components: x, y, and z \value TargetNormalSemantic The attribute is a normal vector for the first \l {Morphing Animation}{morph target}. 3 components: x, y, and z \value TargetTangentSemantic The attribute is a tangent vector for the first \l {Morphing Animation}{morph target}. 3 components: x, y, and z \value TargetBinormalSemantic The attribute is a binormal vector for the first \l {Morphing Animation}{morph target}. 3 components: x, y, and z

In addition, semantic can be IndexSemantic. In this case the attribute does not represent an entry in the vertex buffer, but rather describes the index data in the index buffer. Since there is always just one index per vertex, offset makes no sense for the index buffer, and should be left at zero.

The component type can be one of the following:

\value U16Type The index component type is unsigned 16-bit integer. Only supported for IndexSemantic.

\value U32Type The attribute (or index component) is an unsigned 32-bit integer.

\value I32Type The attribute is a signed 32-bit integer. Be aware that old OpenGL versions (such as, 2.1 or OpenGL ES 2.0) may not support this data type.

\value F32Type The attribute is a single-precision float.

Note
The joint index data is typically I32Type. F32Type is also supported in order to enable functioning with APIs, such as OpenGL ES 2.0, that do not support integer vertex input attributes.
For index data (IndexSemantic) only U16Type and U32Type are sensible and supported.
TargetXXXSemantics will be deprecated. \l addTargetAttribute can be used for the morph targets. Now these semantics are just supported for backward compatibility. If they are mixed-used with addTargetAttribute and setTargetData, the result cannot be quaranteed.

Definition at line 608 of file qquick3dgeometry.cpp.

References d, QQuick3DGeometryPrivate::MAX_ATTRIBUTE_COUNT, QQuick3DGeometryPrivate::MAX_TARGET_ATTRIBUTE_COUNT, offset, semantic, QQuick3DGeometry::Attribute::TargetBinormalSemantic, QQuick3DGeometry::Attribute::TargetNormalSemantic, QQuick3DGeometry::Attribute::TargetPositionSemantic, and QQuick3DGeometry::Attribute::TargetTangentSemantic.

◆ addAttribute() [2/2]

void QQuick3DGeometry::addAttribute ( const Attribute & attribute)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Adds vertex attribute description.

Each attribute has a semantic, which specifies the usage of the attribute and the number of components it has, an offset from the beginning to the vertex to the attribute location inside a vertex and a componentType specifying the datatype and size of the attribute.

Definition at line 644 of file qquick3dgeometry.cpp.

References d, and QQuick3DGeometryPrivate::MAX_ATTRIBUTE_COUNT.

◆ attribute()

QQuick3DGeometry::Attribute QQuick3DGeometry::attribute ( int index) const

Returns attribute definition number index.

The attribute definitions are numbered from 0 to {attributeCount() - 1}

Definition at line 287 of file qquick3dgeometry.cpp.

References d.

Referenced by attributeBySemantic().

+ Here is the caller graph for this function:

◆ attributeCount()

int QQuick3DGeometry::attributeCount ( ) const

Returns the number of attributes defined for this geometry.

See also
attribute

Definition at line 276 of file qquick3dgeometry.cpp.

References d.

Referenced by attributeBySemantic().

+ Here is the caller graph for this function:

◆ boundsMax()

QVector3D QQuick3DGeometry::boundsMax ( ) const

◆ boundsMin()

QVector3D QQuick3DGeometry::boundsMin ( ) const

◆ clear()

void QQuick3DGeometry::clear ( )

Resets the geometry to its initial state, clearing previously set vertex and index data as well as attributes.

Definition at line 718 of file qquick3dgeometry.cpp.

References d, and Triangles.

◆ geometryNodeDirty

void QQuick3DGeometry::geometryNodeDirty ( )
signal

Referenced by QQuick3DModel::setGeometry(), and updateSpatialNode().

+ Here is the caller graph for this function:

◆ indexData()

QByteArray QQuick3DGeometry::indexData ( ) const

Returns the index buffer data.

Definition at line 265 of file qquick3dgeometry.cpp.

References d.

◆ markAllDirty()

void QQuick3DGeometry::markAllDirty ( )
overrideprotectedvirtual

Reimplemented from QQuick3DObject.

Definition at line 362 of file qquick3dgeometry.cpp.

References QQuick3DObject::markAllDirty().

Referenced by updateSpatialNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ primitiveType()

QQuick3DGeometry::PrimitiveType QQuick3DGeometry::primitiveType ( ) const

Returns the primitive type used when rendering.

The default is Triangles.

See also
setPrimitiveType

Definition at line 323 of file qquick3dgeometry.cpp.

References d.

◆ Q_REVISION() [1/15]

QQuick3DGeometry::Q_REVISION ( 6 ,
3  ) const

◆ Q_REVISION() [2/15]

QQuick3DGeometry::Q_REVISION ( 6 ,
3  ) const

◆ Q_REVISION() [3/15]

QQuick3DGeometry::Q_REVISION ( 6 ,
3  ) const

◆ Q_REVISION() [4/15]

QQuick3DGeometry::Q_REVISION ( 6 ,
3  ) const

◆ Q_REVISION() [5/15]

QQuick3DGeometry::Q_REVISION ( 6 ,
3  ) const

◆ Q_REVISION() [6/15]

QQuick3DGeometry::Q_REVISION ( 6 ,
3  ) const

◆ Q_REVISION() [7/15]

QQuick3DGeometry::Q_REVISION ( 6 ,
3  )

◆ Q_REVISION() [8/15]

QQuick3DGeometry::Q_REVISION ( 6 ,
6  ) const

◆ Q_REVISION() [9/15]

QQuick3DGeometry::Q_REVISION ( 6 ,
6  ) const

◆ Q_REVISION() [10/15]

QQuick3DGeometry::Q_REVISION ( 6 ,
6  ) const

◆ Q_REVISION() [11/15]

QQuick3DGeometry::Q_REVISION ( 6 ,
6  ) const &

◆ Q_REVISION() [12/15]

QQuick3DGeometry::Q_REVISION ( 6 ,
6  )

◆ Q_REVISION() [13/15]

QQuick3DGeometry::Q_REVISION ( 6 ,
6  ) const &

◆ Q_REVISION() [14/15]

QQuick3DGeometry::Q_REVISION ( 6 ,
6  )

◆ Q_REVISION [15/15]

QQuick3DGeometry::Q_REVISION ( 6 ,
7  )
signal

◆ setBounds()

void QQuick3DGeometry::setBounds ( const QVector3D & min,
const QVector3D & max )

Sets the bounding volume of the geometry to the cube defined by the points min and max.

This is used for \l {View3D::pick}{picking}.

Definition at line 516 of file qquick3dgeometry.cpp.

References d.

◆ setIndexData() [1/2]

void QQuick3DGeometry::setIndexData ( const QByteArray & data)

Sets the index buffer to data.

To use indexed drawing, add an attribute with IndexSemantic

See also
addAttribute

Definition at line 456 of file qquick3dgeometry.cpp.

References d, and data.

◆ setIndexData() [2/2]

void QQuick3DGeometry::setIndexData ( int offset,
const QByteArray & data )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Updates a subset of the index buffer.

offset specifies the offset in bytes, data specifies the size and the data.

This function will not resize the buffer. If {offset + data.size()} is greater than the current size of the buffer, the overshooting data will be ignored.

Note
The partial update functions for vertex, index and morph target data do not offer any guarantee on how such changes are implemented internally. Depending on the underlying implementation, even partial changes may lead to updating the entire graphics resource.

Definition at line 477 of file qquick3dgeometry.cpp.

References d, and qMin().

+ Here is the call graph for this function:

◆ setPrimitiveType()

void QQuick3DGeometry::setPrimitiveType ( PrimitiveType type)

Sets the primitive type used for rendering to type.

\value Points The primitives are points. \value LineStrip The primitives are lines in a strip. \value Lines The primitives are lines in a list. \value TriangleStrip The primitives are triangles in a strip. \value TriangleFan The primitives are triangles in a fan. Be aware that triangle fans may not be supported at run time, depending on the underlying graphics API. \value Triangles The primitives are triangles in a list.

The initial value is Triangles.

Note
Be aware that triangle fans (TriangleFan) may not be supported at run time, depending on the underlying graphics API. For example, with Direct 3D this topology will not be functional at all.
The point size for Points and the line width for Lines and LineStrip are controlled by the \l{PrincipledMaterial::pointSize}{material}. Be aware however that sizes other than 1 may not be supported at run time, depending on the underlying graphics API.

Definition at line 548 of file qquick3dgeometry.cpp.

References d.

◆ setStride()

void QQuick3DGeometry::setStride ( int stride)

Sets the stride of the vertex buffer to stride, measured in bytes.

This is the distance between two consecutive vertices in the buffer.

For example, a tightly packed, interleaved vertex buffer for a geometry using PositionSemantic, IndexSemantic, and ColorSemantic will have a stride of 28 (Seven floats in total: Three for position, four for color, and none for indexes, which do not go in the vertex buffer.)

Note
QQuick3DGeometry expects, and works only with, vertex data with an interleaved attribute layout.
See also
addAttribute

Definition at line 503 of file qquick3dgeometry.cpp.

References d, and stride.

◆ setVertexData() [1/2]

void QQuick3DGeometry::setVertexData ( const QByteArray & data)

Sets the vertex buffer data.

The buffer should hold all the vertex data packed in the array, as described by the attribute definitions. Note that this does not include attributes with IndexSemantic, which belong in the index buffer.

See also
addAttribute, setStride, setIndexData

Definition at line 375 of file qquick3dgeometry.cpp.

References d, and data.

◆ setVertexData() [2/2]

void QQuick3DGeometry::setVertexData ( int offset,
const QByteArray & data )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Updates a subset of the vertex buffer.

offset specifies the offset in bytes, data specifies the size and the data.

This function will not resize the buffer. If {offset + data.size()} is greater than the current size of the buffer, the overshooting data will be ignored.

Note
The partial update functions for vertex, index and morph target data do not offer any guarantee on how such changes are implemented internally. depending on the underlying implementation, even partial changes may lead to updating the entire graphics resource.

Definition at line 396 of file qquick3dgeometry.cpp.

References d, and qMin().

+ Here is the call graph for this function:

◆ stride()

int QQuick3DGeometry::stride ( ) const

◆ updateSpatialNode()

◆ vertexData()

QByteArray QQuick3DGeometry::vertexData ( ) const

Returns the vertex buffer data set by setVertexData.

Definition at line 245 of file qquick3dgeometry.cpp.

References d.

Member Data Documentation

◆ boundsMax

QVector3D QQuick3DGeometry::boundsMax

Returns the maximum coordinate of the bounding volume.

See also
setBounds

Definition at line 95 of file qquick3dgeometry.h.

Referenced by QQuick3DModel::updateSpatialNode().

◆ boundsMin

QVector3D QQuick3DGeometry::boundsMin

Returns the minimum coordinate of the bounding volume.

See also
setBounds

Definition at line 95 of file qquick3dgeometry.h.

Referenced by QQuick3DModel::updateSpatialNode().

◆ count

int QQuick3DGeometry::count

Definition at line 95 of file qquick3dgeometry.h.

◆ data

const QByteArray& QQuick3DGeometry::data

Definition at line 99 of file qquick3dgeometry.h.

Referenced by setIndexData(), and setVertexData().

◆ name

int const QVector3D const QVector3D const QString& QQuick3DGeometry::name = {})

Definition at line 95 of file qquick3dgeometry.h.

◆ offset

Attribute::Semantic int QQuick3DGeometry::offset

Definition at line 103 of file qquick3dgeometry.h.

Referenced by addAttribute().

◆ semantic

Attribute::Semantic QQuick3DGeometry::semantic

Definition at line 103 of file qquick3dgeometry.h.

Referenced by addAttribute().

◆ stride

int QQuick3DGeometry::stride = 0)

Returns the byte stride of the vertex buffer.

See also
setStride

Definition at line 104 of file qquick3dgeometry.h.

Referenced by setStride().


The documentation for this class was generated from the following files: