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