mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
Rename to cache
This commit is contained in:
parent
8c99a58fca
commit
cb47623caf
@ -1,4 +1,4 @@
|
||||
use mapr::io::pool::Pool;
|
||||
use mapr::io::cache::Cache;
|
||||
use mapr::main_loop;
|
||||
use winit::event_loop::EventLoop;
|
||||
use winit::window::WindowBuilder;
|
||||
@ -12,12 +12,12 @@ fn main() {
|
||||
.build(&event_loop)
|
||||
.unwrap();
|
||||
|
||||
let io_tile_pool = Pool::new();
|
||||
let main_tile_pool = io_tile_pool.clone();
|
||||
let cache_io = Cache::new();
|
||||
let cache_main = cache_io.clone();
|
||||
|
||||
std::thread::spawn(move || {
|
||||
io_tile_pool.run_loop();
|
||||
cache_io.run_loop();
|
||||
});
|
||||
|
||||
pollster::block_on(main_loop::setup(window, event_loop, main_tile_pool));
|
||||
pollster::block_on(main_loop::setup(window, event_loop, cache_main));
|
||||
}
|
||||
|
||||
@ -19,12 +19,12 @@ pub struct TesselatedTile {
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Pool {
|
||||
pub struct Cache {
|
||||
requests: Arc<WorkQueue<TileCoords>>,
|
||||
responses: Arc<WorkQueue<TesselatedTile>>,
|
||||
}
|
||||
|
||||
impl Pool {
|
||||
impl Cache {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
requests: Arc::new(WorkQueue::new()),
|
||||
@ -1,4 +1,4 @@
|
||||
pub mod pool;
|
||||
pub mod cache;
|
||||
pub mod static_database;
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
|
||||
@ -3,16 +3,16 @@ use winit::event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEve
|
||||
use winit::event_loop::{ControlFlow, EventLoop};
|
||||
|
||||
use crate::input::InputHandler;
|
||||
use crate::io::pool::Pool;
|
||||
use crate::io::cache::Cache;
|
||||
use crate::platform::Instant;
|
||||
use crate::render::state::State;
|
||||
|
||||
pub async fn setup(window: winit::window::Window, event_loop: EventLoop<()>, pool: Pool) {
|
||||
pub async fn setup(window: winit::window::Window, event_loop: EventLoop<()>, cache: Cache) {
|
||||
info!("== mapr ==");
|
||||
|
||||
for x in 0..2 {
|
||||
for y in 0..2 {
|
||||
pool.fetch((2179 + x, 1421 + y, 12).into())
|
||||
cache.fetch((2179 + x, 1421 + y, 12).into())
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ pub async fn setup(window: winit::window::Window, event_loop: EventLoop<()>, poo
|
||||
let dt = now - last_render_time;
|
||||
last_render_time = now;
|
||||
input.update_state(&mut state, dt);
|
||||
state.update(&pool);
|
||||
state.update(&cache);
|
||||
match state.render() {
|
||||
Ok(_) => {}
|
||||
// Reconfigure the surface if lost
|
||||
|
||||
@ -15,7 +15,7 @@ use winit::window::Window;
|
||||
use vector_tile::parse_tile_reader;
|
||||
|
||||
use crate::fps_meter::FPSMeter;
|
||||
use crate::io::pool::Pool;
|
||||
use crate::io::cache::Cache;
|
||||
use crate::io::static_database;
|
||||
use crate::platform::{COLOR_TEXTURE_FORMAT, MIN_BUFFER_SIZE};
|
||||
use crate::render::buffer_pool::{BackingBufferDescriptor, BufferPool};
|
||||
@ -425,8 +425,8 @@ impl State {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update(&mut self, pool: &Pool) {
|
||||
for tile in pool.pop_all().iter() {
|
||||
pub fn update(&mut self, cache: &Cache) {
|
||||
for tile in cache.pop_all().iter() {
|
||||
self.buffer_pool
|
||||
.allocate_geometry(&self.queue, tile.coords, &tile.geometry);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user