Geometry QML Type

Base type for custom geometry. More...

Import Statement: import QtQuick3D
Instantiates: QQuick3DGeometry
Inherits:

Object3D

Inherited By:

GridGeometry and HeightFieldGeometry

Detailed Description

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 source to a Model. Instead, set its geometry property to reference a Geometry object.

A typical way of implementing custom geometry is by creating a 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 GridGeometry in the Helpers module. The following is an example of 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, and QQuick3DGeometry.

© 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.