mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
Resolve warnings
This commit is contained in:
parent
7fe9e82348
commit
ddc11c20e5
@ -1,6 +1,6 @@
|
||||
//! File which exposes all kinds of coordinates used throughout mapr
|
||||
|
||||
use crate::util::math::{div_away, div_ceil, div_floor};
|
||||
use crate::util::math::{div_away, div_floor};
|
||||
use cgmath::Point3;
|
||||
use std::fmt;
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
use crate::example::fetch_munich_tiles;
|
||||
use log::{error, info, trace};
|
||||
use winit::event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent};
|
||||
use winit::event_loop::{ControlFlow, EventLoop};
|
||||
@ -15,8 +14,6 @@ pub async fn setup(
|
||||
) {
|
||||
info!("== mapr ==");
|
||||
|
||||
/* fetch_munich_tiles(worker_loop.as_ref());
|
||||
*/
|
||||
let mut input = InputController::new(0.2, 100.0);
|
||||
let mut maybe_state: Option<RenderState> = if cfg!(target_os = "android") {
|
||||
None
|
||||
|
||||
@ -39,10 +39,10 @@ pub struct BufferPool<Q, B, V, I, M, FM> {
|
||||
|
||||
#[derive(Debug)]
|
||||
enum BackingBufferType {
|
||||
VERTICES,
|
||||
INDICES,
|
||||
METADATA,
|
||||
FEATURE_METADATA,
|
||||
Vertices,
|
||||
Indices,
|
||||
Metadata,
|
||||
FeatureMetadata,
|
||||
}
|
||||
|
||||
impl<Q: Queue<B>, B, V: bytemuck::Pod, I: bytemuck::Pod, M: bytemuck::Pod, FM: bytemuck::Pod>
|
||||
@ -58,22 +58,22 @@ impl<Q: Queue<B>, B, V: bytemuck::Pod, I: bytemuck::Pod, M: bytemuck::Pod, FM: b
|
||||
vertices: BackingBuffer::new(
|
||||
vertices.buffer,
|
||||
vertices.inner_size,
|
||||
BackingBufferType::VERTICES,
|
||||
BackingBufferType::Vertices,
|
||||
),
|
||||
indices: BackingBuffer::new(
|
||||
indices.buffer,
|
||||
indices.inner_size,
|
||||
BackingBufferType::INDICES,
|
||||
BackingBufferType::Indices,
|
||||
),
|
||||
metadata: BackingBuffer::new(
|
||||
metadata.buffer,
|
||||
metadata.inner_size,
|
||||
BackingBufferType::METADATA,
|
||||
BackingBufferType::Metadata,
|
||||
),
|
||||
feature_metadata: BackingBuffer::new(
|
||||
feature_metadata.buffer,
|
||||
feature_metadata.inner_size,
|
||||
BackingBufferType::FEATURE_METADATA,
|
||||
BackingBufferType::FeatureMetadata,
|
||||
),
|
||||
index: VecDeque::new(), // TODO: Approximate amount of buffers in pool
|
||||
phantom_v: Default::default(),
|
||||
@ -87,10 +87,10 @@ impl<Q: Queue<B>, B, V: bytemuck::Pod, I: bytemuck::Pod, M: bytemuck::Pod, FM: b
|
||||
#[cfg(test)]
|
||||
fn available_space(&self, typ: BackingBufferType) -> wgpu::BufferAddress {
|
||||
let gap = match typ {
|
||||
BackingBufferType::VERTICES => &self.vertices,
|
||||
BackingBufferType::INDICES => &self.indices,
|
||||
BackingBufferType::METADATA => &self.metadata,
|
||||
BackingBufferType::FEATURE_METADATA => &self.feature_metadata,
|
||||
BackingBufferType::Vertices => &self.vertices,
|
||||
BackingBufferType::Indices => &self.indices,
|
||||
BackingBufferType::Metadata => &self.metadata,
|
||||
BackingBufferType::FeatureMetadata => &self.feature_metadata,
|
||||
}
|
||||
.find_largest_gap(&self.index);
|
||||
|
||||
@ -268,16 +268,16 @@ impl<B> BackingBuffer<B> {
|
||||
|
||||
fn find_largest_gap(&self, index: &VecDeque<IndexEntry>) -> Range<wgpu::BufferAddress> {
|
||||
let start = index.front().map(|first| match self.typ {
|
||||
BackingBufferType::VERTICES => first.buffer_vertices.start,
|
||||
BackingBufferType::INDICES => first.buffer_indices.start,
|
||||
BackingBufferType::METADATA => first.buffer_metadata.start,
|
||||
BackingBufferType::FEATURE_METADATA => first.buffer_feature_metadata.start,
|
||||
BackingBufferType::Vertices => first.buffer_vertices.start,
|
||||
BackingBufferType::Indices => first.buffer_indices.start,
|
||||
BackingBufferType::Metadata => first.buffer_metadata.start,
|
||||
BackingBufferType::FeatureMetadata => first.buffer_feature_metadata.start,
|
||||
});
|
||||
let end = index.back().map(|first| match self.typ {
|
||||
BackingBufferType::VERTICES => first.buffer_vertices.end,
|
||||
BackingBufferType::INDICES => first.buffer_indices.end,
|
||||
BackingBufferType::METADATA => first.buffer_metadata.end,
|
||||
BackingBufferType::FEATURE_METADATA => first.buffer_feature_metadata.end,
|
||||
BackingBufferType::Vertices => first.buffer_vertices.end,
|
||||
BackingBufferType::Indices => first.buffer_indices.end,
|
||||
BackingBufferType::Metadata => first.buffer_metadata.end,
|
||||
BackingBufferType::FeatureMetadata => first.buffer_feature_metadata.end,
|
||||
});
|
||||
|
||||
if let Some(start) = start {
|
||||
@ -410,31 +410,31 @@ mod tests {
|
||||
}
|
||||
assert_eq!(
|
||||
128 - 2 * 48,
|
||||
pool.available_space(BackingBufferType::VERTICES)
|
||||
pool.available_space(BackingBufferType::Vertices)
|
||||
);
|
||||
|
||||
pool.allocate_geometry(&queue, (0, 0, 0).into(), &data24bytes_aligned, 2, &vec![]);
|
||||
assert_eq!(
|
||||
128 - 2 * 48 - 24,
|
||||
pool.available_space(BackingBufferType::VERTICES)
|
||||
pool.available_space(BackingBufferType::Vertices)
|
||||
);
|
||||
println!("{:?}", &pool.index);
|
||||
|
||||
pool.allocate_geometry(&queue, (0, 0, 0).into(), &data24bytes_aligned, 2, &vec![]);
|
||||
// appended now at the beginning
|
||||
println!("{:?}", &pool.index);
|
||||
assert_eq!(24, pool.available_space(BackingBufferType::VERTICES));
|
||||
assert_eq!(24, pool.available_space(BackingBufferType::Vertices));
|
||||
|
||||
pool.allocate_geometry(&queue, (0, 0, 0).into(), &data24bytes_aligned, 2, &vec![]);
|
||||
println!("{:?}", &pool.index);
|
||||
assert_eq!(0, pool.available_space(BackingBufferType::VERTICES));
|
||||
assert_eq!(0, pool.available_space(BackingBufferType::Vertices));
|
||||
|
||||
pool.allocate_geometry(&queue, (0, 0, 0).into(), &data24bytes_aligned, 2, &vec![]);
|
||||
println!("{:?}", &pool.index);
|
||||
assert_eq!(24, pool.available_space(BackingBufferType::VERTICES));
|
||||
assert_eq!(24, pool.available_space(BackingBufferType::Vertices));
|
||||
|
||||
pool.allocate_geometry(&queue, (0, 0, 0).into(), &data24bytes_aligned, 2, &vec![]);
|
||||
println!("{:?}", &pool.index);
|
||||
assert_eq!(0, pool.available_space(BackingBufferType::VERTICES));
|
||||
assert_eq!(0, pool.available_space(BackingBufferType::Vertices));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use cgmath::{Point3, Vector3};
|
||||
use cgmath::Point3;
|
||||
use std::default::Default;
|
||||
use std::{cmp, iter};
|
||||
|
||||
@ -377,17 +377,6 @@ impl RenderState {
|
||||
let world_coords = layer.coords.into_world_tile();
|
||||
self.tile_mask_pattern.update_bounds(&world_coords);
|
||||
|
||||
/*match tile.layer_data.name() {
|
||||
"transportation" => {}
|
||||
"building" => {}
|
||||
"boundary" => {}
|
||||
"water" => {}
|
||||
"waterway" => {}
|
||||
_ => {
|
||||
continue;
|
||||
}
|
||||
};*/
|
||||
|
||||
let feature_metadata = layer
|
||||
.layer_data
|
||||
.features()
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
use crate::platform::Instant;
|
||||
use log::trace;
|
||||
|
||||
pub struct TimeMeasure {
|
||||
now: Instant,
|
||||
}
|
||||
|
||||
impl TimeMeasure {
|
||||
pub fn time() -> Self {
|
||||
Self {
|
||||
now: Instant::now(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn breadcrumb(&mut self, name: &'static str) {
|
||||
trace!(
|
||||
"Measurement \"{}\": {}ms",
|
||||
name,
|
||||
self.now.elapsed().as_millis()
|
||||
);
|
||||
self.now = Instant::now();
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for TimeMeasure {
|
||||
fn drop(&mut self) {
|
||||
self.breadcrumb("Drop");
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,5 @@
|
||||
|
||||
mod fps_meter;
|
||||
pub mod math;
|
||||
mod measure;
|
||||
|
||||
pub use fps_meter::FPSMeter;
|
||||
pub use measure::TimeMeasure;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user