|
|
|
@ -15,6 +15,8 @@ |
|
|
|
|
#include "game.h" |
|
|
|
|
#include "gui.h" |
|
|
|
|
|
|
|
|
|
#include <stdio.h> |
|
|
|
|
|
|
|
|
|
struct Editor_State |
|
|
|
|
{ |
|
|
|
|
int enabled; |
|
|
|
@ -73,11 +75,11 @@ void editor_update(float dt) |
|
|
|
|
/* Debug Window */ |
|
|
|
|
if(editor_state.renderer_settings_window) |
|
|
|
|
{ |
|
|
|
|
if(nk_begin_titled(context, "Renderer_Settings_Window", "Renderer Settings", nk_rect(half_width, half_height, 400, 300), |
|
|
|
|
if(nk_begin_titled(context, "Renderer_Settings_Window", "Renderer Settings", nk_rect(half_width, half_height, 300, 350), |
|
|
|
|
NK_WINDOW_BORDER | NK_WINDOW_CLOSABLE | NK_WINDOW_MOVABLE | |
|
|
|
|
NK_WINDOW_SCROLL_AUTO_HIDE | NK_WINDOW_SCALABLE | NK_WINDOW_MINIMIZABLE)) |
|
|
|
|
{ |
|
|
|
|
if(nk_tree_push(context, NK_TREE_TAB, "Debug", NK_MINIMIZED)) |
|
|
|
|
if(nk_tree_push(context, NK_TREE_TAB, "Debug", NK_MAXIMIZED)) |
|
|
|
|
{ |
|
|
|
|
static const char* draw_modes[] = {"Triangles", "Lines", "Points"}; |
|
|
|
|
nk_layout_row_dynamic(context, 25, 2); |
|
|
|
@ -94,29 +96,52 @@ void editor_update(float dt) |
|
|
|
|
nk_tree_pop(context); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(nk_tree_push(context, NK_TREE_TAB, "Fog", NK_MINIMIZED)) |
|
|
|
|
if(nk_tree_push(context, NK_TREE_TAB, "Fog", NK_MAXIMIZED)) |
|
|
|
|
{ |
|
|
|
|
static const char* fog_modes[] = {"None", "Linear", "Exponential", "Exponential Squared"}; |
|
|
|
|
/* TODO: Fix bugs here before moving on! */ |
|
|
|
|
nk_layout_row_dynamic(context, 25, 2); |
|
|
|
|
nk_label(context, "Color", NK_TEXT_ALIGN_LEFT | NK_TEXT_ALIGN_MIDDLE); |
|
|
|
|
static vec4 fog_color; |
|
|
|
|
vec4_fill_vec3(&fog_color, &render_settings->fog.color, 1.f); |
|
|
|
|
editor_color_combo(context, &fog_color, 200, 400); |
|
|
|
|
vec3_fill(&render_settings->fog.color, fog_color.x, fog_color.y, fog_color.w); |
|
|
|
|
vec3_fill(&render_settings->fog.color, fog_color.x, fog_color.y, fog_color.z); |
|
|
|
|
|
|
|
|
|
nk_layout_row_dynamic(context, 25, 2); |
|
|
|
|
nk_label(context, "Fog Mode", NK_TEXT_ALIGN_LEFT | NK_TEXT_ALIGN_MIDDLE); |
|
|
|
|
render_settings->fog.mode = nk_combo(context, fog_modes, 4, render_settings->fog.mode, 20, nk_vec2(180, 100)); |
|
|
|
|
render_settings->fog.mode = nk_combo(context, |
|
|
|
|
fog_modes, |
|
|
|
|
4, |
|
|
|
|
render_settings->fog.mode, |
|
|
|
|
20, |
|
|
|
|
nk_vec2(180, 100)); |
|
|
|
|
|
|
|
|
|
nk_layout_row_dynamic(context, 25, 1); |
|
|
|
|
nk_property_float(context, "Density", 0.f, &render_settings->fog.density, 10.f, 0.05f, 0.1f); |
|
|
|
|
nk_layout_row_dynamic(context, 25, 2); |
|
|
|
|
nk_label(context, "Density", NK_TEXT_ALIGN_LEFT | NK_TEXT_ALIGN_MIDDLE); |
|
|
|
|
struct nk_rect bounds = nk_widget_bounds(context); |
|
|
|
|
nk_slider_float(context, 0.f, &render_settings->fog.density, 1.f, 0.005); |
|
|
|
|
if(nk_input_is_mouse_hovering_rect(&context->input, bounds)) |
|
|
|
|
{ |
|
|
|
|
static char float_str[6]; |
|
|
|
|
snprintf(float_str, 6, "%.4f", render_settings->fog.density); |
|
|
|
|
float_str[5] = '\0'; |
|
|
|
|
nk_tooltip(context, float_str); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
nk_layout_row_dynamic(context, 25, 1); |
|
|
|
|
nk_property_float(context, "Start Distance", 0.f, &render_settings->fog.start_dist, 10000.f, 5.f, 10.f); |
|
|
|
|
nk_property_float(context, |
|
|
|
|
"Start Distance", |
|
|
|
|
0.f, |
|
|
|
|
&render_settings->fog.start_dist, |
|
|
|
|
render_settings->fog.max_dist, |
|
|
|
|
5.f, 10.f); |
|
|
|
|
|
|
|
|
|
nk_layout_row_dynamic(context, 25, 1); |
|
|
|
|
nk_property_float(context, "Max Distance", 0.f, &render_settings->fog.max_dist, 10000.f, 5.f, 10.f); |
|
|
|
|
nk_property_float(context, |
|
|
|
|
"Max Distance", |
|
|
|
|
render_settings->fog.start_dist, |
|
|
|
|
&render_settings->fog.max_dist, |
|
|
|
|
10000.f, |
|
|
|
|
5.f, 10.f); |
|
|
|
|
|
|
|
|
|
nk_tree_pop(context); |
|
|
|
|
} |
|
|
|
|