mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Ice cliffs
This commit is contained in:
parent
a2a3a20aad
commit
a2ca95af3d
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
column::{ColumnGen, ColumnSample},
|
||||
util::{FastNoise, RandomField, RandomPerm, Sampler, SmallCache},
|
||||
IndexRef,
|
||||
IndexRef, CONFIG,
|
||||
};
|
||||
use common::{
|
||||
calendar::{Calendar, CalendarEvent},
|
||||
@ -211,7 +211,7 @@ impl<'a> BlockGen<'a> {
|
||||
// Water
|
||||
if over_water && (wposf.z as f32 - water_height).abs() < ice_depth {
|
||||
// TODO: Ice block
|
||||
Some(Block::new(BlockKind::WeakRock, Rgb::new(200, 225, 255)))
|
||||
Some(Block::new(BlockKind::WeakRock, CONFIG.ice_color))
|
||||
} else if (wposf.z as f32) < water_height {
|
||||
// Ocean
|
||||
Some(water)
|
||||
|
@ -1120,9 +1120,21 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
|
||||
let ice_depth = if snow_factor < -0.25
|
||||
&& water_vel.magnitude_squared() < (0.1f32 + marble_mid * 0.2).powi(2)
|
||||
{
|
||||
let cliff = (sim.gen_ctx.hill_nz.get((wposf3d.div(180.0)).into_array()) as f32)
|
||||
.add((marble_mid - 0.5) * 0.2)
|
||||
.abs()
|
||||
.powi(3)
|
||||
.mul(32.0);
|
||||
let cliff_ctrl = (sim.gen_ctx.hill_nz.get((wposf3d.div(128.0)).into_array()) as f32)
|
||||
.sub(0.4)
|
||||
.add((marble_mid - 0.5) * 0.2)
|
||||
.mul(32.0)
|
||||
.clamped(0.0, 1.0);
|
||||
|
||||
((1.0 - Lerp::lerp(marble, Lerp::lerp(marble_mid, marble_small, 0.25), 0.5)) * 5.0
|
||||
- 1.5)
|
||||
.max(0.0)
|
||||
+ cliff * cliff_ctrl
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
|
@ -1,5 +1,6 @@
|
||||
use common::assets;
|
||||
use serde::Deserialize;
|
||||
use vek::*;
|
||||
|
||||
pub struct Config {
|
||||
pub sea_level: f32,
|
||||
@ -51,6 +52,8 @@ pub struct Config {
|
||||
/// Rough desired river width-to-depth ratio (in terms of horizontal chunk
|
||||
/// width / m, for some reason). Not exact.
|
||||
pub river_width_to_depth: f32,
|
||||
/// TODO: Move to colors.ron when blockgen can access it
|
||||
pub ice_color: Rgb<u8>,
|
||||
}
|
||||
|
||||
pub const CONFIG: Config = Config {
|
||||
@ -71,6 +74,7 @@ pub const CONFIG: Config = Config {
|
||||
river_max_width: 2.0,
|
||||
river_min_height: 0.25,
|
||||
river_width_to_depth: 8.0,
|
||||
ice_color: Rgb::new(175, 200, 255),
|
||||
};
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
@ -216,7 +216,7 @@ pub fn sample_pos(
|
||||
};
|
||||
let rgb =
|
||||
if is_water && is_ice && column_data.map_or(false, |(_, _, ice_depth)| ice_depth > 0.0) {
|
||||
Rgb::new(200, 225, 255)
|
||||
CONFIG.ice_color
|
||||
} else {
|
||||
match (river_kind, (is_water, true_alt >= true_sea_level)) {
|
||||
(_, (false, _)) | (None, (_, true)) | (Some(RiverKind::River { .. }), _) => {
|
||||
|
Loading…
Reference in New Issue
Block a user