visuals and a lot of other things

This commit is contained in:
2025-06-26 08:48:42 -04:00
parent ea2e7e918c
commit 6d488fce1e
21 changed files with 2315 additions and 728 deletions

View File

@@ -9,6 +9,13 @@ struct TextureData
u32 length;
};
static const unsigned char texture_dummy[] =
{
0xFF
};
static const unsigned int texture_dummy_len = 1;
static const unsigned char texture_eye_closed[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10,
@@ -266,10 +273,154 @@ static const unsigned char texture_arrow_down[] = {
0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
static const unsigned int texture_arrow_down_len = 153;
static const unsigned char texture_frame[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28,
0x08, 0x06, 0x00, 0x00, 0x00, 0xf7, 0xda, 0x7a, 0xa1, 0x00, 0x00, 0x00,
0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x5c, 0x46, 0x00, 0x00, 0x5c,
0x46, 0x01, 0x14, 0x94, 0x43, 0x41, 0x00, 0x00, 0x00, 0x29, 0x49, 0x44,
0x41, 0x54, 0x48, 0xc7, 0x63, 0x68, 0x68, 0x68, 0xf8, 0xcf, 0x40, 0x01,
0x60, 0x62, 0xa0, 0x10, 0x0c, 0xbc, 0x01, 0xa3, 0x60, 0x14, 0x8c, 0x82,
0x51, 0x30, 0x0a, 0x46, 0xc1, 0x28, 0x18, 0x7e, 0x60, 0xb4, 0x89, 0x43,
0xb9, 0x01, 0x00, 0xc1, 0xdf, 0x05, 0x0d, 0xfb, 0xcb, 0xa2, 0x51, 0x00,
0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
static const unsigned int texture_frame_len = 119;
#define TEXTURE_COUNT (TEXTURE_ARROW_DOWN + 1)
static const unsigned char texture_frame_alternate[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28,
0x08, 0x06, 0x00, 0x00, 0x00, 0xf7, 0xda, 0x7a, 0xa1, 0x00, 0x00, 0x00,
0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x5c, 0x46, 0x00, 0x00, 0x5c,
0x46, 0x01, 0x14, 0x94, 0x43, 0x41, 0x00, 0x00, 0x00, 0x2a, 0x49, 0x44,
0x41, 0x54, 0x48, 0xc7, 0xed, 0xcc, 0x31, 0x0d, 0x00, 0x30, 0x0c, 0x03,
0xb0, 0xa8, 0xc8, 0xc2, 0x9f, 0xd4, 0x06, 0xa2, 0x4f, 0x0f, 0x1b, 0x80,
0xd3, 0xf6, 0x65, 0x61, 0xb2, 0x24, 0x10, 0x08, 0x04, 0x02, 0x81, 0x40,
0x20, 0xb8, 0x18, 0x7c, 0x4d, 0xb9, 0x02, 0x0e, 0x6e, 0xb1, 0x5c, 0xc5,
0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
static const unsigned int texture_frame_alternate_len = 120;
static const unsigned char texture_picker[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28,
0x08, 0x06, 0x00, 0x00, 0x00, 0xf7, 0xda, 0x7a, 0xa1, 0x00, 0x00, 0x00,
0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x5c, 0x46, 0x00, 0x00, 0x5c,
0x46, 0x01, 0x14, 0x94, 0x43, 0x41, 0x00, 0x00, 0x00, 0x58, 0x49, 0x44,
0x41, 0x54, 0x48, 0xc7, 0xed, 0xd6, 0x3b, 0x0e, 0x00, 0x20, 0x08, 0x44,
0x41, 0x35, 0xde, 0x1b, 0x38, 0xb9, 0x06, 0x2b, 0x13, 0xbf, 0x88, 0xe5,
0x6e, 0x61, 0xc7, 0xc4, 0xf2, 0x45, 0x66, 0x2e, 0xc1, 0xb1, 0x14, 0x9c,
0xcb, 0xfa, 0x10, 0xd1, 0xd3, 0xb1, 0x88, 0xf8, 0x7f, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0c, 0xb4, 0x69, 0x64, 0x58, 0x37,
0x84, 0x89, 0x05, 0x59, 0x56, 0xcd, 0x0d, 0x72, 0x4c, 0xa2, 0x1d, 0x72,
0xdd, 0x53, 0x33, 0xc4, 0x1c, 0x63, 0x3d, 0xf2, 0x5c, 0x72, 0x7a, 0x78,
0x3a, 0xae, 0xf6, 0x35, 0xd0, 0x0d, 0x0b, 0xf2, 0x1e, 0xa3, 0x00, 0x00,
0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
static unsigned int texture_picker_len = 166;
static const unsigned char texture_interpolated_frame_icon[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08,
0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0x0f, 0xbe, 0x8b, 0x00, 0x00, 0x00,
0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x5c, 0x46, 0x00, 0x00, 0x5c,
0x46, 0x01, 0x14, 0x94, 0x43, 0x41, 0x00, 0x00, 0x00, 0x24, 0x49, 0x44,
0x41, 0x54, 0x18, 0xd3, 0x63, 0x60, 0x20, 0x00, 0x18, 0x61, 0x8c, 0xff,
0x40, 0x80, 0x22, 0x01, 0x04, 0x70, 0x05, 0xe8, 0x92, 0xc8, 0x8a, 0x98,
0x08, 0x59, 0x41, 0xb9, 0x02, 0x82, 0x8e, 0x24, 0x08, 0x00, 0x53, 0x98,
0x0c, 0x0a, 0x09, 0x30, 0x65, 0xd2, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45,
0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
static const unsigned int texture_interpolated_frame_icon_len = 114;
static const unsigned char texture_uninterpolated_frame_icon[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08,
0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0x0f, 0xbe, 0x8b, 0x00, 0x00, 0x00,
0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x5c, 0x46, 0x00, 0x00, 0x5c,
0x46, 0x01, 0x14, 0x94, 0x43, 0x41, 0x00, 0x00, 0x00, 0x1c, 0x49, 0x44,
0x41, 0x54, 0x18, 0xd3, 0x63, 0x60, 0x20, 0x00, 0x18, 0x41, 0xc4, 0x7f,
0x20, 0xc0, 0x2a, 0x09, 0x04, 0x4c, 0x84, 0x4c, 0x18, 0x0c, 0x0a, 0x08,
0x02, 0x00, 0x88, 0xe4, 0x04, 0x0c, 0x6a, 0xae, 0x5d, 0xa6, 0x00, 0x00,
0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
static const unsigned int texture_uninterpolated_frame_icon_len = 106;
static const unsigned char texture_trigger_frame_icon[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08,
0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0x0f, 0xbe, 0x8b, 0x00, 0x00, 0x00,
0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x5c, 0x46, 0x00, 0x00, 0x5c,
0x46, 0x01, 0x14, 0x94, 0x43, 0x41, 0x00, 0x00, 0x00, 0x1b, 0x49, 0x44,
0x41, 0x54, 0x18, 0xd3, 0x63, 0x60, 0x40, 0x02, 0xff, 0xa1, 0x00, 0x59,
0x8c, 0x89, 0x81, 0x00, 0xa0, 0x83, 0x02, 0xd2, 0x00, 0x59, 0xbe, 0x00,
0x00, 0x46, 0x35, 0x0f, 0xfb, 0x77, 0xd4, 0xf4, 0xcd, 0x00, 0x00, 0x00,
0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
static const unsigned int texture_trigger_frame_icon_len = 105;
static const unsigned char texture_target[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20,
0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, 0xf4, 0x00, 0x00, 0x00,
0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x5c, 0x46, 0x00, 0x00, 0x5c,
0x46, 0x01, 0x14, 0x94, 0x43, 0x41, 0x00, 0x00, 0x00, 0xb9, 0x49, 0x44,
0x41, 0x54, 0x58, 0xc3, 0xed, 0x56, 0x8b, 0x0a, 0x80, 0x30, 0x08, 0xec,
0x46, 0xff, 0xff, 0xcb, 0x8b, 0x81, 0x85, 0x94, 0x7b, 0xe8, 0x5a, 0x2e,
0x98, 0x10, 0x2c, 0x03, 0x3d, 0xf5, 0x76, 0xb9, 0x6d, 0x7f, 0xb6, 0x48,
0xd6, 0x13, 0x23, 0x78, 0x17, 0xb1, 0x00, 0xc0, 0x38, 0xfb, 0xeb, 0xc8,
0xe3, 0x00, 0x18, 0xdf, 0x81, 0x12, 0xe7, 0x2c, 0x7c, 0x34, 0x8d, 0x20,
0x55, 0xca, 0xab, 0xbd, 0xbf, 0x0f, 0x05, 0x50, 0x4a, 0xf4, 0xc9, 0x08,
0x66, 0x21, 0x61, 0xcc, 0x74, 0x00, 0xc3, 0x01, 0xd4, 0x94, 0x4f, 0x0b,
0x22, 0x18, 0x93, 0x83, 0x27, 0xa2, 0x33, 0x5a, 0x00, 0x36, 0x01, 0x48,
0x31, 0xce, 0xe7, 0x9e, 0x1c, 0x80, 0x58, 0x24, 0xf9, 0xd4, 0x20, 0x5e,
0x25, 0xa1, 0x04, 0x4c, 0x2a, 0xe6, 0xc1, 0x81, 0xde, 0x3f, 0x5a, 0x07,
0x60, 0xcc, 0x79, 0x0d, 0x79, 0x43, 0xce, 0xb6, 0x72, 0x0e, 0x48, 0xbc,
0xc8, 0xf9, 0xa4, 0x58, 0xdc, 0x76, 0xad, 0xa2, 0xa5, 0x80, 0xb9, 0xef,
0xd2, 0x24, 0x6b, 0xb7, 0x32, 0x68, 0xe6, 0x55, 0x92, 0x02, 0xf2, 0x45,
0xad, 0x16, 0xb8, 0x0b, 0x91, 0xbb, 0x14, 0xaf, 0xa5, 0xd4, 0x7d, 0x23,
0xda, 0x3b, 0x77, 0x42, 0x73, 0xe2, 0x69, 0x36, 0xa2, 0x45, 0xc2, 0x05,
0xc0, 0xdd, 0x0e, 0x27, 0x86, 0x84, 0x1b, 0x55, 0x64, 0x35, 0x3e, 0x00,
0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
static const unsigned int texture_target_len = 263;
static const unsigned char texture_pivot[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06,
0x08, 0x06, 0x00, 0x00, 0x00, 0xe0, 0xcc, 0xef, 0x48, 0x00, 0x00, 0x00,
0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x5c, 0x46, 0x00, 0x00, 0x5c,
0x46, 0x01, 0x14, 0x94, 0x43, 0x41, 0x00, 0x00, 0x00, 0x1e, 0x49, 0x44,
0x41, 0x54, 0x08, 0xd7, 0x63, 0x60, 0x80, 0x82, 0xff, 0x50, 0x00, 0xe3,
0x33, 0x31, 0xe0, 0x00, 0x8c, 0xc8, 0xaa, 0x90, 0x01, 0x4e, 0x1d, 0x0c,
0x24, 0xdb, 0x01, 0x00, 0xfa, 0x18, 0x13, 0xf4, 0x52, 0xd7, 0xb6, 0xe8,
0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
static const unsigned int texture_pivot_len = 108;
static const unsigned char texture_error[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0e,
0x08, 0x06, 0x00, 0x00, 0x00, 0x26, 0x2f, 0x9c, 0x8a, 0x00, 0x00, 0x00,
0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x5c, 0x46, 0x00, 0x00, 0x5c,
0x46, 0x01, 0x14, 0x94, 0x43, 0x41, 0x00, 0x00, 0x00, 0x5a, 0x49, 0x44,
0x41, 0x54, 0x28, 0xcf, 0xad, 0x53, 0x41, 0x0e, 0x00, 0x20, 0x08, 0x12,
0xff, 0xff, 0xe7, 0xf2, 0xe8, 0x4c, 0xd2, 0x65, 0xdc, 0x5a, 0xa0, 0x68,
0x04, 0x21, 0x58, 0x06, 0x7f, 0x86, 0x21, 0xe3, 0xa1, 0x12, 0x1e, 0x82,
0x50, 0x08, 0x4c, 0x1c, 0x89, 0xec, 0x0e, 0x91, 0xc0, 0xac, 0xb2, 0x91,
0x54, 0x1a, 0xb8, 0x8d, 0x85, 0xaa, 0x7b, 0x66, 0xdd, 0xf3, 0xb5, 0xdb,
0x99, 0x8d, 0xa6, 0x13, 0x31, 0x2d, 0xd0, 0x15, 0xa7, 0xaf, 0x50, 0x85,
0x27, 0xee, 0x4b, 0xbb, 0x81, 0x29, 0x1d, 0x8c, 0x83, 0xf4, 0x25, 0xca,
0x2f, 0x9f, 0x69, 0x03, 0x2f, 0x92, 0x4c, 0x14, 0x86, 0xa5, 0x1a, 0x1d,
0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
static const unsigned int texture_error_len = 168;
#define TEXTURE_COUNT (TEXTURE_ERROR + 1)
enum TextureType
{
TEXTURE_DUMMY,
TEXTURE_EYE_OPEN,
TEXTURE_EYE_CLOSED,
TEXTURE_ANIMATION,
@@ -282,11 +433,21 @@ enum TextureType
TEXTURE_RECT_SHOW,
TEXTURE_RECT_HIDE,
TEXTURE_ARROW_UP,
TEXTURE_ARROW_DOWN
TEXTURE_ARROW_DOWN,
TEXTURE_FRAME,
TEXTURE_FRAME_ALTERNATE,
TEXTURE_PICKER,
TEXTURE_INTERPOLATED_FRAME_ICON,
TEXTURE_UNINTERPOLATED_FRAME_ICON,
TEXTURE_TRIGGER_FRAME_ICON,
TEXTURE_TARGET,
TEXTURE_PIVOT,
TEXTURE_ERROR
};
static const TextureData TEXTURE_DATA[TEXTURE_COUNT] =
{
{texture_dummy, texture_dummy_len},
{texture_eye_open, texture_eye_open_len},
{texture_eye_closed, texture_eye_closed_len},
{texture_animation, texture_animation_len},
@@ -300,6 +461,15 @@ static const TextureData TEXTURE_DATA[TEXTURE_COUNT] =
{texture_rect_hide, texture_rect_hide_len},
{texture_arrow_up, texture_arrow_up_len},
{texture_arrow_down, texture_arrow_down_len},
{texture_frame, texture_frame_len},
{texture_frame_alternate, texture_frame_alternate_len},
{texture_picker, texture_picker_len},
{texture_interpolated_frame_icon, texture_interpolated_frame_icon_len},
{texture_uninterpolated_frame_icon, texture_uninterpolated_frame_icon_len},
{texture_trigger_frame_icon, texture_trigger_frame_icon_len},
{texture_target, texture_target_len},
{texture_pivot, texture_pivot_len},
{texture_error, texture_error_len}
};
/* Shaders */
@@ -309,37 +479,61 @@ struct ShaderData
const char* fragment;
};
#define SHADER_COUNT (SHADER + 1)
#define SHADER_COUNT (SHADER_TEXTURE + 1)
enum ShaderType
{
SHADER
SHADER_LINE,
SHADER_TEXTURE
};
static const char SHADER_VERTEX[] =
"#version 330 core\n" \
"layout (location = 0)\n" \
"in vec2 i_position;\n" \
"layout (location = 0) in vec2 i_position;\n" \
"layout (location = 1) in vec2 i_uv;\n" \
"\n" \
"out vec2 i_uv_out;\n" \
"\n" \
"uniform mat4 u_transform;\n" \
"\n" \
"void main()\n" \
"{\n" \
" vec4 pos = vec4(i_position, 0.0, 1.0);\n" \
" gl_Position = u_transform * pos;\n" \
" i_uv_out = i_uv;\n" \
" gl_Position = u_transform * vec4(i_position, 0.0, 1.0);\n" \
"}\n";
static const char SHADER_FRAGMENT[] = "#version 330 core\n" \
"out vec4 FragColor;\n" \
static const char SHADER_TEXTURE_FRAGMENT[] =
"#version 330 core\n" \
"in vec2 i_uv_out;\n" \
"uniform sampler2D u_texture;\n" \
"uniform vec4 u_tint;\n" \
"uniform vec3 u_color_offset;\n" \
"out vec4 o_fragColor;\n" \
"void main()\n" \
"{\n" \
" vec4 texColor = texture(u_texture, i_uv_out);\n" \
" texColor *= u_tint;\n" \
" texColor.rgb += u_color_offset;\n" \
" o_fragColor = texColor;\n" \
"}\n";
static const char SHADER_FRAGMENT[] =
"#version 330 core\n" \
"out vec4 o_fragColor;\n" \
"uniform vec4 u_color;\n" \
"\n" \
"void main()\n" \
"{\n" \
" FragColor = u_color;\n" \
" o_fragColor = u_color;\n" \
"}\n";
static const char SHADER_UNIFORM_COLOR[] = "u_color";
static const char SHADER_UNIFORM_TRANSFORM[] = "u_transform";
static const char SHADER_UNIFORM_TINT[] = "u_tint";
static const char SHADER_UNIFORM_COLOR_OFFSET[] = "u_color_offset";
static const char SHADER_UNIFORM_TEXTURE[] = "u_texture";
static const ShaderData SHADER_DATA[SHADER_COUNT] =
{
{SHADER_VERTEX, SHADER_FRAGMENT}
{SHADER_VERTEX, SHADER_FRAGMENT},
{SHADER_VERTEX, SHADER_TEXTURE_FRAGMENT}
};