diff options
author | Andy Nichols <andy.nichols@qt.io> | 2023-06-08 16:25:47 +0200 |
---|---|---|
committer | Andy Nichols <nezticle@gmail.com> | 2023-06-12 16:05:36 +0200 |
commit | f7cc7656e2bd01851c5fb04747b0c8439ffa9dbe (patch) | |
tree | 3999f4a6efc61e1841e21941fd6bf8a51025d121 /examples/quick3d/particles3d/ModelShape.qml | |
parent | 16c734c0a26b5fed0542f3ef2fee07be74a45da8 (diff) |
Fix qmllint errors in particles3d example
Pick-to: 6.6
Change-Id: I10126755f2a42fb365219f09b9c54e45ed8e4316
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'examples/quick3d/particles3d/ModelShape.qml')
-rw-r--r-- | examples/quick3d/particles3d/ModelShape.qml | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/examples/quick3d/particles3d/ModelShape.qml b/examples/quick3d/particles3d/ModelShape.qml new file mode 100644 index 00000000..50f5966b --- /dev/null +++ b/examples/quick3d/particles3d/ModelShape.qml @@ -0,0 +1,160 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick3D +import QtQuick3D.Particles3D + +Item { + id: mainWindow + anchors.fill: parent + property real fontSize: width * 0.012 + + View3D { + id: view + anchors.fill: parent + + environment: SceneEnvironment { + clearColor: "#202020" + backgroundMode: SceneEnvironment.Color + antialiasingMode: SceneEnvironment.MSAA + antialiasingQuality: SceneEnvironment.High + } + + PerspectiveCamera { + id: camera + property real cameraAnim: 0 + SequentialAnimation { + running: true + loops: Animation.Infinite + NumberAnimation { + target: camera + property: "cameraAnim" + to: 1 + duration: 4000 + easing.type: Easing.InOutQuad + } + NumberAnimation { + target: camera + property: "cameraAnim" + to: 0 + duration: 4000 + easing.type: Easing.InOutQuad + } + } + position: Qt.vector3d(500 * Math.sin(cameraAnim * Math.PI * 2), 0, 500 * Math.cos(cameraAnim * Math.PI * 2)) + eulerRotation: Qt.vector3d(0, cameraAnim * 360, 0) + } + + Timer { + running: true + repeat: true + interval: 4000 + onTriggered: { + if (shape1.delegate === cube) { + shape1.delegate = suzanne; + shape2.delegate = suzanne; + } else if (shape1.delegate === suzanne) { + shape1.delegate = cube; + shape2.delegate = cube; + } + } + } + + ParticleSystem3D { + id: psystem + + SpriteParticle3D { + id: particleFire + sprite: Texture { + source: "images/sphere.png" + } + colorTable: Texture { + source: "images/colorTable.png" + } + maxAmount: 6000 + color: "#ffffff" + billboard: true + blendMode: SpriteParticle3D.Screen + } + + Component { + id: suzanne + Model { + source: "meshes/suzanne.mesh" + scale: Qt.vector3d(100, 100, 100) + materials: DefaultMaterial { diffuseColor: "red" } + } + } + + Component { + id: cube + Model { + source: "#Cube" + scale: Qt.vector3d(2, 2, 2) + materials: DefaultMaterial { diffuseColor: "red" } + } + } + + ParticleEmitter3D { + particle: particleFire + position: Qt.vector3d(-150, 0, 0) + particleScale: 1 + particleScaleVariation: 1 + velocity: VectorDirection3D { + direction: Qt.vector3d(0, 60, 0) + directionVariation: Qt.vector3d(6, 6, 6) + } + emitRate: 3000 + lifeSpan: 1000 + shape: ParticleModelShape3D { + id: shape1 + delegate: suzanne + } + Node { + x: -30 + y: 150 + Text { + anchors.verticalCenter: parent.verticalCenter + text: "Filled" + font.pointSize: mainWindow.fontSize + color: "#ffffff" + } + } + } + + ParticleEmitter3D { + particle: particleFire + position: Qt.vector3d(150, 0, 0) + particleScale: 1 + particleScaleVariation: 1 + velocity: VectorDirection3D { + direction: Qt.vector3d(0, 60, 0) + directionVariation: Qt.vector3d(6, 6, 6) + } + emitRate: 3000 + lifeSpan: 1000 + shape: ParticleModelShape3D { + id: shape2 + delegate: suzanne + fill: false + } + Node { + x: -30 + y: 150 + Text { + anchors.verticalCenter: parent.verticalCenter + text: "Surface" + font.pointSize: mainWindow.fontSize + color: "#ffffff" + } + } + } + } + } + + LoggingView { + anchors.bottom: parent.bottom + particleSystems: [psystem] + } +} |