Skip to content

Commit

Permalink
Tile limit + 0.5 to fill gaps
Browse files Browse the repository at this point in the history
Error from previous merge corrected: format parameter puzzled
Some formating and debug!
  • Loading branch information
-karlos- committed Nov 30, 2023
1 parent 4b42009 commit 31be85d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/http_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl AssetReader for HttpAssetReader {
let cache_path = self.cache_path.as_ref().map(|p| p.join(path));
// Load from cache if the asset exists there.
if let Some(cache_path) = &cache_path {
info!("READ: {:?}", path);
debug!("READ: {:?}",path);
if cache_path.exists() {
let file = File::open(&cache_path).await?;
return Ok(Box::new(file) as Box<Reader>);
Expand All @@ -56,7 +56,7 @@ impl AssetReader for HttpAssetReader {
let (x, rest) = path.split_once('_').unwrap();
// The tile servers we're using have their files gzipped, so we download that and unzip it
// transparently and act as if there's a .glb file there.
let path = format!("{}lod1/{}/{x}/{rest}.gz", TILE_ZOOM, self.base_url);
let path = format!("{}lod1/{}/{x}/{rest}.gz", self.base_url, TILE_ZOOM);
let mut bytes_compressed = Vec::new();
bevy_web_asset::WebAssetReader::Https
.read(Path::new(&path))
Expand All @@ -78,7 +78,7 @@ impl AssetReader for HttpAssetReader {
if let Some(cache_path) = cache_path {
// Write asset to cache, but ensure only one HttpAssetReader writes at any given point in time
if self.sync.write().unwrap().insert(cache_path.clone()) {
debug!("write: {:?}", path);
debug!("write: {path}");
async_fs::create_dir_all(cache_path.parent().unwrap()).await?;
async_fs::write(cache_path, &bytes).await?;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ fn load_next_tile(

let origin = GeoPos::from_cartesian(pos - transform.translation);
let tile_size = origin.tile_size(TILE_ZOOM);
let radius = sky.scale.x / tile_size;
let radius = sky.scale.x / tile_size + 0.5;
let origin = origin.to_tile_coordinates(TILE_ZOOM);

tilemap.load_next(
Expand Down
2 changes: 1 addition & 1 deletion src/tilemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl TileMap {
let oob = offset.length_squared() > radius.length_squared();
if oob {
if let Some(entity) = commands.get_entity(*tile) {
debug!("despawn: {}/{}", x, y);
debug!("despawn: {x}/{y}");
entity.despawn_recursive();
}
}
Expand Down

0 comments on commit 31be85d

Please sign in to comment.