|
|
@ -122,18 +122,63 @@ VkResult main_thread(ClientContext* context) {
|
|
|
|
4*sizeof(uint32_t),
|
|
|
|
4*sizeof(uint32_t),
|
|
|
|
&context->render));
|
|
|
|
&context->render));
|
|
|
|
|
|
|
|
|
|
|
|
HexRegion* region;
|
|
|
|
HexRegion* regions[19];
|
|
|
|
VK_RESULT(create_hex_region(0, 0, ®ion, &context->hex, &context->render));
|
|
|
|
uint32_t colors[] = {
|
|
|
|
|
|
|
|
0xFF0000FF,
|
|
|
|
|
|
|
|
0x00FF00FF,
|
|
|
|
|
|
|
|
0x00FF00FF,
|
|
|
|
|
|
|
|
0x00FF00FF,
|
|
|
|
|
|
|
|
0x00FF00FF,
|
|
|
|
|
|
|
|
0x00FF00FF,
|
|
|
|
|
|
|
|
0x00FF00FF,
|
|
|
|
|
|
|
|
0x0000FFFF,
|
|
|
|
|
|
|
|
0x0000FFFF,
|
|
|
|
|
|
|
|
0x0000FFFF,
|
|
|
|
|
|
|
|
0x0000FFFF,
|
|
|
|
|
|
|
|
0x0000FFFF,
|
|
|
|
|
|
|
|
0x0000FFFF,
|
|
|
|
|
|
|
|
0x0000FFFF,
|
|
|
|
|
|
|
|
0x0000FFFF,
|
|
|
|
|
|
|
|
0x0000FFFF,
|
|
|
|
|
|
|
|
0x0000FFFF,
|
|
|
|
|
|
|
|
0x0000FFFF,
|
|
|
|
|
|
|
|
0x0000FFFF,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region( 0, 0, ®ions[0], &context->hex, &context->render));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region( 1, -1, ®ions[1], &context->hex, &context->render));
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region( 1, 0, ®ions[2], &context->hex, &context->render));
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region( 0, 1, ®ions[3], &context->hex, &context->render));
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region(-1, 1, ®ions[4], &context->hex, &context->render));
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region(-1, 0, ®ions[5], &context->hex, &context->render));
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region( 0, -1, ®ions[6], &context->hex, &context->render));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region( 0, -2, ®ions[7], &context->hex, &context->render));
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region( 1, -2, ®ions[8], &context->hex, &context->render));
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region( 2, -2, ®ions[9], &context->hex, &context->render));
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region( 2, -1, ®ions[10], &context->hex, &context->render));
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region( 2, 0, ®ions[11], &context->hex, &context->render));
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region( 1, 1, ®ions[12], &context->hex, &context->render));
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region( 0, 2, ®ions[13], &context->hex, &context->render));
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region(-1, 2, ®ions[14], &context->hex, &context->render));
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region(-2, 2, ®ions[15], &context->hex, &context->render));
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region(-2, 1, ®ions[16], &context->hex, &context->render));
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region(-2, 0, ®ions[17], &context->hex, &context->render));
|
|
|
|
|
|
|
|
VK_RESULT(create_hex_region(-1, -1, ®ions[18], &context->hex, &context->render));
|
|
|
|
GPUHex* temp_hexes = malloc(sizeof(GPUHex)*REGION_HEX_COUNT);
|
|
|
|
GPUHex* temp_hexes = malloc(sizeof(GPUHex)*REGION_HEX_COUNT);
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t colors[] = {0xFF0000FF, 0x00FF00FF, 0x0000FFFF};
|
|
|
|
for(uint32_t r = 0; r < sizeof(regions)/sizeof(HexRegion*); r++) {
|
|
|
|
for(uint32_t i = 0; i < REGION_HEX_COUNT; i++) {
|
|
|
|
for(uint32_t i = 0; i < REGION_HEX_COUNT; i++) {
|
|
|
|
for(uint32_t h = 0; h < 6; h++) {
|
|
|
|
for(uint32_t h = 0; h < 6; h++) {
|
|
|
|
temp_hexes[i].color[h] = colors[i%3];
|
|
|
|
temp_hexes[i].color[h] = colors[r % (sizeof(colors)/sizeof(uint32_t))];
|
|
|
|
temp_hexes[i].height[h] = 0;
|
|
|
|
temp_hexes[i].height[h] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
VK_RESULT(add_transfer(temp_hexes, region->region, offsetof(GPUHexRegion, hexes), sizeof(GPUHex)*REGION_HEX_COUNT, 0, &context->render));
|
|
|
|
VK_RESULT(add_transfer(temp_hexes, regions[r]->region, offsetof(GPUHexRegion, hexes), sizeof(GPUHex)*REGION_HEX_COUNT, 0, &context->render));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
free(temp_hexes);
|
|
|
|
free(temp_hexes);
|
|
|
|
|
|
|
|
|
|
|
|
context->position[0] = 0;
|
|
|
|
context->position[0] = 0;
|
|
|
@ -204,7 +249,7 @@ VkResult main_thread(ClientContext* context) {
|
|
|
|
camera[1] = context->position[1] + context->distance*sin(context->rotation[1]);
|
|
|
|
camera[1] = context->position[1] + context->distance*sin(context->rotation[1]);
|
|
|
|
camera[2] = context->position[2] + context->distance*cos(context->rotation[1])*sin(context->rotation[0]);
|
|
|
|
camera[2] = context->position[2] + context->distance*cos(context->rotation[1])*sin(context->rotation[0]);
|
|
|
|
glm_lookat(camera, context->position, up, context->hex.data.view);
|
|
|
|
glm_lookat(camera, context->position, up, context->hex.data.view);
|
|
|
|
add_transfer(&context->hex.data, context->hex.context, 0, 2*sizeof(mat4), 0, &context->render);
|
|
|
|
add_transfer(&context->hex.data, context->hex.context, 0, 2*sizeof(mat4), context->render.current_frame, &context->render);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(context->clicked_container != 0) {
|
|
|
|
if(context->clicked_container != 0) {
|
|
|
|