Qt 3D

Qt 3D provides functionality for near-realtime simulation systems with support for 2D and 3D rendering in both Qt C++ and Qt Quick applications.

Qt 3D 功能被劃分成下列 C++ 模塊:

下列 C++ 模塊仍在開發,但可用作技術預覽:

對於 Qt Quick 應用程序,Qt 3D 提供下列 QML 模塊:

下列 QML 模塊仍在開發,但可用作技術預覽:

使用模塊

For a C++ application that performs 2D or 3D rendering, collision detection, and handles user input, include the following directives of the modules' classes:

#include <Qt3DCore>
#include <Qt3DRender>
#include <Qt3DInput>
#include <Qt3DLogic>
#include <Qt3DExtras>
#include <Qt3DAnimation>
					

要導入 QML 類型到應用程序中,使用以下 import 語句在 .qml 文件中:

import Qt3D.Core
import Qt3D.Render
import Qt3D.Input
import Qt3D.Logic
import Qt3D.Extras
import Qt3D.Animation
import QtQuick.Scene2D
import QtQuick.Scene3D
					

使用 Qt 模塊的 C++ API 要求直接 (或透過其它依賴) 鏈接到模塊庫。幾個構建工具對此有專用支持,包括 CMake and qmake .

構建采用 CMake

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

find_package(Qt6 REQUIRED COMPONENTS
    3DCore
    3DRender
    3DInput
    3DLogic
    3DExtras
    3DAnimation
)
target_link_libraries(mytarget PRIVATE
    Qt6::3DCore
    Qt6::3DRender
    Qt6::3DLogic
    Qt6::3DExtras
    Qt6::3DAnimation
)
					

采用 qmake 構建

To configure the module for building with qmake, add the modules to the QT 變量在工程的 .pro 文件:

QT += 3dcore 3drender 3dinput 3dlogic 3dextras 3danimation
					

A Qt Quick application requires additional dependencies:

QT += 3dcore 3drender 3dinput 3dlogic 3dextras 3danimation qml quick 3dquick
					

概述

Qt 3D 高級設計、動機的描述在 Qt 3D 概述 . The Qt 3D Render offers support for data-driven configuration as described in Qt 3D 渲染 FrameGraph .

參考

Qt 3D 平颱支持

Qt 3D 支持下列平颱:

  • 微軟 Windows (win32) - 支持
  • Linux X11 - 支持
  • macOS - 支持 (盡管可能有一些視網膜比例縮放問題)
  • Android - 支持
  • 嵌入式 Linux - 支持
  • iOS - 從 Qt5.7 起支持
  • WinRT - 尚不支持

模塊演變

Qt3D 的變化 列齣瞭 Qt 的 Qt 6 係列在模塊 API 和功能上所做齣的重要改變。

許可和歸屬

Qt 3D 在商業許可下是可用的來自 Qt 公司 。此外,它是可用的根據 GNU LGPL (次一般公共許可) 第 3 版 ,或 GNU GPL (一般公共許可) 第 2 版 。見 Qt 許可 進一步瞭解細節。

此外,Qt 3D 包含的第 3 方模塊遵循下列準許許可:

Dear ImGui - ProggyClean.ttf

MIT 許可

Dear ImGui - stb

MIT 許可或公共領域

Dear ImGui, version v1.91.0

MIT 許可

Open Asset Import Library, version 6.0.2

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