3#include "InspectorGuiHelper.h"
8 float ConvertLinear(
float C_srgb)
10 if(C_srgb <= 0.04045f){
11 return (1.0f/12.92f) * C_srgb;
14 return pow((C_srgb + 0.055f)/1.055f, 2.4f);
17 float ConvertSRGB(
float C_linear)
19 if(C_linear < 0.0031308f){
20 return 12.92f * C_linear;
23 return 1.055f * pow(C_linear, (1.0f/2.4f)) - 0.055f;
29 void gammaDebugger(
class Context* ,
bool* show)
31 if (*show ==
false)
return;
32 guiBegin(
"Gamma Debugger", show);
34 ImDrawList *draw_list = ImGui::GetWindowDrawList();
36 ImGui::Text(
"Gamma Correct");
38 static int test_col = (int)(ConvertSRGB(0.5f)*255);
41 ImVec2 c = ImGui::GetCursorScreenPos();
44 draw_list->AddRectFilled(c, c+ImVec2(200, 200), IM_COL32(0, 0, 0, 255));
45 for(
int i=0; i<200; i++){
46 for(
int j=0; j<200; j++){
48 ImVec2 p = ImVec2((
float)i, (
float)j);
49 draw_list->AddRectFilled(c+p, c+p+ImVec2(1, 1), IM_COL32(255, 255, 255, 255));
54 ImGui::Dummy(ImVec2(200, 200));
56 ImGui::SameLine(0.0f, 0.0f);
59 ImVec2 c = ImGui::GetCursorScreenPos();
60 draw_list->AddRectFilled(c, c+ImVec2(200, 200), IM_COL32(test_col, test_col, test_col, 255));
62 ImGui::Dummy(ImVec2(200, 200));
64 ImGui::SliderInt(
"Test Color", &test_col, 0, 255);
66 float sRGB = (float)test_col/255.0f;
67 float linear = ConvertLinear(
sRGB);
68 ImGui::Text(
"sRGB: %f Linear: %f",
sRGB, linear);
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
@ sRGB
Value is a color and is subject to gamma correction.