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 .
使用
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
)
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 支持下列平台:
Qt3D 的变化 列出了 Qt 的 Qt 6 系列在模块 API 和功能上所做出的重要改变。
Qt 3D 在商业许可下是可用的来自 Qt 公司 。此外,它是可用的根据 GNU LGPL (次一般公共许可) 第 3 版 ,或 GNU GPL (一般公共许可) 第 2 版 。见 Qt 许可 进一步了解细节。
此外,Qt 3D 包含的第 3 方模块遵循下列准许许可:
| MIT 许可 | |
| MIT 许可或公共领域 | |
| MIT 许可 | |
| BSD 3 条款新 (或修订) 许可 |