mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added snow to mountains, fixed hash sub-chunk allocation failure
Former-commit-id: 45bb3063172b980f7cd7aa5bd2b50a1a53480120
This commit is contained in:
parent
cafbb45e52
commit
86bb277116
@ -114,12 +114,13 @@ impl WriteVol for Chonk {
|
|||||||
self.sub_chunks[sub_chunk_idx] = SubChunk::Hash(*cblock, map);
|
self.sub_chunks[sub_chunk_idx] = SubChunk::Hash(*cblock, map);
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
SubChunk::Hash(cblock, map) if map.len() < 4096 => {
|
SubChunk::Hash(cblock, map) if map.len() < 1024 => {
|
||||||
map.insert(rpos, block);
|
map.insert(rpos, block);
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
SubChunk::Hash(cblock, map) => {
|
SubChunk::Hash(cblock, map) => {
|
||||||
let mut new_chunk = Chunk::filled(*cblock, ());
|
let mut new_chunk = Chunk::filled(*cblock, ());
|
||||||
|
new_chunk.set(rpos, block).unwrap(); // Can't fail (I hope)
|
||||||
|
|
||||||
for (map_pos, map_block) in map {
|
for (map_pos, map_block) in map {
|
||||||
new_chunk.set(*map_pos, *map_block).unwrap(); // Can't fail (I hope!)
|
new_chunk.set(*map_pos, *map_block).unwrap(); // Can't fail (I hope!)
|
||||||
@ -128,9 +129,21 @@ impl WriteVol for Chonk {
|
|||||||
self.sub_chunks[sub_chunk_idx] = SubChunk::Heterogeneous(new_chunk);
|
self.sub_chunks[sub_chunk_idx] = SubChunk::Heterogeneous(new_chunk);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
SubChunk::Homogeneous(cblock) => {
|
||||||
|
let mut new_chunk = Chunk::filled(*cblock, ());
|
||||||
|
|
||||||
|
new_chunk.set(rpos, block).unwrap(); // Can't fail (I hope!)
|
||||||
|
|
||||||
|
self.sub_chunks[sub_chunk_idx] = SubChunk::Heterogeneous(new_chunk);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
*/
|
||||||
SubChunk::Heterogeneous(chunk) => chunk
|
SubChunk::Heterogeneous(chunk) => chunk
|
||||||
.set(rpos, block)
|
.set(rpos, block)
|
||||||
.map_err(|err| ChonkError::ChunkError(err)),
|
.map_err(|err| ChonkError::ChunkError(err)),
|
||||||
|
//_ => unimplemented!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,9 +166,9 @@ void main() {
|
|||||||
vec4 fxaa_color = fxaa_apply(src_color, uv * screen_res.xy, screen_res.xy);
|
vec4 fxaa_color = fxaa_apply(src_color, uv * screen_res.xy, screen_res.xy);
|
||||||
|
|
||||||
vec4 hsva_color = vec4(rgb2hsv(fxaa_color.rgb), fxaa_color.a);
|
vec4 hsva_color = vec4(rgb2hsv(fxaa_color.rgb), fxaa_color.a);
|
||||||
hsva_color.y += 0.27;
|
hsva_color.y *= 1.27;
|
||||||
hsva_color.x -= 0.015;
|
hsva_color.x -= 0.015;
|
||||||
hsva_color.z = 1.0 - 1.0 / (1.0 * hsva_color.z + 1.0);
|
//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 = vec4(hsv2rgb(hsva_color.rgb), hsva_color.a);
|
||||||
|
|
||||||
tgt_color = final_color;
|
tgt_color = final_color;
|
||||||
|
@ -142,7 +142,8 @@ impl WorldSim {
|
|||||||
let warm_grass = Rgb::new(0.55, 0.9, 0.0);
|
let warm_grass = Rgb::new(0.55, 0.9, 0.0);
|
||||||
let cold_stone = Rgb::new(0.78, 0.86, 1.0);
|
let cold_stone = Rgb::new(0.78, 0.86, 1.0);
|
||||||
let warm_stone = Rgb::new(0.72, 0.7, 0.33);
|
let warm_stone = Rgb::new(0.72, 0.7, 0.33);
|
||||||
let sand = Rgb::new(0.93, 0.84, 0.23);
|
let sand = Rgb::new(0.93, 0.84, 0.33);
|
||||||
|
let snow = Rgb::broadcast(1.0);
|
||||||
|
|
||||||
let grass = Rgb::lerp(cold_grass, warm_grass, temp);
|
let grass = Rgb::lerp(cold_grass, warm_grass, temp);
|
||||||
let ground = Rgb::lerp(grass, warm_stone, rock.mul(5.0).min(0.8));
|
let ground = Rgb::lerp(grass, warm_stone, rock.mul(5.0).min(0.8));
|
||||||
@ -154,7 +155,16 @@ impl WorldSim {
|
|||||||
surface_color: Rgb::lerp(
|
surface_color: Rgb::lerp(
|
||||||
sand,
|
sand,
|
||||||
// Land
|
// Land
|
||||||
Rgb::lerp(ground, cliff, (alt - SEA_LEVEL - 100.0) / 150.0),
|
Rgb::lerp(
|
||||||
|
ground,
|
||||||
|
// Mountain
|
||||||
|
Rgb::lerp(
|
||||||
|
cliff,
|
||||||
|
snow,
|
||||||
|
(alt - SEA_LEVEL - 215.0 - temp * 24.0) / 4.0,
|
||||||
|
),
|
||||||
|
(alt - SEA_LEVEL - 100.0) / 100.0
|
||||||
|
),
|
||||||
// Beach
|
// Beach
|
||||||
(alt - SEA_LEVEL - 2.0) / 5.0,
|
(alt - SEA_LEVEL - 2.0) / 5.0,
|
||||||
),
|
),
|
||||||
@ -203,7 +213,8 @@ impl SimChunk {
|
|||||||
|
|
||||||
let chaos = chaos + chaos.mul(20.0).sin().mul(0.05);
|
let chaos = chaos + chaos.mul(20.0).sin().mul(0.05);
|
||||||
|
|
||||||
let alt_base = gen_ctx.alt_nz.get((wposf.div(5000.0)).into_array()) as f32 * 0.4;
|
let alt_base = gen_ctx.alt_nz.get((wposf.div(5000.0)).into_array()) as f32;
|
||||||
|
let alt_base = alt_base * 0.4 + alt_base.mul(16.0).sin().mul(0.01);
|
||||||
|
|
||||||
let alt_main = gen_ctx.alt_nz.get((wposf.div(750.0)).into_array()) as f32;
|
let alt_main = gen_ctx.alt_nz.get((wposf.div(750.0)).into_array()) as f32;
|
||||||
|
|
||||||
@ -232,7 +243,7 @@ impl SimChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_base_z(&self) -> f32 {
|
pub fn get_base_z(&self) -> f32 {
|
||||||
self.alt - Z_TOLERANCE.0
|
self.alt - Z_TOLERANCE.0 * (self.chaos + 0.1)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_max_z(&self) -> f32 {
|
pub fn get_max_z(&self) -> f32 {
|
||||||
|
Loading…
Reference in New Issue
Block a user