Fixed world q/r calculation

main
noah metz 2024-11-17 20:07:28 -07:00
parent dc22aa586e
commit 02a7f37d44
2 changed files with 13 additions and 8 deletions

@ -58,14 +58,15 @@ void main() {
/* /*
vec2 hex_qr = start_coords[side]*radius + direction_coords[side]*(ring-(radius*side)); vec2 hex_qr = start_coords[side]*radius + direction_coords[side]*(ring-(radius*side));
vec2 world_qr = vec2(0, 0); vec2 world_qr = vec2(0, 0);
world_qr.x = hex_qr.x
+ region_qr.x*((region_size-1)*2 + 1.0)
+ region_qr.y*((region_size-1) + 0.0);
world_qr.y = hex_qr.y world_qr.y = hex_qr.y
- region_qr.x*(region_size + 0.5) - region_qr.x*((region_size-1) + 0.5)
- region_qr.y*(region_size*2 + 1.0); - region_qr.y*((region_size-1)*2 + 1.0);
world_qr.x = hex_qr.x color = vec4(world_qr/100, 0, 1);
+ region_qr.x*(region_size*2 + 1.0)
+ region_qr.y*(region_size + 0.0);
color = vec4(world_qr/100, 0, 1);
vec4 hex_pos = vec4(0, 0, 0, 1); vec4 hex_pos = vec4(0, 0, 0, 1);
hex_pos.x = x*hex_qr.x; hex_pos.x = x*hex_qr.x;

@ -958,8 +958,12 @@ VkResult update_hex_info_ui(ClientContext* context) {
int32_t hex_q = hex_starts_qr[side][0]*radius + hex_directions_qr[side][0]*(ring-(radius*side)); int32_t hex_q = hex_starts_qr[side][0]*radius + hex_directions_qr[side][0]*(ring-(radius*side));
int32_t hex_r = hex_starts_qr[side][1]*radius + hex_directions_qr[side][1]*(ring-(radius*side)); int32_t hex_r = hex_starts_qr[side][1]*radius + hex_directions_qr[side][1]*(ring-(radius*side));
int32_t world_q = hex_q + region->data.q*(REGION_SIZE*2 + 1) + region->data.r*REGION_SIZE; int32_t region_q = region->data.q*((REGION_SIZE-1)*2 + 1) + region->data.r*(REGION_SIZE-1);
int32_t world_r = hex_r + region->data.q*(REGION_SIZE + 0.5) + region->data.r*(REGION_SIZE*2+1);
int32_t region_r = region->data.q*((REGION_SIZE-1) + 0.5) + region->data.r*((REGION_SIZE-1)*2+1);
int32_t world_q = hex_q + region_q;
int32_t world_r = hex_r - region_r;
snprintf( snprintf(
temp, temp,