Skip to content

Commit

Permalink
Wha Wha Wha What's going on
Browse files Browse the repository at this point in the history
  • Loading branch information
grorp committed May 17, 2023
1 parent d5f6b91 commit 00eefb4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/gfx/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,10 @@ impl MapRender {
meshgen_threads.push(std::thread::spawn(move || {
let mut buffer_cap = 0;
let info = info.deref();
let mut nodes_by_name = HashMap::<String, NodeDef>::new();
for def in &info.nodes {
let mut nodes_by_name = HashMap::<String, u16>::new();
for (i, def) in info.nodes.iter().enumerate() {
if let Some(def) = def {
nodes_by_name.insert(def.name.clone(), *def.clone());
nodes_by_name.insert(def.name.clone(), i as u16);
} else {
break;
}
Expand Down
12 changes: 7 additions & 5 deletions src/gfx/map/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl MeshData {

pub(super) fn create_mesh(
mkinfo: &MeshgenInfo,
nodes_by_name: &HashMap<String, NodeDef>,
nodes_by_name: &HashMap<String, u16>,
settings: &MapRenderSettings,
_pos: Point3<i16>,
block: &MapBlock,
Expand Down Expand Up @@ -75,9 +75,7 @@ pub(super) fn create_mesh(
let pos: [i16; 3] = array(|i| ((index >> (4 * i)) & 0xf) as i16);

for (f, face) in CUBE.iter().enumerate() {
if draw_type == DrawType::Cube
|| draw_type == DrawType::Liquid
{
if draw_type == DrawType::Cube || draw_type == DrawType::Liquid {
let c = [1, 1, 0, 0, 2, 2][f];

let mut nblk = block;
Expand All @@ -101,7 +99,11 @@ pub(super) fn create_mesh(
DrawType::Cube => ndef.draw_type == DrawType::Cube,
DrawType::Liquid => {
// println!("alternate flowing name: {:?}", &ndef.flowing_alt);
let alternate = nodes_by_name.get(&ndef.flowing_alt);
let alt_id = nodes_by_name.get(&ndef.flowing_alt);
let mut alt_def = None;
if let Some(alt_id) = alt_id {
alt_def = Some(mkinfo.nodes.as_ref()[*alt_id as usize].as_ref().unwrap());
}
// println!("alternate flowing: {:?}", alternate);
ndef.draw_type == DrawType::Cube || ncontent == content
}
Expand Down

0 comments on commit 00eefb4

Please sign in to comment.