2024-10-30 17:36:53 -06:00
|
|
|
#ifndef HEX_H
|
|
|
|
#define HEX_H
|
|
|
|
|
|
|
|
#include "gpu.h"
|
|
|
|
|
2024-11-01 15:46:27 -06:00
|
|
|
#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 {
|
2024-10-30 17:36:53 -06:00
|
|
|
VkDeviceAddress context;
|
2024-10-30 21:24:03 -06:00
|
|
|
double time;
|
|
|
|
} HexPushConstant;
|
2024-10-30 17:36:53 -06:00
|
|
|
|
2024-11-01 15:46:27 -06:00
|
|
|
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);
|
2024-10-30 17:36:53 -06:00
|
|
|
|
|
|
|
#endif
|