Geometry QML Type
自定义几何体的基本类型。更多
Import Statement: | import QtQuick3D |
In C++: | QQuick3DGeometry |
Inherits: | |
Inherited By: |
详细说明
自定义几何体允许使用应用程序生成的顶点和索引数据,这些数据也可能动态变化。要使用自定义几何体,请不要将.mesh
文件指定为模型的source 。相反,应将geometry 属性设置为引用几何对象。
实现自定义几何的典型方法是在 C++ 中创建QQuick3DGeometry 子类,并注册新类型供 QML 使用。
也可以使用Helpers
模块中的内置自定义几何体提供程序GridGeometry 。下面是GridGeometry 的示例。任何应用程序提供的几何子类都可以用同样的方式使用。
import QtQuick3D.Helpers Model { geometry: GridGeometry { } materials: [ DefaultMaterial { diffuseColor: "white" lighting: DefaultMaterial.NoLighting } ] }
© 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.