Debian Codegraph @

tests/manual/scenegraph_lancelot/data/shaders/atlas/atlas.qml

raw
1 import QtQuick 2.15
2
3 Item {
4 width: 320
5 height: 480
6
7 Column {
8 spacing: 10
9 padding: 5
10
11 Repeater {
12 model: ["sand_16x16.png", "circle_16x16.png", "star_16x16.png", "square_16x16.png"]
13 Row {
14 spacing: 20
15 Image {
16 id: img
17 source: "../../shared/" + modelData
18 }
19
20 // Non-atlased: copies subrect of atlas to a new texture
21 ShaderEffect {
22 width: img.width
23 height: img.height
24 property variant source: img
25 fragmentShader: "qrc:shaders/gradientgrid.frag"
26 supportsAtlasTextures: false
27 }
28
29 // Atlased: qt_MultiTexCoord0 points to the atlas subrect
30 ShaderEffect {
31 width: img.width
32 height: img.height
33 property variant source: img
34 fragmentShader: "qrc:shaders/gradientgrid.frag"
35 supportsAtlasTextures: true
36 }
37
38 // Subrect mode: qt_MultiTexCoord0 goes from 0.0 to 1.0,
39 // and qt_Subrect_source specifies the atlas subrect
40 ShaderEffect {
41 width: img.width
42 height: img.height
43 property variant source: img
44 fragmentShader: "qrc:shaders/gradientgrid.frag"
45 vertexShader: "qrc:shaders/subrect.vert"
46 supportsAtlasTextures: false
47 }
48 }
49 }
50 }
51 }