GridGeometry QML Type

用于渲染网格的自定义几何体提供程序。更多

Import Statement: import QtQuick3D.Helpers
Inherits:

Geometry

属性

详细说明

该辅助程序实现了网格几何功能,可以在场景中显示网格。

例如,以下代码段将在有一盏灯的场景中显示一个在两个方向上都有 19 个单元格的网格。在没有进一步变换的情况下,网格默认朝向摄像机。

View3D {
    anchors.fill: parent
    camera: camera

    PerspectiveCamera {
        id: camera
        position: Qt.vector3d(0, 0, 600)
    }

    DirectionalLight {
        position: Qt.vector3d(-500, 500, -100)
        color: Qt.rgba(0.4, 0.2, 0.6, 1.0)
        ambientColor: Qt.rgba(0.1, 0.1, 0.1, 1.0)
    }

    Model {
        scale: Qt.vector3d(100, 100, 100)
        geometry: GridGeometry {
            horizontalLines: 20
            verticalLines: 20
        }
        materials: [ DefaultMaterial { } ]
    }
}

另请参阅 Qt Quick 3D - 自定义几何示例Model

属性文档

horizontalLines : int

指定网格中水平线的数量。默认值为 1000。


horizontalStep : real

指定水平线之间的间距。默认值为 0.1。


verticalLines : int

指定网格中垂直线的数量。默认值为 1000。


verticalStep : real

指定垂直线之间的间距。默认值为 0.1。


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