mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Simpler cliffs, camera tilt
This commit is contained in:
parent
bac7bad9f7
commit
38c836d6c5
@ -106,6 +106,11 @@ impl Camera {
|
||||
self.tgt_dist = (self.tgt_dist + delta).max(0.0);
|
||||
}
|
||||
|
||||
/// Get the distance of the camera from the target
|
||||
pub fn get_distance(&self) -> f32 {
|
||||
self.tgt_dist
|
||||
}
|
||||
|
||||
/// Set the distance of the camera from the target (i.e., zoom).
|
||||
pub fn set_distance(&mut self, dist: f32) {
|
||||
self.tgt_dist = dist;
|
||||
|
@ -115,7 +115,9 @@ impl Scene {
|
||||
.map_or(Vec3::zero(), |pos| pos.0);
|
||||
|
||||
// Alter camera position to match player.
|
||||
self.camera.set_focus_pos(player_pos + Vec3::unit_z() * 2.1);
|
||||
let tilt = self.camera.get_orientation().y;
|
||||
let dist = self.camera.get_distance();
|
||||
self.camera.set_focus_pos(player_pos + Vec3::unit_z() * (2.1 - tilt.min(0.0) * dist * 0.5));
|
||||
|
||||
// Tick camera for interpolation.
|
||||
self.camera.update(client.state().get_time());
|
||||
|
@ -66,19 +66,25 @@ impl<'a> Sampler for BlockGen<'a> {
|
||||
.mul((chaos - 0.1).max(0.0))
|
||||
.mul(90.0);
|
||||
|
||||
let cliff = (self.world.sim()
|
||||
let cliff = (0.0
|
||||
+ (self.world.sim()
|
||||
.gen_ctx
|
||||
.warp_nz
|
||||
.get((wposf.div(Vec3::new(150.0, 150.0, 150.0))).into_array())
|
||||
as f32)
|
||||
//.add(0.6)
|
||||
.mul(130.0);
|
||||
.get((wposf.div(Vec3::new(350.0, 350.0, 800.0))).into_array())
|
||||
as f32) * 0.8
|
||||
+ (self.world.sim()
|
||||
.gen_ctx
|
||||
.warp_nz
|
||||
.get((wposf.div(Vec3::new(100.0, 100.0, 100.0))).into_array())
|
||||
as f32) * 0.2)
|
||||
.add(0.6)
|
||||
.mul(64.0);
|
||||
|
||||
let is_cliff = (self.world.sim()
|
||||
.gen_ctx
|
||||
.warp_nz
|
||||
.get((wposf.div(Vec3::new(100.0, 100.0, 100.0))).into_array())
|
||||
as f32) > 0.0;//4;
|
||||
.get((wposf.div(Vec3::new(300.0, 300.0, 800.0))).into_array())
|
||||
as f32) > 0.25;//4;
|
||||
|
||||
let height = alt + warp + if is_cliff { cliff } else { 0.0 };
|
||||
|
||||
@ -86,6 +92,7 @@ impl<'a> Sampler for BlockGen<'a> {
|
||||
|
||||
let air = Block::empty();
|
||||
let stone = Block::new(2, Rgb::new(200, 220, 255));
|
||||
let surface_stone = Block::new(1, Rgb::new(200, 220, 255));
|
||||
let dirt = Block::new(1, Rgb::new(128, 90, 0));
|
||||
let sand = Block::new(1, Rgb::new(180, 150, 50));
|
||||
let water = Block::new(1, Rgb::new(100, 150, 255));
|
||||
@ -93,7 +100,11 @@ impl<'a> Sampler for BlockGen<'a> {
|
||||
|
||||
let block = if (wposf.z as f32) < height - 4.0 {
|
||||
// Underground
|
||||
if (wposf.z as f32) > alt {
|
||||
Some(surface_stone)
|
||||
} else {
|
||||
Some(stone)
|
||||
}
|
||||
} else if (wposf.z as f32) < height {
|
||||
// Surface
|
||||
Some(Block::new(1, surface_color.map(|e| (e * 255.0) as u8)))
|
||||
|
@ -4,7 +4,7 @@ use std::sync::Arc;
|
||||
use vek::*;
|
||||
|
||||
lazy_static! {
|
||||
pub static ref TREES: [Arc<Structure>; 61] = [
|
||||
pub static ref TREES: [Arc<Structure>; 9] = [
|
||||
// green oaks
|
||||
assets::load_map("world/tree/oak_green/1.vox", |s: Structure| s
|
||||
.with_center(Vec3::new(15, 18, 14)))
|
||||
@ -34,7 +34,7 @@ lazy_static! {
|
||||
.with_center(Vec3::new(26, 26, 14)))
|
||||
.unwrap(),
|
||||
// green pines
|
||||
assets::load_map("world/tree/pine_green/1.vox", |s: Structure| s
|
||||
/*assets::load_map("world/tree/pine_green/1.vox", |s: Structure| s
|
||||
.with_center(Vec3::new(15, 15, 14)))
|
||||
.unwrap(),
|
||||
assets::load_map("world/tree/pine_green/2.vox", |s: Structure| s
|
||||
@ -196,7 +196,7 @@ lazy_static! {
|
||||
.with_center(Vec3::new(7, 7, 10)))
|
||||
.unwrap(),
|
||||
// palm trees
|
||||
/*assets::load_map("world/tree/desert_palm/1.vox", |s: Structure| s
|
||||
assets::load_map("world/tree/desert_palm/1.vox", |s: Structure| s
|
||||
.with_center(Vec3::new(12, 12, 10)))
|
||||
.unwrap(),
|
||||
assets::load_map("world/tree/desert_palm/2.vox", |s: Structure| s
|
||||
|
@ -45,13 +45,15 @@ impl<'a> Sampler for ColumnGen<'a> {
|
||||
|
||||
let rock = (sim.gen_ctx.small_nz.get(Vec3::new(wposf.x, wposf.y, alt as f64).div(100.0).into_array()) as f32)
|
||||
.mul(rockiness)
|
||||
.sub(0.35)
|
||||
.sub(0.4)
|
||||
.max(0.0)
|
||||
.mul(6.0);
|
||||
.mul(8.0);
|
||||
|
||||
let wposf3d = Vec3::new(wposf.x, wposf.y, alt as f64);
|
||||
|
||||
let marble = (sim.gen_ctx.hill_nz.get((wposf3d.div(48.0)).into_array()) as f32)
|
||||
let marble = (0.0
|
||||
+ (sim.gen_ctx.hill_nz.get((wposf3d.div(48.0)).into_array()) as f32).mul(0.75)
|
||||
+ (sim.gen_ctx.hill_nz.get((wposf3d.div(3.0)).into_array()) as f32).mul(0.5))
|
||||
.add(1.0)
|
||||
.mul(0.5);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user