ResourceLoader QML Type
允许预加载 3D 资源。更多
Import Statement: | import QtQuick3D |
Inherits: |
属性
- geometries : List<QtQuick3D::Geometry>
- meshSources : List<url>
- textures : List<QtQuick3D::Texture>
详细说明
ResourceLoader 用于为Qt Quick 3D 预加载资源。通常情况下,只有在需要渲染帧时才会加载资源,而在未用于渲染场景时则会卸载资源。这种积极的资源生命周期方法意味着只使用最低限度的 GPU 资源来渲染帧,但对于某些动态场景,这可能会导致资源被频繁加载和释放。ResourceLoader 组件可对场景中资源的生命周期进行更精细的控制。ResourceLoader 组件中列出的资源会被加载到 GPU 内存中,并一直保留到从 ResourceLoader 列表中删除或 ResourceLoader 被销毁为止。
ResourceLoader 还可用于确保在渲染帧之前有大量资源可用。由于资源只有在帧需要时才会加载,这可能会导致帧在等待加载大型资源时被丢弃。通过在显示场景前预先加载大型资源,就不会出现因动画期间加载资源而丢帧的风险。
有关使用示例,请参见Qt Quick 3D - 原理材质示例
属性文档
geometries : List<QtQuick3D::Geometry> |
该属性定义了将加载到 GPU 并缓存的几何体资源列表。
meshSources : List<url> |
该属性定义了包含几何体的网格文件的位置列表。当一个网格文件被添加到此列表中时,它将被加载到 GPU 并缓存起来。如果 /c 模型使用了相同的网格文件,则无需再次加载。
textures : List<QtQuick3D::Texture> |
该属性定义了将加载到 GPU 并缓存的纹理资源列表。
© 2025 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.