mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix paths (sorta) and rock moss.
This commit is contained in:
parent
a3491d5073
commit
0b91f5ba90
@ -69,17 +69,17 @@ pub fn apply_paths_to(canvas: &mut Canvas) {
|
|||||||
// Try to use the column at the centre of the path for sampling to make them
|
// Try to use the column at the centre of the path for sampling to make them
|
||||||
// flatter
|
// flatter
|
||||||
let col_pos = -info.wpos().map(|e| e as f32) + path_nearest;
|
let col_pos = -info.wpos().map(|e| e as f32) + path_nearest;
|
||||||
let col00 = info.col(info.wpos() + col_pos.map(|e| e.floor() as i32) + Vec2::new(0, 0));
|
let col00 = info.col_or_gen(info.wpos() + col_pos.map(|e| e.floor() as i32) + Vec2::new(0, 0));
|
||||||
let col10 = info.col(info.wpos() + col_pos.map(|e| e.floor() as i32) + Vec2::new(1, 0));
|
let col10 = info.col_or_gen(info.wpos() + col_pos.map(|e| e.floor() as i32) + Vec2::new(1, 0));
|
||||||
let col01 = info.col(info.wpos() + col_pos.map(|e| e.floor() as i32) + Vec2::new(0, 1));
|
let col01 = info.col_or_gen(info.wpos() + col_pos.map(|e| e.floor() as i32) + Vec2::new(0, 1));
|
||||||
let col11 = info.col(info.wpos() + col_pos.map(|e| e.floor() as i32) + Vec2::new(1, 1));
|
let col11 = info.col_or_gen(info.wpos() + col_pos.map(|e| e.floor() as i32) + Vec2::new(1, 1));
|
||||||
let col_attr = |col: &ColumnSample| {
|
let col_attr = |col: &ColumnSample| {
|
||||||
Vec3::new(col.riverless_alt, col.alt, col.water_dist.unwrap_or(1000.0))
|
Vec3::new(col.riverless_alt, col.alt, col.water_dist.unwrap_or(1000.0))
|
||||||
};
|
};
|
||||||
let [riverless_alt, alt, water_dist] = match (col00, col10, col01, col11) {
|
let [riverless_alt, alt, water_dist] = match (col00, col10, col01, col11) {
|
||||||
(Some(col00), Some(col10), Some(col01), Some(col11)) => Lerp::lerp(
|
(Some(col00), Some(col10), Some(col01), Some(col11)) => Lerp::lerp(
|
||||||
Lerp::lerp(col_attr(col00), col_attr(col10), path_nearest.x.fract()),
|
Lerp::lerp(col_attr(&col00), col_attr(&col10), path_nearest.x.fract()),
|
||||||
Lerp::lerp(col_attr(col01), col_attr(col11), path_nearest.x.fract()),
|
Lerp::lerp(col_attr(&col01), col_attr(&col11), path_nearest.x.fract()),
|
||||||
path_nearest.y.fract(),
|
path_nearest.y.fract(),
|
||||||
),
|
),
|
||||||
_ => col_attr(col),
|
_ => col_attr(col),
|
||||||
|
@ -122,7 +122,6 @@ pub fn apply_rocks_to(canvas: &mut Canvas, _dynamic_rng: &mut impl Rng) {
|
|||||||
} */
|
} */
|
||||||
|
|
||||||
/* let mut is_top = true; */
|
/* let mut is_top = true; */
|
||||||
let mut last_block = Block::empty();
|
|
||||||
(/*bounds*/aabb.min.x../*bounds*/aabb.max.x).for_each(|x| {
|
(/*bounds*/aabb.min.x../*bounds*/aabb.max.x).for_each(|x| {
|
||||||
(/*bounds*/aabb.min.y../*bounds*/aabb.max.y).for_each(|y| {
|
(/*bounds*/aabb.min.y../*bounds*/aabb.max.y).for_each(|y| {
|
||||||
let col = if let Some(col) = info.col(Vec2::new(x, y)) {
|
let col = if let Some(col) = info.col(Vec2::new(x, y)) {
|
||||||
@ -131,6 +130,7 @@ pub fn apply_rocks_to(canvas: &mut Canvas, _dynamic_rng: &mut impl Rng) {
|
|||||||
// NOTE: Should never happen as we're always within the render area.
|
// NOTE: Should never happen as we're always within the render area.
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
let mut last_block = Block::empty();
|
||||||
for z in (/*bounds*/aabb.min.z../*bounds*/aabb.max.z).rev() {
|
for z in (/*bounds*/aabb.min.z../*bounds*/aabb.max.z).rev() {
|
||||||
let wpos = Vec3::new(x, y, z);
|
let wpos = Vec3::new(x, y, z);
|
||||||
let model_pos = wpos - rock.wpos;
|
let model_pos = wpos - rock.wpos;
|
||||||
|
Loading…
Reference in New Issue
Block a user