- Qt 5.15
- Qt 3D
- QML Types
- Scene2D QML Type
- Qt 5.15.16 Reference Documentation

# 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

- List of all members, including inherited members

## 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

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 to the texture.

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

Holds the render policy of this Scene2D.

- Continuous The Scene2D is rendering continuously. This is the default render policy.
- SingleShot The Scene2D renders to the texture only once after which the resources allocated for rendering are released.