roleplay/client/include/hex.h

62 lines
1.1 KiB
C

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