Added giant trees to LoD

This commit is contained in:
Joshua Barretto 2022-05-10 20:30:48 +01:00
parent d4fd9d2d0e
commit 907ba3dcbc
4 changed files with 32 additions and 0 deletions

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

Binary file not shown.

View File

@ -19,6 +19,7 @@ pub enum ObjectKind {
Oak,
Pine,
House,
GiantTree,
}
#[derive(Clone, Debug, Serialize, Deserialize)]

View File

@ -64,6 +64,10 @@ impl Lod {
(lod::ObjectKind::Oak, make_lod_object("oak", renderer)),
(lod::ObjectKind::Pine, make_lod_object("pine", renderer)),
(lod::ObjectKind::House, make_lod_object("house", renderer)),
(
lod::ObjectKind::GiantTree,
make_lod_object("giant_tree", renderer),
),
]
.into_iter()
.collect(),
@ -119,6 +123,7 @@ impl Lod {
lod::ObjectKind::Pine => Rgb::new(0, 25, 12),
lod::ObjectKind::Oak => Rgb::new(13, 50, 5),
lod::ObjectKind::House => Rgb::new(20, 15, 0),
lod::ObjectKind::GiantTree => Rgb::new(13, 50, 5),
};
objects
.entry(object.kind)

View File

@ -543,6 +543,29 @@ impl World {
}),
);
// Add giant trees
objects.extend(
index
.sites
.iter()
.filter(|(_, site)| {
site.get_origin()
.map2(min_wpos.zip(max_wpos), |e, (min, max)| e >= min && e < max)
.reduce_and()
})
.filter(|(_, site)| matches!(&site.kind, SiteKind::GiantTree(_)))
.map(|(_, site)| lod::Object {
kind: lod::ObjectKind::GiantTree,
pos: {
let wpos2d = site.get_origin();
(wpos2d - min_wpos)
.map(|e| e as i16)
.with_z(self.sim().get_alt_approx(wpos2d).unwrap_or(0.0) as i16)
},
flags: lod::Flags::empty(),
}),
);
lod::Zone { objects }
}
}