MCPcopy Create free account
hub / github.com/DiligentGraphics/DiligentFX / ToneMappingUpdateUI

Function ToneMappingUpdateUI

Components/src/ToneMapping.cpp:85–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85bool ToneMappingUpdateUI(HLSL::ToneMappingAttribs& Attribs, float* AverageLogLum)
86{
87 bool AttribsChanged = false;
88 {
89 std::array<const char*, 10> ToneMappingMode{};
90 ToneMappingMode[TONE_MAPPING_MODE_NONE] = "None";
91 ToneMappingMode[TONE_MAPPING_MODE_EXP] = "Exp";
92 ToneMappingMode[TONE_MAPPING_MODE_REINHARD] = "Reinhard";
93 ToneMappingMode[TONE_MAPPING_MODE_REINHARD_MOD] = "Reinhard Mod";
94 ToneMappingMode[TONE_MAPPING_MODE_UNCHARTED2] = "Uncharted 2";
95 ToneMappingMode[TONE_MAPPING_FILMIC_ALU] = "Filmic ALU";
96 ToneMappingMode[TONE_MAPPING_LOGARITHMIC] = "Logarithmic";
97 ToneMappingMode[TONE_MAPPING_ADAPTIVE_LOG] = "Adaptive log";
98 ToneMappingMode[TONE_MAPPING_AGX] = "AgX";
99 ToneMappingMode[TONE_MAPPING_AGX_CUSTOM] = "AgX Custom";
100 if (ImGui::Combo("Tone Mapping Mode", &Attribs.iToneMappingMode, ToneMappingMode.data(), static_cast<int>(ToneMappingMode.size())))
101 AttribsChanged = true;
102 }
103
104 if (AverageLogLum != nullptr)
105 {
106 if (ImGui::SliderFloat("Average log lum", AverageLogLum, 0.01f, 10.0f, "%.3f", ImGuiSliderFlags_Logarithmic))
107 AttribsChanged = true;
108 }
109
110 if (ImGui::SliderFloat("Middle gray", &Attribs.fMiddleGray, 0.01f, 1.0f))
111 AttribsChanged = true;
112
113 if (Attribs.iToneMappingMode == TONE_MAPPING_MODE_REINHARD_MOD ||
114 Attribs.iToneMappingMode == TONE_MAPPING_MODE_UNCHARTED2 ||
115 Attribs.iToneMappingMode == TONE_MAPPING_LOGARITHMIC ||
116 Attribs.iToneMappingMode == TONE_MAPPING_ADAPTIVE_LOG)
117 {
118 if (ImGui::SliderFloat("White point", &Attribs.fWhitePoint, 0.1f, 20.0f))
119 AttribsChanged = true;
120 }
121
122 if (Attribs.iToneMappingMode == TONE_MAPPING_AGX_CUSTOM)
123 {
124 if (ImGui::SliderFloat("AgX Saturation", &Attribs.AgX.Saturation, 0.0f, 2.0f))
125 AttribsChanged = true;
126 if (ImGui::SliderFloat("AgX Offset", &Attribs.AgX.Offset, 0.0f, 1.0f))
127 AttribsChanged = true;
128 if (ImGui::SliderFloat("AgX Slope", &Attribs.AgX.Slope, 0.0f, 10.0f))
129 AttribsChanged = true;
130 if (ImGui::SliderFloat("AgX Power", &Attribs.AgX.Power, 0.0f, 10.0f))
131 AttribsChanged = true;
132 }
133
134 return AttribsChanged;
135}
136
137} // namespace Diligent

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected