Scene3DView QML Type

The Scene3DView type is used to integrate a Qt 3D sub scene into a QtQuick 2 scene using Scene3D . Whereas you should only use a single Scene3D instance per application, you can have multiple Scene3DView instances. 更多...

import 语句: import QtQuick.Scene3D 2.15
Since: Qt 5.14
继承:

Item

详细描述

Essentially, if you need to render multiple scenes each in a separate view, you should use a single Scene3D instance and as many Scene3DView items as you have scenes to render.

Typical usage looks like:

Scene3D {
    id: mainScene3D
    anchors.fill: parent
}
Scene3DView {
    id: view1
    scene3D: mainScene3D
    width: 200
    height: 200
    Entity {
        ...
    }
}
Scene3DView {
    id: view2
    scene3D: mainScene3D
    width: 200
    height: 200
    x: 200
    Entity {
        ...
    }
}
					

There are a few limitations when using Scene3DView:

  • The Scene3D compositingMode has to be set to FBO
  • The Scene3D is sized to occupy the full window size (at the very least it must be sized as wide as the area occupied by all Scene3DViews)
  • The Scene3D instance is instantiated prior to any Scene3DView
  • The Scene3D entity property is left unset

Scene3D behaves likes a texture atlas from which all Scene3DView instances. For this reason, care should be taken that only the first Scene3DView declared in the scene clears the color/depth. Additionally overlapping Scene3DView instances is discouraged as this might not produce the expected output.

It is expected that a Scene3DView's Entity provide a RenderSettings with a valid SceneGraph. Please note that only the RenderSettings of the first Scene3DView instantiated will be taken into account.

There are no restriction on the sharing of elements between different scenes in different Scene3DView instances.

By default, you are in charge of ensuring the lifetime of the referenced Entity. If you wish to transfer this duty to the Scene3DView, the ownsEntity property can be set to true (defaults to false).