Debian Codegraph @

tests/manual/advancedcustommaterial/Water.qml

raw
1 // Copyright (C) 2017 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 import Qt3D.Core 2.0
5 import Qt3D.Render 2.0
6 import Qt3D.Input 2.0
7 import Qt3D.Extras 2.0
8 import QtQuick 2.0 as QQ2
9
10
11 Entity {
12 id: water
13
14 WaterMaterial {
15 id: watermaterial
16
17 property real tox: 0.0
18 property real toy: 0.0
19 property real vertY: 1.0
20 property real waveRandomAnim: 0.0
21
22 diffuse: "qrc:/textures/WaterDiffuse.jpg"
23 normal: "qrc:/textures/WaterNormal.jpg"
24 specular: "qrc:/textures/WaterSpecular.jpg"
25 wave: "qrc:/textures/Waterwave.jpg"
26 sky: "qrc:/textures/sky.jpg"
27 foam: "qrc:/textures/foam.jpg"
28
29 textureScale: slider1.value
30 wavescale: vertY * slider2.value
31 specularity: slider3.value
32 offsetx: tox * slider5.value
33 offsety: toy * slider5.value
34 normalAmount: slider8.value
35 waveheight: slider6.value
36 waveStrenght: slider7.value
37 shininess: 100
38 waveRandom: waveRandomAnim
39 }
40
41 Mesh {
42 id: watermesh
43 source: "qrc:/models/waterPlane.obj"
44 }
45
46 Transform {
47 id: waterTransform
48 property real scale: 1.0
49 property real rotx: 0.0
50 scale3D: Qt.vector3d(scale, scale, scale)
51 rotationY: slider4.value
52 }
53
54 Entity {
55 id: waterEntity
56 components: [watermesh, watermaterial, waterTransform]
57 }
58
59 QQ2.SequentialAnimation {
60 QQ2.NumberAnimation {
61 target: watermaterial
62 property: "waveRandomAnim"
63 to: 3.0
64 duration: 4000
65 // easing.type: Easing.Linear
66 }
67 QQ2.NumberAnimation {
68 target: watermaterial
69 property: "waveRandomAnim"
70 to: 1.0
71 duration: 4000
72 // easing.type: Easing.Linear
73 }
74 }
75
76 QQ2.SequentialAnimation {
77 running: true
78 loops: QQ2.Animation.Infinite
79 QQ2.ParallelAnimation {
80 QQ2.NumberAnimation {
81 target: watermaterial
82 property: "toy"
83 to: 10.0
84 duration: 100000
85 }
86 QQ2.NumberAnimation {
87 target: watermaterial
88 property: "tox"
89 to: 10.0
90 duration: 100000
91 }
92 }
93 QQ2.ParallelAnimation {
94 QQ2.NumberAnimation {
95 target: watermaterial
96 property: "toy"
97 to: 0.0
98 duration: 0
99 }
100 QQ2.NumberAnimation {
101 target: watermaterial
102 property: "tox"
103 to: 0.0
104 duration: 0
105 }
106 }
107 }
108
109 QQ2.SequentialAnimation {
110 running: true
111 loops: QQ2.Animation.Infinite
112 QQ2.NumberAnimation {
113 target: watermaterial
114 property: "vertY"
115 to: 200
116 duration: 200000
117 // easing.type: Easing.Linear
118 }
119 QQ2.NumberAnimation {
120 target: watermaterial
121 property: "vertY"
122 to: 2
123 duration: 200000
124 // easing.type: Easing.Linear
125 }
126 }
127 }
128