File: main.qml

package info (click to toggle)
qt6-quick3d 6.8.2-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 140,860 kB
  • sloc: cpp: 380,464; ansic: 36,078; xml: 252; sh: 241; makefile: 29
file content (158 lines) | stat: -rw-r--r-- 5,375 bytes parent folder | download | duplicates (2)
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
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick
import QtQuick3D
import QtQuick3D.Helpers

Window {
    id: window
    width: 1280
    height: 720
    visible: true
    title: "SpecularGlossyMaterial Example"
    color: "#848895"

    View3D {
        anchors.fill: parent
        camera: camera

        // Rotate the light direction
        DirectionalLight {
            eulerRotation.y: -100
            SequentialAnimation on eulerRotation.y {
                loops: Animation.Infinite
                PropertyAnimation {
                    duration: 5000
                    to: 360
                    from: 0
                }
            }
        }

        environment: SceneEnvironment {
            backgroundMode: SceneEnvironment.SkyBox
            probeExposure: 1.5
            lightProbe: Texture {
                textureData: ProceduralSkyTextureData {}
            }
            skyboxBlurAmount: 0.4
        }

        Node {
            scale: Qt.vector3d(100, 100, 100)
            Model {
                id: waterBottle_MR
                x: -0.08
                rotation: Qt.quaternion(0, 0, 1, 0)
                source: "meshes/waterBottle_MR.mesh"

                PrincipledMaterial {
                    id: bottleMat_MR_material
                    baseColorMap: Texture {
                        source: "maps/WaterBottle_baseColor.jpg"
                        generateMipmaps: true
                        mipFilter: Texture.Linear
                    }
                    opacityChannel: Material.A

                    Texture {
                        id: metalRoughnessTexture
                        source: "maps/WaterBottle_roughnessMetallic.jpg"
                        generateMipmaps: true
                        mipFilter: Texture.Linear
                    }
                    metalnessMap: metalRoughnessTexture
                    metalnessChannel: Material.B
                    roughnessMap: metalRoughnessTexture
                    roughnessChannel: Material.G
                    metalness: 1
                    roughness: 1
                    normalMap: Texture {
                        source: "maps/WaterBottle_normal.png"
                        generateMipmaps: true
                        mipFilter: Texture.Linear
                    }
                    occlusionMap: Texture {
                        source: "maps/WaterBottle_occlusion.png"
                        generateMipmaps: true
                        mipFilter: Texture.Linear
                    }
                    occlusionChannel: Material.R
                    emissiveMap: Texture {
                        source: "maps/WaterBottle_emissive.png"
                        generateMipmaps: true
                        mipFilter: Texture.Linear
                    }
                    emissiveFactor: Qt.vector3d(1, 1, 1)
                    alphaMode: PrincipledMaterial.Opaque
                }
                materials: [
                    bottleMat_MR_material
                ]
            }
            Model {
                id: waterBottle_SpecGloss
                x: 0.08
                rotation: Qt.quaternion(0, 0, 1, 0)
                source: "meshes/waterBottle_SpecGloss.mesh"

                SpecularGlossyMaterial {
                    id: bottleMat_SpecGloss_material
                    albedoMap: Texture {
                        source: "maps/WaterBottle_diffuse.jpg"
                        generateMipmaps: true
                        mipFilter: Texture.Linear
                    }

                    normalMap: Texture {
                        source: "maps/WaterBottle_normal.png"
                        generateMipmaps: true
                        mipFilter: Texture.Linear
                    }
                    occlusionMap: Texture {
                        source: "maps/WaterBottle_occlusion.png"
                        generateMipmaps: true
                        mipFilter: Texture.Linear
                    }
                    occlusionChannel: Material.R
                    emissiveMap: Texture {
                        source: "maps/WaterBottle_emissive.png"
                        generateMipmaps: true
                        mipFilter: Texture.Linear
                    }
                    emissiveFactor: Qt.vector3d(1, 1, 1)
                    alphaMode: PrincipledMaterial.Opaque

                    Texture {
                        id: specularGlossyTexture
                        source: "maps/WaterBottle_specularGlossiness.png"
                        generateMipmaps: true
                        mipFilter: Texture.Linear
                    }

                    specularMap: specularGlossyTexture
                    glossiness: 1.0
                    glossinessMap: specularGlossyTexture
                    glossinessChannel: Material.A
                }
                materials: [
                    bottleMat_SpecGloss_material
                ]
            }
        }

        Node {
            id: originNode
            PerspectiveCamera {
                id: cameraNode
                position: Qt.vector3d(0, 0, 30)
            }
        }

        OrbitCameraController {
            origin: originNode
            camera: cameraNode
        }
    }
}