| 1 |
// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
import QtQuick 2.2 as QQ2 |
| 5 |
import Qt3D.Core 2.0 |
| 6 |
import Qt3D.Render 2.0 |
| 7 |
|
| 8 |
RenderSettings { |
| 9 |
id: root |
| 10 |
|
| 11 |
property alias viewCamera: viewCameraSelector.camera |
| 12 |
property alias lightCamera: lightCameraSelector.camera |
| 13 |
readonly property Texture2D shadowTexture: depthTexture |
| 14 |
|
| 15 |
activeFrameGraph: Viewport { |
| 16 |
normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0) |
| 17 |
|
| 18 |
RenderSurfaceSelector { |
| 19 |
RenderPassFilter { |
| 20 |
matchAny: [ FilterKey { name: "pass"; value: "shadowmap" } ] |
| 21 |
|
| 22 |
RenderTargetSelector { |
| 23 |
target: RenderTarget { |
| 24 |
attachments: [ |
| 25 |
RenderTargetOutput { |
| 26 |
objectName: "depth" |
| 27 |
attachmentPoint: RenderTargetOutput.Depth |
| 28 |
texture: Texture2D { |
| 29 |
id: depthTexture |
| 30 |
width: 1024 |
| 31 |
height: 1024 |
| 32 |
format: Texture.DepthFormat |
| 33 |
generateMipMaps: false |
| 34 |
magnificationFilter: Texture.Linear |
| 35 |
minificationFilter: Texture.Linear |
| 36 |
wrapMode { |
| 37 |
x: WrapMode.ClampToEdge |
| 38 |
y: WrapMode.ClampToEdge |
| 39 |
} |
| 40 |
comparisonFunction: Texture.CompareLessEqual |
| 41 |
comparisonMode: Texture.CompareRefToTexture |
| 42 |
} |
| 43 |
} |
| 44 |
] |
| 45 |
} |
| 46 |
|
| 47 |
ClearBuffers { |
| 48 |
buffers: ClearBuffers.DepthBuffer |
| 49 |
|
| 50 |
CameraSelector { |
| 51 |
id: lightCameraSelector |
| 52 |
} |
| 53 |
} |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
RenderPassFilter { |
| 58 |
matchAny: [ FilterKey { name: "pass"; value: "forward" } ] |
| 59 |
|
| 60 |
ClearBuffers { |
| 61 |
clearColor: Qt.rgba(0.0, 0.4, 0.7, 1.0) |
| 62 |
buffers: ClearBuffers.ColorDepthBuffer |
| 63 |
|
| 64 |
CameraSelector { |
| 65 |
id: viewCameraSelector |
| 66 |
} |
| 67 |
} |
| 68 |
} |
| 69 |
} |
| 70 |
} |
| 71 |
} |