Disable Obsolete ImGui Functions

This commit is contained in:
TheBrokenRail 2024-11-21 03:29:37 -05:00
parent 00f90afc2a
commit dd760cc6f2
2 changed files with 4 additions and 5 deletions

View File

@ -32,6 +32,7 @@ target_compile_definitions(imgui PUBLIC
IMGUI_DISABLE_DEMO_WINDOWS
IMGUI_DISABLE_DEBUG_TOOLS
IMGUI_DISABLE_DEFAULT_FONT
IMGUI_DISABLE_OBSOLETE_FUNCTIONS
)
# Patch

View File

@ -1,10 +1,5 @@
#include "frame.h"
// Clamp Function
static float clamp(const float value, const float min = 0.0f, const float max = 1.0f) {
return std::max(min, std::min(value, max));
}
// Calculate Perceived Brightness Of Color
// See: https://en.wikipedia.org/w/index.php?title=Relative_luminance&useskin=vector
static float compute_luma(const ImVec4 &color) {
@ -12,6 +7,9 @@ static float compute_luma(const ImVec4 &color) {
}
// Apply Luma To RGB
static float clamp(const float value) {
return std::max(0.0f, std::min(value, 1.0f));
}
static ImVec4 apply_luma_to_color(const float target_luma, const ImVec4 &color) {
const float current_luma = compute_luma(color);
const float luma_ratio = (current_luma != 0) ? target_luma / current_luma : 0;