Fog and more blocks
This commit is contained in:
@@ -1,11 +1,23 @@
|
||||
#version 450
|
||||
|
||||
vec3 SkyColour = vec3(186.0f / 255.0f, 214.0f / 255.0f, 254.0f / 255.0f);
|
||||
|
||||
in vec3 TexCoord;
|
||||
in float Distance;
|
||||
|
||||
out vec4 outColour;
|
||||
|
||||
uniform sampler2DArray tex;
|
||||
|
||||
void main() {
|
||||
outColour = texture(tex, TexCoord);
|
||||
|
||||
outColour = texture(tex, TexCoord);
|
||||
|
||||
if (outColour.w == .0)
|
||||
discard;
|
||||
|
||||
float fogMax = 20000;
|
||||
|
||||
outColour = vec4(mix(outColour.xyz, SkyColour, min(1.0f, Distance / fogMax)), outColour.w);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,12 +4,23 @@ layout (location = 0) in vec3 position;
|
||||
layout (location = 1) in vec3 texcoord;
|
||||
|
||||
out vec3 TexCoord;
|
||||
out float Distance;
|
||||
|
||||
uniform mat4 model;
|
||||
uniform mat4 view;
|
||||
uniform mat4 proj;
|
||||
|
||||
void main() {
|
||||
TexCoord = texcoord;
|
||||
gl_Position = proj * view * model * vec4(position, 1.0);
|
||||
|
||||
TexCoord = texcoord;
|
||||
|
||||
gl_Position = proj * view * model * vec4(position, 1.0);
|
||||
|
||||
// Makes no sense but it works
|
||||
Distance = (
|
||||
gl_Position.x * gl_Position.x +
|
||||
gl_Position.y * gl_Position.y +
|
||||
gl_Position.z * gl_Position.z
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
BIN
resources/textures/bedrock.png
Normal file
BIN
resources/textures/bedrock.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 225 B |
BIN
resources/textures/cobblestone.png
Normal file
BIN
resources/textures/cobblestone.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 568 B |
BIN
resources/textures/stone.png
Normal file
BIN
resources/textures/stone.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 223 B |
Reference in New Issue
Block a user