This type enables rendering qml into a texture, which then can be used as a part of 3D scene. 更多...
导入语句: | import QtQuick.Scene2D 2.2 |
Since: | Qt 5.9 |
实例化: | QScene2D |
This object uses RenderControl to render the given Item into an offscreen surface, which is attached to a texture provided by the user. This allows the component to directly render into the texture without intermediate copy and the user to freely specify how the texture is used in the 3D scene.
The entities using the Scene2D can be associated with the type to enable interaction with the item; if an entity has an ObjectPicker component, the pick events from that picker are sent to the Scene2D and converted to mouse events and finally sent to the item.
注意: Only mouse events are supported. The item does not support keyboard input.
用法:
Entity { id: sceneRoot // specify Scene2D inside the entity hierarchy Scene2D { // specify output output: RenderTargetOutput { attachmentPoint: RenderTargetOutput.Color0 texture: Texture2D { id: textureId width: 1024 height: 1024 format: Texture.RGBA8_UNorm } } // specify entities entities: [entityId] // specify rendered content Rectangle { color: "red" } } Entity { id: entityId property Material material: TextureMaterial { texture: textureId } property ObjectPicker picker: ObjectPicker { hoverEnabled: true dragEnabled: true } ...
entities : list < Entity > |
Holds the list of entities which are associated with the Scene2D object. If the entities have ObjectPicker , the pick events from that entity are sent to Scene2D and converted to mouse events.
item : Item |
Holds the Item, which is rendered by Scene2D 到纹理。
mouseEnabled : bool |
Holds whether mouse events are enabled for the rendered item. The mouse events are generated from object picking events of the entities added to the Scene2D . Mouse is enabled by default.
注意: Events sent to items are delayed by one frame due to object picking happening in the backend.
output : RenderTargetOutput |
保持 RenderTargetOutput , which specifies where the Scene2D is rendering to.
renderPolicy : enumeration |
Holds the render policy of this Scene2D .