Dave Parks 2013-04-18 01:33:54 -05:00
commit 70d50028ae
4 changed files with 27 additions and 17 deletions

View File

@ -308,11 +308,13 @@ void main()
col *= diffuse.rgb;
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
if (spec.a > 0.0) // specular reflection
{
// the old infinite-sky shiny reflection
//
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
float sa = dot(refnormpersp, sun_dir.xyz);
vec3 dumbshiny = vary_SunlitColor*(texture2D(lightFunc, vec2(sa, spec.a)).r);
@ -320,13 +322,15 @@ void main()
vec3 spec_contrib = dumbshiny * spec.rgb;
bloom = dot(spec_contrib, spec_contrib) / 6;
col += spec_contrib;
//add environmentmap
}
if (envIntensity > 0.0)
{ //add environmentmap
vec3 env_vec = env_mat * refnormpersp;
col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb,
max(envIntensity-diffuse.a*2.0, 0.0));
}
col = atmosLighting(col);
col = scaleSoftClip(col);

View File

@ -315,11 +315,13 @@ void main()
col *= diffuse.rgb;
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
if (spec.a > 0.0) // specular reflection
{
// the old infinite-sky shiny reflection
//
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
float sa = dot(refnormpersp, sun_dir.xyz);
vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*(texture2D(lightFunc, vec2(sa, spec.a)).r);
@ -327,8 +329,10 @@ void main()
vec3 spec_contrib = dumbshiny * spec.rgb;
bloom = dot(spec_contrib, spec_contrib) / 6;
col += spec_contrib;
}
//add environmentmap
if (envIntensity > 0.0)
{ //add environmentmap
vec3 env_vec = env_mat * refnormpersp;
col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb,
max(envIntensity-diffuse.a*2.0, 0.0));

View File

@ -1720,8 +1720,8 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate
getChild<LLUICtrl>("shinyOffsetV")->setValue(offset_y);
getChild<LLColorSwatchCtrl>("shinycolorswatch")->setOriginal(material->getSpecularLightColor());
getChild<LLColorSwatchCtrl>("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE);
getChild<LLUICtrl>("glossiness")->setValue((F32)(material->getSpecularLightExponent())/255.0);
getChild<LLUICtrl>("environment")->setValue((F32)(material->getEnvironmentIntensity())/255.0);
getChild<LLUICtrl>("glossiness")->setValue(material->getSpecularLightExponent());
getChild<LLUICtrl>("environment")->setValue(material->getEnvironmentIntensity());
}
updateShinyControls(combobox_shininess,this, true);
@ -1844,8 +1844,8 @@ void LLPanelFace::updateMaterial()
if (!new_material)
{
mMaterial->setSpecularLightColor(getChild<LLColorSwatchCtrl>("shinycolorswatch")->get());
mMaterial->setSpecularLightExponent((U8)(255*getChild<LLUICtrl>("glossiness")->getValue().asReal()));
mMaterial->setEnvironmentIntensity((U8)(255*getChild<LLUICtrl>("environment")->getValue().asReal()));
mMaterial->setSpecularLightExponent(getChild<LLUICtrl>("glossiness")->getValue().asInteger());
mMaterial->setEnvironmentIntensity(getChild<LLUICtrl>("environment")->getValue().asInteger());
}
}
else

View File

@ -392,12 +392,13 @@
Glossiness
</text>
<spinner
decimal_digits="3"
min_value="0"
max_value="1"
decimal_digits="0"
min_val="0"
max_val="255"
follows="left|top"
height="19"
initial_value="0.2"
initial_value="51"
increment="1"
layout="topleft"
top_delta="-4"
left_pad="10"
@ -417,9 +418,10 @@
Environment
</text>
<spinner
decimal_digits="3"
min_value="0"
max_value="1"
decimal_digits="0"
min_val="0"
max_val="255"
increment="1"
follows="left|top"
height="19"
initial_value="0"