2#include "SDL2/SDL_video.h"
20#include "nuklear/nuklear.h"
21#include "nuklear/nuklear_sdl_gl3.h"
45#define MAX_GLTF_NAMES 256
48#define MAX_RPROBE_NAMES 256
68 if (SDL_GetDesktopDisplayMode(0, &DM) == 0)
75 SDL_SetWindowFullscreen(
window, SDL_WINDOW_FULLSCREEN);
80 SDL_SetWindowFullscreen(
window, SDL_WINDOW_FULLSCREEN_DESKTOP);
83 SDL_SetWindowFullscreen(
window, 0);
103 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER,
GBUFFER_FBO.
depth_rbo.
i);
137 int current_width = w;
138 int current_height = h;
139 for (
int i = 0; i < 5; i++)
208 Undo * current = undo;
212 Undo * tmp = current;
213 current = current->
prev;
227 current = current->
prev;
277 if (!current)
return;
280 current = current->
prev;
325 current->
free =
true;
326 current->
prev = NULL;
327 next = current->
next;
357 memcpy(undo->
bytes, bytes, byte_size);
385 memcpy(undo->
bytes, bytes, byte_size);
402 memcpy(a.
ids,
id,
sizeof(
int) * 8);
435 *special_bytes = malloc(
sizeof(uint8_t*) * undo->
special_count);
438 (*special_bytes)[i] = malloc(undo->
byte_size);
445 *special_bytes = NULL;
474 uint8_t ** bytes = malloc(
sizeof(uint8_t*));
475 bytes[0] = malloc(
sizeof(
Light));
476 memcpy(bytes[0], light,
sizeof(
Light));
477 size_t total_bytes =
sizeof(uint8_t*) +
sizeof(
Light);
496 lights[i] = lights[i-1];
538 if (mns[i].mesh == -1 || mns[i].free)
continue;
539 if (!meshes[mns[i].mesh].static_mesh || !mns[i].static_mesh || mns[i].physics_mode)
continue;
655 uint8_t ** bytes = malloc(
sizeof(uint8_t*));
712 uint8_t ** bytes = malloc(
sizeof(uint8_t*));
767 size_t total_bytes =
sizeof(uint8_t*) *
LPV_SLOTS;
804 uint8_t * temp_b0 = malloc(
sizeof(
mat3));
805 uint8_t * temp_b1 = malloc(
sizeof(
vec3));
811 memcpy(temp_b1, &obbaxis,
sizeof(
vec3));
850 temp[1] = pv->byte_offset;
877 uint8_t ** bytes = malloc(
sizeof(uint8_t*));
898 uint8_t ** bytes = malloc(
sizeof(uint8_t*) * 2);
899 bytes[0] = malloc(
sizeof(
size_t));
900 bytes[1] = malloc(
sizeof(
size_t));
901 *((
size_t*)bytes[0]) = pv->byte_offset;
902 *((
size_t*)bytes[1]) = pv->size;
907 undo->
byte_size =
sizeof(uint8_t*) +
sizeof(
size_t) * 2;
935 uint8_t * temp_b0 = malloc(
sizeof(
mat3));
936 uint8_t * temp_b1 = malloc(
sizeof(
vec3));
942 memcpy(temp_b1, &obbaxis,
sizeof(
vec3));
984 load_emitter(e, e->path, e->is_loop, e->is_occludable, e->base_volume);
991 load_emitter(e, e->path, e->is_loop, e->is_occludable, e->base_volume);
1024 uint8_t ** bytes = malloc(
sizeof(uint8_t*) * 2);
1026 bytes[1] = malloc(
sizeof(
int) * apv->adjacent_portals.count);
1028 memcpy(bytes[1], apv->adjacent_portals.buffer,
sizeof(
int) * apv->adjacent_portals.count);
1035 undo->
byte_size =
sizeof(uint8_t*) * 2 +
sizeof(
AudioPortal) +
sizeof(int) * apv->adjacent_portals.count;
1045 memcpy(apv->adjacent_portals.buffer, undo->
special_bytes[1],
sizeof(
int) * apv->adjacent_portals.capacity);
1125 uint8_t ** bytes = malloc(
sizeof(uint8_t*));
1126 size_t byte_size =
sizeof(uint8_t*) +
sizeof(
UIContainer);
1134 temp[2] = el->container;
1162 temp[2] = el->container;
1164 uint8_t ** bytes = NULL;
1165 size_t byte_size = 0;
1166 int special_count = 0;
1171 bytes = malloc(
sizeof(uint8_t*));
1173 memcpy(bytes[0], del_container,
sizeof(
UIContainer));
1175 byte_size +=
sizeof(uint8_t*);
1203 uint8_t ** bytes = malloc(
sizeof(uint8_t*) * 2);
1204 bytes[0] = malloc(
sizeof(
TextBox));
1205 bytes[1] = malloc(
sizeof(
char) * tb->
text_cap);
1206 memcpy(bytes[0], tb,
sizeof(
TextBox));
1207 memcpy(bytes[1], tb->
text,
sizeof(
char) * tb->
text_cap);
1208 size_t byte_size =
sizeof(uint8_t*) * 2 +
sizeof(
TextBox) +
sizeof(char) * tb->
text_cap;
1233 int s0 = el->as.label.align;
1317 uint8_t ** bytes = malloc(
sizeof(uint8_t*) * 2);
1318 bytes[0] = malloc(
sizeof(
TextBox));
1319 bytes[1] = malloc(
sizeof(
char) * tb->text_cap);
1321 memcpy(bytes[0], tb,
sizeof(
TextBox));
1322 memcpy(bytes[1], tb->text,
sizeof(
char) * tb->text_cap);
1323 size_t byte_size =
sizeof(
TextBox) +
sizeof(uint8_t*) * 2 +
sizeof(char) * tb->text_cap;
1345 if (tb->text) free(tb->text);
1347 tb->text = malloc(
sizeof(
char) * tb->text_cap);
1348 memcpy(tb->text, undo->
special_bytes[1],
sizeof(
char) * tb->text_cap);
1359 uint8_t ** bytes = NULL;
1360 size_t byte_size = 0;
1363 int text_cap = tb->text_cap;
1366 bytes = malloc(
sizeof(uint8_t*));
1367 bytes[0] = malloc(
sizeof(
char) * tb->text_cap);
1368 byte_size +=
sizeof(uint8_t*) +
sizeof(
char) * tb->text_cap;
1370 memcpy(bytes[0], tb->text,
sizeof(
char) * tb->text_cap);
1379 tb->text = malloc(
sizeof(
char) * tb->text_cap);
1380 memcpy(tb->text, undo->
special_bytes[0],
sizeof(
char) * tb->text_cap);
1439 uint8_t ** bytes = malloc(
sizeof(uint8_t*) * 3);
1440 bytes[0] = malloc(
sizeof(
float));
1441 bytes[1] = malloc(
sizeof(
mat4));
1442 bytes[2] = malloc(
sizeof(
vec3));
1444 memcpy(bytes[1], &AI->model,
sizeof(
mat4));
1445 memcpy(bytes[2], &AI->rot,
sizeof(
vec3));
1485 uint8_t ** bytes = malloc(
sizeof(uint8_t*) * 3);
1486 bytes[0] = malloc(
sizeof(
float));
1487 bytes[1] = malloc(
sizeof(
mat4));
1488 bytes[2] = malloc(
sizeof(
vec3));
1490 memcpy(bytes[1], &mn->global_matrix,
sizeof(
mat4));
1491 memcpy(bytes[2], &mn->rotation,
sizeof(
vec3));
1511 Mesh * m = &meshes[mn->mesh];
1593 memcpy(s->
bytes, bytes, byte_size);
1604 "Point Light Shadows",
1624 double full_time = 0.0f;
1644 sprintf(box->
text,
"Performance Overlay");
1648 double full_time = 0.0f;
1654 double time = query_s[query] / 1e6;
1664 sprintf(end->
text,
"Frame Time: %.3f (%.3f FPS)", full_time, 1000.0f/full_time);
1688 TextBox * tb_title = &boxes[i];
1693 tb_title->
text = malloc(256 *
sizeof(
char));
1695 tb_title->
text[0] =
'\0';
1699 tb_title->
free =
false;
1703 translation.
y += 40;
1714 bool push_undo =
false;
1716 if (memcmp(a, b, byte_size) != 0)
1722 memcpy(s->
bytes, a, byte_size);
1732 memcpy(a, b, byte_size);
1751 bool push_undo =
false;
1781 bool push_undo =
false;
1807 bool push_undo =
false;
1813 memcpy(s->
bytes, a,
sizeof(
float));
1832 bool push_undo =
false;
1838 memcpy(s->
bytes, a,
sizeof(
int));
1931 WIN32_FIND_DATAA find_data;
1932 char search_path[MAX_PATH];
1933 snprintf(search_path,
sizeof(search_path),
"%s\\*", registry->
directory);
1935 HANDLE hFind = FindFirstFileA(search_path, &find_data);
1936 if (hFind == INVALID_HANDLE_VALUE)
return;
1941 if (!(find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
1946 if (strstr(find_data.cFileName, registry->
suffix))
1949 strncpy(name, find_data.cFileName, 254);
1956 strncpy(name, find_data.cFileName, 254);
1960 }
while (FindNextFileA(hFind, &find_data));
1968 WIN32_FIND_DATAA find_data;
1969 char search_path[MAX_PATH];
1970 snprintf(search_path,
sizeof(search_path),
"%s\\*", folder_path);
1972 HANDLE hFind = FindFirstFileA(search_path, &find_data);
1973 if (hFind == INVALID_HANDLE_VALUE)
return;
1978 if (!(find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
1982 }
while (FindNextFileA(hFind, &find_data));
1989 WIN32_FIND_DATAA find_data;
1990 char search_path[MAX_PATH];
1991 snprintf(search_path,
sizeof(search_path),
"%s\\*", folder_path);
1993 HANDLE hFind = FindFirstFileA(search_path, &find_data);
1994 if (hFind == INVALID_HANDLE_VALUE)
return;
1999 if (!(find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
2000 if (strstr(find_data.cFileName,
"gltf"))
2007 }
while (FindNextFileA(hFind, &find_data));
2038 NK_WINDOW_TITLE | NK_WINDOW_SCROLL_AUTO_HIDE | NK_WINDOW_CLOSABLE
2042 struct nk_rect win_bounds = nk_window_get_bounds(
NK_CTX);
2045 nk_layout_row_dynamic(
NK_CTX, 20, 1);
2050 nk_layout_row_dynamic(
NK_CTX, 20, 1);
2052 sprintf(sk,
"Skin: %d", ent->
skin);
2053 nk_label(
NK_CTX, sk, NK_TEXT_ALIGN_LEFT);
2055 if (nk_button_label(
NK_CTX,
"Player Interact"))
2084 nk_layout_row_dynamic(
NK_CTX, 20, 1);
2085 nk_label(
NK_CTX,
"PC Menu", NK_TEXT_ALIGN_LEFT);
2087 bool pc_dirty =
false;
2089 nk_layout_row_dynamic(
NK_CTX, 20, 3);
2090 float mass = nk_propertyf(
NK_CTX,
"Mass", 0.0f, pc->
mass, 10000.0f, 0.01f, 0.01f);
2091 if (mass != pc->
mass)
2096 float restitution = nk_propertyf(
NK_CTX,
"Restitution", 0.0f, pc->
restitution, 20.0f, 0.005f, 0.005f);
2101 float mu = nk_propertyf(
NK_CTX,
"Mu", 0, pc->
mu, 20.0f, 0.005f, 0.005f);
2111 if (nk_button_label(
NK_CTX,
"Delete PC"))
2122 if (nk_button_label(
NK_CTX,
"Create PC"))
2134 nk_layout_row_dynamic(
NK_CTX, 20, 1);
2135 nk_label(
NK_CTX,
"AC Menu", NK_TEXT_ALIGN_LEFT);
2138 nk_label(
NK_CTX, tracks, NK_TEXT_ALIGN_LEFT);
2144 sprintf(keyframe,
"Keyframes t%d: %d", i, t->
kf_count);
2145 nk_label(
NK_CTX, keyframe, NK_TEXT_ALIGN_LEFT);
2148 for (
int j = 0; j < t->
kf_count; j++)
2152 sprintf(
time,
"Time k%d", j);
2153 float new_time = nk_propertyf(
NK_CTX,
time, 0.01f, kf->
time, 10000, 0.01f, 0.01f);
2154 if (new_time != kf->
time)
2156 kf->
time = new_time;
2165 sprintf(tg,
"Flt t%d k%d", i, j);
2166 float new_val = nk_propertyf(
NK_CTX, tg, -10000.0f, kf->
val.v, 10000, 0.01f, 0.01f);
2167 if (new_val != kf->
val.v)
2169 kf->
val.v = new_val;
2175 sprintf(tgx,
"x t%d k%d", i, j);
2176 float new_x = nk_propertyf(
NK_CTX, tgx, -10000.0f, kf->
val.v3.x, 10000, 0.01f, 0.01f);
2177 if (new_x != kf->
val.v3.x)
2179 kf->
val.v3.x = new_x;
2182 sprintf(tgy,
"y t%d k%d", i, j);
2183 float new_y = nk_propertyf(
NK_CTX, tgy, -10000.0f, kf->
val.v3.y, 10000, 0.01f, 0.01f);
2184 if (new_y != kf->
val.v3.y)
2186 kf->
val.v3.y = new_y;
2189 sprintf(tgz,
"z t%d k%d", i, j);
2190 float new_z = nk_propertyf(
NK_CTX, tgz, -10000.0f, kf->
val.v3.z, 10000, 0.01f, 0.01f);
2191 if (new_z != kf->
val.v3.z)
2193 kf->
val.v3.z = new_z;
2198 sprintf(it,
"Int t%d k%d", i, j);
2199 int new_i = nk_propertyi(
NK_CTX, it, -10000, kf->
val.i, 10000, 1, 1);
2200 if (new_i != kf->
val.i)
2213 sprintf(dr,
"Duration t%d", i);
2214 float new_duration = nk_propertyf(
NK_CTX, dr, 0.01f, t->
duration, 10000, 0.01f, 0.01f);
2221 sprintf(lp,
"Loop t%d", i);
2222 nk_bool looper = t->
loop == 1;
2223 if (nk_checkbox_label(
NK_CTX, lp, &looper))
2228 sprintf(act,
"Active t%d", i);
2229 nk_bool acter = t->
active == 1;
2230 if (nk_checkbox_label(
NK_CTX, act, &acter))
2235 char target_type[256];
2238 if (nk_button_label(
NK_CTX, target_type))
2246 sprintf(add,
"Add t%d KF", i);
2247 if (nk_button_label(
NK_CTX, add))
2252 sprintf(rm,
"Remove Track t%d", i);
2253 if (nk_button_label(
NK_CTX, rm))
2271 if (nk_button_label(
NK_CTX,
"Add Track"))
2275 if (nk_button_label(
NK_CTX,
"Delete AC"))
2288 if (nk_button_label(
NK_CTX,
"Create AC"))
2329 if (nk_combo_begin_label(
NK_CTX, registry->
directory, nk_vec2(200, 200))) {
2331 if (!registry->
open)
2336 for (
int i = 0; i < registry->
names.
count; i++)
2344 registry->
open = nk_true;
2345 nk_layout_row_dynamic(
NK_CTX, 20, 1);
2347 nk_bool sel = (i == label.
selected);
2348 if (nk_selectable_label(
NK_CTX, label.
ptrs[i], NK_TEXT_LEFT, &sel)) {
2356 registry->
open = nk_false;
2366 for (
int i = 0; i < option_count; i++)
2374 nk_layout_row_dynamic(
NK_CTX, 20, 1);
2376 nk_bool sel = (i == label.
selected);
2377 if (nk_selectable_label(
NK_CTX, label.
ptrs[i], NK_TEXT_LEFT, &sel)) {
2384void render_dropdown(
const char * dropdown_name,
int * selected,
char ** options,
int option_count,
int x,
int y)
2388 if (*selected >= 0 && *selected < option_count)
2390 strcpy(name, options[*selected]);
2395 strcpy(name, dropdown_name);
2398 if (nk_combo_begin_label(
NK_CTX, name, nk_vec2(x, y))) {
2402 for (
int i = 0; i < option_count; i++)
2410 nk_layout_row_dynamic(
NK_CTX, 20, 1);
2412 nk_bool sel = (i == label.
selected);
2413 if (nk_selectable_label(
NK_CTX, label.
ptrs[i], NK_TEXT_LEFT, &sel)) {
2423 float c = cosf(angle_radians);
2424 float s = sinf(angle_radians);
2434 float c = cosf(angle_radians);
2435 float s = sinf(angle_radians);
2444 float c = cosf(angle_radians);
2445 float s = sinf(angle_radians);
2482 nk_layout_row_dynamic(
NK_CTX, 20, 3);
2484 const char * pos_names[3] =
2491 char final_names[3][256];
2493 for (
int i = 0; i < 3; i++)
2496 strcpy(final_names[i], name);
2497 strcat(final_names[i], pos_names[i]);
2502 size_t byte_offset = 0;
2517 int vecx = nk_propertyi(
NK_CTX, final_names[0], -100000, vec->
x, 100000, 1, 1);
2524 float vecy = nk_propertyi(
NK_CTX, final_names[1], -100000, vec->
y, 100000, 1, 1);
2530 float vecz = nk_propertyi(
NK_CTX, final_names[2], -100000, vec->
z, 100000, 1, 1);
2543 nk_layout_row_dynamic(
NK_CTX, 20, 3);
2545 const char * pos_names[3] =
2552 char final_names[3][256];
2554 for (
int i = 0; i < 3; i++)
2557 strcpy(final_names[i], name);
2558 strcat(final_names[i], pos_names[i]);
2563 size_t byte_offset = 0;
2578 float posx = nk_propertyf(
NK_CTX, final_names[0], -100000.0f, pos->
x, 100000.0f, 0.01f, 0.01f);
2584 float posy = nk_propertyf(
NK_CTX, final_names[1], -100000.0f, pos->
y, 100000.0f, 0.01f, 0.01f);
2590 float posz = nk_propertyf(
NK_CTX, final_names[2], -100000.0f, pos->
z, 100000.0f, 0.01f, 0.01f);
2605 nk_layout_row_dynamic(
NK_CTX, 20, 3);
2607 const char * aabb_names[6] =
2617 char final_names[6][256];
2619 for (
int i = 0; i < 6; i++)
2622 strcpy(final_names[i], name);
2623 strcat(final_names[i], aabb_names[i]);
2629 float aabbx = nk_propertyf(
NK_CTX, final_names[0], -1000.0f, aabb->
center.
x, 1000.0f, 0.01f, 0.01f);
2635 float aabby = nk_propertyf(
NK_CTX, final_names[1], -1000.0f, aabb->
center.
y, 1000.0f, 0.01f, 0.01f);
2641 float aabbz = nk_propertyf(
NK_CTX, final_names[2], -1000.0f, aabb->
center.
z, 1000.0f, 0.01f, 0.01f);
2648 nk_layout_row_dynamic(
NK_CTX, 20, 3);
2650 float aabbex = nk_propertyf(
NK_CTX, final_names[3], -1000.0f, aabb->
extents.
x, 1000.0f, 0.01f, 0.01f);
2656 float aabbey = nk_propertyf(
NK_CTX, final_names[4], -1000.0f, aabb->
extents.
y, 1000.0f, 0.01f, 0.01f);
2662 float aabbez = nk_propertyf(
NK_CTX, final_names[5], -1000.0f, aabb->
extents.
z, 1000.0f, 0.01f, 0.01f);
2682 size_t pos_offset = 0;
2683 size_t scale_offset = 0;
2697 pos_offset = offsetof(
MeshNode, translation);
2698 scale_offset = offsetof(
MeshNode, scale);
2704 const char * obb_names[] =
2718 char final_names[10][256];
2720 for (
int i = 0; i < 10; i++)
2723 strcpy(final_names[i], name);
2724 strcat(final_names[i], obb_names[i]);
2734 pos.
x = nk_propertyf(
NK_CTX, final_names[0], -1000.0f, tr->
x, 1000.0f, 0.01f, 0.01f);
2736 pos.
y = nk_propertyf(
NK_CTX, final_names[1], -1000.0f, tr->
y, 1000.0f, 0.01f, 0.01f);
2738 pos.
z = nk_propertyf(
NK_CTX, final_names[2], -1000.0f, tr->
z, 1000.0f, 0.01f, 0.01f);
2745 bool rot_dirty =
false;
2762 bool angle_dirty =
false;
2766 uint8_t ** bytes = malloc(
sizeof(uint8_t*) * 3);
2767 bytes[0] = malloc(
sizeof(
float));
2768 bytes[1] = malloc(
sizeof(
mat4));
2769 bytes[2] = malloc(
sizeof(
vec3));
2770 memcpy(bytes[0], &rot_angle_old,
sizeof(
float));
2771 memcpy(bytes[1], mat,
sizeof(
mat4));
2772 memcpy(bytes[2],
rot,
sizeof(
vec3));
2774 size_t byte_size =
sizeof(uint8_t*) * 2 +
sizeof(
float) +
sizeof(
mat4) +
sizeof(
vec3);
2788 s.
x = nk_propertyf(
NK_CTX, final_names[7], -1000.0f, sc->
x, 1000.0f, 0.01f, 0.01f);
2790 s.
y = nk_propertyf(
NK_CTX, final_names[8], -1000.0f, sc->
y, 1000.0f, 0.01f, 0.01f);
2792 s.
z = nk_propertyf(
NK_CTX, final_names[9], -1000.0f, sc->
z, 1000.0f, 0.01f, 0.01f);
2816 nk_layout_row_dynamic(
NK_CTX, 20, 3);
2818 const char * obb_names[] =
2831 char final_names[9][256];
2833 for (
int i = 0; i < 9; i++)
2836 strcpy(final_names[i], name);
2837 strcat(final_names[i], obb_names[i]);
2862 float obbx = nk_propertyf(
NK_CTX, final_names[0], -1000.0f, obb->
center.
x, 1000.0f, 0.01f, 0.01f);
2867 float obby = nk_propertyf(
NK_CTX, final_names[1], -1000.0f, obb->
center.
y, 1000.0f, 0.01f, 0.01f);
2872 float obbz = nk_propertyf(
NK_CTX, final_names[2], -1000.0f, obb->
center.
z, 1000.0f, 0.01f, 0.01f);
2878 nk_layout_row_dynamic(
NK_CTX, 20, 3);
2880 float obbex = nk_propertyf(
NK_CTX, final_names[3], -1000.0f, obb->
extents.
x, 1000.0f, 0.01f, 0.01f);
2885 float obbey = nk_propertyf(
NK_CTX, final_names[4], -1000.0f, obb->
extents.
y, 1000.0f, 0.01f, 0.01f);
2890 float obbez = nk_propertyf(
NK_CTX, final_names[5], -1000.0f, obb->
extents.
z, 1000.0f, 0.01f, 0.01f);
2895 bool a_dirty =
false;
2896 bool b_dirty =
false;
2897 bool c_dirty =
false;
2900 bool s6_is_held = sliders[6].
is_held;
2902 if (!s6_is_held && sliders[6].is_held)
2905 uint8_t ** bytes = malloc(
sizeof(uint8_t*) * 2);
2906 bytes[0] = malloc(
sizeof(
mat3));
2907 memcpy(bytes[0], &obb->
rot,
sizeof(
mat3));
2908 bytes[1] = malloc(
sizeof(
vec3));
2910 memcpy(bytes[1], &axis,
sizeof(
vec3));
2911 size_t byte_size =
sizeof(uint8_t*) * 2 +
sizeof(
mat3) +
sizeof(
vec3);
2918 bool s7_is_held = sliders[7].
is_held;
2920 if (!s7_is_held && sliders[7].is_held)
2923 uint8_t ** bytes = malloc(
sizeof(uint8_t*) * 2);
2924 bytes[0] = malloc(
sizeof(
mat3));
2925 memcpy(bytes[0], &obb->
rot,
sizeof(
mat3));
2926 bytes[1] = malloc(
sizeof(
vec3));
2928 memcpy(bytes[1], &axis,
sizeof(
vec3));
2929 size_t byte_size =
sizeof(uint8_t*) * 2 +
sizeof(
mat3) +
sizeof(
vec3);
2936 bool s8_is_held = sliders[8].
is_held;
2939 if (!s8_is_held && sliders[8].is_held)
2942 uint8_t ** bytes = malloc(
sizeof(uint8_t*) * 2);
2943 bytes[0] = malloc(
sizeof(
mat3));
2944 memcpy(bytes[0], &obb->
rot,
sizeof(
mat3));
2945 bytes[1] = malloc(
sizeof(
vec3));
2947 memcpy(bytes[1], &axis,
sizeof(
vec3));
2948 size_t byte_size =
sizeof(uint8_t*) * 2 +
sizeof(
mat3) +
sizeof(
vec3);
2954 if (a_dirty || b_dirty || c_dirty)
3012 NK_WINDOW_TITLE | NK_WINDOW_SCROLL_AUTO_HIDE
3016 struct nk_rect win_bounds = nk_window_get_bounds(
NK_CTX);
3018 nk_layout_row_dynamic(
NK_CTX, 12, 6);
3050 NK_WINDOW_TITLE | NK_WINDOW_SCROLL_AUTO_HIDE | NK_WINDOW_CLOSABLE | NK_WINDOW_MOVABLE
3054 struct nk_rect win_bounds = nk_window_get_bounds(
NK_CTX);
3070 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3072 sprintf(menu_id,
"%s (%d)", m->
id, m->
uID);
3073 nk_label(
NK_CTX, menu_id, NK_TEXT_ALIGN_LEFT);
3075 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3079 sprintf(
id,
"%s (%u)", tb->
id, tb->
uID);
3081 nk_label(
NK_CTX,
id, NK_TEXT_ALIGN_LEFT);
3083 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3090 sprintf(ui_menu_names[i],
"%s (%d)", ms[i].
id, ms[i].uID);
3091 refs[i] = ui_menu_names[i];
3094 int current_menu = tb->
menu;
3097 if (current_menu != tb->
menu)
3109 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3112 if (nk_checkbox_label(
NK_CTX,
"TB Drag Mode", &tb_drag))
3117 nk_layout_row_dynamic(
NK_CTX, 20, 2);
3122 if (nk_button_label(
NK_CTX,
"Change ID"))
3127 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3129 if (nk_button_label(
NK_CTX,
"Create Text Box"))
3146 if (nk_button_label(
NK_CTX,
"Delete Text Box"))
3148 uint8_t ** bytes = malloc(
sizeof(uint8_t*) * 2);
3149 bytes[0] = malloc(
sizeof(
TextBox));
3150 bytes[1] = malloc(
sizeof(
char) * tb->
text_cap);
3151 memcpy(bytes[0], tb,
sizeof(
TextBox));
3152 memcpy(bytes[1], tb->
text,
sizeof(
char) * tb->
text_cap);
3154 size_t byte_size =
sizeof(uint8_t*) * 2 +
sizeof(
TextBox) +
sizeof(char) * tb->
text_cap;
3172 xyval.
x = nk_propertyf(
NK_CTX,
"TB_X", -5000.0f, tb->
translation.
x, 5000.0f, 0.01f, 0.01f);
3173 xyval.
y = nk_propertyf(
NK_CTX,
"TB_Y", -5000.0f, tb->
translation.
y, 5000.0f, 0.01f, 0.01f);
3182 float angle = nk_propertyf(
NK_CTX,
"TB_Angle", 0.0f, tb->
angle, 3.1415f, 0.01f, 0.01f);
3188 scale.
x = nk_propertyf(
NK_CTX,
"TB_Scale_X", 0.0f, tb->
scale.
x, 5000.0f, 0.01f, 0.01f);
3189 scale.
y = nk_propertyf(
NK_CTX,
"TB_Scale_Y", 0.0f, tb->
scale.
y, 5000.0f, 0.01f, 0.01f);
3194 float ts = nk_propertyf(
NK_CTX,
"Text Size", 0.0f, tb->
text_size, 5000.0f, 0.01f, 0.01f);
3199 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3200 uint32_t layer = nk_propertyi(
NK_CTX,
"Text Layer", 0, tb->
layer, 5000, 1, 1);
3206 static char text_buffer[1024] = {0};
3208 tb_text_flags = nk_edit_string_zero_terminated(
NK_CTX, NK_EDIT_FIELD, text_buffer,
sizeof(text_buffer), nk_filter_default);
3209 if (nk_button_label(
NK_CTX,
"Change Text"))
3212 uint8_t ** bytes = NULL;
3213 int bytes_count = 0;
3214 size_t byte_size = 0;
3218 bytes = malloc(
sizeof(uint8_t*));
3219 bytes[0] = malloc(
sizeof(
char) * tb->
text_cap);
3220 memcpy(bytes[0], tb->
text,
sizeof(
char) * tb->
text_cap);
3221 byte_size =
sizeof(uint8_t*) +
sizeof(
char) * tb->
text_cap;
3237 tb->
text_cap = (strlen(text_buffer) + 1);
3239 strcpy(tb->
text, text_buffer);
3243 struct nk_colorf
color = {
3249 nk_label(
NK_CTX,
"TB_Color", NK_TEXT_LEFT);
3251 if (nk_combo_begin_color(
NK_CTX, nk_rgba_cf(
color), nk_vec2(150, 150))) {
3252 nk_layout_row_dynamic(
NK_CTX, 120, 1);
3256 nk_layout_row_dynamic(
NK_CTX, 25, 1);
3269 struct nk_colorf fill = {
3275 nk_label(
NK_CTX,
"TB_fill", NK_TEXT_LEFT);
3277 if (nk_combo_begin_color(
NK_CTX, nk_rgba_cf(fill), nk_vec2(150, 150))) {
3278 nk_layout_row_dynamic(
NK_CTX, 120, 1);
3279 fill = nk_color_picker(
NK_CTX, fill, NK_RGBA);
3282 nk_layout_row_dynamic(
NK_CTX, 25, 1);
3283 fill.r = nk_propertyf(
NK_CTX,
"#R:", 0.0f, fill.r, 1.0f, 0.01f, 0.005f);
3284 fill.g = nk_propertyf(
NK_CTX,
"#G:", 0.0f, fill.g, 1.0f, 0.01f, 0.005f);
3285 fill.b = nk_propertyf(
NK_CTX,
"#B:", 0.0f, fill.b, 1.0f, 0.01f, 0.005f);
3286 fill.a = nk_propertyf(
NK_CTX,
"#A:", 0.0f, fill.a, 1.0f, 0.01f, 0.005f);
3295 nk_bool sh = tb->
shadow == 1;
3296 if (nk_checkbox_label(
NK_CTX,
"Shadow", &sh))
3300 float sh_d = nk_propertyf(
NK_CTX,
"Shadow Dist", 0.0f, tb->
shadow_dist, 5000.0f, 0.01f, 0.01f);
3306 bool dirx_dirty =
false;
3308 float shx = nk_propertyf(
NK_CTX,
"Shadow DirX", -1.0f, tb->
shadow_dir.
x, 1.0f, 0.01f, 0.01f);
3318 bool diry_dirty =
false;
3319 float shy = nk_propertyf(
NK_CTX,
"Shadow DirY", -1.0f, tb->
shadow_dir.
y, 1.0f, 0.01f, 0.01f);
3330 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3334 int found_containers = 0;
3336 int current_container_found_id = -1;
3340 if (current->
free)
continue;
3341 sprintf(container_names[found_containers],
"%s (%d)", current->
id, current->
uID);
3342 container_refs[found_containers] = container_names[found_containers];
3343 pc_indices[found_containers] = current->
uID;
3349 int current_container = current_container_found_id;
3350 render_dropdown(
"Container", ¤t_container, (
char**)container_refs, found_containers, 300, 100);
3353 if (current_container != current_container_found_id)
3355 int cont_id = pc_indices[current_container];
3384 if (nk_button_label(
NK_CTX,
"Remove From TB Container"))
3434 NK_WINDOW_TITLE | NK_WINDOW_SCROLL_AUTO_HIDE | NK_WINDOW_CLOSABLE | NK_WINDOW_MOVABLE
3439 struct nk_rect win_bounds = nk_window_get_bounds(
NK_CTX);
3452 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3454 sprintf(menu_id,
"%s (%d)", m->
id, m->
uID);
3455 nk_label(
NK_CTX, menu_id, NK_TEXT_ALIGN_LEFT);
3457 nk_layout_row_dynamic(
NK_CTX, 20, 2);
3460 if (nk_button_label(
NK_CTX,
"Menu Change ID"))
3467 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3470 sprintf(
id,
"%s (%d)", el->
id, el->
uID);
3472 nk_label(
NK_CTX,
id, NK_TEXT_ALIGN_LEFT);
3474 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3481 sprintf(ui_menu_names[i],
"%s (%d)", ms[i].
id, ms[i].uID);
3482 refs[i] = ui_menu_names[i];
3485 int current_menu = el->
menu;
3488 if (current_menu != el->
menu)
3498 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3501 if (nk_checkbox_label(
NK_CTX,
"Element Drag", &el_drag))
3506 nk_layout_row_dynamic(
NK_CTX, 20, 2);
3511 if (nk_button_label(
NK_CTX,
"Change ID"))
3517 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3518 if (nk_button_label(
NK_CTX,
"Create Element"))
3524 if (nk_button_label(
NK_CTX,
"Delete Element"))
3532 float xval = nk_propertyf(
NK_CTX,
"UI_X", -5000.0f, el->
translation.
x, 5000.0f, 0.1f, 0.1f);
3538 float yval = nk_propertyf(
NK_CTX,
"UI_Y", -5000.0f, el->
translation.
y, 5000.0f, 0.1f, 0.1f);
3544 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3545 if (nk_button_label(
NK_CTX,
"New Base Pos"))
3552 nk_layout_row_dynamic(
NK_CTX, 20, 2);
3553 float xsc = nk_propertyf(
NK_CTX,
"UI_Scale_X", 0.0f, el->
scale.
x, 5000.0f, 0.01f, 0.01f);
3558 float ysc = nk_propertyf(
NK_CTX,
"UI_Scale_Y", 0.0f, el->
scale.
y, 5000.0f, 0.01f, 0.01f);
3564 float r = nk_propertyf(
NK_CTX,
"UI_Radius", 0.0f, el->
radius, 5000.0f, 0.001f, 0.001f);
3570 float angle = nk_propertyf(
NK_CTX,
"UI_Angle", 0.0f, el->
angle, 3.1415f, 0.01f, 0.01f);
3576 float sx = nk_propertyf(
NK_CTX,
"UI_Size_X", 0.0f, el->
size.
x, 5000.0f, 0.01f, 0.01f);
3581 float sy = nk_propertyf(
NK_CTX,
"UI_Size_Y", 0.0f, el->
size.
y, 5000.0f, 0.01f, 0.01f);
3587 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3588 int el_layer = el->
layer;
3589 int layer = nk_propertyi(
NK_CTX,
"UI_Layer", 0, el->
layer, 5000, 1, 1);
3594 if (layer != el->
layer)
3599 if (nk_combo_begin_label(
NK_CTX,
"Action", nk_vec2(200, 200))) {
3604 options[i] = malloc(
sizeof(
char) * 256);
3627 if (nk_combo_begin_label(
NK_CTX,
"Hover", nk_vec2(200, 200))) {
3632 options[i] = malloc(
sizeof(
char) * 256);
3657 struct nk_colorf
color = {
3663 nk_label(
NK_CTX,
"UI_Color", NK_TEXT_LEFT);
3665 if (nk_combo_begin_color(
NK_CTX, nk_rgba_cf(
color), nk_vec2(150, 150))) {
3666 nk_layout_row_dynamic(
NK_CTX, 120, 1);
3670 nk_layout_row_dynamic(
NK_CTX, 25, 1);
3682 struct nk_colorf fill = {
3688 nk_label(
NK_CTX,
"UI_fill", NK_TEXT_LEFT);
3690 if (nk_combo_begin_color(
NK_CTX, nk_rgba_cf(fill), nk_vec2(150, 150))) {
3691 nk_layout_row_dynamic(
NK_CTX, 120, 1);
3692 fill = nk_color_picker(
NK_CTX, fill, NK_RGBA);
3695 nk_layout_row_dynamic(
NK_CTX, 25, 1);
3696 fill.r = nk_propertyf(
NK_CTX,
"#R:", 0.0f, fill.r, 1.0f, 0.01f, 0.005f);
3697 fill.g = nk_propertyf(
NK_CTX,
"#G:", 0.0f, fill.g, 1.0f, 0.01f, 0.005f);
3698 fill.b = nk_propertyf(
NK_CTX,
"#B:", 0.0f, fill.b, 1.0f, 0.01f, 0.005f);
3699 fill.a = nk_propertyf(
NK_CTX,
"#A:", 0.0f, fill.a, 1.0f, 0.01f, 0.005f);
3709 nk_bool sh = el->
shadow == 1;
3710 if (nk_checkbox_label(
NK_CTX,
"Shadow", &sh))
3714 float sh_d = nk_propertyf(
NK_CTX,
"Shadow Dist", 0.0f, el->
shadow_dist, 5000.0f, 0.01f, 0.01f);
3720 bool dir_dirty =
false;
3721 float shx = nk_propertyf(
NK_CTX,
"Shadow DirX", -1.0f, el->
shadow_dir.
x, 1.0f, 0.01f, 0.01f);
3726 float shy = nk_propertyf(
NK_CTX,
"Shadow DirY", -1.0f, el->
shadow_dir.
y, 1.0f, 0.01f, 0.01f);
3732 nk_layout_row_dynamic(
NK_CTX, 20, 2);
3737 int found_containers = 0;
3739 int current_container_found_id = -1;
3743 if (current->
free)
continue;
3744 sprintf(container_names[found_containers],
"%s (%d)", current->
id, current->
uID);
3745 container_refs[found_containers] = container_names[found_containers];
3746 pc_indices[found_containers] = current->
uID;
3752 int current_container = current_container_found_id;
3753 render_dropdown(
"Container", ¤t_container, (
char**)container_refs, found_containers, 300, 100);
3755 if (current_container != current_container_found_id)
3759 int cont_id = pc_indices[current_container];
3776 if (cont_id != -1 && cont_id != el->
container)
3788 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3790 if (nk_button_label(
NK_CTX,
"Remove From Container"))
3807 nk_layout_row_dynamic(
NK_CTX, 20, 2);
3809 if (nk_button_label(
NK_CTX,
"Create Container"))
3813 uint8_t ** bytes = NULL;
3814 size_t byte_size = 0;
3815 int special_count = 0;
3821 bytes = malloc(
sizeof(uint8_t*));
3826 byte_size +=
sizeof(uint8_t*);
3851 if (nk_button_label(
NK_CTX,
"Delete Container"))
3853 uint8_t ** bytes = malloc(
sizeof(uint8_t*));
3854 size_t byte_size =
sizeof(uint8_t*) +
sizeof(
UIContainer);;
3874 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3875 if (nk_tree_push(
NK_CTX, NK_TREE_NODE,
"UI Containers", NK_MINIMIZED))
3879 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3882 sprintf(
id,
"%s (%d)", c->
id, c->
uID);
3884 nk_label(
NK_CTX,
id, NK_TEXT_ALIGN_LEFT);
3886 nk_layout_row_dynamic(
NK_CTX, 20, 2);
3890 nk_bool wrap = c->
wrap == 1;
3891 if (nk_checkbox_label(
NK_CTX,
"Wrap", &wrap))
3896 nk_bool mask = c->
mask == 1;
3897 if (nk_checkbox_label(
NK_CTX,
"Mask", &mask))
3902 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3904 float cx = nk_propertyf(
NK_CTX,
"CPAD_L", 0.0f, c->
padding.
x, 1.0f, 0.001f, 0.001f);
3906 float cy = nk_propertyf(
NK_CTX,
"CPAD_R", 0.0f, c->
padding.
y, 1.0f, 0.001f, 0.001f);
3907 float cz = nk_propertyf(
NK_CTX,
"CPAD_U", 0.0f, c->
padding.
z, 1.0f, 0.001f, 0.001f);
3908 float cw = nk_propertyf(
NK_CTX,
"CPAD_D", 0.0f, c->
padding.
w, 1.0f, 0.001f, 0.001f);
3914 nk_layout_row_dynamic(
NK_CTX, 20, 2);
3915 float xsc = nk_propertyf(
NK_CTX,
"C_Scroll_X", -1.0f, c->
scroll_dir.
x, 1.0f, 0.01f, 0.01f);
3916 bool xsc_dirty =
false;
3926 float ysc = nk_propertyf(
NK_CTX,
"C_Scroll_Y", -1.0f, c->
scroll_dir.
y, 1.0f, 0.01f, 0.01f);
3927 bool ysc_dirty =
false;
3938 nk_layout_row_dynamic(
NK_CTX, 20, 1);
3942 char current_scrollbar_name[256];
3944 sprintf(current_scrollbar_name,
"%s (%d)", sc->
id, sc->
uID);
3946 nk_label(
NK_CTX, current_scrollbar_name, NK_TEXT_ALIGN_LEFT);
3955 int found_scrollbars = 0;
3957 int current_scrollbar_found_id = -1;
3962 sprintf(scrollbar_names[found_scrollbars],
"%s (%d)", current->
id, current->
uID);
3963 scrollbar_refs[found_scrollbars] = scrollbar_names[found_scrollbars];
3964 sc_indices[found_scrollbars] = current->
uID;
3965 if (c->
scrollbar == current->
uID) current_scrollbar_found_id = found_scrollbars;
3970 int current_scrollbar = current_scrollbar_found_id;
3971 render_dropdown(
"Scrollbar", ¤t_scrollbar, (
char**)scrollbar_refs, found_scrollbars, 300, 100);
3973 if (current_scrollbar != current_scrollbar_found_id)
3976 int element_id = sc_indices[current_scrollbar];
3978 if (element_id != -1)
3982 int old_scrollbar_container = -1;
3983 if (old_scrollbar != -1)
3985 UIElement * old_sc = &els[old_scrollbar];
3988 old_scrollbar_container = old_sc->
as.slider.
container;
3995 int old_slider_container = sc->
as.slider.
container;
4007 old_slider_container,
4025 nk_layout_row_dynamic(
NK_CTX, 20, 1);
4032 switch(interactable_type)
4057 nk_layout_row_dynamic(
NK_CTX, 20, 1);
4058 if (nk_button_label(
NK_CTX,
"Compute Bounds"))
4064 nk_layout_row_dynamic(
NK_CTX, 20, 2);
4065 float dirx = nk_propertyf(
NK_CTX,
"Slider_X", 0.0f, sl->
dir.
x, 1.0f, 0.001f, 0.001f);
4066 bool dirx_dirty =
false;
4076 float diry = nk_propertyf(
NK_CTX,
"Slider_Y", 0.0f, sl->
dir.
y, 1.0f, 0.001f, 0.001f);
4077 bool diry_dirty =
false;
4087 float minval = nk_propertyf(
NK_CTX,
"Slider_MinVal", -5000.0f, sl->
min_val, 5000.0f, 0.01f, 0.01f);
4092 float maxval = nk_propertyf(
NK_CTX,
"Slider_MaxVal", -5000.0f, sl->
max_val, 5000.0f, 0.01f, 0.01f);
4097 float len = nk_propertyf(
NK_CTX,
"Slider_Len", -5000.0f, sl->
len , 5000.0f, 0.01f, 0.01f);
4102 float scroll_scale = nk_propertyf(
NK_CTX,
"Slider_ScrollScale", -5000.0f, sl->
scroll_scale , 5000.0f, 0.01f, 0.01f);
4116 nk_layout_row_dynamic(
NK_CTX, 20, 2);
4120 if (nk_button_label(
NK_CTX,
"Assign Label"))
4131 if (nk_button_label(
NK_CTX,
"Create Label"))
4134 uint8_t ** bytes = NULL;
4136 size_t byte_size = 0;
4137 int old_box = l->
box;
4141 uint8_t ** bytes = malloc(
sizeof(uint8_t*) * 2);
4142 bytes[0] = malloc(
sizeof(
TextBox));
4143 bytes[1] = malloc(
sizeof(
char) * tb->
text_cap);
4144 memcpy(bytes[0], tb,
sizeof(
TextBox));
4145 memcpy(bytes[1], tb->
text,
sizeof(
char) * tb->
text_cap);
4147 byte_size =
sizeof(uint8_t*) +
sizeof(
TextBox) +
sizeof(char) * tb->
text_cap;
4171 nk_layout_row_dynamic(
NK_CTX, 20, 1);
4172 int selected_justify = l->
align;
4174 if (selected_justify != l->
align)
4186 l->
align = selected_justify;
4226 NK_WINDOW_TITLE | NK_WINDOW_SCROLL_AUTO_HIDE | NK_WINDOW_CLOSABLE
4230 struct nk_rect win_bounds = nk_window_get_bounds(
NK_CTX);
4234 if (nk_tree_push(
NK_CTX, NK_TREE_NODE,
"Audio Probes", NK_MINIMIZED))
4237 nk_layout_row_dynamic(
NK_CTX, 20, 1);
4267 if (nk_tree_push(
NK_CTX, NK_TREE_NODE,
"Audio Emitters", NK_MINIMIZED))
4270 nk_layout_row_dynamic(
NK_CTX, 20, 2);
4273 if (nk_button_label(
NK_CTX,
"Spawn Emitter"))
4290 float volume = nk_propertyf(
NK_CTX,
"AEM Volume", 0.0, em->
base_volume, 10.0f, 0.01f, 0.01f);
4296 nk_bool loop = em->
is_loop == 1;
4297 if (nk_checkbox_label(
NK_CTX,
"AEM Loop", &loop))
4302 if (nk_checkbox_label(
NK_CTX,
"AEM Occludable", &occludable))
4307 if (nk_button_label(
NK_CTX,
"Delete Sound Obj"))
4317 nk_label(
NK_CTX, em->
path, NK_TEXT_ALIGN_LEFT);
4318 if (nk_button_label(
NK_CTX,
"Set Sound"))
4326 char complete_name[256];
4329 complete_name[255] =
'\0';
4330 strcpy(em->
path, complete_name);
4334 if (nk_button_label(
NK_CTX,
"Load Sound Obj"))
4342 if (nk_button_label(
NK_CTX,
"Delete Emitter"))
4352 if (nk_button_label(
NK_CTX,
"Play Emitter"))
4359 if (nk_button_label(
NK_CTX,
"Stop Emitter"))
4370 nk_layout_row_dynamic(
NK_CTX, 20, 1);
4371 if (nk_tree_push(
NK_CTX, NK_TREE_NODE,
"Audio Portals", NK_MINIMIZED))
4375 if (nk_button_text(
NK_CTX,
"Save Audio Portals", 12))
4378 char complete_name[256];
4381 complete_name[255] =
'\0';
4388 if (nk_button_label(
NK_CTX,
"Load Audio Portals"))
4393 char complete_name[256];
4396 complete_name[255] =
'\0';
4402 if (nk_button_label(
NK_CTX,
"Spawn Audio Portal"))
4411 if (nk_button_label(
NK_CTX,
"Recalculate Audio Portal Paths"))
4423 if (nk_button_label(
NK_CTX,
"Delete Audio Portal"))
4426 uint8_t ** bytes = malloc(
sizeof(uint8_t*) * 2);
4429 size_t byte_size =
sizeof(
AudioPortal) +
sizeof(uint8_t*) * 2;
4454 if (nk_tree_push(
NK_CTX, NK_TREE_NODE,
"APVs", NK_MINIMIZED))
4458 if (nk_button_label(
NK_CTX,
"Reset APVs"))
4462 nk_layout_row_dynamic(
NK_CTX, 20, 1);
4465 nk_layout_row_dynamic(
NK_CTX, 20, 2);
4466 if (nk_button_label(
NK_CTX,
"Open APVs"))
4469 char complete_name[256];
4472 complete_name[255] =
'\0';
4480 if (nk_button_label(
NK_CTX,
"Load APVs"))
4485 char complete_name[256];
4488 complete_name[255] =
'\0';
4499 nk_layout_row_dynamic(
NK_CTX, 20, 1);
4502 nk_layout_row_dynamic(
NK_CTX, 20, 2);
4503 if (nk_button_label(
NK_CTX,
"Open Scene APV"))
4506 char complete_name[256];
4509 complete_name[255] =
'\0';
4528 if (nk_button_label(
NK_CTX,
"Load Scene APV"))
4533 char complete_name[256];
4536 complete_name[255] =
'\0';
4551 if (nk_button_label(
NK_CTX,
"Overwrite Scene APV"))
4556 char complete_name[256];
4559 complete_name[255] =
'\0';
4571 if (nk_button_label(
NK_CTX,
"Spawn APV"))
4578 pv->obb.extents = (
vec3){1,1,1};
4581 pv->byte_offset = 0;
4596 nk_layout_row_dynamic(
NK_CTX, 20, 1);
4598 sprintf(pv_data,
"APV Offset: %zu Size: %zu", pv->
byte_offset, pv->
size);
4599 nk_label(
NK_CTX, pv_data, NK_TEXT_ALIGN_LEFT);
4605 if (nk_button_label(
NK_CTX,
"Reset APV Rotation"))
4610 if (nk_button_label(
NK_CTX,
"Reset APV Size"))
4613 uint8_t ** bytes = malloc(
sizeof(uint8_t*) * 2);
4614 bytes[0] = malloc(
sizeof(
size_t));
4616 bytes[1] = malloc(
sizeof(
size_t));
4617 *bytes[1] = pv->
size;
4619 size_t byte_size =
sizeof(uint8_t*) * 2 +
sizeof(
size_t) * 2;
4625 if (nk_button_label(
NK_CTX,
"Delete APV"))
4627 uint8_t ** bytes = malloc(
sizeof(uint8_t*) * 1);
4630 size_t byte_size =
sizeof(uint8_t*) * 1 +
sizeof(
ProbeVolume);
4639 if (nk_checkbox_label(
NK_CTX,
"APV Overlay", &overlay))
4645 if (nk_button_label(
NK_CTX,
"Bake APV"))
4648 uint8_t ** bytes = malloc(
sizeof(uint8_t*) * 2);
4649 bytes[0] = malloc(
sizeof(
size_t));
4651 bytes[1] = malloc(
sizeof(
size_t));
4652 *bytes[1] = pv->
size;
4654 size_t byte_size =
sizeof(uint8_t*) * 2 +
sizeof(
size_t) * 2;
4694 NK_WINDOW_TITLE | NK_WINDOW_SCROLL_AUTO_HIDE | NK_WINDOW_CLOSABLE
4699 struct nk_rect win_bounds = nk_window_get_bounds(
NK_CTX);
4702 nk_layout_row_dynamic(
NK_CTX, 20, 1);
4703 if (nk_button_label(
NK_CTX,
"Spawn LProbe Volume"))
4732 nk_layout_row_dynamic(
NK_CTX, 20, 2);
4733 if (nk_button_label(
NK_CTX,
"Open LPVs"))
4736 char complete_name[256];
4739 complete_name[255] =
'\0';
4746 if (nk_button_label(
NK_CTX,
"Load LPVs"))
4752 char complete_name[256];
4755 complete_name[255] =
'\0';
4765 nk_layout_row_dynamic(
NK_CTX, 20, 1);
4769 nk_layout_row_dynamic(
NK_CTX, 20, 2);
4770 if (nk_button_label(
NK_CTX,
"Open Scene LPV"))
4773 char complete_name[256];
4776 complete_name[255] =
'\0';
4795 if (nk_button_label(
NK_CTX,
"Load Scene LPV"))
4800 char complete_name[256];
4803 complete_name[255] =
'\0';
4818 if (nk_button_label(
NK_CTX,
"Overwrite Scene LPV"))
4823 char complete_name[256];
4826 complete_name[255] =
'\0';
4837 if (nk_button_label(
NK_CTX,
"Reset LPVs"))
4841 uint8_t ** bytes = malloc(
sizeof(uint8_t*) *
LPV_SLOTS);
4842 size_t total_bytes =
sizeof(uint8_t*) *
LPV_SLOTS;
4849 bytes[i] = malloc(
size);
4851 total_bytes +=
size;
4880 nk_layout_row_dynamic(
NK_CTX, 20, 1);
4882 sprintf(pv_data,
"LPV Offset: %zu Size: %zu", pv->
byte_offset, pv->
size);
4883 nk_label(
NK_CTX, pv_data, NK_TEXT_ALIGN_LEFT);
4888 if (nk_button_label(
NK_CTX,
"Reset LPV Rotation"))
4893 if (nk_button_label(
NK_CTX,
"Reset LPV Size"))
4899 if (nk_button_label(
NK_CTX,
"Delete LProbe Volume"))
4902 uint8_t ** bytes = malloc(
sizeof(uint8_t*));
4905 size_t byte_size =
sizeof(uint8_t*) +
sizeof(
ProbeVolume);
4914 if (nk_checkbox_label(
NK_CTX,
"LPV Overlay", &overlay))
4918 if (nk_button_label(
NK_CTX,
"Bake LPV"))
4942 NK_WINDOW_TITLE | NK_WINDOW_SCROLL_AUTO_HIDE | NK_WINDOW_CLOSABLE
4946 struct nk_rect win_bounds = nk_window_get_bounds(
NK_CTX);
4949 nk_layout_row_dynamic(
NK_CTX, 20, 4);
4952 nk_text(
NK_CTX,
"Scene Name", 10, NK_TEXT_ALIGN_LEFT);
4954 char scene_name_buffer[256];
4956 scene_name_flags = nk_edit_string_zero_terminated(
NK_CTX, NK_EDIT_FIELD, scene_name_buffer,
sizeof(scene_name_buffer), nk_filter_default);
4958 if (nk_button_text(
NK_CTX,
"Change Name", 11))
4967 nk_layout_row_dynamic(
NK_CTX, 20, 3);
4968 char file_name_buffer[256];
4969 scene_file_name_flags = nk_edit_string_zero_terminated(
NK_CTX, NK_EDIT_FIELD, file_name_buffer,
sizeof(file_name_buffer), nk_filter_default);
4970 if (nk_button_label(
NK_CTX,
"Save Scene"))
4974 if (nk_button_label(
NK_CTX,
"Save Scene Volumes"))
4978 nk_layout_row_dynamic(
NK_CTX, 20, 3);
4980 if (nk_button_label(
NK_CTX,
"Load Scene"))
4984 char complete_name[256];
4987 char * bin = strstr(complete_name,
".bin");
4988 if (bin) *bin =
'\0';
4992 if (nk_button_label(
NK_CTX,
"Load Scene Volumes"))
4996 char complete_name[256];
4999 char * bin = strstr(complete_name,
".bin");
5000 if (bin) *bin =
'\0';
5005 nk_layout_row_dynamic(
NK_CTX, 20, 3);
5006 char ui_buffer[256];
5007 ui_name_flags = nk_edit_string_zero_terminated(
NK_CTX, NK_EDIT_FIELD, ui_buffer,
sizeof(ui_buffer), nk_filter_default);
5008 if (nk_button_label(
NK_CTX,
"Save UI"))
5015 if (nk_button_label(
NK_CTX,
"Load UI"))
5019 char complete_name[256];
5021 char * bin = strstr(complete_name,
".bin");
5022 if (bin) *bin =
'\0';
5027 nk_layout_row_dynamic(
NK_CTX, 20, 4);
5031 nk_bool gltf_names_expanded = nk_false;
5032 if (nk_combo_begin_label(
NK_CTX,
"Expand", nk_vec2(200, 200))) {
5047 nk_layout_row_dynamic(
NK_CTX, 20, 1);
5048 for (
int i = 0; i < gltf_label.
item_count; i++) {
5049 nk_bool sel = (i == gltf_label.
selected);
5050 if (nk_selectable_label(
NK_CTX, gltf_label.
ptrs[i], NK_TEXT_LEFT, &sel)) {
5062 if (nk_button_label(
NK_CTX,
"Load Asset"))
5067 char complete_name[256];
5087 if (nk_combo_begin_label(
NK_CTX, asset_label.
ptrs[asset_label.
selected], nk_vec2(200, 200))) {
5090 nk_layout_row_dynamic(
NK_CTX, 20, 1);
5091 for (
int i = 0; i < asset_label.
item_count; i++) {
5092 nk_bool sel = (i == asset_label.
selected);
5093 if (nk_selectable_label(
NK_CTX, asset_label.
ptrs[i], NK_TEXT_LEFT, &sel)) {
5099 if (nk_button_label(
NK_CTX,
"Spawn Instance"))
5102 AssetInstance * ai =
init_new_asset_instance(asset_label.
ptrs[
EDITOR_SETTINGS.
selected_asset_id], (
vec3){0,0,0}, (
vec4){0,0,0,1}, (
vec3){1,1,1});
5116 if (mns[i].mesh == -1 || mns[i].free)
continue;
5117 if (!meshes[mns[i].mesh].static_mesh || !mns[i].static_mesh || mns[i].physics_mode)
continue;
5127 char rprobe_name_buffer[256];
5128 rprobe_name_flags = nk_edit_string_zero_terminated(
NK_CTX, NK_EDIT_FIELD, rprobe_name_buffer,
sizeof(rprobe_name_buffer), nk_filter_default);
5129 if (nk_button_text(
NK_CTX,
"Save RProbes", 12))
5132 char complete_name[256];
5134 strncat(complete_name, rprobe_name_buffer, 255 - strlen(
rprobe_dir));
5135 complete_name[255] =
'\0';
5142 nk_bool rprobe_names_expanded = nk_false;
5143 if (nk_combo_begin_label(
NK_CTX,
"Expand", nk_vec2(200, 200))) {
5158 nk_layout_row_dynamic(
NK_CTX, 20, 1);
5159 for (
int i = 0; i < rprobe_label.
item_count; i++) {
5160 nk_bool sel = (i == rprobe_label.
selected);
5161 if (nk_selectable_label(
NK_CTX, rprobe_label.
ptrs[i], NK_TEXT_LEFT, &sel)) {
5171 if (nk_button_text(
NK_CTX,
"Load RProbes", 12))
5176 char complete_name[256];
5179 complete_name[255] =
'\0';
5187 nk_layout_row_dynamic(
NK_CTX, 20, 1);
5195 nk_layout_row_dynamic(
NK_CTX, 20, 1);
5202 nk_layout_row_dynamic(
NK_CTX, 20, 4);
5204 if (nk_checkbox_label(
NK_CTX,
"SSAO", &ssao))
5209 if (nk_checkbox_label(
NK_CTX,
"SSR", &ssr))
5214 if (nk_checkbox_label(
NK_CTX,
"DOF", &dof))
5220 if (nk_checkbox_label(
NK_CTX,
"MBLUR", &mblur))
5225 if (nk_checkbox_label(
NK_CTX,
"NOISE", &noise))
5230 if (nk_checkbox_label(
NK_CTX,
"ACES", &aces))
5235 if (nk_checkbox_label(
NK_CTX,
"LUT", &lut))
5241 if (nk_checkbox_label(
NK_CTX,
"TAA", &taa))
5246 if (nk_checkbox_label(
NK_CTX,
"MSAA", &msaa))
5255 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER,
GBUFFER_FBO.
depth_rbo.
i);
5270 if (nk_checkbox_label(
NK_CTX,
"FULL_GBUFFER", &full_gbuffer))
5286 if (nk_checkbox_label(
NK_CTX,
"BLOOM", &bloom))
5291 if (nk_checkbox_label(
NK_CTX,
"VSYNC", &vsync))
5294 SDL_GL_SetSwapInterval(vsync);
5297 if (nk_checkbox_label(
NK_CTX,
"UI", &ui))
5346 nk_layout_row_dynamic(
NK_CTX, 20, 1);
5352 if (nk_tree_push(
NK_CTX, NK_TREE_NODE,
"Resolution", NK_MINIMIZED))
5354 nk_layout_row_dynamic(
NK_CTX, 20, 2);
5370 nk_layout_row_dynamic(
NK_CTX, 20, 2);
5374 if (nk_button_label(
NK_CTX,
"Change FS"))
5389 nk_layout_row_dynamic(
NK_CTX, 20, 1);
5390 if (nk_button_label(
NK_CTX,
"Screen"))
5408 char render_res[64];
5410 nk_label(
NK_CTX, render_res, NK_TEXT_ALIGN_LEFT);
5411 if (nk_button_label(
NK_CTX,
"Render"))
5429 nk_label(
NK_CTX, ssao_res, NK_TEXT_ALIGN_LEFT);
5430 if (nk_button_label(
NK_CTX,
"SSAO"))
5446 nk_label(
NK_CTX, coc_res, NK_TEXT_ALIGN_LEFT);
5447 if (nk_button_label(
NK_CTX,
"DOF"))
5462 nk_label(
NK_CTX, bloom_res, NK_TEXT_ALIGN_LEFT);
5463 if (nk_button_label(
NK_CTX,
"BLOOM"))
5477 if (nk_button_label(
NK_CTX,
"Make Effects Halfsize"))
5503 if (nk_tree_push(
NK_CTX, NK_TREE_NODE,
"DOF Settings", NK_MINIMIZED))
5506 nk_layout_row_dynamic(
NK_CTX, 20, 2);
5549 NK_WINDOW_TITLE | NK_WINDOW_SCROLL_AUTO_HIDE | NK_WINDOW_CLOSABLE
5555 struct nk_rect win_bounds = nk_window_get_bounds(
NK_CTX);
5562 nk_layout_row_dynamic(
NK_CTX, 20, 1);
5566 sprintf(idx,
"%zu", mn->
id);
5567 nk_label(
NK_CTX, idx, NK_TEXT_ALIGN_LEFT);
5590 if (nk_combo_begin_label(
NK_CTX, sm_label.
ptrs[sm_label.
selected], nk_vec2(200, 200))) {
5591 nk_layout_row_dynamic(
NK_CTX, 15, 1);
5592 for (
int i = 0; i < sm_label.
item_count; i++) {
5593 nk_bool sel = (i == sm_label.
selected);
5594 if (nk_selectable_label(
NK_CTX, sm_label.
ptrs[i], NK_TEXT_LEFT, &sel)) {
5621 if (nk_combo_begin_label(
NK_CTX, mat_label.
ptrs[mat_label.
selected], nk_vec2(200, 200))) {
5622 nk_layout_row_dynamic(
NK_CTX, 15, 1);
5623 for (
int i = 0; i < mat_label.
item_count; i++) {
5624 nk_bool sel = (i == mat_label.
selected);
5625 if (nk_selectable_label(
NK_CTX, mat_label.
ptrs[i], NK_TEXT_LEFT, &sel)) {
5635 if (nk_button_text(
NK_CTX,
"Change Material", 15))
5649 nk_layout_row_dynamic(
NK_CTX, 20, 1);
5650 if (nk_button_text(
NK_CTX,
"Open Material", 8))
5654 nk_window_show(
NK_CTX,
"Material", NK_SHOWN);
5667 nk_layout_row_dynamic(
NK_CTX, 20, 1);
5675 if (nk_button_label(
NK_CTX,
"Select Entity MN"))
5704 NK_WINDOW_TITLE | NK_WINDOW_SCROLL_AUTO_HIDE | NK_WINDOW_CLOSABLE
5709 struct nk_rect win_bounds = nk_window_get_bounds(
NK_CTX);
5710 if (nk_input_is_mouse_hovering_rect(&
NK_CTX->input, win_bounds)) {
5720 nk_layout_row_dynamic(
NK_CTX, 20, 1);
5721 struct nk_colorf diffuse_color = {
5727 nk_label(
NK_CTX,
"Diffuse", NK_TEXT_LEFT);
5729 if (nk_combo_begin_color(
NK_CTX, nk_rgba_cf(diffuse_color), nk_vec2(150, 150))) {
5730 nk_layout_row_dynamic(
NK_CTX, 120, 1);
5731 diffuse_color = nk_color_picker(
NK_CTX, diffuse_color, NK_RGBA);
5734 nk_layout_row_dynamic(
NK_CTX, 25, 1);
5735 diffuse_color.r = nk_propertyf(
NK_CTX,
"#R:", 0.0f, diffuse_color.r, 1.0f, 0.01f, 0.005f);
5736 diffuse_color.g = nk_propertyf(
NK_CTX,
"#G:", 0.0f, diffuse_color.g, 1.0f, 0.01f, 0.005f);
5737 diffuse_color.b = nk_propertyf(
NK_CTX,
"#B:", 0.0f, diffuse_color.b, 1.0f, 0.01f, 0.005f);
5738 diffuse_color.a = nk_propertyf(
NK_CTX,
"#A:", 0.0f, diffuse_color.a, 1.0f, 0.01f, 0.005f);
5740 if (diffuse_color.r != mat->
kd.
x)
5742 mat->
kd.
x = diffuse_color.r;
5745 if (diffuse_color.g != mat->
kd.
y)
5747 mat->
kd.
y = diffuse_color.g;
5750 if (diffuse_color.b != mat->
kd.
z)
5752 mat->
kd.
z = diffuse_color.b;
5755 if (diffuse_color.a != mat->
kd.
w)
5757 mat->
kd.
w = diffuse_color.a;
5762 struct nk_colorf ambient_color = {
5768 nk_label(
NK_CTX,
"Ambient", NK_TEXT_LEFT);
5770 if (nk_combo_begin_color(
NK_CTX, nk_rgb_cf(ambient_color), nk_vec2(150, 150))) {
5771 nk_layout_row_dynamic(
NK_CTX, 120, 1);
5772 ambient_color = nk_color_picker(
NK_CTX, ambient_color, NK_RGB);
5775 nk_layout_row_dynamic(
NK_CTX, 25, 1);
5776 ambient_color.r = nk_propertyf(
NK_CTX,
"#R:", 0.0f, ambient_color.r, 1.0f, 0.01f, 0.005f);
5777 ambient_color.g = nk_propertyf(
NK_CTX,
"#G:", 0.0f, ambient_color.g, 1.0f, 0.01f, 0.005f);
5778 ambient_color.b = nk_propertyf(
NK_CTX,
"#B:", 0.0f, ambient_color.b, 1.0f, 0.01f, 0.005f);
5780 if (ambient_color.r != mat->
ka.
x)
5782 mat->
ka.
x = ambient_color.r;
5785 if (ambient_color.g != mat->
ka.
y)
5787 mat->
ka.
y = ambient_color.g;
5790 if (ambient_color.b != mat->
ka.
z)
5792 mat->
ka.
z = ambient_color.b;
5797 struct nk_colorf specular_color = {
5803 nk_label(
NK_CTX,
"Specular", NK_TEXT_LEFT);
5805 if (nk_combo_begin_color(
NK_CTX, nk_rgb_cf(specular_color), nk_vec2(150, 150))) {
5806 nk_layout_row_dynamic(
NK_CTX, 120, 1);
5807 specular_color = nk_color_picker(
NK_CTX, specular_color, NK_RGB);
5810 nk_layout_row_dynamic(
NK_CTX, 25, 1);
5811 specular_color.r = nk_propertyf(
NK_CTX,
"#R:", 0.0f, specular_color.r, 1.0f, 0.01f, 0.005f);
5812 specular_color.g = nk_propertyf(
NK_CTX,
"#G:", 0.0f, specular_color.g, 1.0f, 0.01f, 0.005f);
5813 specular_color.b = nk_propertyf(
NK_CTX,
"#B:", 0.0f, specular_color.b, 1.0f, 0.01f, 0.005f);
5815 if (specular_color.r != mat->
ks.
x)
5817 mat->
ks.
x = specular_color.r;
5820 if (specular_color.g != mat->
ks.
y)
5822 mat->
ks.
y = specular_color.g;
5825 if (specular_color.b != mat->
ks.
z)
5827 mat->
ks.
z = specular_color.b;
5833 struct nk_colorf emissive_color = {
5839 nk_label(
NK_CTX,
"Emissive", NK_TEXT_LEFT);
5841 if (nk_combo_begin_color(
NK_CTX, nk_rgb_cf(emissive_color), nk_vec2(150, 150))) {
5842 nk_layout_row_dynamic(
NK_CTX, 120, 1);
5843 emissive_color = nk_color_picker(
NK_CTX, emissive_color, NK_RGB);
5846 nk_layout_row_dynamic(
NK_CTX, 25, 1);
5847 emissive_color.r = nk_propertyf(
NK_CTX,
"#R:", 0.0f, emissive_color.r, 1.0f, 0.01f, 0.005f);
5848 emissive_color.g = nk_propertyf(
NK_CTX,
"#G:", 0.0f, emissive_color.g, 1.0f, 0.01f, 0.005f);
5849 emissive_color.b = nk_propertyf(
NK_CTX,
"#B:", 0.0f, emissive_color.b, 1.0f, 0.01f, 0.005f);
5851 if (emissive_color.r != mat->
ke.
x)
5853 mat->
ke.
x = emissive_color.r;
5856 if (emissive_color.g != mat->
ke.
y)
5858 mat->
ke.
y = emissive_color.g;
5861 if (emissive_color.b != mat->
ke.
z)
5863 mat->
ke.
z = emissive_color.b;
5870 nk_layout_row_dynamic(
NK_CTX, 20, 1);
5872 if (nk_checkbox_label(
NK_CTX,
"Arm Override", &arm_override))
5878 float metallic = nk_propertyf(
NK_CTX,
"Metallic", -1, mat->
metallic, 2, 0.001, 0.001);
5884 float roughness = nk_propertyf(
NK_CTX,
"Roughness", -1, mat->
roughness, 2, 0.001, 0.001);
5891 sprintf(am,
"Alpha Mode: %d", mat->
alpha_mode);
5892 if (nk_button_label(
NK_CTX, am))
5903 float ao_str = nk_propertyf(
NK_CTX,
"AO Strength", 0, mat->
ao_strength, 100000, 0.01, 0.01);
5934 NK_WINDOW_TITLE | NK_WINDOW_SCROLL_AUTO_HIDE | NK_WINDOW_CLOSABLE
5938 struct nk_rect win_bounds = nk_window_get_bounds(
NK_CTX);
5947 nk_layout_row_dynamic(
NK_CTX, 20, 1);
5951 nk_layout_row_dynamic(
NK_CTX, 20, 2);
5952 if (nk_button_label(
NK_CTX,
"Save Lights"))
5955 char complete_name[256];
5958 complete_name[255] =
'\0';
5965 if (nk_button_label(
NK_CTX,
"Load Lights"))
5970 char complete_name[256];
5973 complete_name[255] =
'\0';
5980 nk_layout_row_dynamic(
NK_CTX, 20, 1);
5983 nk_text(
NK_CTX, buf, strlen(buf), NK_TEXT_ALIGN_LEFT);
5989 if (nk_button_label(
NK_CTX,
"Select Entity Light"))
5999 if (nk_button_label(
NK_CTX,
"Build Light BVH"))
6004 if (nk_button_label(
NK_CTX,
"Create Light"))
6007 memset(new_light, 0,
sizeof(
Light));
6022 if (nk_button_label(
NK_CTX,
"Delete Light"))
6027 uint8_t ** bytes = malloc(
sizeof(uint8_t*));
6028 bytes[0] = malloc(
sizeof(
Light));
6029 memcpy(bytes[0], light,
sizeof(
Light));
6030 size_t total_bytes =
sizeof(uint8_t*) +
sizeof(
Light);
6042 struct nk_colorf light_color = {
6048 nk_label(
NK_CTX,
"Color", NK_TEXT_LEFT);
6050 if (nk_combo_begin_color(
NK_CTX, nk_rgb_cf(light_color), nk_vec2(150, 150))) {
6051 nk_layout_row_dynamic(
NK_CTX, 120, 1);
6052 light_color = nk_color_picker(
NK_CTX, light_color, NK_RGB);
6055 nk_layout_row_dynamic(
NK_CTX, 25, 1);
6056 light_color.r = nk_propertyf(
NK_CTX,
"#R:", 0.0f, light_color.r, 1.0f, 0.01f, 0.005f);
6057 light_color.g = nk_propertyf(
NK_CTX,
"#G:", 0.0f, light_color.g, 1.0f, 0.01f, 0.005f);
6058 light_color.b = nk_propertyf(
NK_CTX,
"#B:", 0.0f, light_color.b, 1.0f, 0.01f, 0.005f);
6077 nk_layout_row_dynamic(
NK_CTX, 20, 3);
6078 float xval = nk_propertyf(
NK_CTX,
"X", -1000.0f, light->
pos.
x, 1000.0f, 0.01f, 0.01f);
6079 float yval = nk_propertyf(
NK_CTX,
"Y", -1000.0f, light->
pos.
y, 1000.0f, 0.01f, 0.01f);
6080 float zval = nk_propertyf(
NK_CTX,
"Z", -1000.0f, light->
pos.
z, 1000.0f, 0.01f, 0.01f);
6093 bool dir_dirty =
false;
6095 xval = nk_propertyf(
NK_CTX,
"RX", -1000.0f, light->
dir.
x, 1000.0f, 0.01f, 0.01f);
6096 yval = nk_propertyf(
NK_CTX,
"RY", -1000.0f, light->
dir.
y, 1000.0f, 0.01f, 0.01f);
6097 zval = nk_propertyf(
NK_CTX,
"RZ", -1000.0f, light->
dir.
z, 1000.0f, 0.01f, 0.01f);
6108 nk_layout_row_dynamic(
NK_CTX, 20, 1);
6109 float intensity = nk_propertyf(
NK_CTX,
"Intensity", 0, light->
intensity, 10000, 0.1, 0.1);
6116 nk_layout_row_dynamic(
NK_CTX, 20, 2);
6117 float threshold = nk_propertyf(
NK_CTX,
"Threshold", 0, light->
threshold, 100, 0.0001, 0.0001);
6124 sprintf(radius,
"Radius: %f", light->
radius);
6125 nk_label(
NK_CTX, radius, NK_TEXT_ALIGN_LEFT);
6134 float cone_angle= nk_propertyf(
NK_CTX,
"Cone Angle", 0, light->
cone_angle, 20, 0.1, 0.1);
6140 float penumbra= nk_propertyf(
NK_CTX,
"Penumbra", 0, light->
penumbra, 20, 0.1, 0.1);
6149 int light_type = nk_propertyi(
NK_CTX,
"Light Type", 0, (
int)light->
light_type, 2, 1, 1);
6163 nk_layout_row_dynamic(
NK_CTX, 20, 2);
6173 if (nk_checkbox_label(
NK_CTX,
"M Factor", &mf))
6184 nk_layout_row_dynamic(
NK_CTX, 20, 1);
6196 nk_layout_row_dynamic(
NK_CTX, 20, 2);
6197 if (nk_button_label(
NK_CTX,
"Regenerate Texels"))
6203 if (nk_button_label(
NK_CTX,
"Assign New Texels"))
6209 nk_layout_row_dynamic(
NK_CTX, 20, 1);
6240 if (nk_button_text(
NK_CTX,
"Regenerate", 10))
6260 static char lightmap_buffer[256] = {0};
6262 nk_layout_row_dynamic(
NK_CTX, 20, 2);
6263 lm_name_flags = nk_edit_string_zero_terminated(
NK_CTX, NK_EDIT_FIELD, lightmap_buffer,
sizeof(lightmap_buffer), nk_filter_default);
6265 if (nk_button_label(
NK_CTX,
"Save LM"))
6270 strcat(lm_name, lightmap_buffer);
6271 strcat(lm_name,
"_lm.bin");
6275 nk_layout_row_dynamic(
NK_CTX, 20, 2);
6277 if (nk_button_label(
NK_CTX,
"Load LM"))
6282 char complete_name[256];
6285 complete_name[255] =
'\0';
6293 bool expand_aabb =
false;
6295 nk_layout_row_dynamic(
NK_CTX, 20, 3);
6317 nk_layout_row_dynamic(
NK_CTX, 20, 3);
6343 nk_layout_row_dynamic(
NK_CTX, 20, 1);
6360 if (nk_button_text(
NK_CTX,
"Spawn New R Probe", 17))
6387 nk_text(
NK_CTX, buf, strlen(buf), NK_TEXT_ALIGN_LEFT);
6392 if (nk_button_text(
NK_CTX,
"Delete R Probe", 17))
6395 uint8_t ** bytes = malloc(
sizeof(uint8_t*));
6408 nk_layout_row_dynamic(
NK_CTX, 20, 3);
6410 bool rp_expand_aabb =
false;
6412 float aabbx = nk_propertyf(
NK_CTX,
"rp_aabbX", -1000.0f, p->
aabb.
center.
x, 1000.0f, 0.01f, 0.01f);
6420 float aabby = nk_propertyf(
NK_CTX,
"rp_aabbY", -1000.0f, p->
aabb.
center.
y, 1000.0f, 0.01f, 0.01f);
6426 float aabbz = nk_propertyf(
NK_CTX,
"rp_aabbZ", -1000.0f, p->
aabb.
center.
z, 1000.0f, 0.01f, 0.01f);
6433 nk_layout_row_dynamic(
NK_CTX, 20, 3);
6435 float aabbex = nk_propertyf(
NK_CTX,
"rp_AABBE_X", -1000.0f, p->
aabb.
extents.
x, 1000.0f, 0.01f, 0.01f);
6442 float aabbey = nk_propertyf(
NK_CTX,
"rp_AABBE_Y", -1000.0f, p->
aabb.
extents.
y, 1000.0f, 0.01f, 0.01f);
6449 float aabbez = nk_propertyf(
NK_CTX,
"rp_AABBE_Z", -1000.0f, p->
aabb.
extents.
z, 1000.0f, 0.01f, 0.01f);
6461 float rp_fadex = nk_propertyf(
NK_CTX,
"rp_fade_X", -1000.0f, p->
fade_margin.
x, 1000.0f, 0.01f, 0.01f);
6467 float rp_fadey = nk_propertyf(
NK_CTX,
"rp_fade_Y", -1000.0f, p->
fade_margin.
y, 1000.0f, 0.01f, 0.01f);
6473 float rp_fadez = nk_propertyf(
NK_CTX,
"rp_fade_Z", -1000.0f, p->
fade_margin.
z, 1000.0f, 0.01f, 0.01f);
6479 float capture_posx = nk_propertyf(
NK_CTX,
"rp_capposX", -1000.0f, p->
capture_pos.
x, 1000.0f, 0.01f, 0.01f);
6485 float capture_posy = nk_propertyf(
NK_CTX,
"rp_capposY", -1000.0f, p->
capture_pos.
y, 1000.0f, 0.01f, 0.01f);
6491 float capture_posz = nk_propertyf(
NK_CTX,
"rp_capposZ", -1000.0f, p->
capture_pos.
z, 1000.0f, 0.01f, 0.01f);
6497 nk_layout_row_dynamic(
NK_CTX, 20, 1);
6498 if (nk_button_text(
NK_CTX,
"Center Cap Pos", 14))
6505 if (nk_button_text(
NK_CTX,
"Bake R Probes", 13))
6534 NK_WINDOW_TITLE | NK_WINDOW_SCROLL_AUTO_HIDE | NK_WINDOW_CLOSABLE
6539 struct nk_rect win_bounds = nk_window_get_bounds(
NK_CTX);
6548 nk_layout_row_dynamic(
NK_CTX, 20, 1);
6550 char (* node_names)[256] = calloc(ai->
node_count,
sizeof(*node_names));
6551 char ** name_ptrs = malloc(
sizeof(
char*) * ai->
node_count);
6558 strcpy(node_names[i], mn->
name);
6559 name_ptrs[i] = node_names[i];
6577 if (nk_button_label(
NK_CTX,
"Select Node"))
6588 if (nk_button_label(
NK_CTX,
"Delete Asset Instance"))
6680 if (nk_window_is_closed(
NK_CTX,
"Light Menu") || nk_window_is_hidden(
NK_CTX,
"Light Menu"))
void init_scene_bvh()
Initializes or updates the pre-existing scene bvh based on all mesh nodes with valid meshes.
void build_light_bvh()
Initializes a bvh for all current lights and emissive triangles in the scene, and sets the flux up fo...
Acceleration structure generation and how we traverse them.
Audio probe baking, portal creation, probe volumes, and emitter functions.
vec3 rot(vec3 M[3], vec3 a)
Refer to Ken Perlin's 2 joint IK implmentation.
The debug editor UI for the engine.
Engine specific types and defines.
AABB aabb
Bounding box of area.
bool lights_dirty
If lights need to be reuploaded.
float * lprobes
The raw SH data.
FILE * LPV_FILE
FILE pointer to the opened binary file.
FILE * APV_FILE
FILE pointer to the opened binary file.
Vector mesh_nodes
MeshNodes.
int skin
The GLTFSkin to be modified by this Entity (skeletal animations).
const ivec3 DEFAULT_LPV_RES
What LPVs should always be at to match texture dimensions.
SceneData scene_data
SceneData that is more-so scene specific.
AnimationKeyframe kf[64]
The AnimationKeyframes for this track.
bool loop
If the animation loops.
GLuint i
The image handle for this texture.
void(* fn[ESTATE_MAX])(void *)
nk_bool open
If the directory is currently open in a dropdown.
char LPV_PATH[256]
Path to binary file with lighting ProbeVolumes.
AnimationComponent * ac
The AnimationComponent inside of ANIMATION_COMPONENTS.
vec3 capture_pos
The position to capture the cubemap from.
vec3 fade_margin
The margin to fade between this probe and another.
Vector vertex_layouts
VertexLayouts.
Vector audio_portals
AudioPortals.
const char * DVIEW_NAMES[]
Debug view names used for choosing a debug view.
AnimationTrack tracks[64]
The AnimationTracks with individual values that occur simultaneously.
int kf_count
The amount of AnimationKeyframes.
@ SELMODE_TEXTBOX
TextBox.
@ SELMODE_ASSETINSTANCE
AssetInstance.
@ SELMODE_RPROBE
ReflectionProbe.
@ SELMODE_APV
Audio ProbeVolume (APV).
@ SELMODE_LPV
Lighting ProbeVolume (LPV).
@ SELMODE_UIELEMENT
UIElement.
@ SELMODE_AEM
AudioEmitter.
@ SELMODE_APORTAL
AudioPortal.
int cubemap_idx
Which cubemap this is linked to.
Globals GLOBALS
Engine Globals.
size_t * node_indices
The indices of MeshNodes spawned from this instance inside of Globals.mesh_nodes.
bool free
If the component is empty.
bool keyboard_locked
If the keyboard is unlocked to register text events in the editor UI.
GLTexture depth_texture
The normal depth texture, if there is one.
LPV LOADED_LIGHTING_PV[6]
Load slots for lighting ProbeVolumes.
Vector reflection_probes
ReflectionProbes in the scene.
#define MAX_UI_MENU_NAMES
Used in editor to determine dropdown size.
bool search_suffix
If there is a suffix.
#define LABEL_LEN
The maximum label length of labels in a ComboLabel.
Vector names
The name of each file in the directory.
FullscreenOptions
Fullscreen options.
float duration
The duration of all of the AnimationKeyframes.
Vector lighting_probe_volumes
All of the lighting probe volumes, regardless of if they have been loaded yet.
const char * PPDVIEW_NAMES[]
Postprocess debug view names used for choosing.
bool free
If the Entity is empty.
const ivec3 DEFAULT_APV_RES
When APVs are spawned, they use this.
Vector audio_probe_volumes
All of the AudioProbe% volumes, regardless of if they have been loaded yet.
@ MSAA_SAMPLE_OPTIONS_MAX
size_t node_count
The amount of MeshNodes in this instance.
size_t material
The Material.
size_t id
The ID in ASSET_INSTANCES.
const char * FULLSCREEN_OPTION_NAMES[]
Fullscreen option names.
char APV_PATH[256]
Path to binary file with Audio ProbeVolumes.
Vector materials
Materials.
int track_count
The amount of AnimationTracks.
State * state
The current State that describes actions for this Entity.
PhysicsComponent * pc
The PhysicsComponent inside of PHYSICS_COMPONENTS.
char suffix[256]
The suffix to append to the end of the file when searching.
size_t id
ID inside of ENTITIES.
int pv_id
The ProbeVolume in SceneData.lighting_probe_volume.
bool LOADED_LIGHTING_PV_FLAG[6]
Flags that indicate if the slot is loaded.
char directory[256]
Path to directory for the file.
char path[256]
The path to the Asset.
GLuint fbo
The handle for this fbo.
union AnimationKeyframe::@243377164052067242366020157201307241363031166101 val
LightmapData lightmap_data
The loaded lightmap and lightmap configuration for the scene.
char name[256]
Modifiable name of the scene.
AnimationTargetType type
The type of the data stored on AnimationKeyframe.
bool active
If this animation is currently running.
int current_selection
The file that is currently selected (starts at 0).
Vector islands
The UVIslands on the current lightmap.
int msaa_samples
How many samples our multisampled textures are using.
GLRenderbuffer depth_rbo
The renderbuffer depth texture, if there is one.
#define PERFORMANCE_OVERLAY_TEXT_BOX_COUNT
Offset of how many text boxes are used for the debug performance overlay.
bool currently_rasterizing
If we are going to rasterize this island on the next lightmap bake.
The animation component for interpolation between AnimationKeyframes.
Tagged union for the value stored in a keyframe.
Tagged union for the value stored in a keyframe.
An Asset after it is loaded in from file into Globals.assets.
A instance of an Asset that retains its node structure but can be duplicated into multiple instances ...
Entity structure that holds components and references to the data it owns.
Registry for folders that are used for dropdowns in the editor UI.
Global settings and structures for each system in the engine.
ReflectionProbes used for parallax corrected cubemaps.
Sections of Meshes that are divided based on Material for batching and DrawCommand ordering purposes.
The UVIslands that are generated from contiguous MeshFaces with similar planes for UV lightmapping.
An unused abstraction for VertexLayouts.
mat4 compose_trs_from_mesh_node(MeshNode *mn)
void destroy_entity(Entity *ent)
Deletes an entity by simply freeing it and its components.
AnimationComponent * create_animation_component(Entity *ent)
Creates an animation component for an entity.
PhysicsComponent * create_physics_component(Entity *ent, CollisionType collision_type, PhysicsType physics_type)
Creates an physics component for an entity.
Entity * create_entity(AssetInstance *asset_instance, int mn_id, bool physics_component, bool animation_component)
Creates an entity using the free list of ENTITIES.
ECS creation and maintenance.
int create_text_box(int menu_id)
Creates a DEFAULT_TEXT_BOX.
void delete_text_box(int menu, int id)
Deletes a TextBox and its text and frees it from the UIMenu.
void move_text_box_to_origin(TextBox *box)
Moves a TextBox to , while accounting for Justify.
Functions that modify TextBoxes and load Fonts.
void load_gltf(const char *gltf_path)
Loads a GLTF.
GLTF parsing related utilities and important initialization data for Meshes, MeshNodes,...
ivec3 resolution
The resolution in X, Y, Z.
size_t size
The byte size of this volume.
size_t byte_offset
The byte offset into the binary file storing this volume.
OBB obb
The OBB that defines the size.
void reset_audio_pvs()
Reset audio pvs, frees each slot in the global audio pv slots.
void bake_audio_probe_volume(ProbeVolume *pv)
Bakes an audio probe volume.
The ProbeVolumes for APVs and LPVs, controlled by OBBs.
bool is_occludable
If the AudioEmitter can be occluded and needs to go through the AudioPortal system.
Vector adjacent_portals
int - Vector of AudioPortals that can be seen from this one.
uint32_t id
The static ID of the AudioEmitter inside of AUDIO_EMITTERS.
bool is_loop
If the AudioEmitter loops.
vec3 pos
The position of the AudioEmitter .
char path[256]
The path to the sound.
float base_volume
The starting volume.
vec3 pos
The position of the AudioPortal.
ma_sound sound_obj
The miniaudio sound obj.
bool is_loaded
If the emitter is loaded in miniaudio.
void end_emitter(AudioEmitter *e)
Stops playing an emitter.
AudioEmitter * init_emitter(const char *filepath, bool is_loop, bool is_occludable, float base_volume)
Initialized an audio emitter and sets up its audio object in miniaudio.
void play_emitter(AudioEmitter *emitter, vec3 pos)
Starts playing an emitter.
void unload_emitter(int id)
Unloads an emitter from miniaudio.
#define MAX_AUDIO_EMITTERS
The maximum amount of AudioEmitters.
void load_emitter(AudioEmitter *emitter, const char *filepath, bool is_loop, bool is_occludable, float base_volume)
Loads an existing emitter into miniaudio.
void destroy_emitter(int id)
Unloads an emitter from miniaudio and frees the emitter as well.
void init_new_audio_portal(vec3 pos)
Creates an audio portal by expanding the vector.
void remove_audio_portal(int id)
Removes an audio portal from the vector.
void recalculate_audio_portal_paths()
Recalculates the adjacency map of portals between each other.
An AudioEmitter that plays audio possibily from a certain position or at a certain time.
AudioPortals used for determining paths to transmit sound when emitter and listener are occluded.
int selected_lighting_probe_volume_id
DebugView current_debug_view
int ao_iterations
Controls how many iterations per lightmap iteration perform the AO check.
float rotation_angle
The current angle for rotation operations in the editor.
int selected_rprobe_file_id
float ao_threshold
Controls the distance threshold for AO detection.
int probe_iterations
The amount of iterations to bake each probe.
AABB lm_aabb
The AABB that sizes the current lightmap in world space.
int audio_probe_iterations
The amount of iterations (sample rays) to bake per AudioProbe.
int lm_iterations
The amount of iterations to bake a lightmap.
int selected_asset_instance_id
float texels_per_uv_unit
Controls the texel density of the uv lightmapper.
int selected_audio_probe_volume_id
float reverb_wet
Controls the volume of the reverb signal.
int selected_audio_emitter_id
float DOF_max_blur_radius
int selected_fullscreen_option
float volume
Controls the engine volume.
float render_framerate_target
The target framerate for rendering and processing ui events (a cap).
bool lighting_probe_volume_overlay
int res_width
Tracks rendering dimensions in editor menu.
NKSlider probe_iterations
int selected_ui_action_id
int selected_gltf_file_id
int selected_ui_element_id
PostprocessDView pp_dview
vec3 rotation_axis
The rotation axis for rotation operations in the editor.
int selected_asset_instance_mn_id
bool mfactor_enabled
Controls how many iterations per lightmap iteration perform the AO check.
int current_fullscreen_option
bool asset_instance_menu_open
int selected_audio_portal_id
bool audio_probe_volume_overlay
size_t undo_stack_max_byte_size
The maximum memory value for the Undo stack.
int audio_probe_bounces
The amount of bounces to accept per AudioProbe iteration.
NKSlider sliderscrollscale
float mfactor
Controls how many iterations per lightmap iteration perform the AO check.
int selected_material_mn_id
void execute_aprobe_undo(Undo *undo)
void render_editor_menu()
Renders the editor menus.
void execute_aportal_undo(Undo *undo)
nk_bool rprobe_file_names_open
const char menu_names[][256]
The array for all editor menu names (to avoid Nuklear hashing problems).
LProbeEditorMenu LPROBE_MENU
char scrollbar_buffer[256]
FileDirectoryRegistry rprobe_registry
void push_nk_slider_undo(NKSlider *s, UndoStructure structure, size_t byte_offset)
char text_container_buffer[256]
void load_filenames(FileDirectoryRegistry *registry)
void execute_rprobe_undo(Undo *undo)
char element_cid_buffer[256]
void update_performance_overlay(GLuint64 query_s[PQUERY_MAX])
Fills performance overlay with text based on current GPU profiling information.
AProbeEditorMenu APROBE_MENU
void execute_globals_undo(Undo *undo)
AssetInstanceEditorMenu AI_MENU
void execute_ui_container_undo(Undo *undo)
char scene_lpv_name_buffer[256]
FileDirectoryRegistry ui_registry
void render_lprobe_menu()
void change_dof_res(int w, int h)
void render_entity_menu()
char element_id_buffer[256]
FileDirectoryRegistry aportal_registry
FileDirectoryRegistry sound_registry
const char QUERY_NAMES[PQUERY_MAX][256]
void clear_special_undo_bytes(Undo *undo)
void render_obb_widget(const char *name, UndoStructureType undo_type, int id, OBB *obb, NKSlider *sliders)
bool check_equivalencyi(int *a, int b, NKSlider *s, bool *dirty)
FileDirectoryRegistry scene_apv_registry
void UNDO_INIT()
Initializes Undos inside of UNDOS to free state.
void execute_editor_settings_undo(Undo *undo)
char light_name_buffer[256]
void perform_newest_redo()
Performs top-most Redo (Undo->next) and moves pointers upward.
void execute_undo(Undo *undo)
Performs an Undo (switch-case into each UndoStructureType).
char aportal_name_buffer[256]
void render_material_menu()
nk_bool gltf_file_names_open
void execute_lprobe_undo(Undo *undo)
void render_pos_widget(const char *name, UndoStructureType undo_type, int id, vec3 *pos, NKSlider *sliders)
void execute_ui_menu_undo(Undo *undo)
const char * MSAA_OPTIONS[]
bool check_equivalencyv3(vec3 *a, vec3 b, NKSlider *s, bool *dirty)
mat3 mat3_rotation_z(float angle_radians)
char label_id_buffer[256]
void load_gltf_filenames(const char *folder_path)
void destroy_redo_history()
UndoStructure create_rprobe_undo_structure(int id, UndoSpecial special)
void render_ivec3_widget(const char *name, UndoStructureType undo_type, int id, ivec3 *vec, NKSlider *sliders)
void render_dropdown_labels(int *selected, char **options, int option_count)
void obb_orthonormalize(OBB *obb)
FileDirectoryRegistry lightmap_registry
char gltf_names[256][256]
void execute_mesh_node_undo(Undo *undo)
bool check_equivalencyv4(vec4 *a, vec4 b, NKSlider *s, bool *dirty)
FileDirectoryRegistry lprobe_registry
void change_fullscreen_option(FullscreenOptions option)
char lprobe_name_buffer[256]
void change_ssao_res(int w, int h)
UIElementEditorMenu UIELEMENT_MENU
void change_render_resolution()
void execute_asset_instance_undo(Undo *undo)
UndoStructure create_light_undo_structure(int id, UndoSpecial special)
void render_selection_menu()
void push_raw_bytes_undo(void *bytes, size_t byte_size, UndoStructure structure, size_t byte_offset)
void store_into_nkslider(NKSlider *s, void *bytes, size_t byte_size)
void clear_undo(Undo *undo)
UndoStructure create_singular_id_undo_structure(UndoStructureType type, int id, UndoSpecial special)
char scene_apv_name_buffer[256]
void link_undo(Undo *undo)
FileDirectoryRegistry light_registry
bool check_equivalencyf(float *a, float b, NKSlider *s, bool *dirty)
void change_bloom_res(int w, int h)
void create_performance_overlay()
Allocates and initializes position of the TextBoxes for the performance overlay.
void push_special_undo(UndoStructure structure, uint8_t **bytes, size_t total_byte_size, size_t bytes_count, size_t byte_offset)
mat3 mat3_rotation_x(float angle_radians)
void copy_special_undo(Undo *undo, uint8_t ***special_bytes, int ids[8])
void FILE_DIR_REGISTRY_INIT()
Initializes each FileDirectoryRegistry based on initial paths.
char rprobe_names[256][256]
bool nk_check_equivalency(void *a, void *b, size_t byte_size, NKSlider *s, bool *dirty)
mat3 mat3_rotation_y(float angle_radians)
int scene_file_name_flags
MeshNodeEditorMenu MN_MENU
FileDirectoryRegistry scene_registry
FileDirectoryRegistry aprobe_registry
void perform_newest_undo()
Performs top-most Undo and moves the top-most pointer to the previous.
void render_dropdown(const char *dropdown_name, int *selected, char **options, int option_count, int x, int y)
void render_aabb_widget(const char *name, AABB *aabb)
void execute_ui_element_undo(Undo *undo)
void execute_non_special_undo(Undo *undo, uint8_t *p)
char element_parent_container_buffer[256]
void execute_light_undo(Undo *undo)
void render_asset_instance_menu()
void render_file_directory_dropdown(FileDirectoryRegistry *registry)
void push_special_undo_normal_bytes(UndoStructure structure, void *bytes, size_t byte_size, size_t byte_offset)
void toggle_performance_overlay()
Toggles the performance overlay menu: PERFORMANCE_OVERLAY_MENU.
FileDirectoryRegistry scene_lpv_registry
void render_mat4_widget(const char *name, UndoStructureType undo_type, int id, mat4 *mat, vec3 *tr, vec4 *rot, vec3 *sc, NKSlider *sliders)
const char target_types[4][256]
void execute_aemitter_undo(Undo *undo)
void destroy_undo(Undo *undo)
void execute_text_box_undo(Undo *undo)
UndoStructure create_editor_settings_undo_structure(UndoSpecial special)
UndoStructure create_undo_structure(UndoStructureType type, int id[8], UndoSpecial special)
void load_rprobe_filenames(const char *folder_path)
TextBoxEditorMenu TEXTBOX_MENU
char aprobe_name_buffer[256]
LightEditorMenu LIGHT_MENU
@ UNDOSTRUCT_UI_CONTAINER
@ UNDOSTRUCT_EDITOR_SETTINGS
@ UNDOSTRUCT_ASSETINSTANCE
@ UNDOTEXTBOX_ADD_TO_CONTAINER
@ UNDOUICONTAINER_CHANGE_SCROLLBAR
@ REDOUIELEMENT_ADD_TO_CONTAINER
@ UNDOTEXTBOX_DELETE_TEXT_BOX
@ UNDOAEMITTER_DELETE_SOUND_OBJ
@ UNDOAEMITTER_LOAD_SOUND_OBJ
@ UNDOEDITORSETTINGS_SCREEN_RES
@ UNDOEDITORSETTINGS_BLOOM_RES
@ UNDOAPROBE_RESET_APV_SIZE
@ UNDOEDITORSETTINGS_DOF_RES
@ UNDOEDITORSETTINGS_HALFSIZE_EFFECTS
@ UNDOUIELEMENT_JUSTIFY_LABEL
@ UNDOEDITORSETTINGS_RENDER_RES
@ UNDOLPROBE_RESET_LPV_SIZE
@ UNDOUIELEMENT_DELETE_ELEMENT
@ UNDOUIELEMENT_CREATE_ELEMENT
@ UNDOTEXTBOX_CREATE_TEXT_BOX
@ UNDOUIELEMENT_DELETE_CONTAINER
@ UNDOGLOBAL_SPAWN_ASSET_INSTANCE
@ UNDOAEMITTER_DELETE_EMITTER
@ UNDOASSETINSTANCE_ROTATION_ANGLE
@ UNDOUIELEMENT_CREATE_CONTAINER
@ UNDOEDITORSETTINGS_SSAO_RES
@ UNDOUIELEMENT_CREATE_LABEL
@ UNDOAEMITTER_STOP_EMITTER
@ UNDOEDITORSETTINGS_FULLSCREENOPT
@ UNDOAEMITTER_PLAY_EMITTER
@ UNDOUIELEMENT_CHANGE_CONTAINER
@ UNDOTEXTBOX_CHANGE_TEXT
@ UNDOUIELEMENT_REMOVE_FROM_CONTAINER
@ UNDOTEXTBOX_REMOVE_FROM_CONTAINER
@ UNDOTEXTBOX_CHANGE_CONTAINER
The structure used for some dropdown abstractions in the Editor UI.
Editor settings and engine global variables that can be changed through the editor.
mat3 inverse_inertia
IIA (currently just a calculated box).
float mass
Mass of the component.
float mu
The friction constant for the component.
bool free
If this is an empty component.
float restitution
The restitution (bounce).
mat3 calc_inverse_inertia(PhysicsComponent *pc)
Calculates the mat3 IIA for a PhysicsComponent, using AABB bounds and mass.
@ COL_HULL
Incremental hull generates a ConvexHull which is used for collision tests.
@ PHYSICS_FULL
All impulse resolution options applied.
Entity Component used for physics resolution.
float intensity
The intensity of the Light.
size_t id
The ID inside of Globals.mesh_nodes.
vec3 pos
Position of light.
LightType light_type
The type of Light.
char name[256]
The Material path.
Entity * ent
The Entity this MeshNode refers to (all children point to the same Entity as parent).
vec3 dir
Direction for lights that are not POINT_LIGHTs.
char name[256]
The name generated on loading from file.
bool sm_dirty
If a point light needs a new shadowmap.
bool skip_directional_uv_lighting
Skips directional Lights and rays go through them.
float cone_angle
Cone angle for SPOT_LIGHTs.
float penumbra
Penumbra (opening) for SPOT_LIGHTs.
int mesh
The Mesh it references.
float radius
The radius of the Light.
bool override_arm
If we override the ARM texture and bind a dummy instead.
vec3 rgb
Color of the light.
vec4 ks
Specular (unused).
float threshold
The threshold (how far a light reaches).
uint32_t entity_id
Entity ID into ENTITIES.
The CPU side structure for Lights.
The Materials parsed in from scene files that determine rendering pipeline setup, uploads,...
MeshNodes that describe the position of Meshes, GLTF nodes for GLTFAnimations, or hold references to ...
int uID
The ID inside of UIMenu.containers.
bool free
If this UIContainer is empty or can be replaced.
int box
The TextBox index inside of the UIMenu.
char id[256]
The name of this TextBox.
bool mask
If the UIElements and TextBoxes contained should not be rendered if outside.
vec2 scroll_dir
The direction this container moves in when scrolled.
UIInteractableType interactable
The special interactable type this UIElement may be.
float angle
Angle of rotation.
float angle
The angle to transform this box to.
char id[256]
The name of this UIContainer.
float min_val
The minimum value of the slider.
int container
The UIContainer this UIElement may control.
bool wrap
If UIElements and TextBoxes wrap around the container (unused).
union UIElement::@017317244344356306005252125357265110320354311371 as
TextBox text_boxes[1024]
The TextBoxes.
vec2 size
Size of the SDF.
float scroll_scale
How much the scroll is supposed to influence the UIContainer.
UIElement elements[1024]
The UIElements.
vec2 translation
X and Y coords where Y+ is down.
int scrollbar
The scrollbar UISlider UIElement.
vec2 translation
Where to place the center of the TextBox on the GPU.
UICallback action_callback
The event to occur on action (press or hold) or unaction.
vec4 padding
The padding before UIElements and TextBoxes are wrapped or masked.
vec2 shadow_dir
Which direction to offset the drop shadow in.
int text_cap
The amount of characters allocated.
uint32_t uID
The index inside of MENUS.
int parent_container
The UIContainer that contains this UIElement.
char id[256]
The name of this UIElement.
int menu
The UIMenu this UIElement is inside.
vec4 color
The color of the text.
Justify justify
How the text is centered in relation to and/or its UILabel.
Justify align
How the TextBox is justified within this UIElement.
float len
The length in pixel space.
uint32_t layer
The layer of the UIElement.
UIContainer containers[1024]
The UIContainers.
uint32_t layer
Rendering sort key (lower drawn first).
UICallback hover_callback
The event to occur on hover or unhover.
int parent_container
The UIContainer that contains this TextBox.
uint32_t uID
The ID inside of UIMenu.text_boxes.
char * text
The characters to render.
vec4 fill
The fill of the text.
int element
Which UIElement owns this UIContainer.
vec2 scale
The scale for this box on the GPU.
bool free
If this TextBox is empty and can be overwritten.
bool free
If the UIElement can be replaced or is empty.
uint32_t uID
The ID inside of UIMenu.
char id[256]
The unique name of this menu.
vec2 dir
The direction it slides in.
int menu
The UIMenu that this box is within.
char id[256]
The name of this UICallback inside of its registry.
vec2 base_pos
Where the element was before it was scrolled or manipulated somehow.
float radius
The radius of the circle OR the radius of a rectangle's corners.
float text_size
The size to render the Font.
vec4 color
Color of the shape.
float max_val
The maximum value of the slider.
float shadow_dist
How far the drop shadow is.
void assign_element_to_container(UIElement *el, UIContainer *c)
Assigns a UIElement to be parented to a UIContainer.
const char * JUSTIFY_NAMES[]
The names of Justify for the Editor UI.
int move_text_box_to_menu(int tb_idx, int current_menu, int target_menu)
Moves a TextBox from its current UIMenu to another UIMenu.
int move_element_to_menu(int element_idx, int current_menu, int target_menu)
Moves a UIElement from its current UIMenu to another UIMenu.
void delete_ui_element(int menu, int id)
Deletes a UIElement, removing it from its possible parent UIContainer and deleting its own possible U...
void remove_element_from_container(UIContainer *c, UIElement *el)
Removes a UIElement from a UIContainer.
int create_ui_element(int menu_id)
Creates a UIElement on a given UIMenu.
#define MAX_UI_CONTAINERS
int find_text_box_in_menu(UIMenu *m, const char *id)
Finds a TextBox inside of a UIMenu via name.
void align_text_box_label(UIElement *el)
Aligns a TextBox inside of a UILabel based on its Justify.
void delete_ui_container(UIElement *el)
Deletes a UIContainer, removing all references to it from existing TextBoxes and UIElements on the sa...
const char * UI_INTERACTABLE_NAMES[]
UIElement interactable names for the union that describe unique functions.
void remove_text_box_from_container(UIContainer *c, TextBox *tb)
Removes a TextBox from a UIContainer.
void reassign_elements_to_container(UIElement *el)
Assigns all children based on current UIContainer children.
UIContainer * create_ui_container(UIElement *el, int menu_id)
Creates a UIContainer from a given UIElement a given UIMenu.
UIMenu * create_menu()
Creates a new UIMenu, expanding the MENUS Vector and sets all arrays to free.
void assign_text_box_to_container(TextBox *tb, UIContainer *c)
Assigns a TextBox to be parented to a UIContainer.
void compute_slider_bounds(UIElement *element)
Computes the minimum and maximum in UI space for a UISlider.
bool container_is_valid(int container, int menu)
Checks if a UIContainer and UIMenu ID pairing is valid.
@ UI_INTERACTABLE_SLIDER
UISlider that can interpolate on a plane.
@ UI_INTERACTABLE_LABEL
References a TextBox that is Justified.
A structure holding a Font ID and text to be rendered and transformed with its properties.
UIContainer that contains both TextBoxes and UIElements and can mask and scroll them.
UIElements that are contained within a UIMenu that may receive events, be contained within UIContaine...
UIElement UILabels that contain a TextBox reference.
UIElement sliders that interpolate between two points on a line.
void destroy_asset_instance(uint32_t id)
Destroys and frees an AssetInstance.
void GPU_upload_scene_data()
Uploads current Globals and SceneData structures to the GPU for baking SSBOs.
void allocate_gbuffer_msaa()
Allocated a gbuffer with multisampled textures.
void allocate_gbuffer()
Allocates a gbuffer without multisampled textures.
AssetInstance * init_new_asset_instance(const char *asset_name, vec3 tr, vec4 rot, vec3 scale)
Initializes and spawns a new AssetInstance based on an Asset name, and places the AssetInstance....
void change_fbo_resolution(Framebuffer *fbo, int w, int h, bool skip_depth)
Changes Framebuffer's resolution, and deletes the old textures.
void allocate_main_fbo()
Allocates the main FBO, changes if MSAA is enabled.
Important globals for the entire engine and initialization functions that are mainly called on engine...
#define MAX_ASSET_INSTANCES
void LM_allocate_empty_mns()
Allocates texels for MeshNodes that don't have UVIslands generated yet.
void build_uv_islands(MeshNode *mn)
Builds UVIslands over a MeshNode by stepping through TriangleAdjacency and stopping when normals beco...
void bake_reflection_probes()
Bakes ReflectionProbes for the entire scene onto cubemaps on RPROBE_CUBE_MAP_ARRAY.
void bake_lightmap(LightmapData *ld)
Bakes a UV Lightmap based on which UVIslands have UVIsland.currently_rasterizing set.
void LM_regenerate_texels()
Regenerates lightmap texels: re-inits LightmapData, then builds UVIslands, then calls add_all_meshes_...
void load_lightmap_from_binary(LightmapData *ld, const char *name)
Loads a UV lightmap and relevant UVIsland and MeshNode data fro, binary.
void init_lightmap_data(LightmapData *ld)
Frees current LightmapAtlas and UVIsland data and re-initializes the LightmapAtlas array and initiali...
void bake_lighting_probe_volume(ProbeVolume *pv)
Loads a UV lightmap and relevant UVIsland and MeshNode data fro, binary.
void save_lightmap_to_binary(LightmapData *ld, const char *name)
Saves a UV lightmap and relevant UVIsland and MeshNode data to binary.
void reset_lighting_pvs()
Resets current LPVs from their slots in SceneData.LOADED_LIGHTING_PV.
UV Lightmap setup and baking, ReflectionProbe baking, and lighting ProbeVolume baking.
Vector submeshes
The SubMeshes split via Materials.
A Mesh with geometry data that is either initialized as static or dynamic and split into SubMeshes.
void scene_save_volumes(const char *name)
Saves only AudioProbes, AudioPortals, and ReflectionProbes.
void save_ui(const char *name)
void save_vector(const char *filename, Vector *vec)
void load_ui(const char *name)
void load_rprobes(const char *filename, Vector *vec)
void scene_save(const char *name)
Saves an entire scene into separate files.
void save_lprobes(const char *filename, Vector *vec)
void scene_load_volumes(const char *name)
Loads only AudioProbes, AudioPortals, and ReflectionProbes.
void load_lprobes(const char *filename, Vector *vec)
void load_aportals(const char *filename, Vector *vec)
void load_aprobes(const char *filename)
void save_aportals(const char *filename, Vector *vec)
void load_vector(const char *filename, Vector *vec)
void save_aprobes(const char *filename)
void scene_load(const char *name)
Loads an entire scene from separate files in FileDirectoryRegistry directories.
void reallocate_rprobe_array()
Reallocates RPROBE_CUBE_MAP_ARRAY to new dimensions or when loading.
Saves and loads various files that store engine data.
Framebuffer GBUFFER_RESOLVE_FBO
Entity ENTITIES[MAX_ENTITIES]
AudioEmitter AUDIO_EMITTERS[1024]
struct nk_context * NK_CTX
Nuklear context handle used for Editor UI.
int PERFORMANCE_OVERLAY_TEXT_BOX_START
EditorSettings EDITOR_SETTINGS
int PERFORMANCE_OVERLAY_MENU
float time
The frame time but wrapping at 1.0.
Framebuffer BLOOM_PYRAMID[6]
bool draw_dirty
If we need to reupload and resort transforms in create_and_sort_draw_commands() and upload_instance_d...
AssetInstance ASSET_INSTANCES[MAX_ASSET_INSTANCES]
Framebuffer SSAO_BLUR_FBO
Framebuffer DEPTH_DOWNSAMPLE_FBO
Framebuffer MAIN_RESOLVE_FBO
vec3 vec3_cross(vec3 a, vec3 b)
float vec3_dot(vec3 a, vec3 b)
vec2 vec2_normalize(vec2 v)
vec3 vec3_normalize(vec3 v)
vec3 vec3_scale(vec3 a, float b)
vec3 vec3_sub(vec3 a, vec3 b)
float clamp(float a, float b, float c)
PhysicsComponent impulse resolution and collision detection and acceleration structure traversal.
void upload_lights()
Uploads all current Lights inside of Globals.lights to the GPU in a triple buffered LIGHT_SSBO.
void upload_material_data()
Uploads Material data to the GPU as MaterialGPU.
void add_all_text_boxes_to_draw_buffer()
Adds all TextBoxes to TEXT_VBO and iterates through each character to push indices to TEXT_EBO.
void add_all_meshes_to_buffer(VertexLayout *layout)
Adds all Meshes that have valid MeshNodes.
The main render pass, data GPU uploads, and SSBO management.
The standalone UI library that controls text rendering, ui rendering, and events.
UICallback HOVER_CALLBACKS[MAX_CALLBACKS]
int ACTION_CALLBACK_COUNT
UICallback ACTION_CALLBACKS[MAX_CALLBACKS]
bool vec4_equal(vec4 a, vec4 b, float eps)
void init_vector(Vector *v, size_t i, size_t type_size)
bool vec3_equal(vec3 a, vec3 b, float eps)
void calculate_aabb_bounds(AABB *aabb)
void * vector_expand(Vector *v, size_t i)
#define CAST_VEC(vec, type)
#define REMOVE_FROM_VEC(vec, index, type)
mat4 compose_trs_from_vectors(vec3 pos, vec4 rot, vec3 scale)
mat3 mat3_mul(mat3 M, mat3 N)
vec4 quat_from_axis_angle(vec3 axis, float angle)
#define SHIFT_VEC_RIGHT(vec, index, type)