Increased max loaded regions, need to reduce memory by dynamically allocating/deallocating memory for them

main
noah metz 2024-11-04 21:07:43 -07:00
parent edb587334a
commit c5d88f03d5
2 changed files with 5 additions and 2 deletions

@ -5,7 +5,7 @@
#define REGION_SIZE (10)
#define REGION_HEX_COUNT (3*REGION_SIZE*(REGION_SIZE-1)+1)
#define MAX_LOADED_REGIONS (25*25)
#define MAX_LOADED_REGIONS (51*51)
typedef struct GPUHexStruct {
float height[6];

@ -99,11 +99,14 @@ VkResult main_thread(ClientContext* context) {
0x0000FFFF,
};
context->hex->data.current_map = 0x01;
add_transfer(&context->hex->data.current_map, context->hex->context, offsetof(GPUHexContext, current_map), sizeof(uint32_t), context->render->current_frame, context->render);
uint32_t region = 0;
for(int32_t y = -2; y < 2; y++) {
for(int32_t q = -5; q < 5; q++) {
for(int32_t r = -5; r < 5; r++) {
VK_RESULT(set_hex_region(q, r, y, 0x00, &regions[region], context->hex, context->render));
VK_RESULT(set_hex_region(q, r, y, 0x01, &regions[region], context->hex, context->render));
for(uint32_t i = 0; i < REGION_HEX_COUNT; i++) {
for(uint32_t h = 0; h < 6; h++) {
regions[region]->data.hexes[i].color[h] = colors[(q+r+50) % (sizeof(colors)/sizeof(uint32_t))];