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 Quicks创建3D内容和3D用户界面。Qt Quick 3D不是使用外部引擎,它会产生同步问题和额外的抽象层,而是为空间内容和扩展场景图的渲染器提供现有Qt Quicks场景图的扩展。使用空间场景图时,可以将Qt Quick 2D内容与3D内容混合。
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.Effects
import QtQuick3D.AssetUtils
import QtQuick3D.Helpers
import QtQuick3D.Particles3D
C++ API
Using a Qt module 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模块需要直接或通过其他依赖项链接模块库。一些构建工具对此提供了专门支持,包括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构建的模块,请将该模块作为QT变量的值添加到项目的.pro文件中:
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.
此外,一些示例依赖于Qt Quick控件。
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 6系列Qt模块API和功能的重要更改。
Articles and Guides
文章和指南
- Qt Quick 3D Introduction Example
- Qt Quick 3D Graphics Requirements
- Qt Quick 3D Architecture
- Balsam Asset Import Tool
- Optimizing 2D Assets
- 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
- Custom Material Editor
- Lightmaps and Global Illumination
Examples
示例
- Introduction
- View3D with Multiple Viewports
- Lights and Shadows
- Dynamic Model Creation
- Principled Material
- 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
- 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 Effects QML Types
- Qt Quick 3D Particles3D QML Types
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可能包含以下许可证下的第三方模块:
Apache License 2.0 | |
BSD 3-clause "New" or "Revised" Licensee | |
MIT License | |
BSD 3-clause "New" or "Revised" License | |
MIT License |
© 2022 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.