提供加載現有場景的設施。 更多...
| 頭: | #include <QSceneLoader> |
| qmake: | QT += 3drender |
| Since: | Qt 5.7 |
| 實例化: | SceneLoader |
| 繼承: | Qt3DCore::QComponent |
該類在 Qt 5.7 引入。
| enum | ComponentType { UnknownComponent, GeometryRendererComponent, TransformComponent, MaterialComponent, LightComponent, CameraLensComponent } |
| enum | Status { None, Loading, Ready, Error } |
| QSceneLoader (Qt3DCore::QNode * parent = nullptr) | |
| Qt3DCore::QComponent * | component (const QString & entityName , Qt3DRender::QSceneLoader::ComponentType componentType ) const |
| Qt3DCore::QEntity * | entity (const QString & entityName ) const |
| QStringList | entityNames () const |
| QUrl | source () const |
| Qt3DRender::QSceneLoader::Status | status () const |
| void | setSource (const QUrl & arg ) |
| void | sourceChanged (const QUrl & source ) |
| void | statusChanged (Qt3DRender::QSceneLoader::Status status ) |
給定 3D 源文件, Qt3DRender::QSceneLoader 將試著剖析它並構建樹為 Qt3DCore::QEntity 對象采用適當 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.
顧名思義, Qt3DRender::QSceneLoader loads a complete scene subtree. If you wish to load a single piece of geometry, you should rather use the Qt3DRender::QMesh 代替。
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.
注意: this component shouldn't be shared among several Qt3DCore::QEntity instances. Undefined behavior will result.
另請參閱 Qt3DRender::QMesh and Qt3DRender::QGeometryRenderer .
This enum specifies a component type.
| 常量 | 值 | 描述 |
|---|---|---|
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 |
This enum identifies the state of loading
| 常量 | 值 | 描述 |
|---|---|---|
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. |
Holds the url to the source to be loaded.
訪問函數:
| QUrl | source () const |
| void | setSource (const QUrl & arg ) |
通知程序信號:
| void | sourceChanged (const QUrl & source ) |
Holds the status of scene loading.
訪問函數:
| Qt3DRender::QSceneLoader::Status | status () const |
通知程序信號:
| void | statusChanged (Qt3DRender::QSceneLoader::Status status ) |
另請參閱 Qt3DRender::QSceneLoader::Status .
構造函數創建實例,采用指定的 parent .
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.
注意: 此函數可以被援引,通過元對象係統和從 QML。見 Q_INVOKABLE .
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.
注意: 此函數可以被援引,通過元對象係統和從 QML。見 Q_INVOKABLE .
返迴列錶為
objectNames
of the loaded entities.
注意: 此函數可以被援引,通過元對象係統和從 QML。見 Q_INVOKABLE .