mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'zesterer/small-fixes' into 'master'
Small fixes: Faster meshing, smoother movement, better interpolation, and a return to space for climbing See merge request veloren/veloren!596
This commit is contained in:
commit
6cd78dcb4c
@ -11,7 +11,7 @@ const vec3 SUN_HALO_DAY = vec3(0.35, 0.35, 0.0);
|
|||||||
const vec3 SKY_DUSK_TOP = vec3(0.06, 0.1, 0.20);
|
const vec3 SKY_DUSK_TOP = vec3(0.06, 0.1, 0.20);
|
||||||
const vec3 SKY_DUSK_MID = vec3(0.35, 0.1, 0.15);
|
const vec3 SKY_DUSK_MID = vec3(0.35, 0.1, 0.15);
|
||||||
const vec3 SKY_DUSK_BOT = vec3(0.0, 0.1, 0.13);
|
const vec3 SKY_DUSK_BOT = vec3(0.0, 0.1, 0.13);
|
||||||
const vec3 DUSK_LIGHT = vec3(3.0, 1.0, 0.3);
|
const vec3 DUSK_LIGHT = vec3(3.0, 1.5, 0.3);
|
||||||
const vec3 SUN_HALO_DUSK = vec3(0.6, 0.1, 0.0);
|
const vec3 SUN_HALO_DUSK = vec3(0.6, 0.1, 0.0);
|
||||||
|
|
||||||
const vec3 SKY_NIGHT_TOP = vec3(0.001, 0.001, 0.0025);
|
const vec3 SKY_NIGHT_TOP = vec3(0.001, 0.001, 0.0025);
|
||||||
@ -56,7 +56,7 @@ void get_sun_diffuse(vec3 norm, float time_of_day, out vec3 light, out vec3 diff
|
|||||||
vec3 sun_chroma = sun_color * sun_light;
|
vec3 sun_chroma = sun_color * sun_light;
|
||||||
|
|
||||||
light = sun_chroma + PERSISTENT_AMBIANCE;
|
light = sun_chroma + PERSISTENT_AMBIANCE;
|
||||||
diffuse_light = sun_chroma * mix(1.0, dot(-norm, sun_dir) * 0.5 + 0.5, diffusion) + PERSISTENT_AMBIANCE;
|
diffuse_light = sun_chroma * mix(1.0, max(dot(-norm, sun_dir) * 0.6 + 0.4, 0.0), diffusion) + PERSISTENT_AMBIANCE;
|
||||||
ambient_light = vec3(SUN_AMBIANCE * sun_light);
|
ambient_light = vec3(SUN_AMBIANCE * sun_light);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ use vek::*;
|
|||||||
|
|
||||||
pub const ROLL_DURATION: Duration = Duration::from_millis(600);
|
pub const ROLL_DURATION: Duration = Duration::from_millis(600);
|
||||||
|
|
||||||
const HUMANOID_ACCEL: f32 = 70.0;
|
const HUMANOID_ACCEL: f32 = 50.0;
|
||||||
const HUMANOID_SPEED: f32 = 120.0;
|
const HUMANOID_SPEED: f32 = 120.0;
|
||||||
const HUMANOID_AIR_ACCEL: f32 = 10.0;
|
const HUMANOID_AIR_ACCEL: f32 = 10.0;
|
||||||
const HUMANOID_AIR_SPEED: f32 = 100.0;
|
const HUMANOID_AIR_SPEED: f32 = 100.0;
|
||||||
@ -163,7 +163,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
ori.0 = vek::ops::Slerp::slerp(
|
ori.0 = vek::ops::Slerp::slerp(
|
||||||
ori.0,
|
ori.0,
|
||||||
ori_dir.into(),
|
ori_dir.into(),
|
||||||
if physics.on_ground { 12.0 } else { 2.0 } * dt.0,
|
if physics.on_ground { 9.0 } else { 2.0 } * dt.0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ const BOUYANCY: f32 = 0.0;
|
|||||||
// amount an object will slow down within 1/60th of a second. Eg. if the frction
|
// amount an object will slow down within 1/60th of a second. Eg. if the frction
|
||||||
// is 0.01, and the speed is 1.0, then after 1/60th of a second the speed will
|
// is 0.01, and the speed is 1.0, then after 1/60th of a second the speed will
|
||||||
// be 0.99. after 1 second the speed will be 0.54, which is 0.99 ^ 60.
|
// be 0.99. after 1 second the speed will be 0.54, which is 0.99 ^ 60.
|
||||||
const FRIC_GROUND: f32 = 0.125;
|
const FRIC_GROUND: f32 = 0.08;
|
||||||
const FRIC_AIR: f32 = 0.0125;
|
const FRIC_AIR: f32 = 0.0125;
|
||||||
const FRIC_FLUID: f32 = 0.2;
|
const FRIC_FLUID: f32 = 0.2;
|
||||||
|
|
||||||
|
@ -161,6 +161,7 @@ impl Scene {
|
|||||||
self.figure_state.update(
|
self.figure_state.update(
|
||||||
renderer,
|
renderer,
|
||||||
Vec3::zero(),
|
Vec3::zero(),
|
||||||
|
Vec3::zero(),
|
||||||
Vec3::new(self.char_ori.sin(), -self.char_ori.cos(), 0.0),
|
Vec3::new(self.char_ori.sin(), -self.char_ori.cos(), 0.0),
|
||||||
1.0,
|
1.0,
|
||||||
Rgba::broadcast(1.0),
|
Rgba::broadcast(1.0),
|
||||||
|
@ -44,7 +44,7 @@ fn calc_light<V: RectRasterableVol<Vox = Block> + ReadVol + Debug>(
|
|||||||
let mut vol_cached = vol.cached();
|
let mut vol_cached = vol.cached();
|
||||||
|
|
||||||
let mut voids = HashMap::new();
|
let mut voids = HashMap::new();
|
||||||
let mut rays = vec![outer.size().d; outer.size().product() as usize];
|
let mut rays = vec![(outer.size().d, 0); outer.size().product() as usize];
|
||||||
for x in 0..outer.size().w {
|
for x in 0..outer.size().w {
|
||||||
for y in 0..outer.size().h {
|
for y in 0..outer.size().h {
|
||||||
let mut outside = true;
|
let mut outside = true;
|
||||||
@ -55,9 +55,12 @@ fn calc_light<V: RectRasterableVol<Vox = Block> + ReadVol + Debug>(
|
|||||||
.copied()
|
.copied()
|
||||||
.unwrap_or(Block::empty());
|
.unwrap_or(Block::empty());
|
||||||
|
|
||||||
if !block.is_air() && outside {
|
if !block.is_air() {
|
||||||
rays[(outer.size().w * y + x) as usize] = z;
|
if outside {
|
||||||
outside = false;
|
rays[(outer.size().w * y + x) as usize].0 = z;
|
||||||
|
outside = false;
|
||||||
|
}
|
||||||
|
rays[(outer.size().w * y + x) as usize].1 = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block.is_air() || block.is_fluid()) && !outside {
|
if (block.is_air() || block.is_fluid()) && !outside {
|
||||||
@ -74,6 +77,7 @@ fn calc_light<V: RectRasterableVol<Vox = Block> + ReadVol + Debug>(
|
|||||||
if pos.z
|
if pos.z
|
||||||
> *rays
|
> *rays
|
||||||
.get(((outer.size().w * col.y) + col.x) as usize)
|
.get(((outer.size().w * col.y) + col.x) as usize)
|
||||||
|
.map(|(ray, _)| ray)
|
||||||
.unwrap_or(&0)
|
.unwrap_or(&0)
|
||||||
{
|
{
|
||||||
*l = Some(sunlight - 1);
|
*l = Some(sunlight - 1);
|
||||||
@ -85,6 +89,7 @@ fn calc_light<V: RectRasterableVol<Vox = Block> + ReadVol + Debug>(
|
|||||||
if pos.z
|
if pos.z
|
||||||
>= *rays
|
>= *rays
|
||||||
.get(((outer.size().w * pos.y) + pos.x) as usize)
|
.get(((outer.size().w * pos.y) + pos.x) as usize)
|
||||||
|
.map(|(ray, _)| ray)
|
||||||
.unwrap_or(&0)
|
.unwrap_or(&0)
|
||||||
{
|
{
|
||||||
*l = Some(sunlight - 1);
|
*l = Some(sunlight - 1);
|
||||||
@ -114,7 +119,15 @@ fn calc_light<V: RectRasterableVol<Vox = Block> + ReadVol + Debug>(
|
|||||||
move |wpos| {
|
move |wpos| {
|
||||||
let pos = wpos - outer.min;
|
let pos = wpos - outer.min;
|
||||||
rays.get(((outer.size().w * pos.y) + pos.x) as usize)
|
rays.get(((outer.size().w * pos.y) + pos.x) as usize)
|
||||||
.and_then(|ray| if pos.z > *ray { Some(1.0) } else { None })
|
.and_then(|(ray, deep)| {
|
||||||
|
if pos.z > *ray {
|
||||||
|
Some(1.0)
|
||||||
|
} else if pos.z < *deep {
|
||||||
|
Some(0.0)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
})
|
||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
if let Some(Some(l)) = voids.get(&pos) {
|
if let Some(Some(l)) = voids.get(&pos) {
|
||||||
Some(*l as f32 / sunlight as f32)
|
Some(*l as f32 / sunlight as f32)
|
||||||
|
@ -257,6 +257,7 @@ impl FigureMgr {
|
|||||||
state.update(
|
state.update(
|
||||||
renderer,
|
renderer,
|
||||||
pos.0,
|
pos.0,
|
||||||
|
vel.0,
|
||||||
ori.0,
|
ori.0,
|
||||||
scale,
|
scale,
|
||||||
col,
|
col,
|
||||||
@ -311,6 +312,7 @@ impl FigureMgr {
|
|||||||
state.update(
|
state.update(
|
||||||
renderer,
|
renderer,
|
||||||
pos.0,
|
pos.0,
|
||||||
|
vel.0,
|
||||||
ori.0,
|
ori.0,
|
||||||
scale,
|
scale,
|
||||||
col,
|
col,
|
||||||
@ -367,6 +369,7 @@ impl FigureMgr {
|
|||||||
state.update(
|
state.update(
|
||||||
renderer,
|
renderer,
|
||||||
pos.0,
|
pos.0,
|
||||||
|
vel.0,
|
||||||
ori.0,
|
ori.0,
|
||||||
scale,
|
scale,
|
||||||
col,
|
col,
|
||||||
@ -385,6 +388,7 @@ impl FigureMgr {
|
|||||||
state.update(
|
state.update(
|
||||||
renderer,
|
renderer,
|
||||||
pos.0,
|
pos.0,
|
||||||
|
vel.0,
|
||||||
ori.0,
|
ori.0,
|
||||||
scale,
|
scale,
|
||||||
col,
|
col,
|
||||||
@ -524,6 +528,7 @@ impl<S: Skeleton> FigureState<S> {
|
|||||||
&mut self,
|
&mut self,
|
||||||
renderer: &mut Renderer,
|
renderer: &mut Renderer,
|
||||||
pos: Vec3<f32>,
|
pos: Vec3<f32>,
|
||||||
|
vel: Vec3<f32>,
|
||||||
ori: Vec3<f32>,
|
ori: Vec3<f32>,
|
||||||
scale: f32,
|
scale: f32,
|
||||||
col: Rgba<f32>,
|
col: Rgba<f32>,
|
||||||
@ -535,8 +540,8 @@ impl<S: Skeleton> FigureState<S> {
|
|||||||
|
|
||||||
// Update interpolation values
|
// Update interpolation values
|
||||||
if self.pos.distance_squared(pos) < 64.0 * 64.0 {
|
if self.pos.distance_squared(pos) < 64.0 * 64.0 {
|
||||||
self.pos = Lerp::lerp(self.pos, pos, 15.0 * dt);
|
self.pos = Lerp::lerp(self.pos, pos + vel * 0.03, 10.0 * dt);
|
||||||
self.ori = Slerp::slerp(self.ori, ori, 7.5 * dt);
|
self.ori = Slerp::slerp(self.ori, ori, 5.0 * dt);
|
||||||
} else {
|
} else {
|
||||||
self.pos = pos;
|
self.pos = pos;
|
||||||
self.ori = ori;
|
self.ori = ori;
|
||||||
|
@ -65,7 +65,7 @@ impl Default for ControlSettings {
|
|||||||
jump: KeyMouse::Key(VirtualKeyCode::Space),
|
jump: KeyMouse::Key(VirtualKeyCode::Space),
|
||||||
sit: KeyMouse::Key(VirtualKeyCode::K),
|
sit: KeyMouse::Key(VirtualKeyCode::K),
|
||||||
glide: KeyMouse::Key(VirtualKeyCode::LShift),
|
glide: KeyMouse::Key(VirtualKeyCode::LShift),
|
||||||
climb: KeyMouse::Key(VirtualKeyCode::LShift),
|
climb: KeyMouse::Key(VirtualKeyCode::Space),
|
||||||
climb_down: KeyMouse::Key(VirtualKeyCode::LControl),
|
climb_down: KeyMouse::Key(VirtualKeyCode::LControl),
|
||||||
wall_leap: KeyMouse::Mouse(MouseButton::Middle),
|
wall_leap: KeyMouse::Mouse(MouseButton::Middle),
|
||||||
mount: KeyMouse::Key(VirtualKeyCode::F),
|
mount: KeyMouse::Key(VirtualKeyCode::F),
|
||||||
|
Loading…
Reference in New Issue
Block a user