|
|
@@ -126,9 +126,9 @@ impl OrthograficView {
|
|
126
|
126
|
//TODO Add a little safety margin since the rendered globe is not a perfect sphere and its
|
|
127
|
127
|
// screen area is underestimated by the tesselation.
|
|
128
|
128
|
let sphere_diameter = 2.0f64.powf(map_view.zoom) *
|
|
129
|
|
- (f64::consts::FRAC_1_PI * map_view.tile_size as f64);
|
|
|
129
|
+ (f64::consts::FRAC_1_PI * f64::from(map_view.tile_size));
|
|
130
|
130
|
|
|
131
|
|
- return map_view.width.hypot(map_view.height) < sphere_diameter;
|
|
|
131
|
+ map_view.width.hypot(map_view.height) < sphere_diameter
|
|
132
|
132
|
}
|
|
133
|
133
|
|
|
134
|
134
|
/// Returns the tile zoom value that is used for rendering with the current zoom.
|
|
|
@@ -175,9 +175,9 @@ impl OrthograficView {
|
|
175
|
175
|
|
|
176
|
176
|
if vertices.iter().all(|v| v.z > 0.0) {
|
|
177
|
177
|
// Tile is on the backside of the sphere
|
|
178
|
|
- return false;
|
|
|
178
|
+ false
|
|
179
|
179
|
} else {
|
|
180
|
|
- return vertices.iter().any(&point_on_screen);
|
|
|
180
|
+ vertices.iter().any(&point_on_screen)
|
|
181
|
181
|
}
|
|
182
|
182
|
};
|
|
183
|
183
|
|
|
|
@@ -192,25 +192,18 @@ impl OrthograficView {
|
|
192
|
192
|
|
|
193
|
193
|
let mut neighbors = Vec::with_capacity(4);
|
|
194
|
194
|
|
|
195
|
|
- loop {
|
|
196
|
|
- if let Some(tn) = stack.pop() {
|
|
197
|
|
- match tn {
|
|
198
|
|
- TileNeighbor::Coord(tc) => {
|
|
199
|
|
- if tile_is_visible(tc) {
|
|
200
|
|
- tiles.push(tc.into());
|
|
201
|
|
- tile_neighbors(tc, &mut neighbors);
|
|
202
|
|
- for tn in &neighbors {
|
|
203
|
|
- if !visited.contains(tn) {
|
|
204
|
|
- visited.insert(*tn);
|
|
205
|
|
- stack.push(*tn);
|
|
206
|
|
- }
|
|
207
|
|
- }
|
|
|
195
|
+ while let Some(tn) = stack.pop() {
|
|
|
196
|
+ if let TileNeighbor::Coord(tc) = tn {
|
|
|
197
|
+ if tile_is_visible(tc) {
|
|
|
198
|
+ tiles.push(tc.into());
|
|
|
199
|
+ tile_neighbors(tc, &mut neighbors);
|
|
|
200
|
+ for tn in &neighbors {
|
|
|
201
|
+ if !visited.contains(tn) {
|
|
|
202
|
+ visited.insert(*tn);
|
|
|
203
|
+ stack.push(*tn);
|
|
208
|
204
|
}
|
|
209
|
|
- },
|
|
210
|
|
- _ => {},
|
|
|
205
|
+ }
|
|
211
|
206
|
}
|
|
212
|
|
- } else {
|
|
213
|
|
- break;
|
|
214
|
207
|
}
|
|
215
|
208
|
}
|
|
216
|
209
|
|
|
|
@@ -218,7 +211,7 @@ impl OrthograficView {
|
|
218
|
211
|
}
|
|
219
|
212
|
|
|
220
|
213
|
pub fn radius_physical_pixels(map_view: &MapView) -> f64 {
|
|
221
|
|
- 2.0f64.powf(map_view.zoom) * (FRAC_1_PI * map_view.tile_size as f64)
|
|
|
214
|
+ 2.0f64.powf(map_view.zoom) * (FRAC_1_PI * f64::from(map_view.tile_size))
|
|
222
|
215
|
}
|
|
223
|
216
|
|
|
224
|
217
|
pub fn transformation_matrix(map_view: &MapView) -> Matrix3<f64> {
|
|
|
@@ -257,9 +250,10 @@ impl OrthograficView {
|
|
257
|
250
|
)
|
|
258
|
251
|
};
|
|
259
|
252
|
|
|
260
|
|
- let transform = Transform::<Point3<f64>>::concat(&rot_mat_y, &rot_mat_x);
|
|
261
|
|
- let transform = Transform::<Point3<f64>>::concat(&scale_mat, &transform);
|
|
262
|
|
- transform
|
|
|
253
|
+ Transform::<Point3<f64>>::concat(
|
|
|
254
|
+ &scale_mat,
|
|
|
255
|
+ &Transform::<Point3<f64>>::concat(&rot_mat_y, &rot_mat_x)
|
|
|
256
|
+ )
|
|
263
|
257
|
}
|
|
264
|
258
|
}
|
|
265
|
259
|
|