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.

Qt Quick 3D also provides for XR and VR applications with Qt Quick 3D Xr .

使用模塊

QML API

模塊的 QML 類型是可用的透過 QtQuick3D 導入。要使用類型,添加以下 import 語句到 .qml 文件:

import QtQuick3D
					

The following module imports provide additional functionality:

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

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 學院課程

許可和歸屬

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

Java Native Interface for C++, version 1.0.0

MIT 許可

JsonCpp, version 1.9.6

MIT 許可

Open Asset Import Library, version 6.0.2

BSD 3 條款新 (或修訂) 許可

OpenXR SDK, version 1.1.49

Apache 許可 2.0

Tiny OpenEXR, version 1.0.12

BSD 3 條款新 (或修訂) 許可

meshoptimizer, version 0.23

MIT 許可

xatlas, version 16ace528acd2cf1f16a7c0dde99c42c486488dbe

MIT 許可