Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit be8eba0

Browse files
committed
fy: tone mapping -> display mapping; boost the priority of gamma slider
1 parent 0d782bd commit be8eba0

File tree

3 files changed

+50
-30
lines changed

3 files changed

+50
-30
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,6 @@ __pycache__
4545
*.exe
4646
*.out
4747
*.app
48+
49+
.vs
50+
out

include/tev/Common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ bool shuttingDown();
369369
void setShuttingDown();
370370

371371
enum ETonemap : int {
372-
SRGB = 0,
373-
Gamma,
372+
Gamma = 0,
373+
SRGB,
374374
FalseColor,
375375
PositiveNegative,
376376

src/ImageViewer.cpp

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,21 @@ ImageViewer::ImageViewer(
9797

9898
mImageCanvas = new ImageCanvas{horizontalScreenSplit, pixel_ratio()};
9999

100-
// Tonemapping sectionim
100+
// DisplayMapping(PostProcessing) sectionim
101101
{
102102
auto panel = new Widget{mSidebarLayout};
103103
panel->set_layout(new BoxLayout{Orientation::Horizontal, Alignment::Fill, 5});
104-
new Label{panel, "Tonemapping", "sans-bold", 25};
104+
new Label{panel, "DisplayMapping", "sans-bold", 25};
105105
panel->set_tooltip(
106-
"Various tonemapping options. Hover the individual controls to learn more!"
106+
"Various DisplayMapping options. Hover the individual controls to learn more!"
107107
);
108108

109-
// Exposure label and slider
109+
110+
// Exposure/Offset label and slider
110111
{
111112
panel = new Widget{mSidebarLayout};
112-
panel->set_layout(new BoxLayout{Orientation::Vertical, Alignment::Fill, 5});
113+
panel->set_layout(new GridLayout{ Orientation::Vertical, 2, Alignment::Fill, 5, 0 });
114+
113115

114116
mExposureLabel = new Label{panel, "", "sans-bold", 15};
115117

@@ -124,12 +126,7 @@ ImageViewer::ImageViewer(
124126
"Exposure scales the brightness of an image prior to tonemapping by 2^Exposure.\n\n"
125127
"Keyboard shortcuts:\nE and Shift+E"
126128
);
127-
}
128129

129-
// Offset/Gamma label and slider
130-
{
131-
panel = new Widget{mSidebarLayout};
132-
panel->set_layout(new GridLayout{Orientation::Vertical, 2, Alignment::Fill, 5, 0});
133130

134131
mOffsetLabel = new Label{panel, "", "sans-bold", 15};
135132

@@ -140,24 +137,18 @@ ImageViewer::ImageViewer(
140137
});
141138
setOffset(0);
142139

143-
mGammaLabel = new Label{panel, "", "sans-bold", 15};
144-
145-
mGammaSlider = new Slider{panel};
146-
mGammaSlider->set_range({0.01f, 5.0f});
147-
mGammaSlider->set_callback([this](float value) {
148-
setGamma(value);
149-
});
150-
setGamma(2.2f);
151-
152140
panel->set_tooltip(
153141
"The offset is added to the image after exposure has been applied.\n"
154142
"Keyboard shortcuts: O and Shift+O\n\n"
155-
"Gamma is the exponent used when gamma-tonemapping.\n"
156-
"Keyboard shortcuts: G and Shift+G\n\n"
157143
);
158144
}
159145
}
160146

147+
// TODO: Tonemapping
148+
149+
// DOF(need a depth image)
150+
// Bloom
151+
161152
// Exposure/offset buttons
162153
{
163154
auto buttonContainer = new Widget{mSidebarLayout};
@@ -176,6 +167,8 @@ ImageViewer::ImageViewer(
176167
mCurrentImageButtons.push_back(
177168
makeButton("Normalize", [this]() { normalizeExposureAndOffset(); }, 0, "Shortcut: N")
178169
);
170+
171+
// TODO: Split
179172
makeButton("Reset", [this]() { resetImage(); }, 0, "Shortcut: R");
180173

181174
if (mSupportsHdr) {
@@ -232,7 +225,8 @@ ImageViewer::ImageViewer(
232225
}
233226
}
234227

235-
// Tonemap options
228+
229+
// Display options
236230
{
237231
mTonemapButtonContainer = new Widget{mSidebarLayout};
238232
mTonemapButtonContainer->set_layout(new GridLayout{Orientation::Horizontal, 4, Alignment::Fill, 5, 2});
@@ -245,22 +239,22 @@ ImageViewer::ImageViewer(
245239
return button;
246240
};
247241

248-
makeTonemapButton("sRGB", [this]() { setTonemap(ETonemap::SRGB); });
249242
makeTonemapButton("Gamma", [this]() { setTonemap(ETonemap::Gamma); });
243+
makeTonemapButton("sRGB", [this]() { setTonemap(ETonemap::SRGB); });
250244
makeTonemapButton("FC", [this]() { setTonemap(ETonemap::FalseColor); });
251245
makeTonemapButton("+/-", [this]() { setTonemap(ETonemap::PositiveNegative); });
252246

253-
setTonemap(ETonemap::SRGB);
247+
//setTonemap(ETonemap::Gamma);
254248

255249
mTonemapButtonContainer->set_tooltip(
256-
"Tonemap operator selection:\n\n"
257-
258-
"sRGB\n"
259-
"Linear to sRGB conversion\n\n"
250+
"Display operator selection:\n\n"
260251

261252
"Gamma\n"
262253
"Inverse power gamma correction\n\n"
263254

255+
"sRGB\n"
256+
"Linear to sRGB conversion\n\n"
257+
264258
"FC\n"
265259
"False-color visualization\n\n"
266260

@@ -269,6 +263,29 @@ ImageViewer::ImageViewer(
269263
);
270264
}
271265

266+
// Gamma label and slider
267+
{
268+
auto panel = new Widget{ mSidebarLayout };
269+
panel->set_layout(new BoxLayout{ Orientation::Vertical, Alignment::Fill, 5 });
270+
271+
mGammaLabel = new Label{ panel, "", "sans-bold", 15 };
272+
273+
mGammaSlider = new Slider{ panel };
274+
mGammaSlider->set_range({ 0.01f, 5.0f });
275+
mGammaSlider->set_callback([this](float value) {
276+
setGamma(value);
277+
});
278+
279+
setGamma(2.2f);
280+
setTonemap(ETonemap::Gamma);
281+
282+
panel->set_tooltip(
283+
"Gamma is the exponent used when gamma-tonemapping.\n"
284+
"Keyboard shortcuts: G and Shift+G\n\n"
285+
);
286+
}
287+
288+
272289
// Error metrics
273290
{
274291
mMetricButtonContainer = new Widget{mSidebarLayout};

0 commit comments

Comments
 (0)