Qt3DRender::QMesh Class

class Qt3DRender::QMesh

自定义网格加载器更多

头文件: #include <Qt3DRender/QMesh>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
在 QML 中: Mesh
继承: Qt3DRender::QGeometryRenderer
状态:已废弃

公共类型

enum Status { None, Loading, Ready, Error }

属性

公共功能

QMesh(Qt3DCore::QNode *parent = nullptr)
QString meshName() const
QUrl source() const
Qt3DRender::QMesh::Status status() const

公共插槽

void setMeshName(const QString &meshName)
void setSource(const QUrl &source)

信号

void meshNameChanged(const QString &meshName)
void sourceChanged(const QUrl &source)
void statusChanged(Qt3DRender::QMesh::Status status)

详细说明

从各种格式的外部文件加载网格数据。Qt3DRender::QMesh ,将数据加载到单个网格中。

在 Qt3D 5.9 中,QMesh 支持以下格式:

  • 波阵面 OBJ
  • 斯坦福三角格式 PLY
  • STL (STereoLithography)

如果安装了 SDK 并内置并找到了 fbx 几何体加载器插件,QMesh 还将支持以下格式:

  • Autodesk FBX

如果您希望加载由多个对象组成的整个场景,请使用Qt3DRender::QSceneLoader

另请参阅 Qt3DRender::QSceneLoader

成员类型文档

enum QMesh::Status

该枚举用于确定所使用着色器的状态。

常量说明
Qt3DRender::QMesh::None0源网格尚未分配源
Qt3DRender::QMesh::Loading1网格几何体正在加载中
Qt3DRender::QMesh::Ready2网格几何体已成功加载
Qt3DRender::QMesh::Error3加载网格时发生错误

属性文档

meshName : QString

网格名称。

访问功能:

QString meshName() const
void setMeshName(const QString &meshName)

通知信号:

void meshNameChanged(const QString &meshName)

source : QUrl

包含自定义网格文件的source 网址。

访问功能:

QUrl source() const
void setSource(const QUrl &source)

通知信号:

void sourceChanged(const QUrl &source)

[read-only] status : const Status

网格加载状态。

访问功能:

Qt3DRender::QMesh::Status status() const

通知信号:

void statusChanged(Qt3DRender::QMesh::Status status)

另请参阅 Qt3DRender::QMesh::Status

成员函数文档

[explicit] QMesh::QMesh(Qt3DCore::QNode *parent = nullptr)

构建一个新的 QMesh,parent

© 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.