2022-06-08 12:47:24 +00:00
|
|
|
// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
|
2024-02-23 14:41:04 +00:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
2015-01-20 07:38:57 +00:00
|
|
|
|
2015-10-15 14:05:37 +00:00
|
|
|
import Qt3D.Core 2.0
|
2015-10-18 08:58:19 +00:00
|
|
|
import Qt3D.Render 2.0
|
2016-04-11 12:58:17 +00:00
|
|
|
import Qt3D.Extras 2.0
|
2015-01-20 07:38:57 +00:00
|
|
|
import QtQuick 2.0 as QQ2
|
|
|
|
|
|
|
|
Entity {
|
|
|
|
id: sceneRoot
|
|
|
|
property int counter: 0
|
|
|
|
|
2016-02-26 17:21:20 +00:00
|
|
|
components: [
|
|
|
|
RenderSettings {
|
|
|
|
activeFrameGraph: Viewport {
|
|
|
|
normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0)
|
|
|
|
enabled: counter !== 5
|
2015-01-20 10:49:14 +00:00
|
|
|
|
2016-02-26 17:21:20 +00:00
|
|
|
RenderSurfaceSelector {
|
|
|
|
|
2016-03-16 22:41:28 +00:00
|
|
|
ClearBuffers {
|
|
|
|
buffers : ClearBuffers.ColorDepthBuffer
|
2016-03-19 21:43:55 +00:00
|
|
|
clearColor: "white"
|
2016-02-26 17:21:20 +00:00
|
|
|
enabled: counter !== 6
|
|
|
|
}
|
2015-01-20 10:49:14 +00:00
|
|
|
|
2016-02-26 17:21:20 +00:00
|
|
|
CameraSelector {
|
|
|
|
camera: camera
|
|
|
|
enabled: counter !== 7
|
2015-01-20 10:49:14 +00:00
|
|
|
|
2016-02-26 17:21:20 +00:00
|
|
|
LayerFilter {
|
|
|
|
enabled: counter === 12
|
2016-05-06 06:48:50 +00:00
|
|
|
layers: sceneLayer
|
2016-02-26 17:21:20 +00:00
|
|
|
}
|
|
|
|
}
|
2015-01-20 10:49:14 +00:00
|
|
|
}
|
|
|
|
}
|
2015-01-20 07:38:57 +00:00
|
|
|
}
|
2016-02-26 17:21:20 +00:00
|
|
|
]
|
2015-01-20 07:38:57 +00:00
|
|
|
|
|
|
|
QQ2.Timer {
|
|
|
|
interval: 500
|
|
|
|
repeat: true
|
|
|
|
running: true
|
|
|
|
onTriggered: {
|
|
|
|
counter += 1;
|
2015-01-20 10:49:14 +00:00
|
|
|
if (counter > 15)
|
2015-01-20 07:38:57 +00:00
|
|
|
counter = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-07 19:02:14 +00:00
|
|
|
Camera {
|
|
|
|
id: camera
|
2015-01-20 07:38:57 +00:00
|
|
|
projectionType: CameraLens.PerspectiveProjection
|
|
|
|
fieldOfView: 45
|
|
|
|
aspectRatio: 16/9
|
|
|
|
nearPlane : 0.1
|
|
|
|
farPlane : 1000.0
|
|
|
|
enabled: counter !== 4
|
2016-01-05 09:38:18 +00:00
|
|
|
position: Qt.vector3d(0, 10, 10)
|
2015-11-07 19:02:14 +00:00
|
|
|
viewCenter: Qt.vector3d(0, 0, 0)
|
|
|
|
upVector: Qt.vector3d(0, 1, 0)
|
2015-01-20 07:38:57 +00:00
|
|
|
}
|
|
|
|
|
2015-01-20 10:49:14 +00:00
|
|
|
// Sphere
|
|
|
|
Entity {
|
2020-07-30 11:03:46 +00:00
|
|
|
SphereMesh {
|
2015-01-20 10:49:14 +00:00
|
|
|
id: sphereMesh
|
2020-07-30 11:03:46 +00:00
|
|
|
enabled: counter !== 0
|
2015-01-20 10:49:14 +00:00
|
|
|
}
|
2015-01-20 07:38:57 +00:00
|
|
|
|
2015-01-20 10:49:14 +00:00
|
|
|
PhongMaterial {
|
|
|
|
id: material
|
|
|
|
ambient: "dodgerblue"
|
|
|
|
diffuse: "chartreuse"
|
|
|
|
specular: "ghostwhite"
|
|
|
|
enabled: counter !== 1
|
|
|
|
}
|
2015-01-20 07:38:57 +00:00
|
|
|
|
2015-01-20 10:49:14 +00:00
|
|
|
Layer {
|
2016-05-06 06:48:50 +00:00
|
|
|
id: sceneLayer
|
2015-01-20 10:49:14 +00:00
|
|
|
enabled: counter !== 2
|
|
|
|
}
|
2015-01-20 07:38:57 +00:00
|
|
|
|
2015-01-20 10:49:14 +00:00
|
|
|
Transform {
|
|
|
|
id: transform
|
2015-11-07 19:02:14 +00:00
|
|
|
property real x: 0.0
|
|
|
|
property real y: 0.0
|
|
|
|
property real z: 0.0
|
|
|
|
translation: Qt.vector3d(x, y, z)
|
2015-01-20 10:49:14 +00:00
|
|
|
enabled: counter !== 3
|
2015-03-23 14:48:54 +00:00
|
|
|
}
|
2015-01-20 10:49:14 +00:00
|
|
|
|
2015-03-23 14:48:54 +00:00
|
|
|
QQ2.SequentialAnimation {
|
|
|
|
running: true
|
|
|
|
loops: QQ2.Animation.Infinite
|
|
|
|
QQ2.NumberAnimation {
|
2015-11-07 19:02:14 +00:00
|
|
|
target: transform; property: "x"
|
2015-03-23 14:48:54 +00:00
|
|
|
from: 0; to: 5;
|
|
|
|
duration: 550
|
|
|
|
easing.type: QQ2.Easing.InOutQuad
|
|
|
|
}
|
|
|
|
QQ2.NumberAnimation {
|
2015-11-07 19:02:14 +00:00
|
|
|
target: transform; property: "y"
|
2015-03-23 14:48:54 +00:00
|
|
|
from: 0; to: 5;
|
|
|
|
duration: 650
|
|
|
|
easing.type: QQ2.Easing.InOutQuad
|
|
|
|
}
|
|
|
|
QQ2.NumberAnimation {
|
2015-11-07 19:02:14 +00:00
|
|
|
target: transform; property: "z"
|
2015-03-23 14:48:54 +00:00
|
|
|
from: 0; to: 5;
|
|
|
|
duration: 350
|
|
|
|
easing.type: QQ2.Easing.InOutQuad
|
|
|
|
}
|
|
|
|
QQ2.NumberAnimation {
|
2015-11-07 19:02:14 +00:00
|
|
|
target: transform; property: "x"
|
2015-03-23 14:48:54 +00:00
|
|
|
from: 5; to: 0;
|
|
|
|
duration: 550
|
|
|
|
easing.type: QQ2.Easing.InOutQuad
|
|
|
|
}
|
|
|
|
QQ2.NumberAnimation {
|
2015-11-07 19:02:14 +00:00
|
|
|
target: transform; property: "y"
|
2015-03-23 14:48:54 +00:00
|
|
|
from: 5; to: 0;
|
|
|
|
duration: 350
|
|
|
|
easing.type: QQ2.Easing.InOutQuad
|
|
|
|
}
|
|
|
|
QQ2.NumberAnimation {
|
2015-11-07 19:02:14 +00:00
|
|
|
target: transform; property: "z"
|
2015-03-23 14:48:54 +00:00
|
|
|
from: 5; to: 0;
|
|
|
|
duration: 650
|
|
|
|
easing.type: QQ2.Easing.InOutQuad
|
2015-01-20 07:38:57 +00:00
|
|
|
}
|
|
|
|
}
|
2015-03-23 14:48:54 +00:00
|
|
|
|
2016-05-06 06:48:50 +00:00
|
|
|
components: [sphereMesh, material, sceneLayer, transform]
|
2015-01-20 07:38:57 +00:00
|
|
|
}
|
|
|
|
|
2015-01-20 10:49:14 +00:00
|
|
|
// Floor
|
2015-01-20 07:38:57 +00:00
|
|
|
Entity {
|
2020-07-30 11:03:46 +00:00
|
|
|
PlaneMesh {
|
2015-01-20 10:49:14 +00:00
|
|
|
id: planeMesh
|
2020-07-30 11:03:46 +00:00
|
|
|
width: 25.0
|
|
|
|
height: 10
|
2015-01-20 10:49:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PhongMaterial {
|
|
|
|
id: floorMaterial
|
|
|
|
ambient: "lawngreen"
|
|
|
|
diffuse: "forestgreen"
|
|
|
|
specular: "floralwhite"
|
|
|
|
shininess: 0.5
|
|
|
|
}
|
|
|
|
|
|
|
|
Layer {
|
|
|
|
id: floorLayer
|
|
|
|
}
|
|
|
|
|
|
|
|
components: [planeMesh, floorMaterial, floorLayer]
|
2015-01-20 07:38:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|