2024-11-01 15:46:27 -06:00
|
|
|
struct Hex {
|
|
|
|
float heights[6];
|
2024-11-02 22:02:32 -06:00
|
|
|
uint colors[7];
|
2024-11-01 15:46:27 -06:00
|
|
|
};
|
|
|
|
|
2024-11-01 17:34:41 -06:00
|
|
|
layout(std430, buffer_reference) readonly buffer Region {
|
2024-11-02 12:07:11 -06:00
|
|
|
int q;
|
|
|
|
int r;
|
2024-11-04 21:02:48 -07:00
|
|
|
int y;
|
|
|
|
uint map;
|
2024-11-01 17:34:41 -06:00
|
|
|
Hex hexes[];
|
2024-11-01 15:46:27 -06:00
|
|
|
};
|
|
|
|
|
2024-11-24 21:44:36 -07:00
|
|
|
struct Highlight {
|
|
|
|
vec4 color;
|
|
|
|
uint region;
|
|
|
|
uint hex;
|
|
|
|
float offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
layout(std430, buffer_reference) readonly buffer HighlightList {
|
|
|
|
Highlight h[];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Point {
|
|
|
|
vec4 color;
|
|
|
|
uint region;
|
|
|
|
uint hex;
|
|
|
|
uint vertex;
|
|
|
|
float size;
|
|
|
|
float offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
layout(std430, buffer_reference) readonly buffer PointList {
|
|
|
|
Point p[];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Ray {
|
|
|
|
vec4 start;
|
|
|
|
vec4 end;
|
|
|
|
vec4 color;
|
|
|
|
};
|
|
|
|
|
|
|
|
layout(std430, buffer_reference) readonly buffer RayList {
|
|
|
|
Ray r[];
|
|
|
|
};
|
|
|
|
|
2024-10-30 21:24:03 -06:00
|
|
|
layout(std430, buffer_reference) readonly buffer HexContext {
|
|
|
|
mat4 proj;
|
|
|
|
mat4 view;
|
2024-11-04 21:04:51 -07:00
|
|
|
uint current_map;
|
2024-11-24 21:44:36 -07:00
|
|
|
RayList rays;
|
|
|
|
PointList points;
|
|
|
|
HighlightList highlights;
|
2024-11-01 17:34:41 -06:00
|
|
|
Region regions[];
|
2024-10-30 21:24:03 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
layout(std430, push_constant) uniform PushConstant {
|
|
|
|
HexContext context;
|
|
|
|
float time;
|
|
|
|
} pc;
|
2024-11-04 20:42:58 -07:00
|
|
|
|
|
|
|
#define PI 3.1415926535897932384626433832795
|
|
|
|
const float w = 0.5;
|
|
|
|
const float x = 0.75;
|
|
|
|
const float z = sqrt(3.0)/2.0;
|
|
|
|
|
|
|
|
const int region_size = 10;
|
|
|
|
const float region_diameter = 2*region_size-1;
|
|
|
|
const float region_width = x*region_diameter;
|
|
|
|
const float region_height = z*region_diameter;
|
|
|
|
const int region_hex_count = 3*region_size*(region_size-1)+1;
|
|
|
|
|
|
|
|
const vec4 vertices[] = {
|
|
|
|
vec4(0, 0, 0, 1),
|
|
|
|
vec4(w*cos(0*PI/3), 0, w*sin(0*PI/3), 1),
|
|
|
|
vec4(w*cos(1*PI/3), 0, w*sin(1*PI/3), 1),
|
|
|
|
vec4(w*cos(2*PI/3), 0, w*sin(2*PI/3), 1),
|
|
|
|
vec4(w*cos(3*PI/3), 0, w*sin(3*PI/3), 1),
|
|
|
|
vec4(w*cos(4*PI/3), 0, w*sin(4*PI/3), 1),
|
|
|
|
vec4(w*cos(5*PI/3), 0, w*sin(5*PI/3), 1),
|
|
|
|
};
|
|
|
|
|
|
|
|
const uint indices[] = {
|
|
|
|
0, 2, 1,
|
|
|
|
0, 3, 2,
|
|
|
|
0, 4, 3,
|
|
|
|
0, 5, 4,
|
|
|
|
0, 6, 5,
|
|
|
|
0, 1, 6,
|
|
|
|
};
|
|
|
|
|
|
|
|
const vec4 starts[] = {
|
|
|
|
vec4( 0, 0, z, 0), // 0, -1
|
|
|
|
vec4(-x, 0, z/2, 0), // -1, 0
|
|
|
|
vec4(-x, 0, -z/2, 0), // -1, +1
|
|
|
|
vec4( 0, 0, -z, 0), // 0, +1
|
|
|
|
vec4( x, 0, -z/2, 0), // +1, 0
|
|
|
|
vec4( x, 0, z/2, 0), // +1, -1
|
|
|
|
};
|
|
|
|
|
|
|
|
const vec2 start_coords[] = {
|
|
|
|
vec2(0, -1),
|
|
|
|
vec2(-1, 0),
|
|
|
|
vec2(-1, 1),
|
|
|
|
vec2(0, 1),
|
|
|
|
vec2(1, 0),
|
|
|
|
vec2(1, -1),
|
|
|
|
};
|
|
|
|
|
|
|
|
const vec4 direction[] = {
|
|
|
|
vec4(-x, 0, -z/2, 0),
|
|
|
|
vec4( 0, 0, -z, 0),
|
|
|
|
vec4( x, 0, -z/2, 0),
|
|
|
|
vec4( x, 0, z/2, 0),
|
|
|
|
vec4( 0, 0, z, 0),
|
|
|
|
vec4(-x, 0, z/2, 0),
|
|
|
|
};
|
|
|
|
|
|
|
|
const vec2 direction_coords[] = {
|
|
|
|
vec2(-1, 1),
|
|
|
|
vec2(0, 1),
|
|
|
|
vec2(1, 0),
|
|
|
|
vec2(1, -1),
|
|
|
|
vec2(0, -1),
|
|
|
|
vec2(-1, 0),
|
|
|
|
};
|