the problem child continues
Some checks failed
build and test / wxbox - latest (push) Failing after 39m52s
Verify Latest Dependencies / Verify Latest Dependencies (push) Successful in 40m17s

This commit is contained in:
core 2025-03-08 16:46:21 -05:00
parent ca89a8d15d
commit 17a1d95e7c
Signed by: core
GPG key ID: FDBF740DADDCEECF
5 changed files with 12 additions and 13 deletions

View file

@ -94,7 +94,7 @@
}
}
</style>
<link rel="modulepreload" href="/wxbox-client-28b62034c6896d47.js" crossorigin="anonymous" integrity="sha384-wkhAe67T8C73+DmlG8JEq34RPAIiO8Jf+d3BH/nrBQ1b1NjMqo8csITaVtpbPBwV"><link rel="preload" href="/wxbox-client-28b62034c6896d47_bg.wasm" crossorigin="anonymous" integrity="sha384-ow0yiVvZiDW6OWF6cYTSzuFo0LI6DMGTWCGFs9WoiJRhnge0QYDzOmr02jBTPGqk" as="fetch" type="application/wasm"></head>
<link rel="modulepreload" href="/wxbox-client-2aa7e8d0a7ce87a0.js" crossorigin="anonymous" integrity="sha384-wkhAe67T8C73+DmlG8JEq34RPAIiO8Jf+d3BH/nrBQ1b1NjMqo8csITaVtpbPBwV"><link rel="preload" href="/wxbox-client-2aa7e8d0a7ce87a0_bg.wasm" crossorigin="anonymous" integrity="sha384-ktNNMM2Y7MpHin8ahouTcp3Hi86z/aHl3k0MF4B0UPIib8zY3d+HWLstQnSOh8yT" as="fetch" type="application/wasm"></head>
<body>
<!-- The WASM code will resize the canvas dynamically -->
@ -111,8 +111,8 @@
<script type="module">
import init, * as bindings from '/wxbox-client-28b62034c6896d47.js';
const wasm = await init({ module_or_path: '/wxbox-client-28b62034c6896d47_bg.wasm' });
import init, * as bindings from '/wxbox-client-2aa7e8d0a7ce87a0.js';
const wasm = await init({ module_or_path: '/wxbox-client-2aa7e8d0a7ce87a0_bg.wasm' });
window.wasmBindings = bindings;

View file

@ -73,6 +73,7 @@ impl Map {
fn load_tiles(&mut self, ctx: &egui::Context, viewport_width: usize, viewport_height: usize) -> Tileset {
// lat, long is top left
// tiles are rendered at 256x256. how many can we fit?
debug!("viewport is {}px, we can render {}", viewport_width, viewport_width / 256);
let tiles_x = viewport_width / 256;
let tiles_y = viewport_height / 256;
@ -106,17 +107,16 @@ impl Map {
// for each tile, determine pixel coordinates, then offset by the tile fractionals
for x in 1..tiles_x {
let tile_x = tilex + x;
for y in 1..3 {
for y in 1..tiles_y+1 {
let tile_y = tiley + y;
let pixel_x = 512_f32 * x as f32;
let pixel_y = (-512_f32 * y as f32);
let pixel_x = 256_f32 * x as f32 - x_tile_frac as f32;
let pixel_y = -256_f32 * y as f32 + y_tile_frac as f32;
// download the tile
let tile = self.layer_manager.tiles.entry((z_clamped as usize, tile_x, tile_y, OSMBaselayer::SOURCE_ID))
.or_insert_with(|| {
debug!("fetching {}/{}/{}", z_clamped, tile_x, tile_y);
let (sender, promise) = Promise::new();
let request = ehttp::Request::get(format!("https://tile.openstreetmap.org/{}/{tile_x}/{tile_y}.png", z_clamped as usize));
let ctx = ctx.clone();

View file

@ -122,9 +122,9 @@ impl MapRender {
let verticies: &[f32] = &[
// X Y Z S T
1.0, 1.0, 0.0, 1.0, 1.0, // top right
1.0, -1.0, 0.0, 1.0, 0.0, // bottom right
-1.0, -1.0, 0.0, 0.0, 0.0, // bottom left
-1.0, 1.0, 0.0, 0.0, 1.0, // top left
1.0, 0.0, 0.0, 1.0, 0.0, // bottom right
0.0, 0.0, 0.0, 0.0, 0.0, // bottom left
0.0, 1.0, 0.0, 0.0, 1.0, // top left
];
let indicies: &[u32] = &[
0, 1, 3,
@ -185,12 +185,11 @@ impl MapRender {
gl.use_program(Some(self.shader_program));
debug!("{} {}", tile.x, tile.y);
let w = 256.0_f32;
let h = 256.0_f32;
let x = (tile.x + w) / width - 1.0;
let y = (tile.y - h) / width + 1.0;
let x = (tile.x) / width - 1.0;
let y = (tile.y) / width + 1.0;
let transform = nalgebra_glm::translate(&nalgebra_glm::Mat4::identity(), &nalgebra_glm::vec3(x, y, 0.0));