1
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
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
|
precision highp float;
|
21
|
precision highp int;
|
22
|
|
23
|
out vec4 fragColor;
|
24
|
in vec2 v_TexCoordinate;
|
25
|
|
26
|
uniform vec2 u_Size;
|
27
|
|
28
|
layout (std430,binding=1) buffer linkedlist
|
29
|
{
|
30
|
uint u_Records[];
|
31
|
};
|
32
|
|
33
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
34
|
|
35
|
void main()
|
36
|
{
|
37
|
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
|
|
41
|
uint ptr = u_Records[index];
|
42
|
|
43
|
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
|
}
|