Skip to content

Commit

Permalink
Add sRGB conversion to ospExamples' color widget
Browse files Browse the repository at this point in the history
  • Loading branch information
johguenther committed Feb 8, 2021
1 parent 6f6cda7 commit 4d32a46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Version History
- Both geometric and volumetric models can now have their child
geometry/volume objects rebound using an object parameter
- Fix light leaking artifacts at poles of HDRI (and Sun-Sky) light
- Add sRGB conversion to `ospExamples` such that the color of the
widget for `backgroundColor` actually matches
- Dropping support for MSVC14, new minimum compiler on Windows is
MSVC15 (Visual Studio 2017)

Expand Down
8 changes: 6 additions & 2 deletions apps/ospExamples/GLFWOSPRayWindow.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2018-2020 Intel Corporation
// Copyright 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#include "GLFWOSPRayWindow.h"
Expand Down Expand Up @@ -561,7 +561,11 @@ void GLFWOSPRayWindow::buildUI()
addObjectToCommit(renderer->handle());
}

if (ImGui::ColorEdit3("backgroundColor", bgColor)) {
static vec3f bgColorSRGB{0.0f}; // imGUI's widget implicitely uses sRGB
if (ImGui::ColorEdit3("backgroundColor", bgColorSRGB)) {
bgColor = vec3f(std::pow(bgColorSRGB.x, 2.2f),
std::pow(bgColorSRGB.y, 2.2f),
std::pow(bgColorSRGB.z, 2.2f)); // approximate
rendererPT.setParam("backgroundColor", bgColor);
rendererSV.setParam("backgroundColor", bgColor);
rendererAO.setParam("backgroundColor", bgColor);
Expand Down

0 comments on commit 4d32a46

Please sign in to comment.