Browse Source

Rename tile_cache_gl -> tile_atlas

Johannes Hofmann 8 years ago
parent
commit
1abbe6393d
3 changed files with 8 additions and 8 deletions
  1. 1
    1
      src/main.rs
  2. 4
    4
      src/map_view_gl.rs
  3. 3
    3
      src/tile_atlas.rs

+ 1
- 1
src/main.rs View File

22
 mod texture;
22
 mod texture;
23
 mod tile;
23
 mod tile;
24
 mod tile_cache;
24
 mod tile_cache;
25
-mod tile_cache_gl;
25
+mod tile_atlas;
26
 mod tile_loader;
26
 mod tile_loader;
27
 mod tile_source;
27
 mod tile_source;
28
 
28
 

+ 4
- 4
src/map_view_gl.rs View File

8
 use program::Program;
8
 use program::Program;
9
 use texture::{Texture, TextureFormat};
9
 use texture::{Texture, TextureFormat};
10
 use tile_cache::TileCache;
10
 use tile_cache::TileCache;
11
-use tile_cache_gl::TileCacheGl;
11
+use tile_atlas::TileAtlas;
12
 use tile_source::TileSource;
12
 use tile_source::TileSource;
13
 
13
 
14
 
14
 
20
     viewport_size: (u32, u32),
20
     viewport_size: (u32, u32),
21
     map_view: MapView,
21
     map_view: MapView,
22
     tile_cache: TileCache,
22
     tile_cache: TileCache,
23
-    tile_cache_gl: TileCacheGl<'a>,
23
+    tile_atlas: TileAtlas<'a>,
24
 }
24
 }
25
 
25
 
26
 impl<'a> MapViewGl<'a> {
26
 impl<'a> MapViewGl<'a> {
72
                 viewport_size: initial_size,
72
                 viewport_size: initial_size,
73
                 map_view: map_view,
73
                 map_view: map_view,
74
                 tile_cache: TileCache::new(move |_tile| update_func(), use_network),
74
                 tile_cache: TileCache::new(move |_tile| update_func(), use_network),
75
-                tile_cache_gl: TileCacheGl::new(tex, 256),
75
+                tile_atlas: TileAtlas::new(tex, 256),
76
             }
76
             }
77
         }
77
         }
78
     }
78
     }
105
 
105
 
106
         loop {
106
         loop {
107
             let (textured_visible_tiles, remainder_opt, used_tiles) = {
107
             let (textured_visible_tiles, remainder_opt, used_tiles) = {
108
-                self.tile_cache_gl.textured_visible_tiles(
108
+                self.tile_atlas.textured_visible_tiles(
109
                     remainder,
109
                     remainder,
110
                     max_tiles_to_use,
110
                     max_tiles_to_use,
111
                     source,
111
                     source,

src/tile_cache_gl.rs → src/tile_atlas.rs View File

16
 }
16
 }
17
 
17
 
18
 #[derive(Clone, Debug)]
18
 #[derive(Clone, Debug)]
19
-pub struct TileCacheGl<'a> {
19
+pub struct TileAtlas<'a> {
20
     texture: Texture<'a>,
20
     texture: Texture<'a>,
21
     tile_size: u32,
21
     tile_size: u32,
22
     slots_lru: LinkedHashMap<CacheSlot, Option<Tile>>, // LRU cache of slots
22
     slots_lru: LinkedHashMap<CacheSlot, Option<Tile>>, // LRU cache of slots
23
     tile_to_slot: HashMap<Tile, CacheSlot>,
23
     tile_to_slot: HashMap<Tile, CacheSlot>,
24
 }
24
 }
25
 
25
 
26
-impl<'a> TileCacheGl<'a> {
26
+impl<'a> TileAtlas<'a> {
27
     pub fn new(tex: Texture<'a>, tile_size: u32) -> Self {
27
     pub fn new(tex: Texture<'a>, tile_size: u32) -> Self {
28
         let slots_x = tex.width() / tile_size;
28
         let slots_x = tex.width() / tile_size;
29
         let slots_y = tex.height() / tile_size;
29
         let slots_y = tex.height() / tile_size;
39
 
39
 
40
         slots_lru.remove(&Self::default_slot());
40
         slots_lru.remove(&Self::default_slot());
41
 
41
 
42
-        TileCacheGl {
42
+        TileAtlas {
43
             texture: tex,
43
             texture: tex,
44
             tile_size: tile_size,
44
             tile_size: tile_size,
45
             slots_lru: slots_lru,
45
             slots_lru: slots_lru,