1 |
8777ce17
|
Leszek Koltunski
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2018 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
|
|
// This file is part of Distorted. //
|
5 |
|
|
// //
|
6 |
|
|
// Distorted is free software: you can redistribute it and/or modify //
|
7 |
|
|
// it under the terms of the GNU General Public License as published by //
|
8 |
|
|
// the Free Software Foundation, either version 2 of the License, or //
|
9 |
|
|
// (at your option) any later version. //
|
10 |
|
|
// //
|
11 |
|
|
// Distorted is distributed in the hope that it will be useful, //
|
12 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14 |
|
|
// GNU General Public License for more details. //
|
15 |
|
|
// //
|
16 |
|
|
// You should have received a copy of the GNU General Public License //
|
17 |
|
|
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. //
|
18 |
|
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
19 |
|
|
|
20 |
f89a986e
|
Leszek Koltunski
|
precision highp float;
|
21 |
47511918
|
Leszek Koltunski
|
precision highp int;
|
22 |
8777ce17
|
Leszek Koltunski
|
|
23 |
e029600f
|
Leszek Koltunski
|
out vec4 fragColor;
|
24 |
|
|
in vec2 v_TexCoordinate;
|
25 |
8777ce17
|
Leszek Koltunski
|
|
26 |
e029600f
|
Leszek Koltunski
|
uniform vec2 u_Size;
|
27 |
8777ce17
|
Leszek Koltunski
|
|
28 |
e029600f
|
Leszek Koltunski
|
layout (std430,binding=1) buffer linkedlist
|
29 |
8777ce17
|
Leszek Koltunski
|
{
|
30 |
e029600f
|
Leszek Koltunski
|
uint u_Records[];
|
31 |
|
|
};
|
32 |
8777ce17
|
Leszek Koltunski
|
|
33 |
|
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
34 |
|
|
|
35 |
|
|
void main()
|
36 |
|
|
{
|
37 |
e029600f
|
Leszek Koltunski
|
uint pixelX = uint(v_TexCoordinate.x * u_Size.x);
|
38 |
|
|
uint pixelY = uint(v_TexCoordinate.y * u_Size.y);
|
39 |
|
|
uint index = pixelX + pixelY * uint(u_Size.x);
|
40 |
f89a986e
|
Leszek Koltunski
|
|
41 |
e029600f
|
Leszek Koltunski
|
uint ptr = u_Records[index];
|
42 |
8777ce17
|
Leszek Koltunski
|
|
43 |
e029600f
|
Leszek Koltunski
|
if( u_Records[ptr]==2u ) fragColor = vec4(1.0,0.0,0.0,1.0);
|
44 |
|
|
else if( u_Records[ptr]==1u ) fragColor = vec4(0.0,1.0,0.0,1.0);
|
45 |
|
|
else fragColor = vec4(0.0,0.0,1.0,1.0);
|
46 |
8777ce17
|
Leszek Koltunski
|
}
|