diff --git a/src/generate/heightmap.rs b/src/generate/heightmap.rs index 69412b5..d17065a 100644 --- a/src/generate/heightmap.rs +++ b/src/generate/heightmap.rs @@ -1,4 +1,4 @@ -use crate::{coordinates, terrain::raster::Raster}; +use crate::coordinates; use crate::mapfile::MapFile; use crate::terrain::quadtree::node::VNode; use crate::terrain::raster::{GlobalRaster, RasterCache}; @@ -6,10 +6,10 @@ use crate::terrain::tile_cache::{LayerParams, LayerType}; use anyhow::Error; use cgmath::Vector2; use crossbeam::channel::{self, Receiver, Sender}; -use futures::{Future, TryFutureExt, future::{self, BoxFuture, FutureExt}, stream::FuturesUnordered}; +use futures::{Future, future::{self, BoxFuture, FutureExt}}; use lru_cache::LruCache; use rayon::prelude::*; -use std::collections::{HashMap, HashSet}; +use std::collections::{HashMap}; use std::collections::VecDeque; use std::io::{Cursor, Read, Write}; use std::sync::{Arc, Weak}; diff --git a/src/terrain/quadtree/node.rs b/src/terrain/quadtree/node.rs index 4ee6b0e..9d6d452 100644 --- a/src/terrain/quadtree/node.rs +++ b/src/terrain/quadtree/node.rs @@ -132,12 +132,12 @@ impl VNode { fn cspace_to_fspace(cspace: Vector3) -> (u8, f64, f64) { let (face, x, y) = match (cspace.x, cspace.y, cspace.z) { - (1.0, a, b) => (0, a, -b), - (-1.0, a, b) => (1, -a, -b), - (a, 1.0, b) => (2, a, b), - (a, -1.0, b) => (3, -a, b), - (a, b, 1.0) => (4, a, -b), - (a, b, -1.0) => (5, -a, -b), + (unit, a, b) if unit == 1.0 => (0, a, -b), + (unit, a, b) if unit == -1.0 => (1, -a, -b), + (a, unit, b) if unit == 1.0 => (2, a, b), + (a, unit, b) if unit == -1.0 => (3, -a, b), + (a, b, unit) if unit == 1.0 => (4, a, -b), + (a, b, unit) if unit == -1.0 => (5, -a, -b), _ => panic!("Coordinate is not on unit cube surface"), };