mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Increased block rendering altitude range
This commit is contained in:
parent
32d2274caf
commit
568a8ab87c
@ -18,12 +18,10 @@ flat out vec3 f_norm;
|
||||
out vec3 f_col;
|
||||
out float f_light;
|
||||
|
||||
const float EXTRA_NEG_Z = 65536.0;
|
||||
|
||||
void main() {
|
||||
f_pos = vec3(
|
||||
float((v_pos_norm >> 0) & 0x00FFu),
|
||||
float((v_pos_norm >> 8) & 0x00FFu),
|
||||
float((v_pos_norm >> 16) & 0x1FFFu)
|
||||
) + model_offs;
|
||||
f_pos = vec3((uvec3(v_pos_norm) >> uvec3(0, 6, 12)) & uvec3(0x3Fu, 0x3Fu, 0x1FFFFu)) - vec3(0, 0, EXTRA_NEG_Z) + model_offs;
|
||||
f_pos.z *= min(1.0001 - 0.02 / pow(tick.x - load_time, 10.0), 1.0);
|
||||
f_pos.z -= 25.0 * pow(distance(focus_pos.xy, f_pos.xy) / view_distance.x, 20.0);
|
||||
|
||||
|
@ -17,8 +17,10 @@ flat out uint f_pos_norm;
|
||||
out vec3 f_col;
|
||||
out float f_light;
|
||||
|
||||
const float EXTRA_NEG_Z = 65536.0;
|
||||
|
||||
void main() {
|
||||
f_pos = vec3((uvec3(v_pos_norm) >> uvec3(0, 8, 16)) & uvec3(0xFFu, 0xFFu, 0x1FFFu)) + model_offs;
|
||||
f_pos = vec3((uvec3(v_pos_norm) >> uvec3(0, 6, 12)) & uvec3(0x3Fu, 0x3Fu, 0x1FFFFu)) - vec3(0, 0, EXTRA_NEG_Z) + model_offs;
|
||||
|
||||
f_pos.z *= min(1.0001 - 0.02 / pow(tick.x - load_time, 10.0), 1.0);
|
||||
f_pos.z -= 25.0 * pow(distance(focus_pos.xy, f_pos.xy) / view_distance.x, 20.0);
|
||||
|
@ -40,14 +40,16 @@ impl Vertex {
|
||||
.enumerate()
|
||||
.find(|(_i, e)| **e != 0.0)
|
||||
.unwrap_or((0, &1.0));
|
||||
let norm_bits = (norm_axis << 1) | if *norm_dir > 0.0 { 1 } else { 0 };
|
||||
let norm_bits = ((norm_axis << 1) | if *norm_dir > 0.0 { 1 } else { 0 }) as u32;
|
||||
|
||||
const EXTRA_NEG_Z: f32 = 65536.0;
|
||||
|
||||
Self {
|
||||
pos_norm: 0
|
||||
| ((pos.x as u32) & 0x00FF) << 0
|
||||
| ((pos.y as u32) & 0x00FF) << 8
|
||||
| ((pos.z.max(0.0).min((1 << 13) as f32) as u32) & 0x1FFF) << 16
|
||||
| ((norm_bits as u32) & 0x7) << 29,
|
||||
| ((pos.x as u32) & 0x003F) << 0
|
||||
| ((pos.y as u32) & 0x003F) << 6
|
||||
| (((pos.z + EXTRA_NEG_Z).max(0.0).min((1 << 17) as f32) as u32) & 0x1FFFF) << 12
|
||||
| (norm_bits & 0x7) << 29,
|
||||
col_light: 0
|
||||
| ((col.r.mul(200.0) as u32) & 0xFF) << 8
|
||||
| ((col.g.mul(200.0) as u32) & 0xFF) << 16
|
||||
|
@ -38,11 +38,13 @@ gfx_defines! {
|
||||
|
||||
impl Vertex {
|
||||
pub fn new(norm_bits: u32, light: u32, pos: Vec3<f32>, col: Rgb<f32>) -> Self {
|
||||
const EXTRA_NEG_Z: f32 = 65536.0;
|
||||
|
||||
Self {
|
||||
pos_norm: 0
|
||||
| ((pos.x as u32) & 0x00FF) << 0
|
||||
| ((pos.y as u32) & 0x00FF) << 8
|
||||
| ((pos.z.max(0.0).min((1 << 13) as f32) as u32) & 0x1FFF) << 16
|
||||
| ((pos.x as u32) & 0x003F) << 0
|
||||
| ((pos.y as u32) & 0x003F) << 6
|
||||
| (((pos + EXTRA_NEG_Z).z.max(0.0).min((1 << 17) as f32) as u32) & 0xFFFFF) << 12
|
||||
| (norm_bits & 0x7) << 29,
|
||||
col_light: 0
|
||||
| ((col.r.mul(255.0) as u32) & 0xFF) << 8
|
||||
|
@ -184,7 +184,7 @@ impl Archetype for House {
|
||||
return if profile.y == foundation_height + 1 {
|
||||
fire
|
||||
} else {
|
||||
internal
|
||||
internal.with_priority(foundation_layer)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -504,7 +504,7 @@ impl Settlement {
|
||||
for z in inset - depth..inset {
|
||||
vol.set(
|
||||
Vec3::new(offs.x, offs.y, surface_z + z),
|
||||
if bridge_offset >= 2.0 && dist >= 2.5 || z < inset - 1 {
|
||||
if bridge_offset >= 2.0 && dist >= 3.0 || z < inset - 1 {
|
||||
Block::new(BlockKind::Normal, noisy_color(Rgb::new(80, 80, 100), 8))
|
||||
} else {
|
||||
Block::new(BlockKind::Normal, noisy_color(Rgb::new(80, 50, 30), 8))
|
||||
@ -542,8 +542,8 @@ impl Settlement {
|
||||
|
||||
let roll = |seed, n| self.noise.get(Vec3::new(wpos2d.x, wpos2d.y, seed * 5)) % n;
|
||||
|
||||
let dirt = Rgb::new(80, 55, 35).map(|e| e + (self.noise.get(Vec3::broadcast((seed % 4096 + 0) as i32)) % 8) as u8);
|
||||
let mound = Rgb::new(100, 130, 40).map(|e| e + roll(0, 8) as u8).map(|e| e + (self.noise.get(Vec3::broadcast((seed % 4096 + 1) as i32)) % 8) as u8);
|
||||
let dirt = Rgb::new(80, 55, 35).map(|e| e + (self.noise.get(Vec3::broadcast((seed % 4096 + 0) as i32)) % 32) as u8);
|
||||
let mound = Rgb::new(70, 80, 30).map(|e| e + roll(0, 8) as u8).map(|e| e + (self.noise.get(Vec3::broadcast((seed % 4096 + 1) as i32)) % 32) as u8);
|
||||
|
||||
if in_furrow {
|
||||
if roll(0, 5) == 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user