Qt Quick 3D

Qt Quick 3D 提供用于创建 3D 内容和 3D 用户界面的高级 API,基于 Qt Quick . Rather than using an external engine, which creates syncing issues and additional layers of abstraction, Qt Quick 3D provides extensions to the existing Qt Quick 场景图形 for spatial content and a renderer for that extended scene graph. When using the spatial scene graph, it's possible to mix Qt Quick 2D content with 3D content.

使用模块

QML API

模块的 QML 类型是可用的透过 QtQuick3D 导入。要使用类型,添加以下 import 语句到 .qml 文件:

import QtQuick3D
												

The following module imports provide additional functionality:

import QtQuick3D.AssetUtils
import QtQuick3D.Helpers
import QtQuick3D.Particles3D
												

C++ API

使用 Qt 模块的 C++ API 要求直接 (或透过其它依赖) 链接到模块库。几个构建工具对此有专用支持,包括 CMake and qmake .

构建采用 CMake

使用 find_package() 命令定位所需模块组件在 Qt6 包:

find_package(Qt6 REQUIRED COMPONENTS Quick3D)
target_link_libraries(mytarget PRIVATE Qt6::Quick3D)
												

更多细节,见 构建采用 CMake 概述。

采用 qmake 构建

要配置采用 qmake 构建模块,添加模块作为值为 QT 变量在工程的 .pro 文件:

QT += quick3d
												

从源代码构建

当从源代码构建时,确保模块和工具来自 qtdeclarative and qtshadertools repositories are built first, as it's not possible to use Qt Quick 3D without these. Having qtquicktimeline 可用强烈建议为好,因为基于关键帧的动画否则将不可用。

此外,某些范例依赖 Qt Quick Controls .

模块演变

Qt Quick 3D 的变化 列出了 Qt 的 Qt 6 系列在模块 API 和功能上所做出的重要改变。

文章和指南

范例

参考

许可和归属

Qt Quick 3D 在商业许可下是可用的来自 Qt 公司 。此外,它是可用的根据 GNU GPL (一般公共许可) 第 3 版 。见 Qt 许可 进一步了解细节。

Furthermore, Qt Quick 3D potentially contains third party modules under the following permissive licenses:

Godot Engine: Fog

MIT 许可

Godot Engine: ProceduralSky

MIT 许可

Intel Embree, version 3.13.3

Apache 许可 2.0

Open Asset Import Library, version 5.2.5

BSD 3 条款新 (或修订) 许可

Tiny OpenEXR, version v1.0.7

BSD 3 条款新 (或修订) 许可

meshoptimizer, version v0.18

MIT 许可

xatlas, version 16ace528acd2cf1f16a7c0dde99c42c486488dbe

MIT 许可