aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/lineparticles/qml/main.qml
blob: f05993e57aa478260358b6b3e2f3f19b811100d1 (plain)
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
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick
import QtQuick3D
import QtQuick3D.Particles3D
import QtQuick3D.Helpers

Window {
    id: mainWindow
    width: 1280
    height: 720
    visible: true

    property real fontSize: 14

    Text {
        x : mainWindow.width / 4
        text: "Fixed length"
        font.pixelSize: mainWindow.fontSize
        color: "black"
    }
    Text {
        id: textbox
        x : 3 * mainWindow.width / 4
        text: "Variable length"
        font.pixelSize: mainWindow.fontSize
        color: "black"
    }

    View3D {
        anchors.topMargin: textbox.height
        anchors.fill: parent

        environment: SceneEnvironment {
            clearColor: "#101010"
            backgroundMode: SceneEnvironment.Color
            antialiasingMode: SceneEnvironment.MSAA
            antialiasingQuality: SceneEnvironment.VeryHigh
        }
        PerspectiveCamera {
            id: camera
            position: Qt.vector3d(0, 100, 600)
            clipFar: 2000
        }

        Model {
            source: "#Cube"
            position: Qt.vector3d(-400, -50, 0)
            scale: Qt.vector3d(0.5, 0.5, 0.001)
            materials: [
                DefaultMaterial {
                    diffuseColor: "white"
                    lighting: DefaultMaterial.NoLighting
                }
            ]
        }

        LineEmitterSystem {
            id: fixedSize
            position: Qt.vector3d(-500, 0, 0)
        }

        LineEmitterSystem {
            id: variableSize
            position: Qt.vector3d(100, 0, 0)
            gravityStrength: 150.0
            variableLengthEnabled: true
            lifespan: 2000
        }
    }
}