| 1 |
// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
| 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 |
|
| 7 |
RenderTarget { |
| 8 |
|
| 9 |
property alias color : colorAttachment |
| 10 |
property alias position : positionAttachment |
| 11 |
property alias normal : normalAttachment |
| 12 |
property alias depth : depthAttachment |
| 13 |
|
| 14 |
attachments : [ |
| 15 |
|
| 16 |
RenderTargetOutput { |
| 17 |
objectName : "color" |
| 18 |
attachmentPoint : RenderTargetOutput.Color0 |
| 19 |
texture : Texture2D { |
| 20 |
id : colorAttachment |
| 21 |
width : 1024 |
| 22 |
height : 1024 |
| 23 |
format : Texture.RGBA32F |
| 24 |
generateMipMaps : false |
| 25 |
magnificationFilter : Texture.Linear |
| 26 |
minificationFilter : Texture.Linear |
| 27 |
wrapMode { |
| 28 |
x: WrapMode.ClampToEdge |
| 29 |
y: WrapMode.ClampToEdge |
| 30 |
} |
| 31 |
} |
| 32 |
}, |
| 33 |
RenderTargetOutput { |
| 34 |
objectName : "position" |
| 35 |
attachmentPoint : RenderTargetOutput.Color1 |
| 36 |
texture : Texture2D { |
| 37 |
id : positionAttachment |
| 38 |
width : 1024 |
| 39 |
height : 1024 |
| 40 |
// We use RGBA32F here instead of a more fitting format because |
| 41 |
// OpenGL vendors might not support other formats |
| 42 |
format : Texture.RGBA32F |
| 43 |
generateMipMaps : false |
| 44 |
magnificationFilter : Texture.Linear |
| 45 |
minificationFilter : Texture.Linear |
| 46 |
wrapMode { |
| 47 |
x: WrapMode.ClampToEdge |
| 48 |
y: WrapMode.ClampToEdge |
| 49 |
} |
| 50 |
} |
| 51 |
}, |
| 52 |
RenderTargetOutput { |
| 53 |
objectName : "normal" |
| 54 |
attachmentPoint : RenderTargetOutput.Color2 |
| 55 |
texture : Texture2D { |
| 56 |
id : normalAttachment |
| 57 |
width : 1024 |
| 58 |
height : 1024 |
| 59 |
// We use RGBA32F here instead of a more fitting format because |
| 60 |
// OpenGL vendors might not support other formats |
| 61 |
format : Texture.RGBA32F |
| 62 |
generateMipMaps : false |
| 63 |
magnificationFilter : Texture.Linear |
| 64 |
minificationFilter : Texture.Linear |
| 65 |
wrapMode { |
| 66 |
x: WrapMode.ClampToEdge |
| 67 |
y: WrapMode.ClampToEdge |
| 68 |
} |
| 69 |
} |
| 70 |
}, |
| 71 |
RenderTargetOutput { |
| 72 |
objectName : "depth" |
| 73 |
attachmentPoint : RenderTargetOutput.Depth |
| 74 |
texture : Texture2D { |
| 75 |
id : depthAttachment |
| 76 |
width : 1024 |
| 77 |
height : 1024 |
| 78 |
format : Texture.D32F |
| 79 |
generateMipMaps : false |
| 80 |
magnificationFilter : Texture.Linear |
| 81 |
minificationFilter : Texture.Linear |
| 82 |
wrapMode { |
| 83 |
x: WrapMode.ClampToEdge |
| 84 |
y: WrapMode.ClampToEdge |
| 85 |
} |
| 86 |
} |
| 87 |
} |
| 88 |
] // outputs |
| 89 |
} |