Added day&night cycle. Also fixed world loading
Build / build (push) Has been cancelled

This commit is contained in:
milkwx3
2026-07-07 22:02:10 +03:00
parent 7ab2d5a083
commit 04d1969084
25 changed files with 3018 additions and 888 deletions
-64
View File
@@ -1,64 +0,0 @@
211d25
413d42
5c5b63
7c808b
a5b0b6
d6dede
ffffff
dcded1
aab1a1
7b8375
585f57
3c3c3c
635d5a
8d837d
b4aea4
dedcd1
eadedf
bcacb1
8f8189
685d66
643747
b2434d
e55858
fa8971
ffb999
ffe0b7
ffbdc1
ef93b5
c971a2
944e89
4c3d57
5d558f
777dc4
96b1e7
bedef6
aae3db
5ac5ce
4694a8
346376
2a3b4a
29684a
379648
79b547
b8cf61
f3db6f
f4ba7a
e79055
ce6442
944940
91555d
b76f6b
cd9383
e1ba9e
facafb
d49ce5
9f76b8
725689
edb762
fcfbc9
de9463
b66a4d
333f29
4e5c2c
708939
Binary file not shown.

Before

Width:  |  Height:  |  Size: 308 B

+6 -8
View File
@@ -14,12 +14,14 @@ speed_up: Fly faster
fly: Toggle flying
chat: Open chat
swap_mouse: Swap LMB/RMB
inventory: Open inventory
# Menu
select_level: Singleplayer
multiplayer: Multiplayer
join: Join
exit: Exit
options: Options
create_world: Create world
# Multiplayer errors
error_notfound: Host not found!
error_internal: Internal enet error!
@@ -41,21 +43,17 @@ item.dirt: "Dirt"
item.sand: "Sand"
item.water: "Water"
item.planks: "Wooden Planks"
item.gray_bricks: "Gray Bricks"
item.red_bricks: "Red Bricks"
item.blue_bricks: "Blue Bricks"
item.green_bricks: "Green Bricks"
item.stone_bricks: "Stone Bricks"
item.copper_block: "Copper Block"
item.silver_block: "Silver Block"
item.gold_block: "Gold Block"
item.glass: "Glass"
item.log: "Log"
item.spruce_planks: "Spruce Planks"
item.red_block: "Red Block"
item.green_block: "Green Block"
item.blue_block: "Blue Block"
item.yellow_block: "Yellow Block"
item.cyan_block: "Cyan Block"
item.magenta_block: "Magenta Block"
item.white_block: "White Block"
item.black_block: "Black Block"
item.leaves: "Leaves"
item.copper_ore: "Copper Ore"
item.silver_ore: "Silver Ore"
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

