mirror of
https://gitlab.com/veloren/veloren.git
synced 2025-07-25 21:02:31 +00:00
Extract 'new_method4' from 'apply_paths_to'
This commit is contained in:
@ -46,19 +46,7 @@ pub fn apply_paths_to(canvas: &mut Canvas) {
|
||||
let (bridge_offset, depth) = new_method1(riverless_alt, alt, water_dist);
|
||||
let surface_z = (riverless_alt + bridge_offset).floor() as i32;
|
||||
|
||||
for z in -depth.abs()..0 {
|
||||
let _ = canvas.set(
|
||||
Vec3::new(wpos2d.x, wpos2d.y, surface_z + z),
|
||||
if bridge_offset >= 2.0 && path_dist >= 3.0 || z < -1 {
|
||||
new_method2(BlockKind::Rock, info.index().colors.layer.bridge.into())
|
||||
} else {
|
||||
new_method2(
|
||||
BlockKind::Earth,
|
||||
path.surface_color(col.sub_surface_color.map(|e| (e * 255.0) as u8)),
|
||||
)
|
||||
},
|
||||
);
|
||||
}
|
||||
new_method4(canvas, wpos2d, col, path_dist, path, info, bridge_offset, depth, surface_z);
|
||||
new_method3(canvas, wpos2d, path_dist, path, surface_z)
|
||||
}
|
||||
});
|
||||
@ -114,6 +102,24 @@ fn new_method2(block_kind: BlockKind, color: Rgb<u8>) -> Block {
|
||||
Block::new(block_kind, noisy_color(color, 8))
|
||||
}
|
||||
|
||||
//TODO: Rename
|
||||
fn new_method4(canvas: &mut Canvas, wpos2d: Vec2<i32>, col: &ColumnSample, path_dist: f32,
|
||||
path: Path, info: CanvasInfo, bridge_offset: f32, depth: i32, surface_z: i32) {
|
||||
for z in -depth.abs()..0 {
|
||||
let _ = canvas.set(
|
||||
Vec3::new(wpos2d.x, wpos2d.y, surface_z + z),
|
||||
if bridge_offset >= 2.0 && path_dist >= 3.0 || z < -1 {
|
||||
new_method2(BlockKind::Rock, info.index().colors.layer.bridge.into())
|
||||
} else {
|
||||
new_method2(
|
||||
BlockKind::Earth,
|
||||
path.surface_color(col.sub_surface_color.map(|e| (e * 255.0) as u8)),
|
||||
)
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Rename
|
||||
fn new_method3(canvas: &mut Canvas, wpos2d: Vec2<i32>, path_dist: f32, path: Path, surface_z: i32) {
|
||||
let head_space = path.head_space(path_dist);
|
||||
|
Reference in New Issue
Block a user