Revision control

+ // Copyright (C) 2026 The Qt Company Ltd.
+ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+ import QtQuick
+ import QtQuick3D
+ import QtQuick3D.Helpers
+
+ // Regression guard: screen-space background (ScreenSpaceFull) with image-based lighting
+ // turned OFF, plus a ReflectionProbe and reflective spheres. In the screen-space modes the
+ // radiance cube is only generated when something consumes it; a reflection probe is one such
+ // consumer. If the cube is (incorrectly) skipped here, the probe has no sky input and the
+ // metallic spheres reflect clear color instead of the sky. With the cube generated, the
+ // spheres reflect the procedural sky.
+ Rectangle {
+ id: root
+ width: 800
+ height: 480
+ color: Qt.rgba(1, 1, 1, 1)
+
+ SkyMaterial {
+ id: mySkyMaterial
+ fragmentShader: "basicsky.frag"
+ skyboxMode: SkyMaterial.ScreenSpaceFull
+ enableIBL: false
+
+ // Sky Settings
+ property vector3d skyTopColor: Qt.vector3d(m_skyTopColor.r, m_skyTopColor.g, m_skyTopColor.b)
+ property vector3d skyHorizonColor: Qt.vector3d(m_skyHorizonColor.r, m_skyHorizonColor.g, m_skyHorizonColor.b)
+ property real skyCurve: 0.09
+ property real skyEnergy: 1.0
+
+ // Ground Settings
+ property vector3d groundBottomColor: Qt.vector3d(m_groundBottomColor.r, m_groundBottomColor.g, m_groundBottomColor.b)
+ property vector3d groundHorizonColor: Qt.vector3d(m_groundHorizonColor.r, m_groundHorizonColor.g, m_groundHorizonColor.b)
+ property real groundCurve: 0.02
+ property real groundEnergy: 1.0
+
+ property vector3d sunColor: Qt.vector3d(1.0, 1.0, 1.0)
+ // Sun Settings
+ property real sunEnergy: mySkyLight.brightness
+ property vector3d sunDirection:Qt.vector3d(-mySkyLight.forward.x, -mySkyLight.forward.y, -mySkyLight.forward.z)
+ property real sunDiskInnerAngle: 2.2
+ property real sunDiskOuterAngle: 9.9
+ property real sunDiskFalloff: 0.32
+ property real sunAlpha: 1.0
+
+ // Default colors
+ readonly property color m_skyTopColor: "#A5D6F1"
+ readonly property color m_skyHorizonColor: "#D6EAFA"
+ readonly property color m_groundBottomColor: "#282F36"
+ readonly property color m_groundHorizonColor: "#6C655F"
+ }
+
+ View3D {
+ id: view3D
+ anchors.fill: parent
+
+ environment: SceneEnvironment {
+ id: scene
+ backgroundMode: SceneEnvironment.SkyMaterial
+ skyMaterial: mySkyMaterial
+ }
+
+ camera: PerspectiveCamera {
+ id: cam
+ position: Qt.vector3d(750, 460, -1128)
+ eulerRotation: Qt.vector3d(-13, -203, 0)
+ }
+
+ DirectionalLight {
+ id: mySkyLight
+ eulerRotation.x: -25
+ property real customBrightness: 1.0
+ brightness: eulerRotation.x > 0.0 || eulerRotation.x < -180 ? 0 : customBrightness
+ }
+
+ ReflectionProbe {
+ position: Qt.vector3d(0, 125, 0)
+ boxSize: Qt.vector3d(4000, 4000, 4000)
+ quality: ReflectionProbe.High
+ refreshMode: ReflectionProbe.EveryFrame
+ parallaxCorrection: true
+ }
+
+ /// Models
+ Model {
+ source: "#Rectangle"
+ scale: Qt.vector3d(30, 30, 30)
+ eulerRotation.x: -90
+ receivesReflections: true
+ materials: PrincipledMaterial {
+ baseColor: "lightgray"
+ roughness: 0.9
+ metalness: 0.0
+ }
+ }
+
+ Model {
+ source: "#Sphere"
+ x: -75
+ y: 125
+ scale: Qt.vector3d(2.5, 2.5, 2.5)
+ receivesReflections: true
+ materials: PrincipledMaterial {
+ baseColor: "lightblue"
+ roughness: 0.05
+ metalness: 1.0
+ }
+ }
+
+ Model {
+ source: "#Sphere"
+ x: 275
+ y: 125
+ scale: Qt.vector3d(2.5, 2.5, 2.5)
+ receivesReflections: true
+ materials: PrincipledMaterial {
+ baseColor: "lightblue"
+ roughness: 0.3
+ metalness: 1.0
+ }
+ }
+
+ Model {
+ source: "#Sphere"
+ x: 575
+ y: 125
+ scale: Qt.vector3d(2.5, 2.5, 2.5)
+ receivesReflections: true
+ materials: PrincipledMaterial {
+ baseColor: "lightblue"
+ roughness: 0.55
+ metalness: 1.0
+ }
+ }
+ }
+
+ WasdController {
+ controlledObject: cam
+ }
+ }