Debian Codegraph @

tests/manual/render-qml-to-texture-qml/main.qml

raw
1 // Copyright (C) 2017 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 import Qt3D.Core 2.0
5 import Qt3D.Render 2.9
6 import Qt3D.Input 2.0
7 import QtQuick 2.0 as QQ2
8 import QtQuick.Scene3D 2.0
9 import QtQuick.Scene2D 2.9
10 import QtQuick.Window 2.0 as QW2
11 import Qt3D.Extras 2.9
12
13
14 QQ2.Item {
15 width: 1024
16 height: 768
17
18 Scene3D {
19 id: scene
20 focus: true
21 anchors.fill: parent
22
23 aspects: ["input", "logic"]
24
25 Entity {
26 id: sceneRoot
27
28 Camera {
29 id: camera
30 projectionType: CameraLens.PerspectiveProjection
31 fieldOfView: 45
32 aspectRatio: scene.width / scene.height
33 nearPlane : 0.1
34 farPlane : 1000.0
35 position: Qt.vector3d( 0.0, 0.0, 6.0 )
36 upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
37 viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
38 }
39
40 Scene2D {
41 id: qmlTexture
42 output: RenderTargetOutput {
43 attachmentPoint: RenderTargetOutput.Color0
44 texture: Texture2D {
45 id: offscreenTexture
46 width: 1024
47 height: 1024
48 format: Texture.RGBA8_UNorm
49 generateMipMaps: true
50 magnificationFilter: Texture.Linear
51 minificationFilter: Texture.LinearMipMapLinear
52 wrapMode {
53 x: WrapMode.ClampToEdge
54 y: WrapMode.ClampToEdge
55 }
56 }
57
58 }
59
60 entities: [plane1]
61
62 mouseEnabled: plane1.picker.pressed
63
64 InteractiveGui {
65
66 }
67 }
68
69 FirstPersonCameraController {
70 id: controller
71 camera: camera
72 enabled: !plane1.picker.pressed
73 }
74
75 components: [
76 RenderSettings {
77 pickingSettings.pickMethod: PickingSettings.TrianglePicking
78 activeFrameGraph:
79 ForwardRenderer {
80 camera: camera
81 }
82 },
83 InputSettings {}
84 ]
85
86 PlaneMesh {
87 id: planeMesh
88 width: 4
89 height: 4
90 mirrored: true
91 }
92
93 Entity {
94 id: plane1
95
96 property Transform transform: Transform {
97 scale: 1
98 translation: Qt.vector3d(0,0,0)
99 rotation: fromAxisAndAngle(Qt.vector3d(1,0,0), 90)
100 }
101
102 property Material material: TextureMaterial {
103 texture: offscreenTexture
104 }
105
106 property ObjectPicker picker: ObjectPicker {
107 hoverEnabled: true
108 dragEnabled: true
109 }
110
111 components: [planeMesh, material, transform, picker]
112 }
113 }
114 }
115 }