Debian Codegraph @

tests/auto/render/raycastingjob/testscene_screenraycasting.qml

raw
1 // Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 import QtQml 2.14
5 import Qt3D.Core 2.14
6 import Qt3D.Render 2.14
7 import Qt3D.Input 2.14
8 import Qt3D.Extras 2.14
9 import QtQuick.Window 2.14
10
11 Entity {
12 id: sceneRoot
13
14 Window {
15 id: win
16 width: 600
17 height: 600
18 visible: true
19 }
20
21 Camera {
22 id: camera
23 projectionType: CameraLens.PerspectiveProjection
24 fieldOfView: 45
25 aspectRatio: 16/9
26 nearPlane : 0.1
27 farPlane : 1000.0
28 position: Qt.vector3d( 0.0, 2.0, 20.0 )
29 upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
30 viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
31 }
32
33 components: [
34 RenderSettings {
35 pickingSettings.pickMethod: PickingSettings.TrianglePicking
36
37 Viewport {
38 normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0)
39
40 RenderSurfaceSelector {
41
42 surface: win
43
44 ClearBuffers {
45 buffers : ClearBuffers.ColorDepthBuffer
46 NoDraw {}
47 }
48
49 CameraSelector {
50 camera: camera
51 }
52 }
53 }
54 },
55 ScreenRayCaster {
56 id: caster
57 objectName: "caster"
58 }
59 ]
60
61 InputSettings { id: inputSettings }
62 MouseHandler {
63 id: mouseHandler
64 sourceDevice: MouseDevice {}
65 onReleased: { caster.trigger(Qt.point(mouse.x, mouse.y)); }
66 }
67
68 CylinderMesh {
69 id: mesh
70 radius: 1
71 length: 3
72 rings: 100
73 slices: 20
74 }
75 PhongMaterial { id: material }
76
77 Entity {
78 property Transform transform: Transform {
79 translation: Qt.vector3d(-5, 0, 0)
80 rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
81 }
82
83 components: [mesh, material, transform]
84 }
85 }