QSceneLoader Class
(Qt3DRender::QSceneLoader)Provides the facility to load an existing Scene 更多...
头文件: | #include <QSceneLoader> |
qmake: | QT += 3drender |
开始支持版本: | Qt 5.7 |
Instantiated By: | SceneLoader |
基类: | Qt3DCore::QComponent |
公有类型
enum | ComponentType { UnknownComponent, GeometryRendererComponent, TransformComponent, MaterialComponent, LightComponent, CameraLensComponent } |
enum | Status { None, Loading, Ready, Error } |
属性
- 1 个属性继承自 Qt3DCore::QComponent
- 3 个属性继承自 Qt3DCore::QNode
- 1 个属性继承自 QObject
公有函数
QSceneLoader(Qt3DCore::QNode *parent = nullptr) | |
Qt3DCore::QComponent * | component(const QString &entityName, ComponentType componentType) const |
Qt3DCore::QEntity * | entity(const QString &entityName) const |
QStringList | entityNames() const |
QUrl | source() const |
Status | status() const |
- 2 个公有函数继承自 Qt3DCore::QComponent
- 11 个公有函数继承自 Qt3DCore::QNode
- 32 个公有函数继承自 QObject
公有槽函数
void | setSource(const QUrl &arg) |
- 1 个公有槽函数继承自 Qt3DCore::QComponent
- 3 个公有槽函数继承自 Qt3DCore::QNode
- 1 个公有槽函数继承自 QObject
信号
void | sourceChanged(const QUrl &source) |
void | statusChanged(Status status) |
- 3 个信号继承自 Qt3DCore::QComponent
- 4 个信号继承自 Qt3DCore::QNode
- 2 个信号继承自 QObject
受保护的函数
QSceneLoader(QSceneLoaderPrivate &dd, Qt3DCore::QNode *parent = nullptr) |
- 2 个受保护的函数继承自 Qt3DCore::QNode
- 9 个受保护的函数继承自 QObject
其他继承的成员
详细描述
Provides the facility to load an existing Scene
Given a 3D source file, the Qt3DRender::QSceneLoader will try to parse it and build a tree of Qt3DCore::QEntity objects with proper Qt3DRender::QGeometryRenderer, Qt3DCore::QTransform and Qt3DRender::QMaterial components.
The loader will try to determine the best material to be used based on the properties of the model file. If you wish to use a custom material, you will have to traverse the tree and replace the default associated materials with yours.
As the name implies, Qt3DRender::QSceneLoader loads a complete scene subtree. If you wish to load a single piece of geometry, you should rather use the Qt3DRender::QMesh instead.
Qt3DRender::QSceneLoader internally relies on the use of plugins to support a wide variety of 3D file formats. Here is a list of formats that are supported by Qt3D.
Note: this component shouldn't be shared among several Qt3DCore::QEntity instances. Undefined behavior will result.
参见 Qt3DRender::QMesh and Qt3DRender::QGeometryRenderer.
成员类型
enum QSceneLoader::ComponentType
This enum specifies a component type.
Constant | Value | Description |
---|---|---|
Qt3DRender::QSceneLoader::UnknownComponent | 0 | Unknown component type |
Qt3DRender::QSceneLoader::GeometryRendererComponent | 1 | Qt3DRender::QGeometryRenderer component |
Qt3DRender::QSceneLoader::TransformComponent | 2 | Qt3DCore::QTransform component |
Qt3DRender::QSceneLoader::MaterialComponent | 3 | Qt3DRender::QMaterial component |
Qt3DRender::QSceneLoader::LightComponent | 4 | Qt3DRender::QAbstractLight component |
Qt3DRender::QSceneLoader::CameraLensComponent | 5 | Qt3DRender::QCameraLens component |
enum QSceneLoader::Status
This enum identifies the state of loading
Constant | Value | Description |
---|---|---|
Qt3DRender::QSceneLoader::None | 0 | The Qt3DRender::QSceneLoader hasn't been used yet. |
Qt3DRender::QSceneLoader::Loading | 1 | The Qt3DRender::QSceneLoader is currently loading the scene file. |
Qt3DRender::QSceneLoader::Ready | 2 | The Qt3DRender::QSceneLoader successfully loaded the scene file. |
Qt3DRender::QSceneLoader::Error | 3 | The Qt3DRender::QSceneLoader encountered an error while loading the scene file. |
属性
source : QUrl
Holds the url to the source to be loaded.
访问函数:
QUrl | source() const |
void | setSource(const QUrl &arg) |
Notifier signal:
void | sourceChanged(const QUrl &source) |
status : const Status
Holds the status of scene loading.
- SceneLoader.None
- SceneLoader.Loading
- SceneLoader.Ready
- SceneLoader.Error
访问函数:
Status | status() const |
Notifier signal:
void | statusChanged(Status status) |
成员函数
QSceneLoader::QSceneLoader(Qt3DCore::QNode *parent = nullptr)
Default constructs an instance of QSceneLoader.
[protected]
QSceneLoader::QSceneLoader(QSceneLoaderPrivate &dd, Qt3DCore::QNode *parent = nullptr)
Copy constructor.
Qt3DCore::QComponent *QSceneLoader::component(const QString &entityName, ComponentType componentType) const
Returns a component matching componentType of a loaded entity with an objectName matching the entityName. If the entity has multiple matching components, the first match in the component list of the entity is returned. If there is no match, a null pointer is returned.
Qt3DCore::QEntity *QSceneLoader::entity(const QString &entityName) const
Returns a loaded entity with an objectName
matching the entityName parameter. If multiple entities have the same name, it is undefined which one of them is returned, but it will always be the same one.
QStringList QSceneLoader::entityNames() const
Returns a list of the objectNames
of the loaded entities.