| 1 |
// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
import Qt3D.Core 2.0 |
| 5 |
import Qt3D.Render 2.10 |
| 6 |
import Qt3D.Input 2.0 |
| 7 |
import Qt3D.Extras 2.0 |
| 8 |
|
| 9 |
Entity { |
| 10 |
id: sceneRoot |
| 11 |
|
| 12 |
Camera { |
| 13 |
id: camera |
| 14 |
projectionType: CameraLens.PerspectiveProjection |
| 15 |
fieldOfView: 45 |
| 16 |
aspectRatio: 16/9 |
| 17 |
nearPlane : 0.1 |
| 18 |
farPlane : 1000.0 |
| 19 |
position: Qt.vector3d( 0.0, 0.0, 3.0 ) |
| 20 |
upVector: Qt.vector3d( 0.0, 1.0, 0.0 ) |
| 21 |
viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 ) |
| 22 |
} |
| 23 |
|
| 24 |
Camera { |
| 25 |
id: backgroundCamera |
| 26 |
projectionType: CameraLens.OrthographicProjection |
| 27 |
left: -0.25 |
| 28 |
bottom: -0.25 |
| 29 |
top: 0.25 |
| 30 |
right: 0.25 |
| 31 |
nearPlane: 0.1 |
| 32 |
farPlane: 1.5 |
| 33 |
position: Qt.vector3d( 0.0, 0.0, 1.0 ) |
| 34 |
upVector: Qt.vector3d( 0.0, 1.0, 0.0 ) |
| 35 |
viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 ) |
| 36 |
} |
| 37 |
|
| 38 |
Layer { |
| 39 |
id: backgroundLayer |
| 40 |
recursive: true |
| 41 |
} |
| 42 |
|
| 43 |
Layer { |
| 44 |
id: sceneLayer |
| 45 |
recursive: true |
| 46 |
} |
| 47 |
|
| 48 |
Layer { |
| 49 |
id: secondBackgroundLayer |
| 50 |
} |
| 51 |
|
| 52 |
RenderSettings { |
| 53 |
id : external_forward_renderer |
| 54 |
activeFrameGraph : |
| 55 |
|
| 56 |
RenderSurfaceSelector { |
| 57 |
Viewport { |
| 58 |
normalizedRect: Qt.rect(0,0,1,1) |
| 59 |
|
| 60 |
ClearBuffers { |
| 61 |
buffers: ClearBuffers.ColorDepthStencilBuffer |
| 62 |
clearColor: "white" |
| 63 |
|
| 64 |
LayerFilter { |
| 65 |
layers: [ |
| 66 |
backgroundLayer, |
| 67 |
secondBackgroundLayer |
| 68 |
] |
| 69 |
|
| 70 |
CameraSelector { |
| 71 |
camera: backgroundCamera |
| 72 |
} |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
ClearBuffers { |
| 77 |
buffers: ClearBuffers.DepthStencilBuffer |
| 78 |
|
| 79 |
LayerFilter { |
| 80 |
layers: [ |
| 81 |
backgroundLayer, |
| 82 |
] |
| 83 |
filterMode: LayerFilter.DiscardAnyMatchingLayers |
| 84 |
|
| 85 |
CameraSelector { |
| 86 |
camera: camera |
| 87 |
} |
| 88 |
} |
| 89 |
} |
| 90 |
} |
| 91 |
} |
| 92 |
} |
| 93 |
|
| 94 |
OrbitCameraController { |
| 95 |
camera: camera |
| 96 |
} |
| 97 |
|
| 98 |
InputSettings { |
| 99 |
id: inputSettings |
| 100 |
} |
| 101 |
|
| 102 |
components: [external_forward_renderer, inputSettings] |
| 103 |
|
| 104 |
PlaneMesh { |
| 105 |
id: backgroundMesh |
| 106 |
width: 0.5 |
| 107 |
height: 0.5 |
| 108 |
} |
| 109 |
|
| 110 |
Transform { |
| 111 |
id: backgroundTransform |
| 112 |
rotation: fromAxisAndAngle(Qt.vector3d(1,0,0), 90) |
| 113 |
} |
| 114 |
|
| 115 |
Transform { |
| 116 |
id: smallBackgroundTransform |
| 117 |
translation: Qt.vector3d(0,0.5,0) |
| 118 |
scale: 0.5 |
| 119 |
} |
| 120 |
|
| 121 |
PhongMaterial { |
| 122 |
id: backgroundMaterial |
| 123 |
ambient: "black" |
| 124 |
} |
| 125 |
|
| 126 |
PhongMaterial { |
| 127 |
id: smallBackgroundMaterial |
| 128 |
ambient: "red" |
| 129 |
} |
| 130 |
|
| 131 |
GeometryRenderer { |
| 132 |
id: mesh |
| 133 |
view: PlaneMesh { |
| 134 |
width: 1 |
| 135 |
height: 1 |
| 136 |
} |
| 137 |
} |
| 138 |
|
| 139 |
Transform { |
| 140 |
id: transform |
| 141 |
translation: Qt.vector3d(0,0,-1) |
| 142 |
rotation: fromAxisAndAngle(Qt.vector3d(1,0,0), 90) |
| 143 |
} |
| 144 |
|
| 145 |
PhongMaterial { |
| 146 |
id: material |
| 147 |
ambient: "blue" |
| 148 |
} |
| 149 |
|
| 150 |
Entity { |
| 151 |
id: backgroundFilterEntity |
| 152 |
components: [backgroundLayer] |
| 153 |
|
| 154 |
Entity { |
| 155 |
id: backgroundEntity |
| 156 |
objectName: "backgroundEntity" |
| 157 |
components: [backgroundMesh, backgroundMaterial, backgroundTransform] |
| 158 |
|
| 159 |
Entity { |
| 160 |
id: smallBackground |
| 161 |
objectName: "smallBackground" |
| 162 |
components: [backgroundMesh, smallBackgroundMaterial, smallBackgroundTransform] |
| 163 |
} |
| 164 |
} |
| 165 |
} |
| 166 |
|
| 167 |
Entity { |
| 168 |
components: [sceneLayer] |
| 169 |
|
| 170 |
Entity { |
| 171 |
id: mainEntity |
| 172 |
objectName: "mainEntity" |
| 173 |
components: [ mesh, material, transform ] |
| 174 |
} |
| 175 |
} |
| 176 |
} |