Scene2D QML Type
This type enables rendering qml into a texture, which then can be used as a part of 3D scene. More...
Import Statement: | import QtQuick.Scene2D 2.15 |
Since: | Qt 5.9 |
Instantiates: | QScene2D |
Properties
- entities : list<Entity>
- item : Item
- mouseEnabled : bool
- output : RenderTargetOutput
- renderPolicy : enumeration
Detailed Description
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.
Note: Only mouse events are supported. The item does not support keyboard input.
Usage:
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 } ...
Property Documentation
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.
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.
Note: Events sent to items are delayed by one frame due to object picking happening in the backend.
output : RenderTargetOutput |
Holds the RenderTargetOutput, which specifies where the Scene2D is rendering to.
renderPolicy : enumeration |