roleplay/client/include/hex.h

70 lines
1.2 KiB
C

#ifndef HEX_H
#define HEX_H
#include "gpu.h"
#define REGION_SIZE (10)
#define REGION_HEX_COUNT (3*REGION_SIZE*(REGION_SIZE-1)+1)
#define MAX_LOADED_REGIONS (25*25)
typedef struct GPUHexStruct {
float height[6];
uint32_t color[7];
} GPUHex;
typedef struct GPUHexRegionStruct {
int32_t q;
int32_t r;
GPUHex hexes[REGION_HEX_COUNT];
} GPUHexRegion;
typedef struct HexRegionStruct {
int32_t q;
int32_t r;
VkDeviceAddress address;
VkBuffer region;
VmaAllocation region_memory;
GPUHex data[REGION_HEX_COUNT];
} HexRegion;
typedef struct GPUHexContextStruct {
mat4 proj;
mat4 view;
vec2 camera;
vec2 forward;
VkDeviceAddress regions[MAX_LOADED_REGIONS];
} GPUHexContext;
typedef struct HexContextStruct {
VkDeviceAddress address;
VkBuffer context;
VmaAllocation context_memory;
GraphicsPipeline graphics;
HexRegion regions[MAX_LOADED_REGIONS];
GPUHexContext data;
} HexContext;
typedef struct HexPushConstantStruct {
VkDeviceAddress context;
uint32_t region;
double time;
} HexPushConstant;
VkResult create_hex_context(
RenderContext* gpu,
HexContext* context);
VkResult create_hex_region(
int32_t q, int32_t r,
HexRegion** region,
HexContext* hex,
RenderContext* gpu);
#endif