瀏覽代碼

Rename tile_cache_gl -> tile_atlas

Johannes Hofmann 8 年之前
父節點
當前提交
1abbe6393d
共有 3 個檔案被更改,包括 8 行新增8 行删除
  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 查看文件

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

+ 4
- 4
src/map_view_gl.rs 查看文件

@@ -8,7 +8,7 @@ use map_view::MapView;
8 8
 use program::Program;
9 9
 use texture::{Texture, TextureFormat};
10 10
 use tile_cache::TileCache;
11
-use tile_cache_gl::TileCacheGl;
11
+use tile_atlas::TileAtlas;
12 12
 use tile_source::TileSource;
13 13
 
14 14
 
@@ -20,7 +20,7 @@ pub struct MapViewGl<'a> {
20 20
     viewport_size: (u32, u32),
21 21
     map_view: MapView,
22 22
     tile_cache: TileCache,
23
-    tile_cache_gl: TileCacheGl<'a>,
23
+    tile_atlas: TileAtlas<'a>,
24 24
 }
25 25
 
26 26
 impl<'a> MapViewGl<'a> {
@@ -72,7 +72,7 @@ impl<'a> MapViewGl<'a> {
72 72
                 viewport_size: initial_size,
73 73
                 map_view: map_view,
74 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,7 +105,7 @@ impl<'a> MapViewGl<'a> {
105 105
 
106 106
         loop {
107 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 109
                     remainder,
110 110
                     max_tiles_to_use,
111 111
                     source,

src/tile_cache_gl.rs → src/tile_atlas.rs 查看文件

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