| 1 |
// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
import QtQuick 2.1 as QQ2 |
| 5 |
import Qt3D.Core 2.0 |
| 6 |
import Qt3D.Render 2.0 |
| 7 |
import Qt3D.Input 2.0 |
| 8 |
import Qt3D.Extras 2.0 |
| 9 |
|
| 10 |
Entity { |
| 11 |
id: root |
| 12 |
objectName: "root" |
| 13 |
|
| 14 |
// Use the renderer configuration specified in ForwardRenderer.qml |
| 15 |
// and render from the mainCamera |
| 16 |
components: [ |
| 17 |
RenderSettings { |
| 18 |
activeFrameGraph: ForwardRenderer { |
| 19 |
id: renderer |
| 20 |
camera: mainCamera |
| 21 |
clearColor: "black" |
| 22 |
} |
| 23 |
}, |
| 24 |
// Event Source will be set by the Qt3DQuickWindow |
| 25 |
InputSettings { } |
| 26 |
] |
| 27 |
|
| 28 |
BasicCamera { |
| 29 |
id: mainCamera |
| 30 |
position: Qt.vector3d( 0.0, 0.0, 10.0 ) |
| 31 |
} |
| 32 |
|
| 33 |
OrbitCameraController { camera: mainCamera } |
| 34 |
|
| 35 |
TessellatedWireframeMaterial { |
| 36 |
id: quadMaterial |
| 37 |
ambient: Qt.rgba( 0.2, 0.0, 0.0, 1.0 ) |
| 38 |
diffuse: Qt.rgba( 0.8, 0.0, 0.0, 1.0 ) |
| 39 |
|
| 40 |
property real innerLevel : 1.0 |
| 41 |
property real outerLevel : 1.0 |
| 42 |
|
| 43 |
innerTessLevel : [innerLevel, innerLevel] |
| 44 |
outerTessLevel : [outerLevel, outerLevel, outerLevel, outerLevel] |
| 45 |
|
| 46 |
effect: TessellatedWireframeEffect { |
| 47 |
tessellationControlShaderCode: shaderProgram.loadSource("qrc:/shaders/quads.tcs") |
| 48 |
tessellationEvaluationShaderCode: shaderProgram.loadSource("qrc:/shaders/quads.tes") |
| 49 |
} |
| 50 |
|
| 51 |
QQ2.SequentialAnimation { |
| 52 |
loops: QQ2.Animation.Infinite |
| 53 |
running: true |
| 54 |
|
| 55 |
QQ2.NumberAnimation { |
| 56 |
target: quadMaterial; |
| 57 |
properties: "innerLevel,outerLevel"; |
| 58 |
duration: 1000; |
| 59 |
from: 1.0 |
| 60 |
to: 20.0 |
| 61 |
} |
| 62 |
|
| 63 |
QQ2.NumberAnimation { |
| 64 |
target: quadMaterial; |
| 65 |
properties: "innerLevel,outerLevel"; |
| 66 |
duration: 1000; |
| 67 |
from: 20.0 |
| 68 |
to: 1.0 |
| 69 |
} |
| 70 |
} |
| 71 |
} |
| 72 |
|
| 73 |
TessellatedQuad { |
| 74 |
id: quad |
| 75 |
material: quadMaterial |
| 76 |
} |
| 77 |
|
| 78 |
// TODO: Add examples for triangle and isoline tessellation modes |
| 79 |
} |