Kuesa ToneMapping QML Example
import Qt3D.Core 2.12
import Qt3D.Render 2.12
import Qt3D.Input 2.12
import Qt3D.Extras 2.12
import QtQuick 2.12
import Kuesa 1.1 as Kuesa
import Kuesa.Effects 1.1 as KuesaFX
import Kuesa.Utils 1.3 as KuesaUtils
Kuesa.SceneEntity {
id: root3D
property string toneMappingAlgorithmName: "None"
property int screenWidth
property int screenHeight
property double exposure: 1.7
property bool rotating: false
property bool lightRotating: true
property var __winSize: Qt.size(_view.width, _view.height)
Kuesa.Skybox {
baseName: "qrc:/pink_sunrise_16f_radiance"
extension: ".dds"
}
components: [
RenderSettings {
activeFrameGraph: Kuesa.ForwardRenderer {
id: frameGraph
camera: cameraAsset.node ? cameraAsset.node : fallbackCamera
clearColor: Qt.rgba(0.1, 0.1, 0.1, 1.0)
exposure: root3D.exposure
toneMappingAlgorithm: {
if (toneMappingAlgorithmName == "Filmic")
return KuesaFX.ToneMappingAndGammaCorrectionEffect.Filmic
if (toneMappingAlgorithmName == "Reinhard")
return KuesaFX.ToneMappingAndGammaCorrectionEffect.Reinhard
if (toneMappingAlgorithmName == "Uncharted")
return KuesaFX.ToneMappingAndGammaCorrectionEffect.Uncharted
return KuesaFX.ToneMappingAndGammaCorrectionEffect.None
}
skinning: true
}
},
InputSettings { },
EnvironmentLight {
irradiance: TextureLoader {
source: "qrc:/pink_sunrise_16f_irradiance" + ((!root3D.es2) ? ".dds" : "_es2.dds")
minificationFilter: Texture.LinearMipMapLinear
magnificationFilter: Texture.Linear
wrapMode {
x: WrapMode.ClampToEdge
y: WrapMode.ClampToEdge
}
generateMipMaps: false
}
specular: TextureLoader {
source: "qrc:/pink_sunrise_16f_specular" + ((!root3D.es2) ? ".dds" : "_es2.dds")
minificationFilter: Texture.LinearMipMapLinear
magnificationFilter: Texture.Linear
wrapMode {
x: WrapMode.ClampToEdge
y: WrapMode.ClampToEdge
}
generateMipMaps: false
}
}
]
Entity {
Transform {
id: transform
property real angle: 0.0
readonly property real radianAngle: angle * 2 * Math.PI / 360
readonly property real radius: 10
readonly property real x: radius * Math.cos(radianAngle)
readonly property real y: 0
readonly property real z: radius * Math.sin(radianAngle)
scale: 10
translation: Qt.vector3d(x, y, z)
NumberAnimation on angle {
loops: Animation.Infinite
duration: 10000
from: 0
to: 360
paused: root3D.lightRotating
}
}
Kuesa.PointLight {
id: pointLight
color: "white"
intensity: 0.2
}
components: [ pointLight, transform ]
}
Camera {
id: fallbackCamera
position: Qt.vector3d(0.0, 0.0, 7.0)
upVector: Qt.vector3d(0.0, 1.0, 0.0)
exposure: root3D.exposure
viewCenter: Qt.vector3d(0.0, 0.0, 0.0)
aspectRatio: root3D.__winSize.width / root3D.__winSize.height
}
KuesaUtils.OrbitCameraController {
id: controller
camera: frameGraph.camera
windowSize: root3D.__winSize
}
Kuesa.AnimationPlayer {
id: helmetSpin
sceneEntity: root3D
clip: "damagedHelmet_Action"
loops: Kuesa.AnimationPlayer.Infinite
running: root3D.rotating
}
Kuesa.Asset {
id: cameraAsset
name: root3D.cameras.names.length ? root3D.cameras.names[0] : ""
collection: root3D.cameras
onNodeChanged: {
if (node)
node.aspectRatio = root3D.__winSize.width / root3D.__winSize.height
}
}
Kuesa.Asset {
id: materialsAsset
name: "Material_MR"
collection: root3D.materials
}
Kuesa.GLTF2Importer {
id: gltf2importer
sceneEntity: root3D
assignNames: true
source: "qrc:/RotatingHelmet.gltf"
options.generateTangents: true
}
}