aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/shaders/chunk.frag
blob: e779d7c8b48307d54ca45ee379c8a535e2807b15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#version 330 core
out vec4 FragColor;

in vec2 TexCoord;
in vec2 BTexCoord;
in vec4 Color;
in vec4 SPos;
in vec4 Viewport;
in mat4 ProjInv;
in vec4 FogColor;
in vec2 FogStartEnd;
flat in vec2 ProvokingTexCoord;

uniform sampler2D atlas;
uniform sampler2D lightTex;

void main()
{
	float relU = SPos.x;
	float relV = SPos.y;
	
	//if(true||relU > 1 || relV > 1){
	if(true){
		//FragColor = vec4(1, 1, 1, 1);
		//FragColor = vec4((SPos.x), (SPos.y), 0, 1);
		FragColor = vec4(SPos.x>0.5?1:0,0, 0, 1);
		//FragColor = vec4(abs(TexCoord.x - ProvokingTexCoord.x) * 100.0, abs(TexCoord.y - ProvokingTexCoord.y) * 100.0, 0, 1);
		//FragColor = vec4((TexCoord.xy - ProvokingTexCoord.xy) * 100.0, 0, 1);
	} else {
	
	//float goodTexCoordU = ProvokingTexCoord.x + (TexCoord.x - ProvokingTexCoord.x) * relU;
	//float goodTexCoordV = ProvokingTexCoord.y + (TexCoord.y - ProvokingTexCoord.y) * relV;
	
	float goodTexCoordU = ProvokingTexCoord.x + (((TexCoord.x - ProvokingTexCoord.x) / SPos.z) * relU);
	float goodTexCoordV = ProvokingTexCoord.y + (((TexCoord.y - ProvokingTexCoord.y) / SPos.w) * relV);
	
	//vec2 goodTexCoord = vec2(goodTexCoordU, goodTexCoordV);
	
	vec2 goodTexCoord = ProvokingTexCoord + vec2(SPos.x / 3.0, SPos.y) * (1.0/16.0);
	
	vec4 texColor = texture(atlas, goodTexCoord);
	//vec4 texColor = texture(atlas, TexCoord);
	/*vec4 colorMult = Color/256.0;
	
	vec4 lightyColor = texture(lightTex, (BTexCoord + 8.0) / 256.0);
	
	vec4 rasterColor = ((texColor * colorMult) * lightyColor);
	
	FragColor = rasterColor;*/
	
	//FragColor = vec4(SPos.z, 1, 1, 1);
	
	FragColor = texColor;
	//FragColor = vec4(relU, relV, 0, 1);
	
	}
	
	//FragColor = vec4(1, 1, 1, 1);
}