mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 11:17:05 -04:00
CI: Check for trailing spaces and (missing) newlines at the end of the file
fixes #737
This commit is contained in:
parent
fd43253f4a
commit
22488a28ae
@ -8,11 +8,11 @@
|
||||
.chance = 0,
|
||||
|
||||
.interpolation = .linear,
|
||||
|
||||
|
||||
.hills = 5,
|
||||
|
||||
.music = "cubyz:tides",
|
||||
|
||||
|
||||
.ground_structure = .{
|
||||
"2 to 4 cubyz:sand",
|
||||
},
|
||||
|
@ -4,11 +4,11 @@
|
||||
},
|
||||
.minHeight = 24,
|
||||
.maxHeight = 60,
|
||||
|
||||
|
||||
.roughness = 20,
|
||||
.hills = 10,
|
||||
.rivers = true,
|
||||
|
||||
|
||||
.music = "cubyz:sunrise",
|
||||
|
||||
.ground_structure = .{
|
||||
|
@ -4,12 +4,12 @@
|
||||
},
|
||||
.minHeight = 80,
|
||||
.maxHeight = 256,
|
||||
|
||||
|
||||
.roughness = 10,
|
||||
.mountains = 100,
|
||||
|
||||
|
||||
.rivers = true,
|
||||
|
||||
|
||||
.ground_structure = .{
|
||||
"0 to 1 cubyz:grass",
|
||||
"0 to 1 cubyz:gravel",
|
||||
|
@ -25,7 +25,7 @@
|
||||
.chance = 0.048,
|
||||
.size = 3,
|
||||
.size_variation = 6,
|
||||
},
|
||||
},
|
||||
.{
|
||||
.id = "cubyz:boulder",
|
||||
.chance = 0.016,
|
||||
|
@ -39,7 +39,6 @@
|
||||
.size_variation = 6,
|
||||
},
|
||||
.{
|
||||
|
||||
.id = "cubyz:ground_patch",
|
||||
.block = "cubyz:lava",
|
||||
.chance = 0.064,
|
||||
|
@ -14,7 +14,7 @@
|
||||
.chance = 0.112,
|
||||
.size = 4,
|
||||
.size_variation = 10,
|
||||
},
|
||||
},
|
||||
.{
|
||||
.id = "cubyz:ground_patch",
|
||||
.block = "cubyz:water",
|
||||
|
@ -18,14 +18,14 @@
|
||||
.chance = 0.48,
|
||||
.size = 4,
|
||||
.size_variation = 6,
|
||||
},
|
||||
},
|
||||
.{
|
||||
.id = "cubyz:stalagmite",
|
||||
.block = "cubyz:limestone",
|
||||
.chance = 0.08,
|
||||
.size = 8,
|
||||
.size_variation = 12,
|
||||
},
|
||||
},
|
||||
.{
|
||||
.id = "cubyz:ground_patch",
|
||||
.block = "cubyz:limestone",
|
||||
|
@ -39,7 +39,7 @@
|
||||
.chance = 0.048,
|
||||
.size = 3,
|
||||
.size_variation = 6,
|
||||
},
|
||||
},
|
||||
.{
|
||||
.id = "cubyz:boulder",
|
||||
.chance = 0.016,
|
||||
|
@ -7,7 +7,7 @@
|
||||
.minHeight = -100,
|
||||
.maxHeight = -22,
|
||||
.radius = 500,
|
||||
|
||||
|
||||
.roughness = 20,
|
||||
.hills = 10,
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
.maxHeight = 40,
|
||||
|
||||
.validPlayerSpawn = true,
|
||||
|
||||
|
||||
.ground_structure = .{
|
||||
"cubyz:grass",
|
||||
"2 cubyz:soil",
|
||||
|
@ -4,11 +4,11 @@
|
||||
},
|
||||
.minHeight = 80,
|
||||
.maxHeight = 256,
|
||||
|
||||
|
||||
.roughness = 50,
|
||||
.mountains = 50,
|
||||
.hills = 50,
|
||||
|
||||
|
||||
.ground_structure = .{
|
||||
"3 to 5 cubyz:snow",
|
||||
"4 cubyz:frost",
|
||||
|
@ -4,14 +4,14 @@
|
||||
},
|
||||
.minHeight = 22,
|
||||
.maxHeight = 40,
|
||||
|
||||
|
||||
.roughness = 10,
|
||||
.hills = 10,
|
||||
|
||||
|
||||
.music = "cubyz:mana-two-part-2",
|
||||
|
||||
.validPlayerSpawn = false,
|
||||
|
||||
|
||||
.ground_structure = .{
|
||||
},
|
||||
.structures = .{
|
||||
|
@ -3,14 +3,14 @@
|
||||
},
|
||||
.minHeight = 22,
|
||||
.maxHeight = 40,
|
||||
|
||||
|
||||
.roughness = 1,
|
||||
.hills = 5,
|
||||
|
||||
|
||||
.music = "cubyz:sunrise",
|
||||
|
||||
.validPlayerSpawn = true,
|
||||
|
||||
|
||||
.ground_structure = .{
|
||||
"cubyz:grass",
|
||||
"2 to 3 cubyz:soil",
|
||||
|
@ -9,7 +9,7 @@
|
||||
.music = "cubyz:Sincerely",
|
||||
|
||||
.radius = 64,
|
||||
|
||||
|
||||
.ground_structure = .{
|
||||
"3 to 4 cubyz:stone",
|
||||
"1 to 2 cubyz:sandstone",
|
||||
|
@ -5,14 +5,14 @@
|
||||
},
|
||||
.minHeight = 22,
|
||||
.maxHeight = 40,
|
||||
|
||||
|
||||
.roughness = 10,
|
||||
.hills = 10,
|
||||
|
||||
|
||||
.music = "cubyz:leaves",
|
||||
|
||||
.validPlayerSpawn = true,
|
||||
|
||||
|
||||
.ground_structure = .{
|
||||
"cubyz:grass",
|
||||
},
|
||||
|
@ -4,14 +4,14 @@
|
||||
},
|
||||
.minHeight = 22,
|
||||
.maxHeight = 40,
|
||||
|
||||
|
||||
.roughness = 10,
|
||||
.hills = 10,
|
||||
|
||||
|
||||
.music = "cubyz:mana-two-part-2",
|
||||
|
||||
.validPlayerSpawn = false,
|
||||
|
||||
|
||||
.ground_structure = .{
|
||||
},
|
||||
.stoneBlock = "cubyz:chalk/white",
|
||||
|
@ -5,12 +5,12 @@
|
||||
.radius = 400,
|
||||
.minHeight = 60,
|
||||
.maxHeight = 256,
|
||||
|
||||
|
||||
.roughness = 10,
|
||||
.mountains = 100,
|
||||
|
||||
|
||||
.rivers = true,
|
||||
|
||||
|
||||
.ground_structure = .{
|
||||
"cubyz:grass",
|
||||
"1 to 2 cubyz:soil",
|
||||
|
@ -5,14 +5,14 @@
|
||||
.radius = 500,
|
||||
.minHeight = -100,
|
||||
.maxHeight = -22,
|
||||
|
||||
|
||||
.roughness = 15,
|
||||
.hills = 15,
|
||||
|
||||
|
||||
.rivers = true,
|
||||
|
||||
.music = "cubyz:under_the_water_sky",
|
||||
|
||||
|
||||
.ground_structure = .{
|
||||
"2 to 3 cubyz:gravel",
|
||||
},
|
||||
|
@ -8,11 +8,11 @@
|
||||
.chance = 0,
|
||||
|
||||
.interpolation = .linear,
|
||||
|
||||
|
||||
.hills = 10,
|
||||
|
||||
.music = "cubyz:tides",
|
||||
|
||||
|
||||
.ground_structure = .{
|
||||
"2 to 4 cubyz:sand",
|
||||
},
|
||||
|
@ -4,9 +4,9 @@
|
||||
},
|
||||
.minHeight = 120,
|
||||
.maxHeight = 256,
|
||||
|
||||
|
||||
.mountains = 125,
|
||||
|
||||
|
||||
.music = "cubyz:DarkTimes",
|
||||
|
||||
.ground_structure = .{
|
||||
|
@ -4,16 +4,16 @@
|
||||
},
|
||||
.minHeight = 22,
|
||||
.maxHeight = 40,
|
||||
|
||||
|
||||
.roughness = 10,
|
||||
.hills = 10,
|
||||
|
||||
.chance = 0.01,
|
||||
|
||||
|
||||
.music = "cubyz:leaves",
|
||||
|
||||
.validPlayerSpawn = true,
|
||||
|
||||
|
||||
.ground_structure = .{
|
||||
"cubyz:grass",
|
||||
"2 to 3 cubyz:soil",
|
||||
|
@ -4,11 +4,11 @@
|
||||
.chance = 0.04,
|
||||
.minHeight = 20,
|
||||
.maxHeight = 40,
|
||||
|
||||
|
||||
.mountains = 30,
|
||||
|
||||
|
||||
.music = "cubyz:sunrise",
|
||||
|
||||
|
||||
.ground_structure = .{
|
||||
"cubyz:grass",
|
||||
"0 to 1 cubyz:soil",
|
||||
@ -32,4 +32,4 @@
|
||||
.size_variance = 4,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,12 @@
|
||||
},
|
||||
.minHeight = 22,
|
||||
.maxHeight = 40,
|
||||
|
||||
|
||||
.roughness = 10,
|
||||
.hills = 10,
|
||||
|
||||
.validPlayerSpawn = true,
|
||||
|
||||
|
||||
.ground_structure = .{
|
||||
"0 to 1 cubyz:grass",
|
||||
"2 to 3 cubyz:soil",
|
||||
|
@ -5,12 +5,12 @@
|
||||
.radius = 320,
|
||||
.minHeight = 128,
|
||||
.maxHeight = 128,
|
||||
|
||||
|
||||
.interpolation = .linear,
|
||||
.mountains = 150,
|
||||
|
||||
.chance = 0,
|
||||
|
||||
|
||||
.music = "cubyz:out_of_breath",
|
||||
|
||||
.parentBiomes = .{
|
||||
|
@ -9,7 +9,7 @@
|
||||
.interpolation = .linear,
|
||||
.mountains = 30,
|
||||
.chance = 0,
|
||||
|
||||
|
||||
.music = "cubyz:out_of_breath",
|
||||
|
||||
.parentBiomes = .{
|
||||
|
@ -5,12 +5,12 @@
|
||||
.radius = 280,
|
||||
.minHeight = 256,
|
||||
.maxHeight = 256,
|
||||
|
||||
|
||||
.interpolation = .linear,
|
||||
.mountains = 75,
|
||||
|
||||
.chance = 0,
|
||||
|
||||
|
||||
.music = "cubyz:out_of_breath",
|
||||
|
||||
.parentBiomes = .{
|
||||
|
@ -5,11 +5,11 @@
|
||||
.radius = 240,
|
||||
.minHeight = 384,
|
||||
.maxHeight = 384,
|
||||
|
||||
|
||||
.interpolation = .linear,
|
||||
|
||||
.chance = 0,
|
||||
|
||||
|
||||
.music = "cubyz:out_of_breath",
|
||||
|
||||
.parentBiomes = .{
|
||||
|
@ -5,11 +5,11 @@
|
||||
.radius = 200,
|
||||
.minHeight = 480,
|
||||
.maxHeight = 480,
|
||||
|
||||
|
||||
.interpolation = .linear,
|
||||
|
||||
.chance = 0,
|
||||
|
||||
|
||||
.music = "cubyz:out_of_breath",
|
||||
|
||||
.parentBiomes = .{
|
||||
|
@ -5,11 +5,11 @@
|
||||
.radius = 160,
|
||||
.minHeight = 576,
|
||||
.maxHeight = 576,
|
||||
|
||||
|
||||
.interpolation = .linear,
|
||||
|
||||
.chance = 0,
|
||||
|
||||
|
||||
.music = "cubyz:out_of_breath",
|
||||
|
||||
.parentBiomes = .{
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
.interpolation = .linear,
|
||||
.chance = 0,
|
||||
|
||||
|
||||
.music = "cubyz:out_of_breath",
|
||||
|
||||
.parentBiomes = .{
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
.interpolation = .linear,
|
||||
.chance = 0,
|
||||
|
||||
|
||||
.music = "cubyz:out_of_breath",
|
||||
|
||||
.parentBiomes = .{
|
||||
|
@ -6,14 +6,14 @@
|
||||
.radius = 32,
|
||||
.minHeight = 22,
|
||||
.maxHeight = 40,
|
||||
|
||||
|
||||
.roughness = 10,
|
||||
.hills = 10,
|
||||
|
||||
|
||||
.music = "cubyz:leaves",
|
||||
|
||||
.validPlayerSpawn = true,
|
||||
|
||||
|
||||
.ground_structure = .{
|
||||
"cubyz:grass",
|
||||
"2 to 3 cubyz:soil",
|
||||
|
@ -5,12 +5,12 @@
|
||||
.radius = 320,
|
||||
.minHeight = 128,
|
||||
.maxHeight = 128,
|
||||
|
||||
|
||||
.interpolation = .linear,
|
||||
.mountains = 150,
|
||||
|
||||
.chance = 0,
|
||||
|
||||
|
||||
.music = "cubyz:out_of_breath",
|
||||
|
||||
.parentBiomes = .{
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
.interpolation = .smooth,
|
||||
.chance = 0,
|
||||
|
||||
|
||||
.music = "cubyz:out_of_breath",
|
||||
|
||||
.parentBiomes = .{
|
||||
|
@ -5,12 +5,12 @@
|
||||
.radius = 260,
|
||||
.minHeight = 256,
|
||||
.maxHeight = 256,
|
||||
|
||||
|
||||
.interpolation = .linear,
|
||||
.mountains = 75,
|
||||
|
||||
.chance = 0,
|
||||
|
||||
|
||||
.music = "cubyz:out_of_breath",
|
||||
|
||||
.parentBiomes = .{
|
||||
|
@ -6,11 +6,11 @@
|
||||
.minHeight = 384,
|
||||
.maxHeight = 384,
|
||||
.mountains = 50,
|
||||
|
||||
|
||||
.interpolation = .linear,
|
||||
|
||||
.chance = 0,
|
||||
|
||||
|
||||
.music = "cubyz:out_of_breath",
|
||||
|
||||
.parentBiomes = .{
|
||||
|
@ -7,11 +7,11 @@
|
||||
.maxHeight = 480,
|
||||
.roughness = 50,
|
||||
.mountains = 50,
|
||||
|
||||
|
||||
.interpolation = .linear,
|
||||
|
||||
.chance = 0,
|
||||
|
||||
|
||||
.music = "cubyz:out_of_breath",
|
||||
|
||||
.parentBiomes = .{
|
||||
|
@ -7,11 +7,11 @@
|
||||
.maxHeight = 576,
|
||||
.roughness = 100,
|
||||
.mountains = 100,
|
||||
|
||||
|
||||
.interpolation = .linear,
|
||||
|
||||
.chance = 0,
|
||||
|
||||
|
||||
.music = "cubyz:out_of_breath",
|
||||
|
||||
.parentBiomes = .{
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
.interpolation = .linear,
|
||||
.chance = 0,
|
||||
|
||||
|
||||
.music = "cubyz:out_of_breath",
|
||||
|
||||
.parentBiomes = .{
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
.interpolation = .linear,
|
||||
.chance = 0,
|
||||
|
||||
|
||||
.music = "cubyz:out_of_breath",
|
||||
|
||||
.parentBiomes = .{
|
||||
|
@ -6,17 +6,17 @@
|
||||
.radius = 500,
|
||||
.minHeight = -100,
|
||||
.maxHeight = -22,
|
||||
|
||||
|
||||
.roughness = 10,
|
||||
.hills = 20,
|
||||
|
||||
.music = "cubyz:tides",
|
||||
|
||||
|
||||
.ground_structure = .{
|
||||
"2 to 4 cubyz:sand",
|
||||
},
|
||||
.stoneBlock = "cubyz:sandstone",
|
||||
|
||||
|
||||
.structures = .{
|
||||
.{
|
||||
.id = "cubyz:ground_patch",
|
||||
|
@ -38,4 +38,4 @@
|
||||
.branched = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -6,4 +6,4 @@
|
||||
},
|
||||
.model = "cubyz:cube",
|
||||
.rotation = .stairs,
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
.degradable = true,
|
||||
.collide = false,
|
||||
.alwaysViewThrough = true,
|
||||
.absorbedLight = 0x121012,
|
||||
.absorbedLight = 0x121012,
|
||||
.model = "cubyz:plane",
|
||||
.rotation = .carpet,
|
||||
.texture = "cubyz:daisies",
|
||||
|
@ -5,11 +5,11 @@
|
||||
.degradable = true,
|
||||
.collide = false,
|
||||
.alwaysViewThrough = true,
|
||||
.absorbedLight = 0x000000,
|
||||
.absorbedLight = 0x000000,
|
||||
.model = "cubyz:plane",
|
||||
.rotation = .carpet,
|
||||
.texture = "cubyz:dead_leaf_pile",
|
||||
.item= .{
|
||||
.item = .{
|
||||
.texture = "dead_leaf_pile.png",
|
||||
},
|
||||
.lodReplacement = "cubyz:air",
|
||||
|
@ -9,4 +9,4 @@
|
||||
.collide = false,
|
||||
|
||||
.model = "cubyz:cube",
|
||||
}
|
||||
}
|
||||
|
@ -5,4 +5,4 @@
|
||||
.{.items = .{.auto}},
|
||||
},
|
||||
.model = "cubyz:cube",
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,12 @@
|
||||
.degradable = true,
|
||||
.collide = false,
|
||||
.alwaysViewThrough = true,
|
||||
.absorbedLight = 0x121012,
|
||||
.absorbedLight = 0x121012,
|
||||
.model = "cubyz:plane",
|
||||
.rotation = .carpet,
|
||||
.texture = "cubyz:ivy",
|
||||
.item= .{
|
||||
.item = .{
|
||||
.texture = "ivy.png",
|
||||
},
|
||||
},
|
||||
.lodReplacement = "cubyz:air",
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
.drops = .{
|
||||
.{.items = .{.auto}},
|
||||
},
|
||||
|
@ -12,7 +12,7 @@
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
.drops = .{
|
||||
.{.items = .{.auto}},
|
||||
},
|
||||
|
@ -7,7 +7,7 @@
|
||||
.degradable = true,
|
||||
.collide = false,
|
||||
.alwaysViewThrough = true,
|
||||
.absorbedLight = 0x000000,
|
||||
.absorbedLight = 0x000000,
|
||||
.model = "cubyz:plane",
|
||||
.rotation = .carpet,
|
||||
.texture = "cubyz:red_leaf_pile",
|
||||
|
@ -7,7 +7,7 @@
|
||||
.degradable = true,
|
||||
.collide = false,
|
||||
.alwaysViewThrough = true,
|
||||
.absorbedLight = 0x000000,
|
||||
.absorbedLight = 0x000000,
|
||||
.model = "cubyz:plane",
|
||||
.rotation = .carpet,
|
||||
.texture = "cubyz:yellow_leaf_pile",
|
||||
|
@ -24,4 +24,4 @@ void main() {
|
||||
uint textureIndex = gl_GlobalInvocationID.x;
|
||||
if(textureIndex >= size) return;
|
||||
animatedTexture[textureIndex] = animation[textureIndex].startFrame + time / animation[textureIndex].time % animation[textureIndex].frames;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 330
|
||||
#version 330
|
||||
|
||||
layout (location=0) out vec4 fragColor;
|
||||
|
||||
@ -8,4 +8,4 @@ uniform sampler2D image;
|
||||
|
||||
void main() {
|
||||
fragColor = texture(image, outTexCoords);
|
||||
}
|
||||
}
|
||||
|
@ -12,4 +12,4 @@ void main() {
|
||||
gl_Position = projectionMatrix*viewMatrix*vec4(vertexPos, 1);
|
||||
|
||||
outTexCoords = texCoords*vec2(1, -1);
|
||||
}
|
||||
}
|
||||
|
@ -103,4 +103,4 @@ void main() {
|
||||
vec3 bufferData = linearSample(ivec2(texCoords));
|
||||
float bloomFactor = max(max(bufferData.x, max(bufferData.y, bufferData.z)) - 1.0, 0);
|
||||
fragColor = vec4(bufferData*bloomFactor, 1);
|
||||
}
|
||||
}
|
||||
|
@ -17,4 +17,4 @@ void main() {
|
||||
normalizedTexCoords = inTexCoords;
|
||||
texCoords = inTexCoords*textureSize(color, 0) - 0.25;
|
||||
gl_Position = vec4(position, 0, 1);
|
||||
}
|
||||
}
|
||||
|
@ -35,4 +35,4 @@ void main() {
|
||||
result += texture(color, texCoords - vec2(tex_offset.x * i, 0.0)).rgb * weights[i];
|
||||
}
|
||||
fragColor = vec4(result, 1);
|
||||
}
|
||||
}
|
||||
|
@ -7,4 +7,4 @@ out vec2 texCoords;
|
||||
void main() {
|
||||
texCoords = inTexCoords;
|
||||
gl_Position = vec4(inTexCoords*2 - vec2(1, 1), 0, 1);
|
||||
}
|
||||
}
|
||||
|
@ -16,4 +16,4 @@ void main() {
|
||||
result += texture(color, texCoords - vec2(0, tex_offset.y * i)).rgb * weights[i];
|
||||
}
|
||||
fragColor = vec4(result, 1);
|
||||
}
|
||||
}
|
||||
|
@ -7,4 +7,4 @@ out vec2 texCoords;
|
||||
void main() {
|
||||
texCoords = inTexCoords;
|
||||
gl_Position = vec4(inTexCoords*2 - vec2(1, 1), 0, 1);
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ void main() {
|
||||
);
|
||||
|
||||
normal = quads[quadIndex].normal;
|
||||
|
||||
|
||||
position += quads[quadIndex].corners[vertexID];
|
||||
position *= voxelSize;
|
||||
position += modelPosition;
|
||||
|
@ -25,4 +25,4 @@ layout(std430, binding = 6) buffer _chunks
|
||||
|
||||
void main() {
|
||||
chunks[chunkID].visibilityState = 1;
|
||||
}
|
||||
}
|
||||
|
@ -75,4 +75,3 @@ void main() {
|
||||
vec3 vertexPosition = modelPosition + (vertexBuffer[vertexID]*chunks[chunkID].maxPos.xyz + (1 - vertexBuffer[vertexID])*chunks[chunkID].minPos.xyz)*chunks[chunkID].voxelSize;
|
||||
gl_Position = projectionMatrix*viewMatrix*vec4(vertexPosition, 1);
|
||||
}
|
||||
|
||||
|
@ -88,4 +88,4 @@ void main() {
|
||||
fragColor.rgb = applyFrontfaceFog(fogDistance, fog.color, fragColor.rgb);
|
||||
float maxColor = max(1.0, max(fragColor.r, max(fragColor.g, fragColor.b)));
|
||||
fragColor.rgb = fragColor.rgb/maxColor;
|
||||
}
|
||||
}
|
||||
|
@ -13,4 +13,4 @@ void main() {
|
||||
direction = (invViewMatrix * vec4(position.x*tanXY.x, 1, position.y*tanXY.y, 0)).xyz;
|
||||
texCoords = inTexCoords;
|
||||
gl_Position = vec4(position, 0, 1);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ void main() {
|
||||
int vertexID = gl_VertexID & 3;
|
||||
|
||||
normal = quads[faceID].normal;
|
||||
|
||||
|
||||
vec3 position = quads[faceID].corners[vertexID];
|
||||
|
||||
vec4 mvPos = viewMatrix*vec4(position, 1);
|
||||
|
@ -30,7 +30,7 @@ float snoise(vec3 v) {
|
||||
vec3 i1 = min(g.xyz, l.zxy);
|
||||
vec3 i2 = max(g.xyz, l.zxy);
|
||||
|
||||
// x0 = x0 - 0. + 0.0 * C
|
||||
// x0 = x0 - 0. + 0.0 * C
|
||||
vec3 x1 = x0 - i1 + 1.0*C.xxx;
|
||||
vec3 x2 = x0 - i2 + 2.0*C.xxx;
|
||||
vec3 x3 = x0 - 1. + 3.0*C.xxx;
|
||||
@ -38,13 +38,13 @@ float snoise(vec3 v) {
|
||||
// Get gradients:
|
||||
ivec3 rand = random3to3(ivec3(i));
|
||||
vec3 p0 = vec3(rand);
|
||||
|
||||
|
||||
rand = random3to3((ivec3(i + i1)));
|
||||
vec3 p1 = vec3(rand);
|
||||
|
||||
|
||||
rand = random3to3((ivec3(i + i2)));
|
||||
vec3 p2 = vec3(rand);
|
||||
|
||||
|
||||
rand = random3to3((ivec3(i + 1)));
|
||||
vec3 p3 = vec3(rand);
|
||||
|
||||
@ -59,4 +59,4 @@ void main() {
|
||||
position = position.x*rightVector + position.y*upVector + position.z*normalVector;
|
||||
position *= frequency;
|
||||
fragColor = vec4(vec3(snoise(position)*0.5 + 0.5), 1);
|
||||
}
|
||||
}
|
||||
|
@ -9,4 +9,4 @@ uniform float reflectionMapSize;
|
||||
void main() {
|
||||
coords = vec3((inTexCoords*2 - vec2(1, 1))*(reflectionMapSize + 1)/reflectionMapSize, 1);
|
||||
gl_Position = vec4(inTexCoords*2 - vec2(1, 1), 0, 1);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 330
|
||||
#version 330
|
||||
|
||||
layout (location=0) out vec4 frag_color;
|
||||
|
||||
@ -16,4 +16,4 @@ void main(){
|
||||
float alpha = linearstep(1+delta, 1-delta, distSqr);
|
||||
frag_color = color;
|
||||
frag_color.a *= alpha;
|
||||
}
|
||||
}
|
||||
|
@ -15,15 +15,14 @@ uniform int circleColor;
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
// Convert to opengl coordinates:
|
||||
vec2 position_percentage = (center + vertex_pos*radius)/screen;
|
||||
|
||||
|
||||
vec2 position = vec2(position_percentage.x, -position_percentage.y)*2+vec2(-1, 1);
|
||||
|
||||
|
||||
gl_Position = vec4(position, 0, 1);
|
||||
|
||||
|
||||
color = vec4((circleColor & 0xff0000)>>16, (circleColor & 0xff00)>>8, circleColor & 0xff, (circleColor>>24) & 255)/255.0;
|
||||
|
||||
|
||||
unitPosition = vertex_pos;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 330
|
||||
#version 330
|
||||
|
||||
layout (location=0) out vec4 frag_color;
|
||||
uniform sampler2D image;
|
||||
@ -8,4 +8,4 @@ in vec2 uv;
|
||||
|
||||
void main() {
|
||||
frag_color = texture(image, uv) * fColor;
|
||||
}
|
||||
}
|
||||
|
@ -15,14 +15,13 @@ uniform vec2 uvDim;
|
||||
uniform int color;
|
||||
|
||||
void main() {
|
||||
|
||||
// Convert to opengl coordinates:
|
||||
vec2 position_percentage = (start + vec2(vertex_pos.x*size.x, size.y - vertex_pos.y*size.y))/screen;
|
||||
|
||||
|
||||
vec2 position = vec2(position_percentage.x, -position_percentage.y)*2+vec2(-1, 1);
|
||||
|
||||
|
||||
gl_Position = vec4(position, 0, 1);
|
||||
|
||||
|
||||
fColor = vec4((color & 0xff0000)>>16, (color & 0xff00)>>8, color & 0xff, (color>>24) & 255)/255.0;
|
||||
uv = uvOffset + vertex_pos*uvDim;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 330
|
||||
#version 330
|
||||
|
||||
layout (location=0) out vec4 frag_color;
|
||||
|
||||
@ -8,4 +8,4 @@ uniform sampler2D texture_sampler;
|
||||
|
||||
void main() {
|
||||
frag_color = color;
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,12 @@ uniform int lineColor;
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
// Convert to opengl coordinates:
|
||||
vec2 position_percentage = (start + vertex_pos*direction)/screen;
|
||||
|
||||
|
||||
vec2 position = vec2(position_percentage.x, -position_percentage.y)*2+vec2(-1, 1);
|
||||
|
||||
|
||||
gl_Position = vec4(position, 0, 1);
|
||||
|
||||
|
||||
color = vec4((lineColor & 0xff0000)>>16, (lineColor & 0xff00)>>8, lineColor & 0xff, (lineColor>>24) & 255)/255.0;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 330
|
||||
#version 330
|
||||
|
||||
layout (location=0) out vec4 frag_color;
|
||||
|
||||
@ -6,4 +6,4 @@ flat in vec4 color;
|
||||
|
||||
void main(){
|
||||
frag_color = color;
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,12 @@ uniform int rectColor;
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
// Convert to opengl coordinates:
|
||||
vec2 position_percentage = (start + vertex_pos*size)/screen;
|
||||
|
||||
|
||||
vec2 position = vec2(position_percentage.x, -position_percentage.y)*2+vec2(-1, 1);
|
||||
|
||||
|
||||
gl_Position = vec4(position, 0, 1);
|
||||
|
||||
|
||||
color = vec4((rectColor & 0xff0000)>>16, (rectColor & 0xff00)>>8, rectColor & 0xff, (rectColor>>24) & 255)/255.0;;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 330
|
||||
#version 330
|
||||
|
||||
layout (location=0) out vec4 frag_color;
|
||||
|
||||
@ -6,4 +6,4 @@ flat in vec4 color;
|
||||
|
||||
void main(){
|
||||
frag_color = color;
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,12 @@ uniform int rectColor;
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
// Convert to opengl coordinates:
|
||||
vec2 position_percentage = (start + vertex_pos.xy*size + vertex_pos.zw*lineWidth)/screen;
|
||||
|
||||
|
||||
vec2 position = vec2(position_percentage.x, -position_percentage.y)*2+vec2(-1, 1);
|
||||
|
||||
|
||||
gl_Position = vec4(position, 0, 1);
|
||||
|
||||
|
||||
color = vec4((rectColor & 0xff0000)>>16, (rectColor & 0xff00)>>8, rectColor & 0xff, (rectColor>>24) & 255)/255.0;;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 330
|
||||
#version 330
|
||||
|
||||
layout (location=0) out vec4 frag_color;
|
||||
|
||||
@ -19,7 +19,6 @@ vec2 convert2Proportional(vec2 original, vec2 full){
|
||||
return vec2(original.x/full.x, original.y/full.y);
|
||||
}
|
||||
|
||||
|
||||
void main() {
|
||||
vec4 texture_rect_percentage = vec4(convert2Proportional(texture_rect.xy, fontSize), convert2Proportional(texture_rect.zw, fontSize));
|
||||
vec2 texture_position = vec2(
|
||||
@ -37,4 +36,4 @@ void main() {
|
||||
frag_color = color*texture(texture_sampler,
|
||||
texture_position).r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ vec2 convert2Proportional(vec2 original, vec2 full) {
|
||||
return vec2(original.x/full.x, original.y/full.y);
|
||||
}
|
||||
|
||||
|
||||
void main() {
|
||||
vec2 vertex_pos = face_pos*vec2(1, -1);
|
||||
vec2 position_percentage = convert2Proportional(floor(offset), scene);
|
||||
@ -28,13 +27,13 @@ void main() {
|
||||
if ((fontEffects & 0x02000000) != 0) { // italic
|
||||
vertex_pos.x += vertex_pos.y/texture_rect.z;
|
||||
}
|
||||
|
||||
|
||||
//convert glyph coords to opengl coords
|
||||
vec4 rect = vec4(position_percentage, size_percentage);
|
||||
|
||||
|
||||
vec2 position = vec2(rect.x+vertex_pos.x*rect.z, -rect.y+vertex_pos.y*rect.w)*2+vec2(-1, 1);
|
||||
|
||||
|
||||
gl_Position = vec4(position, 0, 1);
|
||||
frag_face_pos = face_pos;
|
||||
color = vec4(vec3((fontEffects & 0xff0000)>>16, (fontEffects & 0xff00)>>8, fontEffects & 0xff)/255.0, alpha);
|
||||
}
|
||||
}
|
||||
|
@ -6,4 +6,4 @@ uniform vec3 lineColor;
|
||||
|
||||
void main() {
|
||||
frag_color = vec4(lineColor, 1);
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ void main() {
|
||||
float y = -data[(gl_VertexID+offset)%points];
|
||||
// Convert to opengl coordinates:
|
||||
vec2 position_percentage = (start + dimension*vec2(x/points, y))/screen;
|
||||
|
||||
|
||||
vec2 position = vec2(position_percentage.x, -position_percentage.y)*2 + vec2(-1, 1);
|
||||
|
||||
|
||||
gl_Position = vec4(position, 0, 1);
|
||||
}
|
||||
}
|
||||
|
@ -117,14 +117,14 @@ void mainItemDrop() {
|
||||
if(direction.x == 0) tMax.x = 1.0/0.0;
|
||||
if(direction.y == 0) tMax.y = 1.0/0.0;
|
||||
if(direction.z == 0) tMax.z = 1.0/0.0;
|
||||
|
||||
|
||||
uvec3 voxelPosition = uvec3(floor(startPosition));
|
||||
int lastNormal = faceNormalIndex;
|
||||
uint block = getVoxel(voxelPosition);
|
||||
float total_tMax = 0;
|
||||
|
||||
|
||||
uvec3 sizeMask = upper - 1;
|
||||
|
||||
|
||||
while(block == 0) {
|
||||
if(tMax.x < tMax.y) {
|
||||
if(tMax.x < tMax.z) {
|
||||
@ -170,14 +170,14 @@ void mainItemDrop() {
|
||||
block = getVoxel(voxelPosition);
|
||||
}
|
||||
if(block == 0) discard;
|
||||
|
||||
|
||||
vec3 modifiedCameraSpacePos = cameraSpacePos*(1 + total_tMax*sizeScale*length(direction)/length(cameraSpacePos));
|
||||
vec4 projection = projectionMatrix*vec4(modifiedCameraSpacePos, 1);
|
||||
float depth = projection.z/projection.w;
|
||||
gl_FragDepth = ((gl_DepthRange.diff * depth) + gl_DepthRange.near + gl_DepthRange.far)/2.0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
fragColor = decodeColor(block);
|
||||
fragColor.a = 1; // No transparency supported!
|
||||
fragColor = fragColor*vec4(ambientLight*normalVariations[lastNormal], 1);
|
||||
|
@ -56,7 +56,7 @@ const int[24] positions = int[24](
|
||||
0x010,
|
||||
0x001,
|
||||
0x011,
|
||||
|
||||
|
||||
0x001,
|
||||
0x011,
|
||||
0x101,
|
||||
@ -105,11 +105,11 @@ void main() {
|
||||
textureIndex = -1;
|
||||
}
|
||||
voxelModel = voxelModelIndex;
|
||||
|
||||
|
||||
|
||||
|
||||
vec4 worldSpace = modelMatrix*vec4(pos, 1);
|
||||
direction = (transpose(mat3(modelMatrix))*worldSpace.xyz).xyz;
|
||||
|
||||
|
||||
vec4 cameraSpace = viewMatrix*worldSpace;
|
||||
gl_Position = projectionMatrix*cameraSpace;
|
||||
cameraSpacePos = cameraSpace.xyz;
|
||||
|
@ -14,4 +14,4 @@ void main() {
|
||||
}
|
||||
float maxColor = max(1.0, max(fragColor.r, max(fragColor.g, fragColor.b)));
|
||||
fragColor.rgb = fragColor.rgb/maxColor;
|
||||
}
|
||||
}
|
||||
|
@ -7,4 +7,4 @@ out vec2 texCoords;
|
||||
void main() {
|
||||
texCoords = inTexCoords;
|
||||
gl_Position = vec4(inTexCoords*2 - vec2(1, 1), 0, 1);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 330
|
||||
#version 330
|
||||
|
||||
layout (location=0) out vec4 frag_color;
|
||||
uniform sampler2D image;
|
||||
@ -12,4 +12,4 @@ void main() {
|
||||
frag_color = texture(image, (gl_FragCoord.xy - startCoord)/(2*scale)/textureSize(image, 0));
|
||||
frag_color.a *= fColor.a;
|
||||
frag_color.rgb += fColor.rgb;
|
||||
}
|
||||
}
|
||||
|
@ -13,15 +13,14 @@ uniform vec2 screen;
|
||||
uniform int color;
|
||||
|
||||
void main() {
|
||||
|
||||
// Convert to opengl coordinates:
|
||||
vec2 position_percentage = (start + vertex_pos*size)/screen;
|
||||
startCoord.x = start.x;
|
||||
startCoord.y = screen.y - start.y;
|
||||
|
||||
|
||||
vec2 position = vec2(position_percentage.x, -position_percentage.y)*2+vec2(-1, 1);
|
||||
|
||||
|
||||
gl_Position = vec4(position, 0, 1);
|
||||
|
||||
|
||||
fColor = vec4((color & 0xff0000)>>16, (color & 0xff00)>>8, color & 0xff, (color>>24) & 255)/255.0;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#version 330
|
||||
#version 330
|
||||
|
||||
layout (location=0) out vec4 frag_color;
|
||||
|
||||
@ -16,4 +16,4 @@ void main() {
|
||||
float reducedDistance = distanceToBorder.x*distanceToBorder.y/(distanceToBorder.x + distanceToBorder.y); // Inspired by the reduced mass from physics, to give a sort of curvy look to the outline.
|
||||
float opacity = max(1 - reducedDistance, 0);
|
||||
frag_color = fColor*vec4(1, 1, 1, opacity);
|
||||
}
|
||||
}
|
||||
|
@ -14,17 +14,16 @@ uniform vec2 screen;
|
||||
uniform int color;
|
||||
|
||||
void main() {
|
||||
|
||||
// Convert to opengl coordinates:
|
||||
vec2 position_percentage = (start + vertex_pos*size)/screen;
|
||||
startCoord.x = start.x;
|
||||
startCoord.y = screen.y - start.y - size.y;
|
||||
endCoord.x = start.x + size.x;
|
||||
endCoord.y = screen.y - start.y;
|
||||
|
||||
|
||||
vec2 position = vec2(position_percentage.x, -position_percentage.y)*2+vec2(-1, 1);
|
||||
|
||||
|
||||
gl_Position = vec4(position, 0, 1);
|
||||
|
||||
|
||||
fColor = vec4((color & 0xff0000)>>16, (color & 0xff00)>>8, color & 0xff, (color>>24) & 255)/255.0;
|
||||
}
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ pub const Sync = struct { // MARK: Sync
|
||||
for(command.syncOperations.items) |op| {
|
||||
const syncData = op.serialize(main.stackAllocator);
|
||||
defer main.stackAllocator.free(syncData);
|
||||
|
||||
|
||||
const users = op.getUsers(main.stackAllocator);
|
||||
defer main.stackAllocator.free(users);
|
||||
|
||||
@ -324,7 +324,7 @@ pub const Sync = struct { // MARK: Sync
|
||||
|
||||
const path = std.fmt.allocPrint(main.stackAllocator.allocator, "saves/{s}/players/{s}.zig.zon", .{main.server.world.?.name, hashedName}) catch unreachable;
|
||||
defer main.stackAllocator.free(path);
|
||||
|
||||
|
||||
const playerData = main.files.readToZon(main.stackAllocator, path) catch .null;
|
||||
defer playerData.deinit(main.stackAllocator);
|
||||
|
||||
@ -581,7 +581,7 @@ pub const Command = struct { // MARK: Command
|
||||
return error.Invalid;
|
||||
}
|
||||
create.inv.ref().amount += create.amount;
|
||||
|
||||
|
||||
create.inv.inv.update();
|
||||
},
|
||||
.delete => |delete| {
|
||||
@ -592,7 +592,7 @@ pub const Command = struct { // MARK: Command
|
||||
if (delete.inv.ref().amount == 0) {
|
||||
delete.inv.ref().item = null;
|
||||
}
|
||||
|
||||
|
||||
delete.inv.inv.update();
|
||||
},
|
||||
.useDurability => |durability| {
|
||||
@ -601,7 +601,7 @@ pub const Command = struct { // MARK: Command
|
||||
durability.inv.ref().item = null;
|
||||
durability.inv.ref().amount = 0;
|
||||
}
|
||||
|
||||
|
||||
durability.inv.inv.update();
|
||||
},
|
||||
.health => |health| {
|
||||
@ -1515,7 +1515,7 @@ pub const Command = struct { // MARK: Command
|
||||
if(self.inv.type == .workbench) items = self.inv._items[0..25];
|
||||
for(items, 0..) |stack, slot| {
|
||||
if(stack.item == null) continue;
|
||||
|
||||
|
||||
cmd.executeBaseOperation(allocator, .{.delete = .{
|
||||
.source = .{.inv = self.inv, .slot = @intCast(slot)},
|
||||
.amount = stack.amount,
|
||||
@ -1548,7 +1548,7 @@ pub const Command = struct { // MARK: Command
|
||||
const stack = self.source.ref();
|
||||
|
||||
const costOfChange = if(gamemode != .creative) self.oldBlock.canBeChangedInto(self.newBlock, stack.*) else .yes;
|
||||
|
||||
|
||||
// Check if we can change it:
|
||||
if(!switch(costOfChange) {
|
||||
.no => false,
|
||||
@ -1886,4 +1886,4 @@ pub fn loadFromZon(self: Inventory, zon: ZonElement) void {
|
||||
stack.amount = stackZon.get(u16, "amount", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,9 +56,9 @@ pub fn readAllZonFilesInAddons(externalAllocator: NeverFailingAllocator, addons:
|
||||
defer defaultsArena.deinit();
|
||||
|
||||
const defaultsArenaAllocator = defaultsArena.allocator();
|
||||
|
||||
|
||||
var defaultMap = std.StringHashMap(ZonElement).init(defaultsArenaAllocator.allocator);
|
||||
|
||||
|
||||
var walker = dir.walk(main.stackAllocator.allocator) catch unreachable;
|
||||
defer walker.deinit();
|
||||
|
||||
@ -100,7 +100,7 @@ pub fn readAllZonFilesInAddons(externalAllocator: NeverFailingAllocator, addons:
|
||||
std.log.err("Failed to read default file: {s}", .{@errorName(err)});
|
||||
break :blk .null;
|
||||
};
|
||||
|
||||
|
||||
result.value_ptr.* = default;
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ pub fn readAssets(externalAllocator: NeverFailingAllocator, assetPath: []const u
|
||||
defer addons.deinit();
|
||||
var addonNames = main.List([]const u8).init(main.stackAllocator);
|
||||
defer addonNames.deinit();
|
||||
|
||||
|
||||
{ // Find all the sub-directories to the assets folder.
|
||||
var dir = std.fs.cwd().openDir(assetPath, .{.iterate = true}) catch |err| {
|
||||
std.log.err("Can't open asset path {s}: {s}", .{assetPath, @errorName(err)});
|
||||
|
@ -131,7 +131,7 @@ const MusicLoadTask = struct {
|
||||
.clean = @ptrCast(&clean),
|
||||
.taskType = .misc,
|
||||
};
|
||||
|
||||
|
||||
pub fn schedule(musicId: []const u8) void {
|
||||
const task = main.globalAllocator.create(MusicLoadTask);
|
||||
task.* = MusicLoadTask {
|
||||
@ -331,5 +331,3 @@ fn patestCallback(
|
||||
addMusic(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -222,7 +222,7 @@ pub fn parseBlock(data: []const u8) Block {
|
||||
blockData = std.fmt.parseInt(u16, data[pos + 1..], 0) catch |err| blk: {
|
||||
std.log.err("Error while parsing block data of '{s}': {s}", .{data, @errorName(err)});
|
||||
break :blk null;
|
||||
};
|
||||
};
|
||||
}
|
||||
if(reverseIndices.get(id)) |resultType| {
|
||||
var result: Block = .{.typ = resultType, .data = 0};
|
||||
@ -312,20 +312,20 @@ pub const Block = packed struct { // MARK: Block
|
||||
pub inline fn absorption(self: Block) u32 {
|
||||
return _absorption[self.typ];
|
||||
}
|
||||
|
||||
|
||||
/// GUI that is opened on click.
|
||||
pub inline fn gui(self: Block) []u8 {
|
||||
return _gui[self.typ];
|
||||
}
|
||||
|
||||
|
||||
pub inline fn mode(self: Block) *RotationMode {
|
||||
return _mode[self.typ];
|
||||
}
|
||||
|
||||
|
||||
pub inline fn lodReplacement(self: Block) u16 {
|
||||
return _lodReplacement[self.typ];
|
||||
}
|
||||
|
||||
|
||||
pub inline fn opaqueVariant(self: Block) u16 {
|
||||
return _opaqueVariant[self.typ];
|
||||
}
|
||||
@ -676,7 +676,7 @@ pub const meshes = struct { // MARK: meshes
|
||||
}
|
||||
animationSSBO = SSBO.initStatic(AnimationData, animation.items);
|
||||
animationSSBO.?.bind(0);
|
||||
|
||||
|
||||
animatedTextureSSBO = SSBO.initStaticSize(u32, animation.items.len);
|
||||
animatedTextureSSBO.?.bind(1);
|
||||
fogSSBO = SSBO.initStatic(FogData, textureFogData.items);
|
||||
|
@ -148,7 +148,7 @@ pub const ChunkPosition = struct { // MARK: ChunkPosition
|
||||
wy: i32,
|
||||
wz: i32,
|
||||
voxelSize: u31,
|
||||
|
||||
|
||||
pub fn hashCode(self: ChunkPosition) u32 {
|
||||
const shift: u5 = @truncate(@min(@ctz(self.wx), @ctz(self.wy), @ctz(self.wz)));
|
||||
return (((@as(u32, @bitCast(self.wx)) >> shift) *% 31 +% (@as(u32, @bitCast(self.wy)) >> shift)) *% 31 +% (@as(u32, @bitCast(self.wz)) >> shift)) *% 31 +% self.voxelSize; // TODO: Can I use one of zigs standard hash functions?
|
||||
@ -447,7 +447,7 @@ pub const ServerChunk = struct { // MARK: ServerChunk
|
||||
self.mutex.lock();
|
||||
defer self.mutex.unlock();
|
||||
main.utils.assertLocked(&other.mutex);
|
||||
|
||||
|
||||
var x: u31 = 0;
|
||||
while(x < chunkSize/2): (x += 1) {
|
||||
var y: u31 = 0;
|
||||
@ -472,7 +472,7 @@ pub const ServerChunk = struct { // MARK: ServerChunk
|
||||
neighborCount[i] = 0;
|
||||
continue; // I don't care about air blocks.
|
||||
}
|
||||
|
||||
|
||||
var count: u31 = 0;
|
||||
for(Neighbor.iterable) |n| {
|
||||
const nx = x*2 + dx + n.relX();
|
||||
@ -562,4 +562,4 @@ pub const ServerChunk = struct { // MARK: ServerChunk
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ pub const ClientEntity = struct {
|
||||
|
||||
width: f64,
|
||||
height: f64,
|
||||
|
||||
|
||||
pos: Vec3d = undefined,
|
||||
rot: Vec3f = undefined,
|
||||
|
||||
@ -94,7 +94,7 @@ pub const ClientEntityManager = struct {
|
||||
pub fn init() void {
|
||||
entities = .init();
|
||||
shader = graphics.Shader.initAndGetUniforms("assets/cubyz/shaders/entity_vertex.vs", "assets/cubyz/shaders/entity_fragment.fs", "", &uniforms);
|
||||
|
||||
|
||||
modelTexture = main.graphics.Texture.initFromFile("assets/cubyz/entity/textures/snail_player.png");
|
||||
const modelFile = main.files.read(main.stackAllocator, "assets/cubyz/entity/models/snail_player.obj") catch |err| blk: {
|
||||
std.log.err("Error while reading player model: {s}", .{@errorName(err)});
|
||||
@ -150,7 +150,7 @@ pub const ClientEntityManager = struct {
|
||||
if(projectedPos[2] < 0) continue;
|
||||
const xCenter = (1 + projectedPos[0]/projectedPos[3])*@as(f32, @floatFromInt(main.Window.width/2));
|
||||
const yCenter = (1 - projectedPos[1]/projectedPos[3])*@as(f32, @floatFromInt(main.Window.height/2));
|
||||
|
||||
|
||||
graphics.draw.setColor(0xff000000);
|
||||
var buf = graphics.TextBuffer.init(main.stackAllocator, ent.name, .{.color = 0}, false, .center);
|
||||
defer buf.deinit();
|
||||
@ -251,4 +251,4 @@ pub const ClientEntityManager = struct {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -137,4 +137,4 @@ pub const Dir = struct {
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -8,7 +8,7 @@ var failed: bool = false;
|
||||
fn printError(msg: []const u8, filePath: []const u8, data: []const u8, charIndex: usize) void {
|
||||
var lineStart: usize = 0;
|
||||
var lineNumber: usize = 1;
|
||||
var lineEnd: usize = 0;
|
||||
var lineEnd: usize = data.len;
|
||||
for(data[0..charIndex], 0..) |c, i| {
|
||||
if(c == '\n') {
|
||||
lineStart = i + 1;
|
||||
@ -47,6 +47,9 @@ fn checkFile(dir: std.fs.Dir, filePath: []const u8) !void {
|
||||
switch(c) {
|
||||
'\n' => {
|
||||
lineStart = true;
|
||||
if(i != 0 and (data[i - 1] == ' ' or data[i - 1] == '\t')) {
|
||||
printError("Line contains trailing whitespaces. Please remove them.", filePath, data, i - 1);
|
||||
}
|
||||
},
|
||||
'\r' => {
|
||||
printError("Incorrect line ending \\r. Please configure your editor to use LF instead CRLF.", filePath, data, i);
|
||||
@ -62,6 +65,9 @@ fn checkFile(dir: std.fs.Dir, filePath: []const u8) !void {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(data.len != 0 and data[data.len - 1] != '\n' or (data.len > 2 and data[data.len - 2] == '\n')) {
|
||||
printError("File should end with a single empty line", filePath, data, data.len - 1);
|
||||
}
|
||||
}
|
||||
|
||||
fn checkDirectory(dir: std.fs.Dir) !void {
|
||||
|
18
src/game.zig
18
src/game.zig
@ -316,7 +316,7 @@ pub const collision = struct {
|
||||
const min = std.math.clamp(vec.xy(blockBox.min), vec.xy(boundingBox.min), vec.xy(boundingBox.max));
|
||||
|
||||
const area = (max[0] - min[0]) * (max[1] - min[1]);
|
||||
|
||||
|
||||
if (block.collide()) {
|
||||
totalArea += area;
|
||||
friction += area * @as(f64, @floatCast(block.friction()));
|
||||
@ -324,7 +324,7 @@ pub const collision = struct {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (totalArea == 0) {
|
||||
return defaultFriction;
|
||||
}
|
||||
@ -385,7 +385,7 @@ pub const DamageType = enum(u8) {
|
||||
heal = 0, // For when you are adding health
|
||||
kill = 1,
|
||||
fall = 2,
|
||||
|
||||
|
||||
pub fn sendMessage(self: DamageType, name: []const u8) void {
|
||||
switch (self) {
|
||||
.heal => main.server.sendMessage("{s}§#ffffff was healed", .{name}),
|
||||
@ -519,7 +519,7 @@ pub const Player = struct { // MARK: Player
|
||||
Player.super.vel = .{0, 0, 0};
|
||||
|
||||
Player.super.health = Player.super.maxHealth;
|
||||
|
||||
|
||||
Player.eyeVel = .{0, 0, 0};
|
||||
Player.eyeCoyote = 0;
|
||||
Player.eyeStep = .{false, false, false};
|
||||
@ -784,7 +784,7 @@ pub fn update(deltaTime: f64) void { // MARK: update()
|
||||
const right = Vec3d{-forward[1], forward[0], 0};
|
||||
var movementDir: Vec3d = .{0, 0, 0};
|
||||
var movementSpeed: f64 = 0;
|
||||
|
||||
|
||||
if(main.Window.grabbed) {
|
||||
const walkingSpeed: f64 = if (Player.crouching) 2 else 4;
|
||||
if(KeyBoard.key("forward").value > 0.0) {
|
||||
@ -886,11 +886,11 @@ pub fn update(deltaTime: f64) void { // MARK: update()
|
||||
const smoothPerc = Player.crouchPerc * Player.crouchPerc * (3 - 2 * Player.crouchPerc);
|
||||
|
||||
const newOuterBox = (Player.crouchingBoundingBoxExtent - Player.standingBoundingBoxExtent) * @as(Vec3d, @splat(smoothPerc)) + Player.standingBoundingBoxExtent;
|
||||
|
||||
|
||||
Player.super.pos += newOuterBox - Player.outerBoundingBoxExtent;
|
||||
|
||||
|
||||
Player.outerBoundingBoxExtent = newOuterBox;
|
||||
|
||||
|
||||
Player.outerBoundingBox = .{
|
||||
.min = -Player.outerBoundingBoxExtent,
|
||||
.max = Player.outerBoundingBoxExtent,
|
||||
@ -1035,7 +1035,7 @@ pub fn update(deltaTime: f64) void { // MARK: update()
|
||||
steppingHeight = @min(steppingHeight, Player.eyePos[2] - Player.eyeBox.min[2]);
|
||||
|
||||
const slipLimit = 0.25 * Player.currentFriction;
|
||||
|
||||
|
||||
const xMovement = collision.collideOrStep(.client, .x, move[0], Player.super.pos, hitBox, steppingHeight);
|
||||
Player.super.pos += xMovement;
|
||||
if (KeyBoard.key("crouch").pressed and Player.onGround and @abs(Player.super.vel[0]) < slipLimit) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user