Better LoD giant trees

This commit is contained in:
Joshua Barretto 2023-10-17 16:14:09 +01:00
parent ba763f2da5
commit 321cc030ad
4 changed files with 12 additions and 5 deletions

BIN
assets/voxygen/lod/giant_tree.obj (Stored with Git LFS)

Binary file not shown.

View File

@ -26,6 +26,7 @@ layout(location = 4) flat in uint f_flags;
const uint FLAG_SNOW_COVERED = 1;
const uint FLAG_IS_BUILDING = 2;
const uint FLAG_IS_GIANT_TREE = 4;
layout(location = 0) out vec4 tgt_color;
layout(location = 1) out uvec4 tgt_mat;
@ -76,7 +77,11 @@ void main() {
vec3 k_s = vec3(R_s);
// Tree trunks
if ((f_flags & FLAG_IS_GIANT_TREE) > 0u) {
if (dot(abs(model_pos.xyz) * vec3(1.0, 1.0, 2.0), vec3(1)) < 430.0) { surf_color = vec3(0.05, 0.02, 0.0); }
} else {
if (model_pos.z < 25.0 && dot(abs(model_pos.xy), vec2(1)) < 6.0) { surf_color = vec3(0.05, 0.02, 0.0); }
}
vec3 voxel_norm = f_norm;
float my_alt = f_pos.z + focus_off.z;

View File

@ -11,6 +11,7 @@ bitflags::bitflags! {
pub struct Flags: u8 {
const SNOW_COVERED = 0b00000001;
const IS_BUILDING = 0b00000010;
const IS_GIANT_TREE = 0b00000100;
}
}

View File

@ -678,6 +678,7 @@ impl World {
.with_z(self.sim().get_alt_approx(wpos2d).unwrap_or(0.0) as i16)
},
flags: lod::Flags::empty()
| lod::Flags::IS_GIANT_TREE
| if col.snow_cover {
lod::Flags::SNOW_COVERED
} else {