Re-added gamma setting to color filter shader
Fixed issue with setting default values of sliders for gauss shader
This commit is contained in:
@@ -100,6 +100,7 @@ LLPostProcess::LLPostProcess(void) :
|
||||
defaultEffect["bloom_strength"] = 1.5;
|
||||
|
||||
/// Color Filter Defaults
|
||||
defaultEffect["gamma"] = 1.0;
|
||||
defaultEffect["brightness"] = 1.0;
|
||||
defaultEffect["contrast"] = 1.0;
|
||||
defaultEffect["saturation"] = 1.0;
|
||||
@@ -258,6 +259,7 @@ void LLPostProcess::applyColorFilterShader(void)
|
||||
|
||||
getShaderUniforms(colorFilterUniforms, gPostColorFilterProgram.mProgramObject);
|
||||
glUniform1iARB(colorFilterUniforms["RenderTexture"], 0);
|
||||
glUniform1fARB(colorFilterUniforms["gamma"], tweaks.getGamma());
|
||||
glUniform1fARB(colorFilterUniforms["brightness"], tweaks.getBrightness());
|
||||
glUniform1fARB(colorFilterUniforms["contrast"], tweaks.getContrast());
|
||||
float baseI = (tweaks.getContrastBaseR() + tweaks.getContrastBaseG() + tweaks.getContrastBaseB()) / 3.0f;
|
||||
@@ -283,6 +285,7 @@ void LLPostProcess::createColorFilterShader(void)
|
||||
{
|
||||
/// Define uniform names
|
||||
colorFilterUniforms["RenderTexture"] = 0;
|
||||
colorFilterUniforms["gamma"] = 0;
|
||||
colorFilterUniforms["brightness"] = 0;
|
||||
colorFilterUniforms["contrast"] = 0;
|
||||
colorFilterUniforms["contrastBase"] = 0;
|
||||
|
||||
@@ -157,6 +157,10 @@ public:
|
||||
return F32((*this)["bloom_strength"].asReal());
|
||||
}
|
||||
|
||||
inline F32 getGamma() const {
|
||||
return F32((*this)["gamma"].asReal());
|
||||
}
|
||||
|
||||
inline F32 getBrightness() const {
|
||||
return F32((*this)["brightness"].asReal());
|
||||
}
|
||||
|
||||
@@ -12,12 +12,15 @@ uniform vec3 contrastBase;
|
||||
uniform float saturation;
|
||||
uniform vec3 lumWeights;
|
||||
|
||||
const float gamma = 2.0;
|
||||
uniform float gamma;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st));
|
||||
|
||||
/// Apply gamma
|
||||
color = pow(color, vec3(1.0/gamma));
|
||||
|
||||
/// Modulate brightness
|
||||
color *= brightness;
|
||||
|
||||
|
||||
@@ -151,6 +151,8 @@
|
||||
<real>1.5</real>
|
||||
<key>bloom_width</key>
|
||||
<real>2.25</real>
|
||||
<key>gamma</key>
|
||||
<real>1.0</real>
|
||||
<key>brightness</key>
|
||||
<real>1</real>
|
||||
<key>brightness_multiplier</key>
|
||||
|
||||
@@ -53,7 +53,7 @@ LLFloaterPostProcess::LLFloaterPostProcess() : LLFloater(std::string("Post-Proce
|
||||
|
||||
/// Color Filter Callbacks
|
||||
childSetCommitCallback("ColorFilterToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_color_filter");
|
||||
//childSetCommitCallback("ColorFilterGamma", &LLFloaterPostProcess::onFloatControlMoved, &(gPostProcess->tweaks.gamma()));
|
||||
childSetCommitCallback("ColorFilterGamma", &LLFloaterPostProcess::onFloatControlMoved, (char*)"gamma");
|
||||
childSetCommitCallback("ColorFilterBrightness", &LLFloaterPostProcess::onFloatControlMoved, (char*)"brightness");
|
||||
childSetCommitCallback("ColorFilterSaturation", &LLFloaterPostProcess::onFloatControlMoved, (char*)"saturation");
|
||||
childSetCommitCallback("ColorFilterContrast", &LLFloaterPostProcess::onFloatControlMoved, (char*)"contrast");
|
||||
@@ -252,7 +252,7 @@ void LLFloaterPostProcess::syncMenu()
|
||||
|
||||
/// Sync Color Filter Menu
|
||||
childSetValue("ColorFilterToggle", gPostProcess->tweaks.useColorFilter());
|
||||
//childSetValue("ColorFilterGamma", gPostProcess->tweaks.gamma());
|
||||
childSetValue("ColorFilterGamma", gPostProcess->tweaks.getGamma());
|
||||
childSetValue("ColorFilterBrightness", gPostProcess->tweaks.brightness());
|
||||
childSetValue("ColorFilterSaturation", gPostProcess->tweaks.saturation());
|
||||
childSetValue("ColorFilterContrast", gPostProcess->tweaks.contrast());
|
||||
@@ -272,4 +272,7 @@ void LLFloaterPostProcess::syncMenu()
|
||||
childSetValue("BloomExtract", gPostProcess->tweaks.extractLow());
|
||||
childSetValue("BloomSize", gPostProcess->tweaks.bloomWidth());
|
||||
childSetValue("BloomStrength", gPostProcess->tweaks.bloomStrength());
|
||||
|
||||
childSetValue("GaussBlurToggle", gPostProcess->tweaks.useGaussBlurFilter());
|
||||
childSetValue("GaussBlurPasses", gPostProcess->tweaks.getGaussBlurPasses());
|
||||
}
|
||||
|
||||
@@ -12,6 +12,18 @@
|
||||
<check_box bottom="-20" control_name="ColorFilterToggle" follows="left|top"
|
||||
font="SansSerifSmall" height="16" initial_value="false" label="Enable"
|
||||
left="14" mouse_opaque="true" name="ColorFilterToggle" width="200" />
|
||||
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||
bottom_delta="-20" drop_shadow_visible="true" follows="left|top|right"
|
||||
font="SansSerif" h_pad="0" halign="left" height="16"
|
||||
left="10" mouse_opaque="true" name="ColorFilterGammaText" v_pad="0"
|
||||
width="355">
|
||||
Gamma
|
||||
</text>
|
||||
<slider bottom_delta="-30" can_edit_text="true"
|
||||
control_name="ColorFilterGamma" decimal_digits="2" follows="left"
|
||||
height="18" increment="0.01" initial_val="1.0" label="" left="14"
|
||||
max_val="10" min_val="-.25" mouse_opaque="true" name="ColorFilterGamma"
|
||||
show_text="true" value="1.0" width="200" />
|
||||
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||
bottom_delta="-20" drop_shadow_visible="true" follows="left|top|right"
|
||||
font="SansSerif" h_pad="0" halign="left" height="16"
|
||||
|
||||
Reference in New Issue
Block a user