roleplay/client/include/hex.h

67 lines
1.2 KiB
C

#ifndef HEX_H
#define HEX_H
#include "gpu.h"
#define REGION_SIZE 6
2024-11-01 17:34:41 -06:00
#define REGION_HEX_COUNT (3*REGION_SIZE*(REGION_SIZE-1)+1)
#define MAX_LOADED_REGIONS 100
2024-10-30 21:24:03 -06:00
2024-11-01 17:34:41 -06:00
typedef struct GPUHexStruct {
float height[6];
uint32_t color[6];
} GPUHex;
typedef struct GPUHexRegionStruct {
uint32_t q;
uint32_t r;
GPUHex hexes[REGION_HEX_COUNT];
} GPUHexRegion;
typedef struct HexRegionStruct {
uint32_t q;
uint32_t r;
VkDeviceAddress address;
VkBuffer region;
VmaAllocation region_memory;
} HexRegion;
typedef struct GPUHexContextStruct {
mat4 proj;
mat4 view;
2024-11-01 17:34:41 -06:00
VkDeviceAddress regions[MAX_LOADED_REGIONS];
} GPUHexContext;
typedef struct HexContextStruct {
VkDeviceAddress address;
VkBuffer context;
VmaAllocation context_memory;
GraphicsPipeline graphics;
ComputePipeline compute;
2024-11-01 17:34:41 -06:00
HexRegion regions[MAX_LOADED_REGIONS];
GPUHexContext data;
} HexContext;
2024-11-01 17:34:41 -06:00
typedef struct HexPushConstantStruct {
VkDeviceAddress context;
uint32_t region;
double time;
} HexPushConstant;
VkResult create_hex_context(
RenderContext* gpu,
HexContext* context);
VkResult create_hex_region(
2024-11-01 17:34:41 -06:00
uint32_t q, uint32_t s,
HexRegion** region,
HexContext* hex,
RenderContext* gpu);
#endif