summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llversionviewer.h2
-rw-r--r--indra/llrender/llglslshader.cpp10
-rw-r--r--indra/llrender/llglslshader.h1
-rw-r--r--indra/llrender/llvertexbuffer.cpp27
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl29
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl25
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl25
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl1
-rw-r--r--indra/newview/lldrawpoolmaterials.cpp5
-rw-r--r--indra/newview/llpanelface.cpp364
-rw-r--r--indra/newview/llvovolume.cpp8
-rw-r--r--indra/newview/pipeline.cpp37
-rw-r--r--indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml2
19 files changed, 519 insertions, 89 deletions
diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h
index 1554e9e665..0b0c74b3d3 100644
--- a/indra/llcommon/llversionviewer.h
+++ b/indra/llcommon/llversionviewer.h
@@ -29,7 +29,7 @@
const S32 LL_VERSION_MAJOR = 3;
const S32 LL_VERSION_MINOR = 5;
-const S32 LL_VERSION_PATCH = 0;
+const S32 LL_VERSION_PATCH = 1;
const S32 LL_VERSION_BUILD = 0;
const char * const LL_CHANNEL = "Second Life Developer";
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index 78fd4e98d7..39ad9b9e9b 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -88,7 +88,12 @@ LLShaderFeatures::LLShaderFeatures()
// LLGLSL Shader implementation
//===============================
LLGLSLShader::LLGLSLShader()
- : mProgramObject(0), mActiveTextureChannels(0), mShaderLevel(0), mShaderGroup(SG_DEFAULT), mUniformsDirty(FALSE)
+ : mProgramObject(0),
+ mAttributeMask(0),
+ mActiveTextureChannels(0),
+ mShaderLevel(0),
+ mShaderGroup(SG_DEFAULT),
+ mUniformsDirty(FALSE)
{
}
@@ -285,6 +290,8 @@ BOOL LLGLSLShader::mapAttributes(const vector<string> * attributes)
if (res)
{ //read back channel locations
+ mAttributeMask = 0;
+
//read back reserved channels first
for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++)
{
@@ -293,6 +300,7 @@ BOOL LLGLSLShader::mapAttributes(const vector<string> * attributes)
if (index != -1)
{
mAttribute[i] = index;
+ mAttributeMask |= 1 << i;
LL_DEBUGS("ShaderLoading") << "Attribute " << name << " assigned to channel " << index << LL_ENDL;
}
}
diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h
index 2af74c20ff..725a7e2573 100644
--- a/indra/llrender/llglslshader.h
+++ b/indra/llrender/llglslshader.h
@@ -152,6 +152,7 @@ public:
GLhandleARB mProgramObject;
std::vector<GLint> mAttribute; //lookup table of attribute enum to attribute channel
+ U32 mAttributeMask; //mask of which reserved attributes are set (lines up with LLVertexBuffer::getTypeMask())
std::vector<GLint> mUniform; //lookup table of uniform enum to uniform location
std::map<std::string, GLint> mUniformMap; //lookup map of uniform name to uniform location
std::map<GLint, LLVector4> mValue; //lookup map of uniform location to last known value
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 4e3cea9474..29fe5400a3 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -349,6 +349,25 @@ S32 LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_MAX] =
sizeof(LLVector4), // TYPE_TEXTURE_INDEX (actually exists as position.w), no extra data, but stride is 16 bytes
};
+static std::string vb_type_name[] =
+{
+ "TYPE_VERTEX",
+ "TYPE_NORMAL",
+ "TYPE_TEXCOORD0",
+ "TYPE_TEXCOORD1",
+ "TYPE_TEXCOORD2",
+ "TYPE_TEXCOORD3",
+ "TYPE_COLOR",
+ "TYPE_EMISSIVE",
+ "TYPE_BINORMAL",
+ "TYPE_WEIGHT",
+ "TYPE_WEIGHT4",
+ "TYPE_CLOTHWEIGHT",
+ "TYPE_TEXTURE_INDEX",
+ "TYPE_MAX",
+ "TYPE_INDEX",
+};
+
U32 LLVertexBuffer::sGLMode[LLRender::NUM_MODES] =
{
GL_TRIANGLES,
@@ -2313,6 +2332,14 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask)
if (gDebugGL && ((data_mask & mTypeMask) != data_mask))
{
+ for (U32 i = 0; i < LLVertexBuffer::TYPE_MAX; ++i)
+ {
+ U32 mask = 1 << i;
+ if (mask & data_mask && !(mask & mTypeMask))
+ { //bit set in data_mask, but not set in mTypeMask
+ llwarns << "Missing required component " << vb_type_name[i] << llendl;
+ }
+ }
llerrs << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << llendl;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
index ad50690c02..c11298aadd 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
@@ -110,14 +110,18 @@ void main()
{
lv = normalize(lv);
da = dot(norm, lv);
-
+
float fa = light_col[i].a+1.0;
float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
+
dist_atten *= noise;
float lit = da * dist_atten;
-
+
+ lit = pow(lit,0.7);
+
vec3 col = light_col[i].rgb*lit*diff;
+
//vec3 col = vec3(dist2, light_col[i].a, lit);
if (spec.a > 0.0)
@@ -128,15 +132,16 @@ void main()
float nv = dot(norm, npos);
float vh = dot(npos, h);
float sa = nh;
- vec3 fres = spec.rgb + pow(1 - dot(h, npos), 5) * (1 - spec.rgb);
+ float fres = pow(1 - dot(h, npos), 5)*0.4+0.5;
+
float gtdenom = 2 * nh;
float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh));
-
-
- if (sa > 0.0)
+
+ if (nh > 0.0)
{
- vec3 scol = (fres * texture2D(lightFunc, vec2(nh, spec.a)).r * gt) / (nh * da);
- col += lit*scol*light_col[i].rgb;
+ float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
+ col += lit*scol*light_col[i].rgb*spec.rgb;
+ //col += spec.rgb;
}
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
index bff87cb6aa..09d23db096 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
@@ -40,6 +40,7 @@ uniform sampler2DRect normalMap;
uniform samplerCube environmentMap;
uniform sampler2D noiseMap;
uniform sampler2D projectionMap;
+uniform sampler2D lightFunc;
uniform mat4 proj_mat; //screen space to light space
uniform float proj_near; //near clip for projection
@@ -142,7 +143,7 @@ void main()
}
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
- norm = vec3((norm.xy-0.5)*2.0, norm.z);
+ norm = norm = (norm.xyz-0.5)*2.0;
norm = normalize(norm);
float l_dist = -dot(lv, proj_n);
@@ -190,6 +191,8 @@ void main()
vec3 lcol = color.rgb * plcol.rgb * plcol.a;
lit = da * dist_atten * noise;
+
+ lit = pow(lit, 0.7);
col = lcol*lit*diff_tex;
amb_da += (da*0.5)*proj_ambiance;
@@ -236,8 +239,28 @@ void main()
stc.x > 0.0 &&
stc.y > 0.0)
{
- vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
- col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb;
+
+ vec3 npos = -normalize(pos);
+ lv = pfinal-pos.xyz;
+ lv = normalize(lv);
+
+ vec3 h = normalize(lv+npos);
+ float nh = dot(norm, h);
+ float nv = dot(norm, npos);
+ float vh = dot(npos, h);
+ float sa = nh;
+ float fres = pow(1 - dot(h, npos), 5)*0.4+0.5;
+ float gtdenom = 2 * nh;
+ float gt = max(0,(min(gtdenom * nv / vh, gtdenom * da / vh)));
+
+ if (sa > 0.0)
+ {
+ float scol = fres * texture2D(lightFunc, vec2(nh, spec.a)).r * gt / (nh * da);
+ col += scol*color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod).rgb*spec.rgb;
+ }
+
+ //vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
+ //col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb;
}
}
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
index 03b036375b..e99329bbf2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
@@ -102,6 +102,8 @@ void main()
float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
float lit = da * dist_atten * noise;
+ lit = pow(lit, 0.7);
+
col = color.rgb*lit*col;
vec4 spec = texture2DRect(specularRect, frag.xy);
@@ -113,14 +115,14 @@ void main()
float nv = dot(norm, npos);
float vh = dot(npos, h);
float sa = nh;
- vec3 fres = spec.rgb + pow(1 - dot(h, npos), 5) * (1 - spec.rgb);
+ float fres = pow(1 - dot(h, npos), 5) * 0.4+0.5;
float gtdenom = 2 * nh;
float gt = max(0,(min(gtdenom * nv / vh, gtdenom * da / vh)));
- if (sa > 0.0)
+ if (nh > 0.0)
{
- vec3 scol = (fres * texture2D(lightFunc, vec2(nh, spec.a)).r * gt) / (nh * da);
- col += lit*scol*color.rgb;
+ float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
+ col += lit*scol*color.rgb*spec.rgb;
}
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index f50935c1a8..437a06320e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -280,6 +280,8 @@ void main()
float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
+ da = pow(da, 0.7);
+
vec4 diffuse = texture2DRect(diffuseRect, tc);
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
@@ -300,7 +302,7 @@ void main()
//
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
float sa = dot(refnormpersp, sun_dir.xyz);
- vec3 dumbshiny = vary_SunlitColor*(6 * texture2D(lightFunc, vec2(sa, spec.a)).r);
+ vec3 dumbshiny = vary_SunlitColor*(texture2D(lightFunc, vec2(sa, spec.a)).r);
// add the two types of shiny together
vec3 spec_contrib = dumbshiny * spec.rgb;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
index cca63872de..2f18e1a13d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
@@ -41,6 +41,8 @@ uniform sampler2DRect normalMap;
uniform samplerCube environmentMap;
uniform sampler2D noiseMap;
uniform sampler2D projectionMap;
+uniform sampler2D lightFunc;
+
uniform mat4 proj_mat; //screen space to light space
uniform float proj_near; //near clip for projection
@@ -193,6 +195,8 @@ void main()
lit = da * dist_atten * noise;
+ lit = pow(lit, 0.7);
+
col = lcol*lit*diff_tex;
amb_da += (da*0.5)*proj_ambiance;
}
@@ -238,8 +242,25 @@ void main()
stc.x > 0.0 &&
stc.y > 0.0)
{
- vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
- col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb;
+ vec3 npos = -normalize(pos);
+ lv = pfinal-pos.xyz;
+ lv = normalize(lv);
+
+ vec3 h = normalize(lv+npos);
+ float nh = dot(norm, h);
+ float nv = dot(norm, npos);
+ float vh = dot(npos, h);
+ float sa = nh;
+ float fres = pow(1 - dot(h, npos), 5)*0.4+0.5;
+
+ float gtdenom = 2 * nh;
+ float gt = max(0,(min(gtdenom * nv / vh, gtdenom * da / vh)));
+
+ if (nh > 0.0)
+ {
+ float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
+ col += scol*color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod).rgb*spec.rgb;
+ }
}
}
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index 5621e47ab7..d237ec6236 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -39,6 +39,7 @@ uniform samplerCube environmentMap;
uniform sampler2DRect lightMap;
uniform sampler2D noiseMap;
uniform sampler2D projectionMap;
+uniform sampler2D lightFunc;
uniform mat4 proj_mat; //screen space to light space
uniform float proj_near; //near clip for projection
@@ -177,7 +178,7 @@ void main()
lv = proj_origin-pos.xyz;
lv = normalize(lv);
float da = dot(norm, lv);
-
+
vec3 col = vec3(0,0,0);
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
@@ -203,6 +204,8 @@ void main()
lit = da * dist_atten * noise;
+ lit = pow(lit, 0.7);
+
col = lcol*lit*diff_tex*shadow;
amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance;
}
@@ -241,6 +244,7 @@ void main()
float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0);
+ //stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
if (stc.x < 1.0 &&
@@ -248,8 +252,29 @@ void main()
stc.x > 0.0 &&
stc.y > 0.0)
{
- vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
- col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb*shadow;
+
+ vec3 npos = -normalize(pos);
+ lv = pfinal-pos.xyz;
+ lv = normalize(lv);
+
+ vec3 h = normalize(lv+npos);
+ float nh = dot(norm, h);
+ float nv = dot(norm, npos);
+ float vh = dot(npos, h);
+ float sa = nh;
+ float fres = pow(1 - dot(h, npos), 5)*0.4+0.5;
+
+ float gtdenom = 2 * nh;
+ float gt = max(0,(min(gtdenom * nv / vh, gtdenom * da / vh)));
+
+ if (nh > 0.0)
+ {
+ float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
+ col += scol*color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod).rgb*shadow*spec.rgb;
+ }
+
+ //vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
+ //col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb*shadow;
}
}
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index ff20b63972..eafb7d9c75 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -282,7 +282,8 @@ void main()
norm.xyz = (norm.xyz-0.5)*2.0; // unpack norm
float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
-
+ da = pow(da, 0.7);
+
vec4 diffuse = texture2DRect(diffuseRect, tc);
vec3 col;
@@ -309,7 +310,7 @@ void main()
//
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
float sa = dot(refnormpersp, sun_dir.xyz);
- vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*(6 * texture2D(lightFunc, vec2(sa, spec.a)).r);
+ vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*(texture2D(lightFunc, vec2(sa, spec.a)).r);
// add the two types of shiny together
vec3 spec_contrib = dumbshiny * spec.rgb;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
index 6d6ad6d565..af8089ce67 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
@@ -39,6 +39,8 @@ uniform samplerCube environmentMap;
uniform sampler2DRect lightMap;
uniform sampler2D noiseMap;
uniform sampler2D projectionMap;
+uniform sampler2D lightFunc;
+
uniform mat4 proj_mat; //screen space to light space
uniform float proj_near; //near clip for projection
@@ -203,6 +205,8 @@ void main()
lit = da * dist_atten * noise;
+ lit = pow(lit, 0.7);
+
col = lcol*lit*diff_tex*shadow;
amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance;
}
@@ -248,8 +252,25 @@ void main()
stc.x > 0.0 &&
stc.y > 0.0)
{
- vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
- col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb*shadow;
+ vec3 npos = -normalize(pos);
+ lv = pfinal-pos.xyz;
+ lv = normalize(lv);
+
+ vec3 h = normalize(lv+npos);
+ float nh = dot(norm, h);
+ float nv = dot(norm, npos);
+ float vh = dot(npos, h);
+ float sa = nh;
+ float fres = pow(1 - dot(h, npos), 5)*0.4+0.5;
+
+ float gtdenom = 2 * nh;
+ float gt = max(0,(min(gtdenom * nv / vh, gtdenom * da / vh)));
+
+ if (nh > 0.0)
+ {
+ float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
+ col += scol*color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod).rgb*shadow*spec.rgb;
+ }
}
}
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
index 890486c4b1..147fb4562e 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
@@ -138,6 +138,7 @@ void main()
float shadow = 0.0;
float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz));
+ dp_directional_light = pow(dp_directional_light, 0.7);
vec3 shadow_pos = pos.xyz + displace*norm;
vec3 offset = sun_dir.xyz * (1.0-dp_directional_light);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
index 2dcd3d656f..907b96ffe4 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
@@ -199,6 +199,7 @@ void main()
float shadow = 0.0;
float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz));
+ dp_directional_light = pow(dp_directional_light, 0.7);
vec3 shadow_pos = pos.xyz + displace*norm;
vec3 offset = sun_dir.xyz * (1.0-dp_directional_light);
diff --git a/indra/newview/lldrawpoolmaterials.cpp b/indra/newview/lldrawpoolmaterials.cpp
index d6cca9abe2..3e0f9c9d4d 100644
--- a/indra/newview/lldrawpoolmaterials.cpp
+++ b/indra/newview/lldrawpoolmaterials.cpp
@@ -113,6 +113,9 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass)
llassert(pass < sizeof(type_list)/sizeof(U32));
U32 type = type_list[pass];
+
+ U32 mask = mShader->mAttributeMask;
+
LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type);
LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type);
@@ -137,7 +140,7 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass)
mShader->setMinimumAlpha(params.mAlphaMaskCutoff);
- pushBatch(params, VERTEX_DATA_MASK, TRUE);
+ pushBatch(params, mask, TRUE);
}
}
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 38a45ff4ce..4dad363eb8 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -647,9 +647,12 @@ void LLPanelFace::getState()
LLTextureCtrl* shinytexture_ctrl = getChild<LLTextureCtrl>("shinytexture control");
LLTextureCtrl* bumpytexture_ctrl = getChild<LLTextureCtrl>("bumpytexture control");
+ LLUUID id;
+ LLUUID normmap_id;
+ LLUUID specmap_id;
+
// Texture
{
- LLUUID id;
struct f1 : public LLSelectedTEGetFunctor<LLUUID>
{
LLUUID get(LLViewerObject* object, S32 te_index)
@@ -680,6 +683,45 @@ void LLPanelFace::getState()
} func;
identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id );
+ // Normal map
+ struct norm_get : public LLSelectedTEGetFunctor<LLUUID>
+ {
+ LLUUID get(LLViewerObject* object, S32 te_index)
+ {
+ LLUUID id;
+
+ LLMaterial* mat = object->getTE(te_index)->getMaterialParams().get();
+
+ if (mat)
+ {
+ id = mat->getNormalID();
+ }
+
+ return id;
+ }
+ } norm_get_func;
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &norm_get_func, normmap_id ) && identical;
+
+ // Specular map
+ struct spec_get : public LLSelectedTEGetFunctor<LLUUID>
+ {
+ LLUUID get(LLViewerObject* object, S32 te_index)
+ {
+ LLUUID id;
+
+ LLMaterial* mat = object->getTE(te_index)->getMaterialParams().get();
+
+ if (mat)
+ {
+ id = mat->getSpecularID();
+ }
+
+ return id;
+ }
+ } spec_get_func;
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &spec_get_func, specmap_id ) && identical;
+
+
mIsAlpha = FALSE;
LLGLenum image_format;
struct f2 : public LLSelectedTEGetFunctor<LLGLenum>
@@ -693,7 +735,7 @@ void LLPanelFace::getState()
return image_format;
}
} func2;
- identical &= LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, image_format );
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, image_format ) && identical;
mIsAlpha = FALSE;
switch (image_format)
@@ -747,20 +789,27 @@ void LLPanelFace::getState()
texture_ctrl->setTentative( FALSE );
texture_ctrl->setEnabled( editable );
texture_ctrl->setImageAssetID( id );
+ }
+
+ if (shinytexture_ctrl)
+ {
shinytexture_ctrl->setTentative( FALSE );
shinytexture_ctrl->setEnabled( editable );
- if (!editable)
- {
- shinytexture_ctrl->setImageAssetID( LLUUID::null );
- bumpytexture_ctrl->setImageAssetID( LLUUID::null );
- }
+ shinytexture_ctrl->setImageAssetID(specmap_id);
+ }
+
+ if (bumpytexture_ctrl)
+ {
bumpytexture_ctrl->setTentative( FALSE );
bumpytexture_ctrl->setEnabled( editable );
- getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha);
- getChildView("label alphamode")->setEnabled(editable && mIsAlpha);
- getChildView("maskcutoff")->setEnabled(editable && mIsAlpha);
- getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha);
+ bumpytexture_ctrl->setImageAssetID(normmap_id);
}
+
+ getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha);
+ getChildView("label alphamode")->setEnabled(editable && mIsAlpha);
+ getChildView("maskcutoff")->setEnabled(editable && mIsAlpha);
+ getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha);
+
}
else
{
@@ -772,12 +821,6 @@ void LLPanelFace::getState()
texture_ctrl->setTentative( FALSE );
texture_ctrl->setEnabled( FALSE );
texture_ctrl->setImageAssetID( LLUUID::null );
- shinytexture_ctrl->setTentative( FALSE );
- shinytexture_ctrl->setEnabled( FALSE );
- shinytexture_ctrl->setImageAssetID( LLUUID::null );
- bumpytexture_ctrl->setTentative( FALSE );
- bumpytexture_ctrl->setEnabled( FALSE );
- bumpytexture_ctrl->setImageAssetID( LLUUID::null );
getChildView("combobox alphamode")->setEnabled( FALSE );
getChildView("label alphamode")->setEnabled( FALSE );
getChildView("maskcutoff")->setEnabled( FALSE);
@@ -789,25 +832,47 @@ void LLPanelFace::getState()
texture_ctrl->setTentative( TRUE );
texture_ctrl->setEnabled( editable );
texture_ctrl->setImageAssetID( id );
- shinytexture_ctrl->setTentative( TRUE );
- shinytexture_ctrl->setEnabled( editable );
- if (!editable)
- {
- shinytexture_ctrl->setImageAssetID( LLUUID::null );
- bumpytexture_ctrl->setImageAssetID( LLUUID::null );
- }
- bumpytexture_ctrl->setTentative( TRUE );
- bumpytexture_ctrl->setEnabled( editable );
getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha);
getChildView("label alphamode")->setEnabled(editable && mIsAlpha);
getChildView("maskcutoff")->setEnabled(editable && mIsAlpha);
getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha);
}
}
+
+ if (shinytexture_ctrl)
+ {
+ if (specmap_id.isNull())
+ {
+ shinytexture_ctrl->setTentative( FALSE );
+ shinytexture_ctrl->setEnabled( FALSE );
+ shinytexture_ctrl->setImageAssetID( LLUUID::null );
+ }
+ else
+ {
+ shinytexture_ctrl->setTentative( FALSE );
+ shinytexture_ctrl->setEnabled( FALSE );
+ shinytexture_ctrl->setImageAssetID( specmap_id );
+ }
+ }
+
+ if (bumpytexture_ctrl)
+ {
+ if (normmap_id.isNull())
+ {
+ bumpytexture_ctrl->setTentative( FALSE );
+ bumpytexture_ctrl->setEnabled( FALSE );
+ bumpytexture_ctrl->setImageAssetID( LLUUID::null );
+ }
+ else
+ {
+ shinytexture_ctrl->setTentative( TRUE );
+ shinytexture_ctrl->setEnabled( FALSE );
+ shinytexture_ctrl->setImageAssetID( normmap_id);
+ }
+ }
}
}
-
-
+
// planar align
bool align_planar = false;
bool identical_planar_aligned = false;
@@ -855,17 +920,60 @@ void LLPanelFace::getState()
return object->getTE(face)->mScaleS;
}
} func;
+
identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_s );
identical = align_planar ? identical_planar_aligned : identical;
getChild<LLUICtrl>("TexScaleU")->setValue(editable ? scale_s : 0);
getChild<LLUICtrl>("TexScaleU")->setTentative(LLSD((BOOL)(!identical)));
getChildView("TexScaleU")->setEnabled(editable);
+
+ scale_s = 1.f;
+ struct f3 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ F32 s = 1.f, t = 1.f;
+
+ LLMaterial* mat = object->getTE(face)->getMaterialParams().get();
+ if (mat)
+ {
+ mat->getSpecularRepeat(s, t);
+ }
+ return s;
+ }
+ } shiny_func;
+
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, scale_s );
+ identical = align_planar ? identical_planar_aligned : identical;
+
getChild<LLUICtrl>("shinyScaleU")->setValue(editable ? scale_s : 0);
getChild<LLUICtrl>("shinyScaleU")->setTentative(LLSD((BOOL)(!identical)));
- getChildView("shinyScaleU")->setEnabled(FALSE);
+ getChildView("shinyScaleU")->setEnabled(editable && specmap_id.notNull());
+
+ scale_s = 1.f;
+ struct f4 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ F32 s = 1.f, t = 1.f;
+
+ LLMaterial* mat = object->getTE(face)->getMaterialParams().get();
+ if (mat)
+ {
+ mat->getNormalRepeat(s, t);
+ }
+ return s;
+ }
+ } bump_func;
+
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, scale_s );
+ identical = align_planar ? identical_planar_aligned : identical;
+
+
+
getChild<LLUICtrl>("bumpyScaleU")->setValue(editable ? scale_s : 0);
getChild<LLUICtrl>("bumpyScaleU")->setTentative(LLSD((BOOL)(!identical)));
- getChildView("bumpyScaleU")->setEnabled(FALSE);
+ getChildView("bumpyScaleU")->setEnabled(editable && normmap_id.notNull());
}
{
@@ -883,12 +991,52 @@ void LLPanelFace::getState()
getChild<LLUICtrl>("TexScaleV")->setValue(editable ? scale_t : 0);
getChild<LLUICtrl>("TexScaleV")->setTentative(LLSD((BOOL)(!identical)));
getChildView("TexScaleV")->setEnabled(editable);
+
+ scale_t = 1.f;
+ struct f4 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ F32 s = 1.f, t = 1.f;
+
+ LLMaterial* mat = object->getTE(face)->getMaterialParams().get();
+ if (mat)
+ {
+ mat->getSpecularRepeat(s, t);
+ }
+ return t;
+ }
+ } shiny_func;
+
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, scale_t );
+ identical = align_planar ? identical_planar_aligned : identical;
getChild<LLUICtrl>("shinyScaleV")->setValue(editable ? scale_t : 0);
getChild<LLUICtrl>("shinyScaleV")->setTentative(LLSD((BOOL)(!identical)));
- getChildView("shinyScaleV")->setEnabled(FALSE);
+ getChildView("shinyScaleV")->setEnabled(editable && specmap_id.notNull());
+
+ scale_t = 1.f;
+ struct f5 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ F32 s = 1.f, t = 1.f;
+
+ LLMaterial* mat = object->getTE(face)->getMaterialParams().get();
+ if (mat)
+ {
+ mat->getNormalRepeat(s, t);
+ }
+ return t;
+ }
+ } bump_func;
+
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, scale_t );
+ identical = align_planar ? identical_planar_aligned : identical;
+
getChild<LLUICtrl>("bumpyScaleV")->setValue(editable ? scale_t : 0);
getChild<LLUICtrl>("bumpyScaleV")->setTentative(LLSD((BOOL)(!identical)));
- getChildView("bumpyScaleV")->setEnabled(FALSE);
+ getChildView("bumpyScaleV")->setEnabled(editable && normmap_id.notNull());
+
}
// Texture offset
@@ -907,12 +1055,51 @@ void LLPanelFace::getState()
getChild<LLUICtrl>("TexOffsetU")->setValue(editable ? offset_s : 0);
getChild<LLUICtrl>("TexOffsetU")->setTentative(!identical);
getChildView("TexOffsetU")->setEnabled(editable);
+
+ offset_s = 1.f;
+ struct f3 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ F32 s = 1.f, t = 1.f;
+
+ LLMaterial* mat = object->getTE(face)->getMaterialParams().get();
+ if (mat)
+ {
+ mat->getSpecularOffset(s, t);
+ }
+ return s;
+ }
+ } shiny_func;
+
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, offset_s );
+ identical = align_planar ? identical_planar_aligned : identical;
getChild<LLUICtrl>("shinyOffsetU")->setValue(editable ? offset_s : 0);
- getChild<LLUICtrl>("shinyOffsetU")->setTentative(!identical);
- getChildView("shinyOffsetU")->setEnabled(FALSE);
+ getChild<LLUICtrl>("shinyOffsetU")->setTentative(LLSD((BOOL)(!identical)));
+ getChildView("shinyOffsetU")->setEnabled(editable && specmap_id.notNull());
+
+ offset_s = 1.f;
+ struct f5 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ F32 s = 1.f, t = 1.f;
+
+ LLMaterial* mat = object->getTE(face)->getMaterialParams().get();
+ if (mat)
+ {
+ mat->getNormalOffset(s, t);
+ }
+ return s;
+ }
+ } bump_func;
+
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, offset_s );
+ identical = align_planar ? identical_planar_aligned : identical;
+
getChild<LLUICtrl>("bumpyOffsetU")->setValue(editable ? offset_s : 0);
- getChild<LLUICtrl>("bumpyOffsetU")->setTentative(!identical);
- getChildView("bumpyOffsetU")->setEnabled(FALSE);
+ getChild<LLUICtrl>("bumpyOffsetU")->setTentative(LLSD((BOOL)(!identical)));
+ getChildView("bumpyOffsetU")->setEnabled(editable && normmap_id.notNull());
}
{
@@ -929,12 +1116,52 @@ void LLPanelFace::getState()
getChild<LLUICtrl>("TexOffsetV")->setValue(editable ? offset_t : 0);
getChild<LLUICtrl>("TexOffsetV")->setTentative(!identical);
getChildView("TexOffsetV")->setEnabled(editable);
+
+
+ offset_t = 1.f;
+ struct f3 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ F32 s = 1.f, t = 1.f;
+
+ LLMaterial* mat = object->getTE(face)->getMaterialParams().get();
+ if (mat)
+ {
+ mat->getSpecularOffset(s, t);
+ }
+ return t;
+ }
+ } shiny_func;
+
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, offset_t );
+ identical = align_planar ? identical_planar_aligned : identical;
getChild<LLUICtrl>("shinyOffsetV")->setValue(editable ? offset_t : 0);
- getChild<LLUICtrl>("shinyOffsetV")->setTentative(!identical);
- getChildView("shinyOffsetV")->setEnabled(FALSE);
+ getChild<LLUICtrl>("shinyOffsetV")->setTentative(LLSD((BOOL)(!identical)));
+ getChildView("shinyOffsetV")->setEnabled(editable && specmap_id.notNull());
+
+ offset_t = 1.f;
+ struct f4 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ F32 s = 1.f, t = 1.f;
+
+ LLMaterial* mat = object->getTE(face)->getMaterialParams().get();
+ if (mat)
+ {
+ mat->getNormalOffset(s, t);
+ }
+ return t;
+ }
+ } bump_func;
+
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, offset_t );
+ identical = align_planar ? identical_planar_aligned : identical;
+
getChild<LLUICtrl>("bumpyOffsetV")->setValue(editable ? offset_t : 0);
- getChild<LLUICtrl>("bumpyOffsetV")->setTentative(!identical);
- getChildView("bumpyOffsetV")->setEnabled(FALSE);
+ getChild<LLUICtrl>("bumpyOffsetV")->setTentative(LLSD((BOOL)(!identical)));
+ getChildView("bumpyOffsetV")->setEnabled(editable && normmap_id.notNull());
}
// Texture rotation
@@ -952,12 +1179,53 @@ void LLPanelFace::getState()
getChild<LLUICtrl>("TexRot")->setValue(editable ? rotation * RAD_TO_DEG : 0);
getChild<LLUICtrl>("TexRot")->setTentative(!identical);
getChildView("TexRot")->setEnabled(editable);
+
+
+
+ rotation = 1.f;
+ struct f3 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ F32 ret = 0.f;
+
+ LLMaterial* mat = object->getTE(face)->getMaterialParams().get();
+ if (mat)
+ {
+ ret = mat->getSpecularRotation();
+ }
+ return ret;
+ }
+ } shiny_func;
+
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, rotation );
+ identical = align_planar ? identical_planar_aligned : identical;
getChild<LLUICtrl>("shinyRot")->setValue(editable ? rotation * RAD_TO_DEG : 0);
- getChild<LLUICtrl>("shinyRot")->setTentative(!identical);
- getChildView("shinyRot")->setEnabled(FALSE);
+ getChild<LLUICtrl>("shinyRot")->setTentative(LLSD((BOOL)(!identical)));
+ getChildView("shinyRot")->setEnabled(editable && specmap_id.notNull());
+
+ rotation = 1.f;
+ struct f4 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ F32 ret = 0.f;
+
+ LLMaterial* mat = object->getTE(face)->getMaterialParams().get();
+ if (mat)
+ {
+ ret = mat->getNormalRotation();
+ }
+ return ret;
+ }
+ } bump_func;
+
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, rotation );
+ identical = align_planar ? identical_planar_aligned : identical;
+
getChild<LLUICtrl>("bumpyRot")->setValue(editable ? rotation * RAD_TO_DEG : 0);
- getChild<LLUICtrl>("bumpyRot")->setTentative(!identical);
- getChildView("bumpyRot")->setEnabled(FALSE);
+ getChild<LLUICtrl>("bumpyRot")->setTentative(LLSD((BOOL)(!identical)));
+ getChildView("bumpyRot")->setEnabled(editable && normmap_id.notNull());
}
// Color swatch
@@ -1103,10 +1371,10 @@ void LLPanelFace::getState()
{
getChild<LLUICtrl>("TexScaleU")->setValue(2.0f * getChild<LLUICtrl>("TexScaleU")->getValue().asReal() );
getChild<LLUICtrl>("TexScaleV")->setValue(2.0f * getChild<LLUICtrl>("TexScaleV")->getValue().asReal() );
- getChild<LLUICtrl>("shinyScaleU")->setValue(2.0f * getChild<LLUICtrl>("TexScaleU")->getValue().asReal() );
- getChild<LLUICtrl>("shinyScaleV")->setValue(2.0f * getChild<LLUICtrl>("TexScaleV")->getValue().asReal() );
- getChild<LLUICtrl>("bumpyScaleU")->setValue(2.0f * getChild<LLUICtrl>("TexScaleU")->getValue().asReal() );
- getChild<LLUICtrl>("bumpyScaleV")->setValue(2.0f * getChild<LLUICtrl>("TexScaleV")->getValue().asReal() );
+ getChild<LLUICtrl>("shinyScaleU")->setValue(2.0f * getChild<LLUICtrl>("shinyScaleU")->getValue().asReal() );
+ getChild<LLUICtrl>("shinyScaleV")->setValue(2.0f * getChild<LLUICtrl>("shinyScaleV")->getValue().asReal() );
+ getChild<LLUICtrl>("bumpyScaleU")->setValue(2.0f * getChild<LLUICtrl>("bumpScaleU")->getValue().asReal() );
+ getChild<LLUICtrl>("bumpyScaleV")->setValue(2.0f * getChild<LLUICtrl>("bumpScaleV")->getValue().asReal() );
// EXP-1507 (change label based on the mapping mode)
getChild<LLUICtrl>("rpt")->setValue(getString("string repeats per meter"));
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index fd9f3dc486..8a1f00aa0e 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4771,10 +4771,10 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, simple_faces, FALSE, batch_textures);
genDrawInfo(group, fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, fullbright_faces, FALSE, batch_textures);
genDrawInfo(group, alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, alpha_faces, TRUE, batch_textures);
- genDrawInfo(group, bump_mask, bump_faces, FALSE, FALSE);
- genDrawInfo(group, norm_mask, norm_faces, FALSE, FALSE);
- genDrawInfo(group, spec_mask, spec_faces, FALSE, FALSE);
- genDrawInfo(group, normspec_mask, normspec_faces, FALSE, FALSE);
+ genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, bump_faces, FALSE, FALSE);
+ genDrawInfo(group, norm_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, norm_faces, FALSE, FALSE);
+ genDrawInfo(group, spec_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, spec_faces, FALSE, FALSE);
+ genDrawInfo(group, normspec_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, normspec_faces, FALSE, FALSE);
if (!LLPipeline::sDelayVBUpdate)
{
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 92b673e11c..f664e06dd5 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -1266,7 +1266,7 @@ void LLPipeline::createLUTBuffers()
{
if (!mLightFunc)
{
- U32 lightResX = gSavedSettings.getU32("RenderSpecularResX");
+ /*U32 lightResX = gSavedSettings.getU32("RenderSpecularResX");
U32 lightResY = gSavedSettings.getU32("RenderSpecularResY");
U8* ls = new U8[lightResX*lightResY];
F32 specExp = gSavedSettings.getF32("RenderSpecularExponent");
@@ -1302,10 +1302,10 @@ void LLPipeline::createLUTBuffers()
// Combined with a bit of noise and trilinear filtering, the banding is hardly noticable.
ls[y*lightResX+x] = (U8)(llclamp(spec * (1.f / 6), 0.f, 1.f) * 255);
}
- }
+ }*/
- /*U32 lightResX = gSavedSettings.getU32("RenderSpecularResX");
+ U32 lightResX = gSavedSettings.getU32("RenderSpecularResX");
U32 lightResY = gSavedSettings.getU32("RenderSpecularResY");
F32* ls = new F32[lightResX*lightResY];
//F32 specExp = gSavedSettings.getF32("RenderSpecularExponent"); // Note: only use this when creating new specular lighting functions.
@@ -1327,15 +1327,36 @@ void LLPipeline::createLUTBuffers()
// This is fine, given we only need to create our LUT once per buffer initialization.
spec *= (((n + 2) * (n + 4)) / (8 * F_PI * (powf(2, -n/2) + n)));
+ spec = llclamp(spec, 0.f, 1.f);
+ spec = powf(spec, 0.6f);
+
// Since we use R16F, we no longer have a dynamic range issue we need to work around here.
// Though some older drivers may not like this, newer drivers shouldn't have this problem.
ls[y*lightResX+x] = spec;
+
+
+ //beckmann distribution
+ /*F32 alpha = acosf((F32) x/(lightResX-1));
+ F32 m = 1.f - (F32) y/(lightResY-1);
+
+ F32 cos4_alpha = cosf(alpha);
+ cos4_alpha *= cos4_alpha;
+ cos4_alpha *= cos4_alpha;
+
+ F32 tan_alpha = tanf(alpha);
+ F32 tan2_alpha = tan_alpha*tan_alpha;
+
+ F32 k = expf(-(tan2_alpha)/(m*m)) /
+ (3.14159f*m*m*cos4_alpha);
+
+ ls[y*lightResX+x] = k;*/
}
- }*/
+ }
LLImageGL::generateTextures(LLTexUnit::TT_TEXTURE, GL_R8, 1, &mLightFunc);
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mLightFunc);
- LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_R16F, lightResX, lightResY, GL_RED, GL_UNSIGNED_BYTE, ls, false);
+ LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_R16F, lightResX, lightResY, GL_RED, GL_FLOAT, ls, false);
+ //LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_UNSIGNED_BYTE, lightResX, lightResY, GL_RED, GL_UNSIGNED_BYTE, ls, false);
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_TRILINEAR);
@@ -8250,7 +8271,7 @@ void LLPipeline::renderDeferredLighting()
LLFastTimer ftm(FTM_LOCAL_LIGHTS);
gDeferredLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c);
gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s*s);
- gDeferredLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, pow3f(col, 2.2f).mV);
+ gDeferredLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f);
gGL.syncMatrices();
@@ -8306,7 +8327,7 @@ void LLPipeline::renderDeferredLighting()
gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c);
gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s*s);
- gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, pow3f(col, 2.2f).mV);
+ gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f);
gGL.syncMatrices();
@@ -8397,7 +8418,7 @@ void LLPipeline::renderDeferredLighting()
gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v);
gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s*s);
- gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, pow3f(col, 2.2f).mV);
+ gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f);
mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
}
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
index 545bd94ddd..708dcf4e95 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
@@ -262,7 +262,7 @@
control_name="RenderDeferred"
height="16"
initial_value="true"
- label="Advance Lighting Model"
+ label="Advanced Lighting Model"
layout="topleft"
left_delta="0"
name="UseLightShaders"