| 1 |
// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
import QtQuick 2.0 |
| 5 |
import QtQuick.Scene3D 2.0 |
| 6 |
import Qt3D.Render 2.15 |
| 7 |
|
| 8 |
Item { |
| 9 |
Text { |
| 10 |
text: "Click me!" |
| 11 |
anchors.top: parent.top |
| 12 |
anchors.topMargin: 10 |
| 13 |
anchors.horizontalCenter: parent.horizontalCenter |
| 14 |
|
| 15 |
MouseArea { |
| 16 |
anchors.fill: parent |
| 17 |
onClicked: animation.start() |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
Text { |
| 22 |
text: "Multisample: " + scene3d.multisample |
| 23 |
anchors.bottom: parent.bottom |
| 24 |
anchors.bottomMargin: 10 |
| 25 |
anchors.horizontalCenter: parent.horizontalCenter |
| 26 |
|
| 27 |
MouseArea { |
| 28 |
anchors.fill: parent |
| 29 |
onClicked: scene3d.multisample = !scene3d.multisample |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
Rectangle { |
| 34 |
id: scene |
| 35 |
anchors.fill: parent |
| 36 |
anchors.margins: 50 |
| 37 |
color: "darkRed" |
| 38 |
|
| 39 |
transform: Rotation { |
| 40 |
id: sceneRotation |
| 41 |
axis.x: 1 |
| 42 |
axis.y: 0 |
| 43 |
axis.z: 0 |
| 44 |
origin.x: scene.width / 2 |
| 45 |
origin.y: scene.height / 2 |
| 46 |
} |
| 47 |
//! [0] |
| 48 |
Scene3D { |
| 49 |
id: scene3d |
| 50 |
anchors.fill: parent |
| 51 |
anchors.margins: 10 |
| 52 |
focus: true |
| 53 |
aspects: ["input", "logic"] |
| 54 |
cameraAspectRatioMode: Scene3D.AutomaticAspectRatio |
| 55 |
|
| 56 |
AnimatedEntity { |
| 57 |
id: rootEntity |
| 58 |
} |
| 59 |
} |
| 60 |
//! [0] |
| 61 |
} |
| 62 |
|
| 63 |
Rectangle { |
| 64 |
radius: 10 |
| 65 |
color: "#aaffffff" |
| 66 |
border.width: 1 |
| 67 |
border.color: "black" |
| 68 |
width: childrenRect.width + anchors.margins |
| 69 |
height: childrenRect.height + anchors.margins |
| 70 |
anchors.bottom: parent.bottom |
| 71 |
anchors.right: parent.right |
| 72 |
anchors.margins: 20 |
| 73 |
|
| 74 |
Column { |
| 75 |
x: parent.anchors.margins / 2 |
| 76 |
y: x |
| 77 |
|
| 78 |
Text { text: "Vendor: " + rootEntity.capabilities.vendor } |
| 79 |
Text { text: "Renderer: " + rootEntity.capabilities.renderer } |
| 80 |
Text { text: "Driver Version: " + rootEntity.capabilities.driverVersion } |
| 81 |
Text { text: "GL Version: " + rootEntity.capabilities.majorVersion + "." + rootEntity.capabilities.minorVersion } |
| 82 |
Text { text: "Profile: " + (rootEntity.capabilities.profile === RenderCapabilities.CoreProfile ? "Core" : (rootEntity.capabilities.profile === RenderCapabilities.CompatibilityProfile ? "Compatibility" : "Unknown")) } |
| 83 |
Text { text: "GLSL Version: " + rootEntity.capabilities.glslVersion } |
| 84 |
Text { text: "Extensions: " + (rootEntity.capabilities.extensions.length ? "" : "None") } |
| 85 |
ListView { |
| 86 |
model: rootEntity.capabilities.extensions |
| 87 |
delegate: Text { text: " " + model.modelData } |
| 88 |
width: parent.width |
| 89 |
height: 100 |
| 90 |
visible: rootEntity.capabilities.extensions.length > 0 |
| 91 |
clip: true |
| 92 |
} |
| 93 |
Text { text: "Max Texture Size: " + rootEntity.capabilities.maxTextureSize + "\nMax Texture Units: " + rootEntity.capabilities.maxTextureUnits + "\nMax Texture Layers: " + rootEntity.capabilities.maxTextureLayers } |
| 94 |
Text { text: "Supports UBO: " + rootEntity.capabilities.supportsUBO } |
| 95 |
Text { text: " Max UBO Size: " + rootEntity.capabilities.maxUBOSize + "\n Max UBO Bindings: " + rootEntity.capabilities.maxUBOBindings; visible: rootEntity.capabilities.supportsUBO } |
| 96 |
Text { text: "Supports SSBO: " + rootEntity.capabilities.supportsSSBO } |
| 97 |
Text { text: " Max SSBO Size: " + rootEntity.capabilities.maxSSBOSize + "\n Max SSBO Bindings: " + rootEntity.capabilities.maxSSBOBindings; visible: rootEntity.capabilities.supportsSSBO } |
| 98 |
Text { text: "Supports Image Store: " + rootEntity.capabilities.supportsImageStore } |
| 99 |
Text { text: " Max Image Units: " + rootEntity.capabilities.maxImageUnits; visible: rootEntity.capabilities.supportsImageStore } |
| 100 |
Text { text: "Supports Compute Shaders: " + rootEntity.capabilities.supportsCompute } |
| 101 |
Text { text: " Max Work Group Size: " + rootEntity.capabilities.maxWorkGroupSizeX + ", " + rootEntity.capabilities.maxWorkGroupSizeY + ", " + rootEntity.capabilities.maxWorkGroupSizeZ; visible: rootEntity.capabilities.supportsCompute } |
| 102 |
Text { text: " Max Work Group Count: " + rootEntity.capabilities.maxWorkGroupCountX + ", " + rootEntity.capabilities.maxWorkGroupCountY + ", " + rootEntity.capabilities.maxWorkGroupCountZ; visible: rootEntity.capabilities.supportsCompute } |
| 103 |
Text { text: " Max Invocations: " + rootEntity.capabilities.maxComputeInvocations; visible: rootEntity.capabilities.supportsCompute } |
| 104 |
Text { text: " Max Shared Memory: " + rootEntity.capabilities.maxComputeSharedMemorySize; visible: rootEntity.capabilities.supportsCompute } |
| 105 |
} |
| 106 |
} |
| 107 |
|
| 108 |
Rectangle { |
| 109 |
radius: 10 |
| 110 |
color: "#aaffffff" |
| 111 |
border.width: 1 |
| 112 |
border.color: "black" |
| 113 |
width: childrenRect.width + anchors.margins |
| 114 |
height: childrenRect.height + anchors.margins |
| 115 |
anchors.bottom: parent.bottom |
| 116 |
anchors.left: parent.left |
| 117 |
anchors.margins: 20 |
| 118 |
visible: rootEntity.validBounds |
| 119 |
|
| 120 |
Column { |
| 121 |
x: parent.anchors.margins / 2 |
| 122 |
y: x |
| 123 |
|
| 124 |
Text { text: "Sphere:\n Min Extent: " + rootEntity.sphereMinPt } |
| 125 |
Text { text: " Max Extent: " + rootEntity.sphereMaxPt } |
| 126 |
} |
| 127 |
} |
| 128 |
|
| 129 |
SequentialAnimation { |
| 130 |
id: animation |
| 131 |
|
| 132 |
RotationAnimation { |
| 133 |
to: 45 |
| 134 |
duration: 1000 |
| 135 |
target: sceneRotation |
| 136 |
property: "angle" |
| 137 |
easing.type: Easing.InOutQuad |
| 138 |
} |
| 139 |
PauseAnimation { duration: 500 } |
| 140 |
NumberAnimation { |
| 141 |
to: 0.5 |
| 142 |
duration: 1000 |
| 143 |
target: scene |
| 144 |
property: "scale" |
| 145 |
easing.type: Easing.OutElastic |
| 146 |
} |
| 147 |
PauseAnimation { duration: 500 } |
| 148 |
NumberAnimation { |
| 149 |
to: 1.0 |
| 150 |
duration: 1000 |
| 151 |
target: scene |
| 152 |
property: "scale" |
| 153 |
easing.type: Easing.OutElastic |
| 154 |
} |
| 155 |
PauseAnimation { duration: 500 } |
| 156 |
RotationAnimation { |
| 157 |
to: 0 |
| 158 |
duration: 1000 |
| 159 |
target: sceneRotation |
| 160 |
property: "angle" |
| 161 |
easing.type: Easing.InOutQuad |
| 162 |
} |
| 163 |
} |
| 164 |
} |