+37
View File
@@ -0,0 +1,37 @@
#version 330
in vec2 fragTexCoord;
in vec4 fragColor;
in vec3 fragPosition;
in vec3 fragNormal;
uniform sampler2D texture0;
uniform vec4 sunlightColor;
uniform vec3 lightDir;
out vec4 finalColor;
void main()
{
vec4 texelColor = texture(texture0, fragTexCoord);
vec3 N = normalize(fragNormal);
vec3 L = normalize(lightDir);
float ndotl = max(dot(N, L), 0.0);
float ambient = 0.1;
float sunfactor = ambient + (1.0 - ambient) * ndotl;
sunfactor *= 1+min(0, L.y);
vec3 Lmoon = normalize(-lightDir);
float ndotlMoon = max(dot(N, Lmoon), 0.0);
float moonfactor = (ambient + (1.0 - ambient) * ndotlMoon) * 8;
moonfactor *= max(0, -L.y);
// In fragColor, 'r' is blocklight R, 'g' is blocklight G, 'b' is blocklight B and 'a' is sunlight
texelColor.r *= fragColor.a * sunlightColor.r * (sunfactor+moonfactor) + fragColor.r;
texelColor.g *= fragColor.a * sunlightColor.g * (sunfactor+moonfactor) + fragColor.g;
texelColor.b *= fragColor.a * sunlightColor.b * (sunfactor+moonfactor) + fragColor.b;
finalColor = texelColor;
}
+32
View File
@@ -0,0 +1,32 @@
#version 330
// Input vertex attributes
in vec3 vertexPosition;
in vec2 vertexTexCoord;
in vec3 vertexNormal;
in vec4 vertexColor;
// Input uniform values
uniform mat4 mvp;
uniform mat4 matModel;
uniform mat4 matNormal;
// Output vertex attributes (to fragment shader)
out vec3 fragPosition;
out vec2 fragTexCoord;
out vec4 fragColor;
out vec3 fragNormal;
// NOTE: Add your custom variables here
void main()
{
// Send vertex attributes to fragment shader
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
fragTexCoord = vertexTexCoord;
fragColor = vertexColor;
fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0)));
// Calculate final vertex position
gl_Position = mvp*vec4(vertexPosition, 1.0);
}
+46
View File
@@ -0,0 +1,46 @@
#version 330
in vec2 fragTexCoord;
in vec4 fragColor;
in vec3 fragPosition;
in vec3 fragNormal;
uniform sampler2D texture0;
uniform vec4 sunlightColor;
uniform vec4 skyColor;
uniform vec3 lightDir;
out vec4 finalColor;
void main()
{
vec4 texelColor = texture(texture0, fragTexCoord);
vec3 N = normalize(fragNormal);
vec3 L = normalize(lightDir);
float ndotl = max(dot(N, L), 0.0);
float ambient = 0.1;
float sunfactor = ambient + (1.0 - ambient) * ndotl;
sunfactor *= 1+min(0, L.y);
vec3 Lmoon = normalize(-lightDir);
float ndotlMoon = max(dot(N, Lmoon), 0.0);
float moonfactor = (ambient + (1.0 - ambient) * ndotlMoon) * 8;
moonfactor *= max(0, -L.y);
// In fragColor, 'r' is blocklight R, 'g' is blocklight G, 'b' is blocklight B and 'a' is sunlight
float sunlight = fragColor.a;
texelColor.r *= sunlight * sunlightColor.r * (sunfactor+moonfactor) + fragColor.r;
texelColor.g *= sunlight * sunlightColor.g * (sunfactor+moonfactor) + fragColor.g;
texelColor.b *= sunlight * sunlightColor.b * (sunfactor+moonfactor) + fragColor.b;
float highlight = texelColor.a;
if(highlight < 0.25) highlight = 0;
float highlight_final = abs(N.y)*highlight * 4;
vec3 highlightColor = sunlightColor.rgb*highlight_final*sunlight;
highlightColor.r += fragColor.r*highlight_final;
highlightColor.g += fragColor.g*highlight_final;
highlightColor.b += fragColor.b*highlight_final;
finalColor = texelColor + vec4(highlightColor, min(1.0, highlight_final));
}
+34
View File
@@ -0,0 +1,34 @@
#version 330
// Input vertex attributes
in vec3 vertexPosition;
in vec2 vertexTexCoord;
in vec3 vertexNormal;
in vec4 vertexColor;
// Input uniform values
uniform mat4 mvp;
uniform mat4 matModel;
uniform mat4 matNormal;
uniform float time;
// Output vertex attributes (to fragment shader)
out vec3 fragPosition;
out vec2 fragTexCoord;
out vec4 fragColor;
out vec3 fragNormal;
// NOTE: Add your custom variables here
void main()
{
// Send vertex attributes to fragment shader
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
fragTexCoord = vertexTexCoord;
fragColor = vertexColor;
fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0)));
// Calculate final vertex position
vec3 pos = vertexPosition + vec3(0, sin(time * 2.0 + vertexPosition.x * 1.5) / 20.0 + cos(time * 2.0 + vertexPosition.z * 1.5) / 20.0-0.1, 0);
gl_Position = mvp*vec4(pos, 1.0);
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 901 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB