本页内容

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 支持以下格式:

  • Wavefront OBJ
  • 斯坦福三角格式 PLY
  • STL(立体光刻)

如果已安装 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 : Status

保存网格加载的状态。

访问函数:

Qt3DRender::QMesh::Status status() const

通知信号:

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

另请参阅 Qt3DRender::QMesh::Status 。

成员函数文档

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

使用parent 构建一个新的QMesh。

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