Qt Quick 3D
Qt Quick 3D provides a high-level API for creating 3D content and 3D user interfaces based on 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 Scene Graph 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提供了一个高级API,用于创建基于Qt Quick的3D内容和3D用户界面。Qt Quick 3D没有使用外部引擎(这会产生同步问题和额外的抽象层),而是为空间内容提供了对现有Qt Quick Scene Graph的扩展,并为扩展的场景图提供了渲染器。使用空间场景图时,可以将Qt Quick 2D内容与3D内容混合使用。
Qt Quick 3D also provides for XR and VR applications with Qt Quick 3D Xr.
Qt Quick 3D还通过Qt Quick 3D XR提供XR和VR应用程序。
Using the Module
使用模块
QML API
The QML types of the module are available through the QtQuick3D
import. To use the types, add the following import statement to your .qml file:
QML类型的模块可通过QtQuick3D导入获得。要使用这些类型,请将以下导入语句添加到.qml文件中:
import QtQuick3D
The following module imports provide additional functionality:
以下模块导入提供了附加功能:
import QtQuick3D.AssetUtils import QtQuick3D.Helpers import QtQuick3D.Particles3D import QtQuick3D.Xr
C++ API
Using a Qt module's C++ API requires linking against the module library, either directly or through other dependencies. Several build tools have dedicated support for this, including CMake and qmake.
使用Qt模块的C++API需要直接或通过其他依赖关系链接到模块库。有几个构建工具专门支持这一点,包括CMake和qmake。
Building with CMake
使用CMake构建
Use the find_package()
command to locate the needed module component in the Qt6
package:
使用find_package()命令在Qt6包中查找所需的模块组件:
find_package(Qt6 REQUIRED COMPONENTS Quick3D) target_link_libraries(mytarget PRIVATE Qt6::Quick3D)
For more details, see the Build with CMake overview.
有关更多详细信息,请参阅使用CMake构建概述。
Building with qmake
使用qmake构建
To configure the module for building with qmake, add the module as a value of the QT
variable in the project's .pro file:
要配置模块以使用qmake进行构建,请将模块添加为项目.pro文件中QT变量的值:
QT += quick3d
Building From Source
从源码构建
When building from source, ensure that the modules and tools from the qtdeclarative and qtshadertools repositories are built first, as it's not possible to use Qt Quick 3D without these. Having qtquicktimeline available is strongly recommended as well, since keyframe-based animations will not be available otherwise.
从源代码构建时,请确保首先构建qtdeclarative和qtshadertools存储库中的模块和工具,因为没有这些模块和工具就无法使用Qt Quick 3D。强烈建议使用qtquicktimeline,因为否则将无法使用基于关键帧的动画。
In addition, some of the examples rely on Qt Quick Controls.
此外,一些示例依赖于QtQuick控制。
Module Evolution
模块演进
Changes to Qt Quick 3D lists important changes in the module API and functionality that were done for the Qt 6 series of Qt.
Qt Quick 3D的更改列出了为Qt的Qt 6系列所做的模块API和功能的重要更改。
Articles and Guides
文章和指南
- Qt Quick 3D Introduction Example
- Qt Quick 3D Introduction with glTF Assets
- Qt Quick 3D Graphics Requirements
- Qt Quick 3D Architecture
- Balsam Asset Import Tool
- Optimizing 3D Assets
- Physically-Based Rendering
- Using Image-Based Lighting
- Anti-Aliasing Best Practices
- Qt Quick 3D Scenes with 2D Content
- Programmable Materials, Effects, Geometry, and Texture data
- Build-time materials
- Skeletal Animation
- Morphing Animation
- Instanced Rendering
- Level of Detail
- Custom Material Editor
- Lightmaps and Global Illumination
- Qt Quick 3D Xr Overview
Examples
示例
- Introduction
- View3D with Multiple Viewports
- Lights and Shadows
- Dynamic Model Creation
- Principled Material
- Built-in effects and tonemapping
- Qt Quick Items within the 3D Scene
- Custom Materials
- Unshaded Custom Materials
- Writing Custom Post-Processing Effects
- Adding Custom Geometry from C++
- Adding Custom Texture Data from C++
- Using baked lightmaps
- Demonstrates setting up a simple VR scene
- All examples
Reference
参考
- Qt Quick 3D QML Types
- Qt Quick 3D C++ Classes
- Qt Quick 3D Helpers QML Types
- Qt Quick 3D Asset Utility QML Types
- Qt Quick 3D Particles3D QML Types
- Qt Quick 3D Xr
Related Modules
相关模块
Licenses and Attributions
许可证和属性
Qt Quick 3D is available under the commercial license from The Qt Company. In addition, it is available under the GNU General Public License, version 3. See Qt Licensing for further details.
Qt Quick 3D可从Qt公司获得商业许可。此外,它还可以在GNU通用公共许可证第3版下使用。有关更多详细信息,请参阅Qt许可。
Furthermore, Qt Quick 3D potentially contains third party modules under the following permissive licenses:
此外,Qt Quick 3D可能包含以下许可证下的第三方模块:
MIT License | |
MIT License | |
Apache License 2.0 | |
BSD 3-clause "New" or "Revised" Licensee | |
BSD 3-clause "New" or "Revised" License | |
MIT License | |
MIT License |
© 2024 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.