Merge branch 'zesterer/civsim' into 'master'

Civsim

See merge request veloren/veloren!918
This commit is contained in:
Joshua Barretto 2020-04-23 17:30:09 +00:00
commit 4915ee57d4
195 changed files with 6631 additions and 2271 deletions

View File

@ -48,6 +48,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added dragging and right-click to use functionality to inventory, armor & hotbar slots
- Added capes, lanterns, tabards, rings, helmets & necklaces as equippable armor
- 6 new music tracks
- Added basic world and civilisation simulation
- Added overhauled towns
- Added fields, crops and scarecrows
- Added paths
- Added bridges
- Added procedural house generation
- Added lampposts
- Added NPCs that spawn in towns
- Added simple dungeons
- Added sub-voxel noise effect
- Added waypoints next to dungeons
- Made players spawn in towns
- Added non-uniform block heights
### Changed

134
Cargo.lock generated
View File

@ -2589,17 +2589,23 @@ dependencies = [
[[package]]
name = "minifb"
version = "0.14.0"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "799c20458eb0dd69f48cea5014afe736b363818c86d7ca61dbb56e1c0585014c"
checksum = "b18d2987dac6afdd7f6d81101a3b422b7da3e6799d7f11863ad006d8ccd562b2"
dependencies = [
"cast",
"cc",
"orbclient",
"raw-window-handle",
"tempfile",
"time",
"wayland-client 0.25.0",
"wayland-cursor",
"wayland-protocols 0.25.0",
"winapi 0.3.8",
"x11-dl",
"xkb",
"xkbcommon-sys",
]
[[package]]
@ -2728,6 +2734,19 @@ dependencies = [
"void",
]
[[package]]
name = "nix"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363"
dependencies = [
"bitflags",
"cc",
"cfg-if",
"libc",
"void",
]
[[package]]
name = "nodrop"
version = "0.1.14"
@ -3947,6 +3966,12 @@ dependencies = [
"winapi 0.3.8",
]
[[package]]
name = "scoped-tls"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
[[package]]
name = "scoped_threadpool"
version = "0.1.9"
@ -4406,6 +4431,20 @@ dependencies = [
"remove_dir_all",
]
[[package]]
name = "tempfile"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
dependencies = [
"cfg-if",
"libc",
"rand 0.7.3",
"redox_syscall",
"remove_dir_all",
"winapi 0.3.8",
]
[[package]]
name = "term"
version = "0.5.2"
@ -5217,6 +5256,22 @@ dependencies = [
"wayland-sys 0.23.6",
]
[[package]]
name = "wayland-client"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a42cb608953ec8e132c7f53fde722cca9bfbf8b2071d685dbbb8df2b567fee8b"
dependencies = [
"bitflags",
"downcast-rs",
"libc",
"nix 0.17.0",
"scoped-tls",
"wayland-commons 0.25.0",
"wayland-scanner 0.25.0",
"wayland-sys 0.25.0",
]
[[package]]
name = "wayland-commons"
version = "0.21.13"
@ -5237,6 +5292,28 @@ dependencies = [
"wayland-sys 0.23.6",
]
[[package]]
name = "wayland-commons"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8caa2f106138cf71358c6a9e84468e4406069cec93cbd6dbfce92225fc175932"
dependencies = [
"nix 0.17.0",
"once_cell",
"smallvec 1.2.0",
"wayland-sys 0.25.0",
]
[[package]]
name = "wayland-cursor"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d774f69a6a4a9eac6d1a29cea45a4750ee7f997520421b2068f099a11b4cbba"
dependencies = [
"wayland-client 0.25.0",
"wayland-sys 0.25.0",
]
[[package]]
name = "wayland-protocols"
version = "0.21.13"
@ -5262,6 +5339,18 @@ dependencies = [
"wayland-scanner 0.23.6",
]
[[package]]
name = "wayland-protocols"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f784a990d5fa6d846fa93eb8d3bb744ff1e6ec60c7f785b0a0ee2f1a1f20bee9"
dependencies = [
"bitflags",
"wayland-client 0.25.0",
"wayland-commons 0.25.0",
"wayland-scanner 0.25.0",
]
[[package]]
name = "wayland-scanner"
version = "0.21.13"
@ -5284,6 +5373,17 @@ dependencies = [
"xml-rs",
]
[[package]]
name = "wayland-scanner"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f45ddc08a8078f3efa96b5f413268cc9c53b30712891de081fbc1d5846fbc736"
dependencies = [
"proc-macro2 1.0.9",
"quote 1.0.3",
"xml-rs",
]
[[package]]
name = "wayland-sys"
version = "0.21.13"
@ -5304,6 +5404,15 @@ dependencies = [
"lazy_static",
]
[[package]]
name = "wayland-sys"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80f9fc64f9045ad5ff491886a9460437655353e8be73c1b3f29f569342553319"
dependencies = [
"dlib",
]
[[package]]
name = "web-sys"
version = "0.3.36"
@ -5467,6 +5576,27 @@ version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57"
[[package]]
name = "xkb"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aec02bc5de902aa579f3d2f2c522edaf40fa42963cbaffe645b058ddcc68fdb2"
dependencies = [
"bitflags",
"libc",
"xkbcommon-sys",
]
[[package]]
name = "xkbcommon-sys"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa434980dca02ebf28795d71e570dbb78316d095a228707efd6117bf8246d78b"
dependencies = [
"libc",
"pkg-config",
]
[[package]]
name = "xml-rs"
version = "0.8.0"

View File

@ -14,10 +14,10 @@ members = [
# default profile for devs, fast to compile, okay enough to run, no debug information
[profile.dev]
opt-level = 2
overflow-checks = true
overflow-checks = true
debug-assertions = true
panic = "abort"
debug = false
debug = false
codegen-units = 8
lto = false
incremental = true

View File

@ -0,0 +1,13 @@
Item(
name: "Coconut",
description: "Reliable source of water and fat.
Restores 30 health.",
kind: Consumable(
kind: Coconut,
effect: Health((
amount: 30,
cause: Item,
)),
),
)

BIN
assets/voxygen/background/bg_10.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/background/bg_11.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/icons/item_coconut.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -272,9 +272,13 @@
(0.0, 0.0, 0.0), (-90.0, 180.0, 0.0), 1.0,
),
// Consumables
Consumable(Apple): VoxTrans(
Consumable(Apple):
VoxTrans(
"element.icons.item_apple",
(0.0, 0.0, 0.0), (-90.0, 90.0, 0.0), 1.0,
),
Consumable(Coconut): Png(
"element.icons.item_coconut",
),
Consumable(PotionMinor): VoxTrans(
"voxel.object.potion_red",

View File

@ -4,6 +4,7 @@
in vec3 f_pos;
in vec3 f_col;
in float f_ao;
flat in vec3 f_norm;
layout (std140)
@ -39,6 +40,12 @@ void main() {
vec3 point_light = light_at(f_pos, f_norm);
light += point_light;
diffuse_light += point_light;
float ao = pow(f_ao, 0.5) * 0.85 + 0.15;
ambient_light *= ao;
diffuse_light *= ao;
vec3 surf_color = illuminate(srgb_to_linear(model_col.rgb * f_col), light, diffuse_light, ambient_light);
float fog_level = fog(f_pos.xyz, focus_pos.xyz, medium.x);
@ -48,7 +55,7 @@ void main() {
if ((flags & 1) == 1 && int(cam_mode) == 1) {
float distance = distance(vec3(cam_pos), vec3(model_mat * vec4(vec3(0), 1))) - 2;
float opacity = clamp(distance / distance_divider, 0, 1);
if(threshold_matrix[int(gl_FragCoord.x) % 4][int(gl_FragCoord.y) % 4] > opacity) {

View File

@ -5,6 +5,7 @@
in vec3 v_pos;
in vec3 v_norm;
in vec3 v_col;
in float v_ao;
in uint v_bone_idx;
layout (std140)
@ -27,6 +28,7 @@ uniform u_bones {
out vec3 f_pos;
out vec3 f_col;
out float f_ao;
flat out vec3 f_norm;
void main() {
@ -39,6 +41,8 @@ void main() {
f_col = v_col;
f_ao = v_ao;
// Calculate normal here rather than for each pixel in the fragment shader
f_norm = normalize((
combined_mat *

View File

@ -48,9 +48,9 @@ void main() {
vec4 clouds;
vec3 fog_color = get_sky_color(normalize(f_pos - cam_pos.xyz), time_of_day.x, cam_pos.xyz, f_pos, 0.25, true, clouds);
float passthrough = pow(dot(faceforward(f_norm, f_norm, cam_to_frag), -cam_to_frag), 0.5);
float passthrough = dot(faceforward(f_norm, f_norm, cam_to_frag), -cam_to_frag);
vec4 color = mix(vec4(surf_color, 1.0), vec4(surf_color, 1.0 / (1.0 + diffuse_light * 0.25)), passthrough);
vec4 color = mix(vec4(surf_color, 1.0), vec4(surf_color, 1.0 / (1.0 + diffuse_light)), passthrough);
tgt_color = mix(mix(color, vec4(fog_color, 0.0), fog_level), vec4(clouds.rgb, 0.0), clouds.a);
tgt_color = mix(color, vec4(fog_color, 0.0), 0.0);
}

View File

@ -28,30 +28,33 @@ vec3 warp_normal(vec3 norm, vec3 pos, float time) {
}
float wave_height(vec3 pos) {
float timer = tick.x * 0.75;
pos *= 0.5;
vec3 big_warp = (
texture(t_waves, fract(pos.xy * 0.03 + tick.x * 0.01)).xyz * 0.5 +
texture(t_waves, fract(pos.yx * 0.03 - tick.x * 0.01)).xyz * 0.5 +
texture(t_waves, fract(pos.xy * 0.03 + timer * 0.01)).xyz * 0.5 +
texture(t_waves, fract(pos.yx * 0.03 - timer * 0.01)).xyz * 0.5 +
vec3(0)
);
vec3 warp = (
texture(t_noise, fract(pos.yx * 0.1 + tick.x * 0.02)).xyz * 0.3 +
texture(t_noise, fract(pos.yx * 0.1 - tick.x * 0.02)).xyz * 0.3 +
texture(t_noise, fract(pos.yx * 0.1 + timer * 0.02)).xyz * 0.3 +
texture(t_noise, fract(pos.yx * 0.1 - timer * 0.02)).xyz * 0.3 +
vec3(0)
);
float height = (
(texture(t_noise, pos.xy * 0.03 + big_warp.xy + tick.x * 0.05).y - 0.5) * 1.0 +
(texture(t_noise, pos.yx * 0.03 + big_warp.yx - tick.x * 0.05).y - 0.5) * 1.0 +
(texture(t_waves, pos.xy * 0.1 + warp.xy + tick.x * 0.1).x - 0.5) * 0.5 +
(texture(t_waves, pos.yx * 0.1 + warp.yx - tick.x * 0.1).x - 0.5) * 0.5 +
(texture(t_noise, pos.yx * 0.3 + warp.xy * 0.5 + tick.x * 0.1).x - 0.5) * 0.2 +
(texture(t_noise, pos.yx * 0.3 + warp.yx * 0.5 - tick.x * 0.1).x - 0.5) * 0.2 +
(texture(t_noise, pos.yx * 1.0 + warp.yx * 0.0 - tick.x * 0.1).x - 0.5) * 0.05 +
(texture(t_noise, pos.xy * 0.03 + big_warp.xy + timer * 0.05).y - 0.5) * 1.0 +
(texture(t_noise, pos.yx * 0.03 + big_warp.yx - timer * 0.05).y - 0.5) * 1.0 +
(texture(t_waves, pos.xy * 0.1 + warp.xy + timer * 0.1).x - 0.5) * 0.5 +
(texture(t_waves, pos.yx * 0.1 + warp.yx - timer * 0.1).x - 0.5) * 0.5 +
(texture(t_noise, pos.yx * 0.3 + warp.xy * 0.5 + timer * 0.1).x - 0.5) * 0.2 +
(texture(t_noise, pos.yx * 0.3 + warp.yx * 0.5 - timer * 0.1).x - 0.5) * 0.2 +
(texture(t_noise, pos.yx * 1.0 + warp.yx * 0.0 - timer * 0.1).x - 0.5) * 0.05 +
0.0
);
return pow(abs(height), 0.5) * sign(height) * 5.5;
return pow(abs(height), 0.5) * sign(height) * 10.5;
}
void main() {
@ -89,9 +92,9 @@ void main() {
0.1 / slope
);
nmap = mix(vec3(0, 0, 1), normalize(nmap), min(1.0 / pow(frag_dist, 0.75), 1));
nmap = mix(f_norm, normalize(nmap), min(1.0 / pow(frag_dist, 0.75), 1));
vec3 norm = f_norm * nmap.z + b_norm * nmap.x + c_norm * nmap.y;
vec3 norm = vec3(0, 0, 1) * nmap.z + b_norm * nmap.x + c_norm * nmap.y;
vec3 light, diffuse_light, ambient_light;
get_sun_diffuse(norm, time_of_day.x, light, diffuse_light, ambient_light, 0.0);
@ -101,7 +104,6 @@ void main() {
vec3 point_light = light_at(f_pos, norm);
light += point_light;
diffuse_light += point_light;
vec3 surf_color = srgb_to_linear(vec3(0.2, 0.5, 1.0)) * light * diffuse_light * ambient_light;
float fog_level = fog(f_pos.xyz, focus_pos.xyz, medium.x);
vec4 clouds;
@ -114,11 +116,11 @@ void main() {
vec4 _clouds;
vec3 reflect_color = get_sky_color(reflect_ray_dir, time_of_day.x, f_pos, vec3(-100000), 0.25, false, _clouds) * f_light;
// Tint
reflect_color = mix(reflect_color, surf_color, 0.6);
reflect_color = reflect_color * 0.5 * (diffuse_light + ambient_light);
// 0 = 100% reflection, 1 = translucent water
float passthrough = pow(dot(faceforward(f_norm, f_norm, cam_to_frag), -cam_to_frag), 0.5);
float passthrough = dot(faceforward(f_norm, f_norm, cam_to_frag), -cam_to_frag);
vec4 color = mix(vec4(reflect_color * 2.0, 1.0), vec4(surf_color, 1.0 / (1.0 + diffuse_light * 0.25)), passthrough);
vec4 color = mix(vec4(reflect_color, 1.0), vec4(vec3(0), 1.0 / (1.0 + diffuse_light * 0.25)), passthrough);
tgt_color = mix(mix(color, vec4(fog_color, 0.0), fog_level), vec4(clouds.rgb, 0.0), clouds.a);
}

View File

@ -18,17 +18,16 @@ flat out vec3 f_norm;
out vec3 f_col;
out float f_light;
const float EXTRA_NEG_Z = 65536.0;
void main() {
f_pos = vec3(
float((v_pos_norm >> 0) & 0x00FFu),
float((v_pos_norm >> 8) & 0x00FFu),
float((v_pos_norm >> 16) & 0x1FFFu)
) + model_offs;
f_pos.z *= min(1.0001 - 0.02 / pow(tick.x - load_time, 10.0), 1.0);
f_pos = vec3((uvec3(v_pos_norm) >> uvec3(0, 6, 12)) & uvec3(0x3Fu, 0x3Fu, 0x1FFFFu)) - vec3(0, 0, EXTRA_NEG_Z) + model_offs;
f_pos.z -= 250.0 * (1.0 - min(1.0001 - 0.02 / pow(tick.x - load_time, 10.0), 1.0));
f_pos.z -= 25.0 * pow(distance(focus_pos.xy, f_pos.xy) / view_distance.x, 20.0);
// Small waves
f_pos.z -= 0.05 + 0.05 * (sin(tick.x * 2.0 + f_pos.x * 2.0 + f_pos.y * 2.0) + 1.0) * 0.5;
f_pos.xy += 0.01; // Avoid z-fighting
f_pos.z -= 0.1 + 0.1 * (sin(tick.x * 2.0 + f_pos.x * 2.0 + f_pos.y * 2.0) + 1.0) * 0.5;
f_col = vec3(
float((v_col_light >> 8) & 0xFFu),

View File

@ -1,9 +1,9 @@
uniform sampler2D t_noise;
const float CLOUD_AVG_HEIGHT = 1025.0;
const float CLOUD_HEIGHT_MIN = CLOUD_AVG_HEIGHT - 50.0;
const float CLOUD_HEIGHT_MAX = CLOUD_AVG_HEIGHT + 50.0;
const float CLOUD_THRESHOLD = 0.25;
const float CLOUD_HEIGHT_MIN = CLOUD_AVG_HEIGHT - 60.0;
const float CLOUD_HEIGHT_MAX = CLOUD_AVG_HEIGHT + 60.0;
const float CLOUD_THRESHOLD = 0.27;
const float CLOUD_SCALE = 5.0;
const float CLOUD_DENSITY = 100.0;
@ -15,27 +15,24 @@ vec2 cloud_at(vec3 pos) {
vec2 scaled_pos = pos.xy / CLOUD_SCALE;
float tick_offs = 0.0
+ texture(t_noise, scaled_pos * 0.0005 - time_of_day.x * 0.00002).x * 0.5
+ texture(t_noise, scaled_pos * 0.000015).x * 5.0;
+ texture(t_noise, scaled_pos * 0.0005 - time_of_day.x * 0.00001).x * 0.5
+ texture(t_noise, scaled_pos * 0.0015).x * 0.15;
float value = (
0.0
+ texture(t_noise, scaled_pos * 0.0003 + tick_offs).x
+ texture(t_noise, scaled_pos * 0.0015 - tick_offs * 2.0).x * 0.5
//+ texture(t_noise, scaled_pos * 0.0025 - time_of_day.x * 0.0002).x * 0.25
//+ texture(t_noise, scaled_pos * 0.008 + time_of_day.x * 0.0004).x * 0.15
//+ texture(t_noise, scaled_pos * 0.02 + tick_offs + time_of_day.x * 0.0004).x * 0.2
) / 3.0;
value += (0.0
+ texture(t_noise, scaled_pos * 0.008 + time_of_day.x * 0.0004).x * 0.25
+ texture(t_noise, scaled_pos * 0.02 + tick_offs + time_of_day.x * 0.0004).x * 0.15
+ texture(t_noise, scaled_pos * 0.008 + time_of_day.x * 0.0002).x * 0.25
+ texture(t_noise, scaled_pos * 0.02 + tick_offs + time_of_day.x * 0.0002).x * 0.15
) * value;
float density = max((value - CLOUD_THRESHOLD) - abs(pos.z - CLOUD_AVG_HEIGHT) / 400.0, 0.0) * CLOUD_DENSITY;
float density = max((value - CLOUD_THRESHOLD) - abs(pos.z - CLOUD_AVG_HEIGHT) / 200.0, 0.0) * CLOUD_DENSITY;
const float SHADE_GRADIENT = 1.5 / (CLOUD_AVG_HEIGHT - CLOUD_HEIGHT_MIN);
float shade = ((pos.z - CLOUD_AVG_HEIGHT) / (CLOUD_HEIGHT_MAX - CLOUD_HEIGHT_MIN)) * 2.5 + 0.7;
float shade = (pos.z - CLOUD_AVG_HEIGHT) / (CLOUD_HEIGHT_MAX - CLOUD_HEIGHT_MIN) * 5.0 + 0.3;
return vec2(shade, density / (1.0 + vsum(abs(pos - cam_pos.xyz)) / 5000));
}
@ -67,7 +64,7 @@ vec4 get_cloud_color(vec3 dir, vec3 origin, float time_of_day, float max_dist, f
cloud_shade = mix(cloud_shade, sample.x, passthrough * integral);
dist += INCR * delta;
if (passthrough < 0.05 || (passthrough > 0.8 && dist > (maxd + mind) * 0.7)) {
if (passthrough < 0.1) {
break;
}
}

View File

@ -25,7 +25,9 @@ vec3 illuminate(vec3 color, vec3 light, vec3 diffuse, vec3 ambience) {
}
float attenuation_strength(vec3 rpos) {
return 1.0 / pow(rpos.x * rpos.x + rpos.y * rpos.y + rpos.z * rpos.z, 0.6);
// This is not how light attenuation works at all, but it produces visually pleasing and mechanically useful properties
float d2 = rpos.x * rpos.x + rpos.y * rpos.y + rpos.z * rpos.z;
return max(2.0 / pow(d2 + 10, 0.35) - pow(d2 / 50000.0, 0.8), 0.0);
}
vec3 light_at(vec3 wpos, vec3 wnorm) {
@ -43,7 +45,7 @@ vec3 light_at(vec3 wpos, vec3 wnorm) {
// Pre-calculate difference between light and fragment
vec3 difference = light_pos - wpos;
float strength = pow(attenuation_strength(difference), 0.6);
float strength = attenuation_strength(difference);
// Multiply the vec3 only once
vec3 color = srgb_to_linear(L.light_col.rgb) * (strength * L.light_col.a);

View File

@ -1,7 +1,7 @@
float hash(vec4 p) {
p = fract( p*0.3183099+.1);
p = fract(p * 0.3183099 + 0.1);
p *= 17.0;
return (fract(p.x*p.y*p.z*p.w*(p.x+p.y+p.z+p.w)) - 0.5) * 2.0;
return (fract(p.x * p.y * p.z * p.w * (p.x + p.y + p.z + p.w)) - 0.5) * 2.0;
}
float snoise(in vec4 x) {
@ -33,7 +33,7 @@ float snoise(in vec4 x) {
}
vec3 rand_perm_3(vec3 pos) {
return sin(pos * vec3(1473.7 * pos.z + 472.3, 8891.1 * pos.x + 723.1, 3813.3 * pos.y + 982.5));
return abs(sin(pos * vec3(1473.7 * pos.z + 472.3, 8891.1 * pos.x + 723.1, 3813.3 * pos.y + 982.5)));
}
vec4 rand_perm_4(vec4 pos) {

View File

@ -4,8 +4,8 @@
const float PI = 3.141592;
const vec3 SKY_DAY_TOP = vec3(0.1, 0.2, 0.9);
const vec3 SKY_DAY_MID = vec3(0.02, 0.08, 0.8);
const vec3 SKY_DAY_TOP = vec3(0.1, 0.5, 0.9);
const vec3 SKY_DAY_MID = vec3(0.02, 0.28, 0.8);
const vec3 SKY_DAY_BOT = vec3(0.1, 0.2, 0.3);
const vec3 DAY_LIGHT = vec3(1.2, 1.0, 1.0);
const vec3 SUN_HALO_DAY = vec3(0.35, 0.35, 0.0);
@ -187,7 +187,7 @@ vec3 get_sky_color(vec3 dir, float time_of_day, vec3 origin, vec3 f_pos, float q
// Clouds
clouds = get_cloud_color(dir, origin, time_of_day, f_dist, quality);
clouds.rgb *= get_sun_brightness(sun_dir) * (sun_halo * 1.5 + get_sun_color(sun_dir)) + get_moon_brightness(moon_dir) * (moon_halo * 80.0 + get_moon_color(moon_dir));
clouds.rgb *= get_sun_brightness(sun_dir) * (sun_halo * 1.5 + get_sun_color(sun_dir)) + get_moon_brightness(moon_dir) * (moon_halo * 80.0 + get_moon_color(moon_dir) + 0.25);
if (f_dist > 5000.0) {
sky_color += sun_light + moon_light;

View File

@ -36,7 +36,6 @@ void main() {
uv = clamp(uv + vec2(sin(uv.y * 16.0 + tick.x), sin(uv.x * 24.0 + tick.x)) * 0.005, 0, 1);
}
vec4 aa_color = aa_apply(src_color, uv * screen_res.xy, screen_res.xy);
//vec4 hsva_color = vec4(rgb2hsv(fxaa_color.rgb), fxaa_color.a);
@ -44,7 +43,7 @@ void main() {
//hsva_color.z *= 0.85;
//hsva_color.z = 1.0 - 1.0 / (1.0 * hsva_color.z + 1.0);
//vec4 final_color = vec4(hsv2rgb(hsva_color.rgb), hsva_color.a);
vec4 final_color = pow(aa_color, gamma);
if (medium.x == 1u) {

View File

@ -5,6 +5,7 @@
in vec3 f_pos;
flat in vec3 f_norm;
in vec3 f_col;
in float f_ao;
in float f_light;
out vec4 tgt_color;
@ -24,6 +25,9 @@ void main() {
vec3 point_light = light_at(f_pos, f_norm);
light += point_light;
diffuse_light += point_light;
float ao = pow(f_ao, 0.5) * 0.85 + 0.15;
ambient_light *= ao;
diffuse_light *= ao;
vec3 surf_color = illuminate(f_col, light, diffuse_light, ambient_light);
float fog_level = fog(f_pos.xyz, focus_pos.xyz, medium.x);

View File

@ -6,6 +6,7 @@
in vec3 v_pos;
in vec3 v_norm;
in vec3 v_col;
in float v_ao;
in vec4 inst_mat0;
in vec4 inst_mat1;
in vec4 inst_mat2;
@ -16,6 +17,7 @@ in float inst_wind_sway;
out vec3 f_pos;
flat out vec3 f_norm;
out vec3 f_col;
out float f_ao;
out float f_light;
const float SCALE = 1.0 / 11.0;
@ -41,6 +43,7 @@ void main() {
f_norm = (inst_mat * vec4(v_norm, 0)).xyz;
f_col = srgb_to_linear(v_col) * srgb_to_linear(inst_col);
f_ao = v_ao;
// Select glowing
if (select_pos.w > 0 && select_pos.xyz == floor(sprite_pos)) {

View File

@ -1,11 +1,14 @@
#version 330 core
#include <globals.glsl>
#include <random.glsl>
in vec3 f_pos;
in vec3 f_chunk_pos;
flat in uint f_pos_norm;
in vec3 f_col;
in float f_light;
in float f_ao;
layout (std140)
uniform u_locals {
@ -29,15 +32,21 @@ void main() {
// Use an array to avoid conditional branching
vec3 f_norm = normals[(f_pos_norm >> 29) & 0x7u];
float ao = pow(f_ao, 0.5) * 0.9 + 0.1;
vec3 light, diffuse_light, ambient_light;
get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light, 1.0);
float point_shadow = shadow_at(f_pos, f_norm);
diffuse_light *= f_light * point_shadow;
ambient_light *= f_light * point_shadow;
diffuse_light *= point_shadow;
ambient_light *= point_shadow;
vec3 point_light = light_at(f_pos, f_norm);
light += point_light;
diffuse_light += point_light;
vec3 surf_color = illuminate(srgb_to_linear(f_col), light, diffuse_light, ambient_light);
ambient_light *= f_light * ao;
diffuse_light *= f_light * ao;
diffuse_light += point_light * ao;
vec3 col = f_col + hash(vec4(floor(f_chunk_pos * 3.0 + 0.5), 0)) * 0.02; // Small-scale noise
vec3 surf_color = illuminate(srgb_to_linear(col), light, diffuse_light, ambient_light);
float fog_level = fog(f_pos.xyz, focus_pos.xyz, medium.x);
vec4 clouds;

View File

@ -13,19 +13,25 @@ uniform u_locals {
};
out vec3 f_pos;
out vec3 f_chunk_pos;
flat out uint f_pos_norm;
out vec3 f_col;
out float f_light;
out float f_ao;
const int EXTRA_NEG_Z = 65536;
void main() {
f_pos = vec3((uvec3(v_pos_norm) >> uvec3(0, 8, 16)) & uvec3(0xFFu, 0xFFu, 0x1FFFu)) + model_offs;
f_chunk_pos = vec3(ivec3((uvec3(v_pos_norm) >> uvec3(0, 6, 12)) & uvec3(0x3Fu, 0x3Fu, 0x1FFFFu)) - ivec3(0, 0, EXTRA_NEG_Z));
f_pos = f_chunk_pos + model_offs;
f_pos.z *= min(1.0001 - 0.02 / pow(tick.x - load_time, 10.0), 1.0);
f_pos.z -= 250.0 * (1.0 - min(1.0001 - 0.02 / pow(tick.x - load_time, 10.0), 1.0));
f_pos.z -= 25.0 * pow(distance(focus_pos.xy, f_pos.xy) / view_distance.x, 20.0);
f_col = vec3((uvec3(v_col_light) >> uvec3(8, 16, 24)) & uvec3(0xFFu)) / 255.0;
f_light = float(v_col_light & 0xFFu) / 255.0;
f_light = float(v_col_light & 0x3Fu) / 64.0;
f_ao = float((v_col_light >> 6u) & 3u) / 4.0;
f_pos_norm = v_pos_norm;

View File

@ -9,27 +9,27 @@
lateral: ("npc.giant.male.shoulder_r"),
),
hand_l: (
offset: (-3.0, -2.5, -14.0),
offset: (-2.5, -2.5, -14.0),
lateral: ("npc.giant.male.hand_l"),
),
hand_r: (
offset: (-3.0, -2.5, -14.0),
offset: (-2.5, -2.5, -14.0),
lateral: ("npc.giant.male.hand_r"),
),
leg_l: (
offset: (-3.0, -3.5, -7.0),
offset: (-6.0, -3.5, -7.0),
lateral: ("npc.giant.male.leg_l"),
),
leg_r: (
offset: (-3.0, -3.5, -7.0),
offset: (0.0, -3.5, -7.0),
lateral: ("npc.giant.male.leg_r"),
),
foot_l: (
offset: (-3.0, -5.5, -10.5),
offset: (-3.0, -5.0, -2.5),
lateral: ("npc.giant.male.foot_l"),
),
foot_r: (
offset: (-3.0, -5.5, -10.5),
offset: (-3.0, -5.0, -2.5),
lateral: ("npc.giant.male.foot_r"),
)
),
@ -43,27 +43,27 @@
lateral: ("npc.giant.female.shoulder_r"),
),
hand_l: (
offset: (-3.0, -2.5, -14.0),
offset: (-2.5, -2.5, -14.0),
lateral: ("npc.giant.female.hand_l"),
),
hand_r: (
offset: (-3.0, -2.5, -14.0),
offset: (-2.5, -2.5, -14.0),
lateral: ("npc.giant.female.hand_r"),
),
leg_l: (
offset: (-3.0, -3.5, -7.0),
offset: (-6.0, -3.5, -7.0),
lateral: ("npc.giant.female.leg_l"),
),
leg_r: (
offset: (-3.0, -3.5, -7.0),
offset: (0.0, -3.5, -7.0),
lateral: ("npc.giant.female.leg_r"),
),
foot_l: (
offset: (-3.0, -5.5, -10.5),
offset: (-3.0, -5.0, -2.5),
lateral: ("npc.giant.female.foot_l"),
),
foot_r: (
offset: (-3.0, -5.5, -10.5),
offset: (-3.0, -5.0, -2.5),
lateral: ("npc.giant.female.foot_r"),
)
),

View File

@ -55,4 +55,8 @@
vox_spec: ("weapon.debug_wand", (-1.5, -9.5, -4.0)),
color: None
),
Empty: (
vox_spec: ("armor.empty", (-3.0, -3.5, 1.0)),
color: None
),
})

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/cabbage/cabbage-0.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/cabbage/cabbage-1.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/cabbage/cabbage-2.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/carrot/0.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/carrot/1.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/carrot/2.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/carrot/3.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/carrot/4.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/carrot/5.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/corn/corn-0.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/corn/corn-1.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/corn/corn-2.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/corn/corn-3.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/corn/corn-4.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/corn/corn-5.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/door/door-0.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/ember/1.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/flax/flax-0.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/flax/flax-1.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/flax/flax-2.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/flax/flax-3.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/flax/flax-4.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/flax/flax-5.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/fruit/coconut.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/misc/scarecrow.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/misc/street_lamp.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/pumpkin/1.vox (Stored with Git LFS)

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/pumpkin/2.vox (Stored with Git LFS)

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/pumpkin/3.vox (Stored with Git LFS)

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/pumpkin/4.vox (Stored with Git LFS)

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/pumpkin/5.vox (Stored with Git LFS)

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/pumpkin/6.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/pumpkin/7.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/radish/0.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/radish/1.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/radish/2.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/radish/3.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/radish/4.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/tomato/0.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/tomato/1.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/tomato/2.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/tomato/3.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/tomato/4.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/turnip/turnip-0.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/turnip/turnip-1.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/turnip/turnip-2.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/turnip/turnip-3.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/turnip/turnip-4.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/turnip/turnip-5.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/wheat_green/wheat-0.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/wheat_green/wheat-1.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/wheat_green/wheat-2.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/wheat_green/wheat-3.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/wheat_green/wheat-4.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/wheat_green/wheat-5.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/wheat_green/wheat-6.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/wheat_green/wheat-7.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/wheat_green/wheat-8.vox (Stored with Git LFS) Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More