mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-07 12:10:52 -06:00
Cleaned code and removed unused features.
This commit is contained in:
@@ -136,9 +136,6 @@ public:
|
||||
void setGamma(float gamma) override;
|
||||
void setMaxWhite(float maxWhite) override;
|
||||
void setToneMapOperator(int tmOp) override;
|
||||
void setKey(float key) override;
|
||||
void setYwhite(float white) override;
|
||||
void setTmoSaturation(float sat) override;
|
||||
void setHue(float hue) override;
|
||||
void setValue(float value) override;
|
||||
void setSaturation(float sat) override;
|
||||
@@ -184,7 +181,7 @@ private:
|
||||
UniformCache(mainColorTexture, blackoutFactor, nAaSamples) _uniformCache;
|
||||
|
||||
UniformCache(hdrFeedingTexture, blackoutFactor, hdrExposure, gamma,
|
||||
toneMapOperator, aveLum, maxWhite, Hue, Saturation, Value,
|
||||
toneMapOperator, maxWhite, Hue, Saturation, Value,
|
||||
Lightness, colorSpace, nAaSamples) _hdrUniformCache;
|
||||
|
||||
GLint _defaultFBO;
|
||||
@@ -212,9 +209,6 @@ private:
|
||||
float _maxWhite = 5.0f;
|
||||
int _toneMapOperator = 8;
|
||||
bool _histogramEnabled = false;
|
||||
float _tmoKey = 0.18f;
|
||||
float _tmoYwhite = 1e6f;
|
||||
float _tmoSaturation = 1.0f;
|
||||
float _hue = 1.f;
|
||||
float _saturation = 1.2f;
|
||||
float _value = 1.f;
|
||||
|
||||
@@ -222,9 +222,6 @@ private:
|
||||
properties::FloatProperty _hdrExposure;
|
||||
properties::FloatProperty _maxWhite;
|
||||
properties::OptionProperty _toneMapOperator;
|
||||
properties::FloatProperty _tmoKey;
|
||||
properties::FloatProperty _tmoYwhite;
|
||||
properties::FloatProperty _tmoSaturation;
|
||||
|
||||
properties::PropertyOwner _imageOwner;
|
||||
properties::FloatProperty _gamma;
|
||||
|
||||
@@ -54,9 +54,6 @@ public:
|
||||
virtual void setGamma(float gamma) = 0;
|
||||
virtual void setMaxWhite(float maxWhite) = 0;
|
||||
virtual void setToneMapOperator(int tmOp) = 0;
|
||||
virtual void setKey(float key) = 0;
|
||||
virtual void setYwhite(float white) = 0;
|
||||
virtual void setTmoSaturation(float sat) = 0;
|
||||
virtual void setHue(float hue) = 0;
|
||||
virtual void setValue(float value) = 0;
|
||||
virtual void setSaturation(float sat) = 0;
|
||||
|
||||
@@ -36,7 +36,6 @@ uniform float hdrExposure;
|
||||
uniform float blackoutFactor;
|
||||
uniform float gamma;
|
||||
uniform float maxWhite;
|
||||
uniform float aveLum;
|
||||
uniform float Hue;
|
||||
uniform float Saturation;
|
||||
uniform float Value;
|
||||
@@ -45,52 +44,10 @@ uniform int toneMapOperator;
|
||||
uniform uint colorSpace;
|
||||
uniform int nAaSamples;
|
||||
|
||||
//uniform sampler2D hdrFeedingTexture;
|
||||
uniform sampler2DMS hdrFeedingTexture;
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
// JCC: Change the next function to work with a MSAA texture
|
||||
vec4 adaptiveToneMap() {
|
||||
// int i;
|
||||
// float lum[25];
|
||||
// // Non MSAAA variant:
|
||||
// //vec2 tex_scale = vec2(1.0) / textureSize(hdrFeedingTexture, 0);
|
||||
// vec2 tex_scale = vec2(1.0) / textureSize(hdrFeedingTexture);
|
||||
|
||||
// for (i = 0; i < 25; i++)
|
||||
// {
|
||||
// vec2 tc = (gl_FragCoord.xy + 3.5 * vec2(i % 5 - 2, i / 5 - 2));
|
||||
// vec3 col = texture(hdrFeedingTexture, tc * tex_scale).rgb;
|
||||
// lum[i] = dot(col, vec3(0.3, 0.59, 0.11));
|
||||
// }
|
||||
|
||||
// // Calculate weighted color of region
|
||||
// vec3 vColor = texelFetch(hdrFeedingTexture, ivec2(gl_FragCoord.xy), 0).rgb;
|
||||
|
||||
// float kernelLuminance = (
|
||||
// (1.0 * (lum[0] + lum[4] + lum[20] + lum[24])) +
|
||||
// (4.0 * (lum[1] + lum[3] + lum[5] + lum[9] +
|
||||
// lum[15] + lum[19] + lum[21] + lum[23])) +
|
||||
// (7.0 * (lum[2] + lum[10] + lum[14] + lum[22])) +
|
||||
// (16.0 * (lum[6] + lum[8] + lum[16] + lum[18])) +
|
||||
// (26.0 * (lum[7] + lum[11] + lum[13] + lum[17])) +
|
||||
// (41.0 * lum[12])
|
||||
// ) / 273.0;
|
||||
|
||||
// // Compute the corresponding exposure
|
||||
// float exposure = sqrt(8.0 / (kernelLuminance + 0.25));
|
||||
|
||||
// // Apply the exposure to this texel
|
||||
// vec4 fColor;
|
||||
// fColor.rgb = 1.0 - exp2(-vColor * exposure);
|
||||
// fColor.a = 1.0f;
|
||||
|
||||
// return fColor;
|
||||
return vec4(1.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
|
||||
void main() {
|
||||
vec4 color = vec4(0.0);
|
||||
|
||||
@@ -104,7 +61,7 @@ void main() {
|
||||
|
||||
vec3 tColor = vec3(0.0);
|
||||
if (toneMapOperator == EXPONENTIAL) {
|
||||
tColor = exponentialToneMapping(color.rgb, hdrExposure, gamma);
|
||||
tColor = exponentialToneMapping(color.rgb, hdrExposure, gamma);
|
||||
} else if (toneMapOperator == LINEAR) {
|
||||
tColor = linearToneMapping(color.rgb, hdrExposure);
|
||||
} else if (toneMapOperator == SIMPLE_REINHARD) {
|
||||
@@ -121,10 +78,6 @@ void main() {
|
||||
tColor = Uncharted2ToneMapping(color.rgb, hdrExposure);
|
||||
} else if (toneMapOperator == COSTA) {
|
||||
tColor = jToneMapping(color.rgb, hdrExposure);
|
||||
} else if (toneMapOperator == ADAPTIVE) {
|
||||
tColor = vec3(adaptiveToneMap());
|
||||
} else if (toneMapOperator == GLOBAL) {
|
||||
tColor = globalToneMappingOperatorRTR(color.rgb, hdrExposure, maxWhite, aveLum);
|
||||
} else if (toneMapOperator == PHOTOGRAPHIC_REINHARD) {
|
||||
tColor = photographicReinhardToneMapping(color.rgb);
|
||||
}
|
||||
|
||||
@@ -32,10 +32,7 @@
|
||||
#define FILMIC 6
|
||||
#define UNCHARTED 7
|
||||
#define COSTA 8
|
||||
#define ADAPTIVE 9
|
||||
#define GLOBAL 10
|
||||
#define PHOTOGRAPHIC_REINHARD 11
|
||||
#define MIPMAPPING 12
|
||||
#define PHOTOGRAPHIC_REINHARD 9
|
||||
|
||||
const float HCV_EPSILON = 1e-10;
|
||||
const float HSL_EPSILON = 1e-10;
|
||||
|
||||
@@ -54,16 +54,12 @@ namespace {
|
||||
"mainColorTexture", "blackoutFactor", "nAaSamples"
|
||||
};
|
||||
|
||||
constexpr const std::array<const char*, 13> HDRUniformNames = {
|
||||
constexpr const std::array<const char*, 12> HDRUniformNames = {
|
||||
"hdrFeedingTexture", "blackoutFactor", "hdrExposure", "gamma",
|
||||
"toneMapOperator", "aveLum", "maxWhite", "Hue", "Saturation", "Value",
|
||||
"toneMapOperator", "maxWhite", "Hue", "Saturation", "Value",
|
||||
"Lightness", "colorSpace", "nAaSamples"
|
||||
};
|
||||
|
||||
constexpr const std::array<const char*, 4> TMOUniformNames = {
|
||||
"hdrSampler", "key", "Ywhite", "sat"
|
||||
};
|
||||
|
||||
constexpr const char* ExitFragmentShaderPath =
|
||||
"${SHADERS}/framebuffer/exitframebuffer.frag";
|
||||
constexpr const char* RaycastFragmentShaderPath =
|
||||
@@ -1376,18 +1372,6 @@ void FramebufferRenderer::setToneMapOperator(int tmOp) {
|
||||
_toneMapOperator = tmOp;
|
||||
}
|
||||
|
||||
void FramebufferRenderer::setKey(float key) {
|
||||
_tmoKey = key;
|
||||
}
|
||||
|
||||
void FramebufferRenderer::setYwhite(float white) {
|
||||
_tmoYwhite = white;
|
||||
}
|
||||
|
||||
void FramebufferRenderer::setTmoSaturation(float sat) {
|
||||
_tmoSaturation = sat;
|
||||
}
|
||||
|
||||
void FramebufferRenderer::setHue(float hue) {
|
||||
_hue = hue;
|
||||
}
|
||||
|
||||
@@ -197,24 +197,6 @@ namespace {
|
||||
"equivalent of an electronic image sensor."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo TMOSaturationInfo = {
|
||||
"TMOSaturation",
|
||||
"TMO Saturation",
|
||||
"TMO Saturation"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo TMOYWhiteInfo = {
|
||||
"TMOYWhite",
|
||||
"Ywhite",
|
||||
"Ywhite"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo TMOKeyInfo = {
|
||||
"TMOKey",
|
||||
"Key",
|
||||
"Key"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo GammaInfo = {
|
||||
"Gamma",
|
||||
"Gamma Correction",
|
||||
@@ -313,9 +295,6 @@ RenderEngine::RenderEngine()
|
||||
, _hdrExposure(HDRExposureInfo, 1.68f, 0.01f, 10.0f)
|
||||
, _maxWhite(MaxWhiteInfo, 4.f, 0.001f, 100.0f)
|
||||
, _toneMapOperator(ToneMapOperatorInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
, _tmoKey(TMOKeyInfo, 0.18f, 0.0f, 1.0f)
|
||||
, _tmoYwhite(TMOYWhiteInfo, 1e6f, 0.0f, 1e10f)
|
||||
, _tmoSaturation(TMOSaturationInfo, 1.f, 0.0f, 1.0f)
|
||||
, _imageOwner(ImageInfo)
|
||||
, _gamma(GammaInfo, 0.86f, 0.01f, 5.0f)
|
||||
, _hue(HueInfo, 1.f, 0.0f, 5.0f)
|
||||
@@ -385,10 +364,7 @@ RenderEngine::RenderEngine()
|
||||
_toneMapOperator.addOption(static_cast<int>(ToneMapOperators::FILMIC), "Filmic");
|
||||
_toneMapOperator.addOption(static_cast<int>(ToneMapOperators::UNCHARTED), "Uncharted 2");
|
||||
_toneMapOperator.addOption(static_cast<int>(ToneMapOperators::COSTA), "Costa");
|
||||
_toneMapOperator.addOption(static_cast<int>(ToneMapOperators::ADAPTIVE), "Adaptive");
|
||||
_toneMapOperator.addOption(static_cast<int>(ToneMapOperators::GLOBAL), "Global");
|
||||
_toneMapOperator.addOption(static_cast<int>(ToneMapOperators::PHOTOGRAPHIC_REINHARD), "Photographic Reinhard");
|
||||
_toneMapOperator.addOption(static_cast<int>(ToneMapOperators::MIPMAPPING), "MipMapping Global/Local Reinhard");
|
||||
_toneMapOperator.set(8);
|
||||
|
||||
_toneMapOperator.onChange([this]() {
|
||||
@@ -399,33 +375,6 @@ RenderEngine::RenderEngine()
|
||||
|
||||
addProperty(_toneMapOperator);
|
||||
|
||||
_tmoKey.onChange([this]() {
|
||||
if (_renderer) {
|
||||
_renderer->setKey(_tmoKey);
|
||||
}
|
||||
});
|
||||
|
||||
addProperty(_tmoKey);
|
||||
|
||||
_tmoYwhite.onChange([this]() {
|
||||
if (_renderer) {
|
||||
_renderer->setYwhite(_tmoYwhite);
|
||||
}
|
||||
});
|
||||
|
||||
addProperty(_tmoYwhite);
|
||||
|
||||
_tmoSaturation.onChange([this]() {
|
||||
if (_renderer) {
|
||||
_renderer->setTmoSaturation(_tmoSaturation);
|
||||
}
|
||||
});
|
||||
|
||||
addProperty(_tmoSaturation);
|
||||
|
||||
//this->addPropertySubOwner(_tmoOwner);
|
||||
|
||||
|
||||
_gamma.onChange([this]() {
|
||||
if (_renderer) {
|
||||
_renderer->setGamma(_gamma);
|
||||
|
||||
Reference in New Issue
Block a user