mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'master' into 'master'
Colour adjustment and server crash fix See merge request veloren/veloren!148 Former-commit-id: b0a42340d22980ec25162255bf41855337a8be0b
This commit is contained in:
commit
db2b823fe1
@ -557,8 +557,9 @@ impl Server {
|
||||
pub fn generate_chunk(&mut self, key: Vec2<i32>) {
|
||||
if self.pending_chunks.insert(key) {
|
||||
let chunk_tx = self.chunk_tx.clone();
|
||||
self.thread_pool
|
||||
.execute(move || chunk_tx.send((key, World::generate_chunk(key))).unwrap());
|
||||
self.thread_pool.execute(move || {
|
||||
let _ = chunk_tx.send((key, World::generate_chunk(key)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,18 +144,32 @@ vec4 fxaa_apply(sampler2D tex, vec2 fragCoord, vec2 resolution) {
|
||||
return fxaa(tex, fragCoord, resolution, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
|
||||
}
|
||||
|
||||
vec3 rgb2hsv(vec3 c) {
|
||||
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
||||
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
||||
|
||||
float d = q.x - min(q.w, q.y);
|
||||
float e = 1.0e-10;
|
||||
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
}
|
||||
|
||||
vec3 hsv2rgb(vec3 c) {
|
||||
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = (f_pos + 1.0) * 0.5;
|
||||
|
||||
/*
|
||||
float px_size = 8.0;
|
||||
vec2 px_count = screen_res.xy / px_size;
|
||||
vec2 uv2 = floor(uv * px_count) / px_count;
|
||||
*/
|
||||
vec4 fxaa_color = fxaa_apply(src_color, uv * screen_res.xy, screen_res.xy);
|
||||
|
||||
vec4 color = fxaa_apply(src_color, uv * screen_res.xy, screen_res.xy);
|
||||
vec4 hsva_color = vec4(rgb2hsv(fxaa_color.rgb), fxaa_color.a);
|
||||
hsva_color.y += 0.17;
|
||||
hsva_color.x -= 0.015;
|
||||
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);
|
||||
|
||||
tgt_color = 1.0 - 1.0 / (color + 1.0);
|
||||
|
||||
//tgt_color = ceil(tgt_color * 10.0) / 10.0;
|
||||
tgt_color = final_color;
|
||||
}
|
||||
|
@ -16,17 +16,17 @@ const float PI = 3.141592;
|
||||
vec3 get_sky_color(vec3 dir, float time_of_day) {
|
||||
const float TIME_FACTOR = (PI * 2.0) / (3600.0 * 24.0);
|
||||
|
||||
const vec3 SKY_TOP = vec3(0.0, 0.3, 1.0);
|
||||
const vec3 SKY_BOTTOM = vec3(0.0, 0.05, 0.2);
|
||||
const vec3 SKY_TOP = vec3(0.1, 0.5, 1.0);
|
||||
const vec3 SKY_BOTTOM = vec3(0.025, 0.08, 0.2);
|
||||
|
||||
const vec3 SUN_HALO_COLOR = vec3(1.0, 0.8, 0.5);
|
||||
const vec3 SUN_SURF_COLOR = vec3(1.0, 0.8, 0.0) * 100.0;
|
||||
const vec3 SUN_HALO_COLOR = vec3(1.0, 0.7, 0.5);
|
||||
const vec3 SUN_SURF_COLOR = vec3(1.0, 0.9, 0.35) * 200.0;
|
||||
|
||||
float sun_angle_rad = time_of_day * TIME_FACTOR;
|
||||
vec3 sun_dir = vec3(sin(sun_angle_rad), 0.0, cos(sun_angle_rad));
|
||||
|
||||
vec3 sun_halo = pow(max(dot(dir, sun_dir), 0.0), 8.0) * SUN_HALO_COLOR;
|
||||
vec3 sun_surf = pow(max(dot(dir, sun_dir), 0.0), 1000.0) * SUN_SURF_COLOR;
|
||||
vec3 sun_surf = pow(max(dot(dir, sun_dir) - 0.0045, 0.0), 1000.0) * SUN_SURF_COLOR;
|
||||
vec3 sun_light = sun_halo + sun_surf;
|
||||
|
||||
return mix(SKY_BOTTOM, SKY_TOP, (dir.z + 1.0) / 2.0) + sun_light;
|
||||
|
Loading…
Reference in New Issue
Block a user