static void menu_action_setting_disp_set_label_shader_parameter( file_list_t* list, unsigned *w, unsigned type, unsigned i, const char *label, char *s, size_t len, const char *entry_label, const char *path, char *s2, size_t len2) { #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL) video_shader_ctx_t shader_info; const struct video_shader_parameter *param = NULL; #endif *s = '\0'; *w = 19; strlcpy(s2, path, len2); #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL) video_shader_driver_ctl(SHADER_CTL_GET_CURRENT_SHADER, &shader_info); if (!shader_info.data) return; param = &shader_info.data->parameters[type - MENU_SETTINGS_SHADER_PARAMETER_0]; if (!param) return; snprintf(s, len, "%.2f [%.2f %.2f]", param->current, param->minimum, param->maximum); #endif }
int shader_action_parameter_right(unsigned type, const char *label, bool wraparound) { video_shader_ctx_t shader_info; struct video_shader_parameter *param = NULL; video_shader_driver_ctl(SHADER_CTL_GET_CURRENT_SHADER, &shader_info); param = &shader_info.data->parameters[type - MENU_SETTINGS_SHADER_PARAMETER_0]; return generic_shader_action_parameter_right(shader_info.data, param, type, label, wraparound); }
void nk_menu_wnd_shader_parameters(nk_menu_handle_t *zr) { unsigned i; video_shader_ctx_t shader_info; struct nk_panel layout; struct nk_context *ctx = &zr->ctx; const int id = ZRMENU_WND_SHADER_PARAMETERS; settings_t *settings = config_get_ptr(); if (nk_begin(ctx, &layout, "Shader Parameters", nk_rect(240, 10, 300, 400), NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_MOVABLE| NK_WINDOW_SCALABLE|NK_WINDOW_BORDER)) { struct nk_panel combo; static const char *themes[] = {"Dark", "Light"}; enum nk_menu_theme old = zr->theme; nk_layout_row_dynamic(ctx, 30, 1); video_shader_driver_ctl(SHADER_CTL_GET_CURRENT_SHADER, &shader_info); if (shader_info.data) { for (i = 0; i < GFX_MAX_PARAMETERS; i++) { if (!string_is_empty(shader_info.data->parameters[i].desc)) { /* if(shader_info.data->parameters[i].minimum == 0 && shader_info.data->parameters[i].maximum == 1 && shader_info.data->parameters[i].step == 1) nk_checkbox_float(ctx, shader_info.data->parameters[i].desc, &(shader_info.data->parameters[i].current)); else*/ nk_property_float(ctx, shader_info.data->parameters[i].desc, shader_info.data->parameters[i].minimum, &(shader_info.data->parameters[i].current), shader_info.data->parameters[i].maximum, shader_info.data->parameters[i].step, 1); } } } } /* save position and size to restore after context reset */ nk_menu_set_state(zr, id, nk_window_get_position(ctx), nk_window_get_size(ctx)); nk_end(ctx); }
static int action_start_shader_action_parameter(unsigned type, const char *label) { #ifdef HAVE_SHADER_MANAGER video_shader_ctx_t shader_info; struct video_shader_parameter *param = NULL; video_shader_driver_ctl(SHADER_CTL_GET_CURRENT_SHADER, &shader_info); if (!shader_info.data) return 0; param = &shader_info.data->parameters [type - MENU_SETTINGS_SHADER_PARAMETER_0]; param->current = param->initial; param->current = min(max(param->minimum, param->current), param->maximum); #endif return 0; }