First pass on alpha blended materials

meow-7.2.2
Geenz 2013-04-11 14:57:11 -04:00
parent 84475635b9
commit cfc3757778
14 changed files with 136 additions and 494 deletions

View File

@ -805,7 +805,6 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
//an error occured, print log
LL_WARNS("ShaderLoading") << "GLSL Compilation Error: (" << error << ") in " << filename << LL_ENDL;
dumpObjectLog(ret);
#if LL_WINDOWS
std::stringstream ostr;
//dump shader source for debugging
@ -823,8 +822,20 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
}
LL_WARNS("ShaderLoading") << "\n" << ostr.str() << llendl;
#endif // LL_WINDOWS
#else
std::string str;
for (GLuint i = 0; i < count; i++) {
str.append(text[i]);
if (i % 128 == 0)
{
LL_WARNS("ShaderLoading") << str << llendl;
str = "";
}
}
#endif
ret = 0;
}
}

View File

@ -25,6 +25,10 @@
#extension GL_ARB_texture_rectangle : enable
#define INDEXED 1
#define NON_INDEXED 2
#define NON_INDEXED_NO_COLOR 3
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
@ -33,7 +37,13 @@ out vec4 frag_color;
uniform sampler2DRect depthMap;
#if INDEX_MODE != INDEXED
uniform sampler2D diffuseMap;
#endif
#if INDEX_MODE == INDEXED
vec4 diffuseLookup(vec2 texcoord);
#endif
uniform vec2 screen_res;
@ -46,7 +56,10 @@ VARYING vec3 vary_fragcoord;
VARYING vec3 vary_position;
VARYING vec3 vary_pointlight_col;
#if INDEX_MODE != NON_INDEXED_NO_COLOR
VARYING vec4 vertex_color;
#endif
VARYING vec2 vary_texcoord0;
VARYING vec3 vary_norm;
@ -103,11 +116,21 @@ void main()
vec4 pos = vec4(vary_position, 1.0);
vec4 diff= diffuseLookup(vary_texcoord0.xy);
#if INDEX_MODE == INDEXED
vec4 diff = diffuseLookup(vary_texcoord0.xy);
#else
vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy);
#endif
#if INDEX_MODE == NON_INDEXED_NO_COLOR
float vertex_color_alpha = 1.0;
#else
float vertex_color_alpha = vertex_color.a;
#endif
vec3 dlight = calcDirectionalLight(vary_norm, light_position[0].xyz) * vary_directional.rgb * vary_pointlight_col;
vec4 col = vec4(vary_ambient + dlight, vertex_color.a);
vec4 col = vec4(vary_ambient + dlight, vertex_color_alpha);
vec4 color = diff * col;
color.rgb = atmosLighting(color.rgb);

View File

@ -47,6 +47,7 @@ VARYING vec3 vary_directional;
VARYING vec3 vary_fragcoord;
VARYING vec3 vary_pointlight_col;
VARYING vec2 vary_texcoord0;
VARYING vec3 vary_norm;
uniform float near_clip;
@ -112,6 +113,7 @@ void main()
norm.y = dot(trans[1].xyz, normal);
norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
vary_norm = norm;
vec4 frag_pos = projection_matrix * pos;
gl_Position = frag_pos;

View File

@ -25,25 +25,27 @@
#extension GL_ARB_texture_rectangle : enable
#define INDEXED 1
#define NON_INDEXED 2
#define NON_INDEXED_NO_COLOR 3
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
VARYING vec4 vertex_color;
VARYING vec2 vary_texcoord0;
uniform sampler2DShadow shadowMap0;
uniform sampler2DShadow shadowMap1;
uniform sampler2DShadow shadowMap2;
uniform sampler2DShadow shadowMap3;
uniform sampler2DRect depthMap;
uniform mat4 shadow_matrix[6];
uniform vec4 shadow_clip;
#if INDEX_MODE != INDEXED
uniform sampler2D diffuseMap;
#endif
uniform vec2 screen_res;
uniform vec2 shadow_res;
vec3 atmosLighting(vec3 light);
vec3 scaleSoftClip(vec3 light);
@ -53,8 +55,16 @@ VARYING vec3 vary_directional;
VARYING vec3 vary_fragcoord;
VARYING vec3 vary_position;
VARYING vec3 vary_pointlight_col;
VARYING vec2 vary_texcoord0;
VARYING vec3 vary_norm;
#if INDEX_MODE != NON_INDEXED_NO_COLOR
VARYING vec4 vertex_color;
#endif
uniform mat4 shadow_matrix[6];
uniform vec4 shadow_clip;
uniform vec2 shadow_res;
uniform float shadow_bias;
uniform mat4 inv_proj;
@ -190,9 +200,20 @@ void main()
shadow = 1.0;
}
vec3 dlight = calcDirectionalLight(vary_norm, light_position[0].xyz) * vary_directional.rgb * vary_pointlight_col;
vec4 diff = diffuseLookup(vary_texcoord0.xy);
vec4 col = vec4(vary_ambient + dlight *shadow, vertex_color.a);
#if INDEX_MODE == INDEXED
vec4 diff = diffuseLookup(vary_texcoord0.xy);
#else
vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy);
#endif
#if INDEX_MODE == NON_INDEXED_NO_COLOR
float vertex_color_alpha = 1.0;
#else
float vertex_color_alpha = vertex_color.a;
#endif
vec4 col = vec4(vary_ambient + dlight *shadow, vertex_color_alpha);
vec4 color = diff * col;
color.rgb = atmosLighting(color.rgb);

View File

@ -1,226 +0,0 @@
/**
* @file alphaF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2DShadow shadowMap0;
uniform sampler2DShadow shadowMap1;
uniform sampler2DShadow shadowMap2;
uniform sampler2DShadow shadowMap3;
uniform sampler2DRect depthMap;
uniform sampler2D diffuseMap;
uniform mat4 shadow_matrix[6];
uniform vec4 shadow_clip;
uniform vec2 screen_res;
vec3 atmosLighting(vec3 light);
vec3 scaleSoftClip(vec3 light);
VARYING vec3 vary_ambient;
VARYING vec3 vary_directional;
VARYING vec3 vary_fragcoord;
VARYING vec3 vary_position;
VARYING vec3 vary_pointlight_col;
VARYING vec2 vary_texcoord0;
VARYING vec4 vertex_color;
VARYING vec3 vary_norm;
uniform vec2 shadow_res;
uniform float shadow_bias;
uniform mat4 inv_proj;
uniform vec4 light_position[8];
uniform vec3 light_direction[8];
uniform vec3 light_attenuation[8];
uniform vec3 light_diffuse[8];
float calcDirectionalLight(vec3 n, vec3 l)
{
float a = pow(max(dot(n,l),0.0), 0.7);
return a;
}
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
{
//get light vector
vec3 lv = lp.xyz-v;
//get distance
float d = dot(lv,lv);
float da = 0.0;
if (d > 0.0 && la > 0.0 && fa > 0.0)
{
//normalize light vector
lv = normalize(lv);
//distance attenuation
float dist2 = d/la;
da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
// spotlight coefficient.
float spot = max(dot(-ln, lv), is_pointlight);
da *= spot*spot; // GL_SPOT_EXPONENT=2
//angular attenuation
da *= max(pow(dot(n, lv), 0.7), 0.0);
}
return da;
}
vec4 getPosition(vec2 pos_screen)
{
float depth = texture2DRect(depthMap, pos_screen.xy).a;
vec2 sc = pos_screen.xy*2.0;
sc /= screen_res;
sc -= vec2(1.0,1.0);
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
vec4 pos = inv_proj * ndc;
pos.xyz /= pos.w;
pos.w = 1.0;
return pos;
}
float pcfShadow(sampler2DShadow shadowMap, vec4 stc)
{
stc.xyz /= stc.w;
stc.z += shadow_bias;
stc.x = floor(stc.x*shadow_res.x + fract(stc.y*12345))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
float cs = shadow2D(shadowMap, stc.xyz).x;
float shadow = cs;
shadow += shadow2D(shadowMap, stc.xyz+vec3(2.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;
shadow += shadow2D(shadowMap, stc.xyz+vec3(1.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x;
shadow += shadow2D(shadowMap, stc.xyz+vec3(-1.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;
shadow += shadow2D(shadowMap, stc.xyz+vec3(-2.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x;
return shadow*0.2;
}
void main()
{
vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
frag *= screen_res;
float shadow = 0.0;
vec4 pos = vec4(vary_position, 1.0);
vec4 spos = pos;
if (spos.z > -shadow_clip.w)
{
vec4 lpos;
vec4 near_split = shadow_clip*-0.75;
vec4 far_split = shadow_clip*-1.25;
vec4 transition_domain = near_split-far_split;
float weight = 0.0;
if (spos.z < near_split.z)
{
lpos = shadow_matrix[3]*spos;
float w = 1.0;
w -= max(spos.z-far_split.z, 0.0)/transition_domain.z;
shadow += pcfShadow(shadowMap3, lpos)*w;
weight += w;
shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
}
if (spos.z < near_split.y && spos.z > far_split.z)
{
lpos = shadow_matrix[2]*spos;
float w = 1.0;
w -= max(spos.z-far_split.y, 0.0)/transition_domain.y;
w -= max(near_split.z-spos.z, 0.0)/transition_domain.z;
shadow += pcfShadow(shadowMap2, lpos)*w;
weight += w;
}
if (spos.z < near_split.x && spos.z > far_split.y)
{
lpos = shadow_matrix[1]*spos;
float w = 1.0;
w -= max(spos.z-far_split.x, 0.0)/transition_domain.x;
w -= max(near_split.y-spos.z, 0.0)/transition_domain.y;
shadow += pcfShadow(shadowMap1, lpos)*w;
weight += w;
}
if (spos.z > far_split.x)
{
lpos = shadow_matrix[0]*spos;
float w = 1.0;
w -= max(near_split.x-spos.z, 0.0)/transition_domain.x;
shadow += pcfShadow(shadowMap0, lpos)*w;
weight += w;
}
shadow /= weight;
}
else
{
shadow = 1.0;
}
vec3 dlight = calcDirectionalLight(vary_norm, light_position[0].xyz) * vary_directional.rgb * vary_pointlight_col;
vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy);
vec4 col = vec4(vary_ambient + dlight*shadow, vertex_color.a);
vec4 color = diff * col;
color.rgb = atmosLighting(color.rgb);
color.rgb = scaleSoftClip(color.rgb);
vec3 light_col = vec3(0,0,0);
for (int i = 2; i < 8; i++)
{
light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
}
color.rgb += diff.rgb * vary_pointlight_col * light_col;
frag_color = color;
}

View File

@ -1,232 +0,0 @@
/**
* @file alphaNonIndexedNoColorF.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform float minimum_alpha;
uniform sampler2DShadow shadowMap0;
uniform sampler2DShadow shadowMap1;
uniform sampler2DShadow shadowMap2;
uniform sampler2DShadow shadowMap3;
uniform sampler2DRect depthMap;
uniform sampler2D diffuseMap;
uniform mat4 shadow_matrix[6];
uniform vec4 shadow_clip;
uniform vec2 screen_res;
vec3 atmosLighting(vec3 light);
vec3 scaleSoftClip(vec3 light);
VARYING vec3 vary_ambient;
VARYING vec3 vary_directional;
VARYING vec3 vary_fragcoord;
VARYING vec3 vary_position;
VARYING vec3 vary_pointlight_col;
VARYING vec2 vary_texcoord0;
uniform vec2 shadow_res;
uniform float shadow_bias;
uniform mat4 inv_proj;
uniform vec4 light_position[8];
uniform vec3 light_direction[8];
uniform vec3 light_attenuation[8];
uniform vec3 light_diffuse[8];
float calcDirectionalLight(vec3 n, vec3 l)
{
float a = pow(max(dot(n,l),0.0), 0.7);
return a;
}
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
{
//get light vector
vec3 lv = lp.xyz-v;
//get distance
float d = dot(lv,lv);
float da = 0.0;
if (d > 0.0 && la > 0.0 && fa > 0.0)
{
//normalize light vector
lv = normalize(lv);
//distance attenuation
float dist2 = d/la;
da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
// spotlight coefficient.
float spot = max(dot(-ln, lv), is_pointlight);
da *= spot*spot; // GL_SPOT_EXPONENT=2
//angular attenuation
da *= max(pow(dot(n, lv), 0.7), 0.0);
}
return da;
}
vec4 getPosition(vec2 pos_screen)
{
float depth = texture2DRect(depthMap, pos_screen.xy).a;
vec2 sc = pos_screen.xy*2.0;
sc /= screen_res;
sc -= vec2(1.0,1.0);
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
vec4 pos = inv_proj * ndc;
pos.xyz /= pos.w;
pos.w = 1.0;
return pos;
}
float pcfShadow(sampler2DShadow shadowMap, vec4 stc)
{
stc.xyz /= stc.w;
stc.z += shadow_bias;
stc.x = floor(stc.x*shadow_res.x + fract(stc.y*12345))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
float cs = shadow2D(shadowMap, stc.xyz).x;
float shadow = cs;
shadow += shadow2D(shadowMap, stc.xyz+vec3(2.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;
shadow += shadow2D(shadowMap, stc.xyz+vec3(1.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x;
shadow += shadow2D(shadowMap, stc.xyz+vec3(-1.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;
shadow += shadow2D(shadowMap, stc.xyz+vec3(-2.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x;
return shadow*0.2;
}
void main()
{
vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
frag *= screen_res;
float shadow = 0.0;
vec4 pos = vec4(vary_position, 1.0);
vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy);
if (diff.a < minimum_alpha)
{
discard;
}
vec4 spos = pos;
if (spos.z > -shadow_clip.w)
{
vec4 lpos;
vec4 near_split = shadow_clip*-0.75;
vec4 far_split = shadow_clip*-1.25;
vec4 transition_domain = near_split-far_split;
float weight = 0.0;
if (spos.z < near_split.z)
{
lpos = shadow_matrix[3]*spos;
float w = 1.0;
w -= max(spos.z-far_split.z, 0.0)/transition_domain.z;
shadow += pcfShadow(shadowMap3, lpos)*w;
weight += w;
shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
}
if (spos.z < near_split.y && spos.z > far_split.z)
{
lpos = shadow_matrix[2]*spos;
float w = 1.0;
w -= max(spos.z-far_split.y, 0.0)/transition_domain.y;
w -= max(near_split.z-spos.z, 0.0)/transition_domain.z;
shadow += pcfShadow(shadowMap2, lpos)*w;
weight += w;
}
if (spos.z < near_split.x && spos.z > far_split.y)
{
lpos = shadow_matrix[1]*spos;
float w = 1.0;
w -= max(spos.z-far_split.x, 0.0)/transition_domain.x;
w -= max(near_split.y-spos.z, 0.0)/transition_domain.y;
shadow += pcfShadow(shadowMap1, lpos)*w;
weight += w;
}
if (spos.z > far_split.x)
{
lpos = shadow_matrix[0]*spos;
float w = 1.0;
w -= max(near_split.x-spos.z, 0.0)/transition_domain.x;
shadow += pcfShadow(shadowMap0, lpos)*w;
weight += w;
}
shadow /= weight;
}
else
{
shadow = 1.0;
}
vec3 dlight = calcDirectionalLight(vary_norm, light_position[0].xyz) * vary_directional.rgb * vary_pointlight_col;
vec4 col = vec4(vary_ambient + dlight*shadow, 1.0);
vec4 color = diff * col;
color.rgb = atmosLighting(color.rgb);
color.rgb = scaleSoftClip(color.rgb);
vec3 light_col = vec3(0,0,0);
for (int i = 2; i < 8; i++)
{
light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
}
color.rgb += diff.rgb * vary_pointlight_col * light_col;
frag_color = color;
}

View File

@ -50,7 +50,7 @@ VARYING vec3 vary_pointlight_col;
VARYING vec4 vertex_color;
VARYING vec2 vary_texcoord0;
VARYING vec3 vary_norm;
uniform float near_clip;
uniform float shadow_offset;
@ -115,7 +115,8 @@ void main()
n.xyz = normalize(n.xyz-pos.xyz);
vec3 norm = n.xyz;
vary_norm = norm;
float dp_directional_light = max(0.0, dot(norm, light_position[0].xyz));
vary_position = pos.xyz + light_position[0].xyz * (1.0-dp_directional_light)*shadow_offset;

View File

@ -436,7 +436,6 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
}
LLRenderPass::applyModelMatrix(params);
if (params.mFullbright)
{
@ -447,20 +446,6 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
if (use_shaders)
{
target_shader = fullbright_shader;
if (target_shader)
{
if (LLPipeline::sRenderDeferred)
{
if (params.mFace->getViewerObject()->isHUDAttachment())
{
target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0);
} else {
target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2);
}
} else {
target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0);
}
}
}
else
{
@ -497,6 +482,51 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
LLGLSLShader::bindNoShader();
current_shader = NULL;
}
if (params.mMaterialID != LLMaterialID::null && current_shader == simple_shader)
{
// I apologize in advance for not giving this its own shader.
// We have a material. Supply the appropriate data here.
if (LLPipeline::sRenderDeferred)
{
current_shader->uniform4f(LLShaderMgr::SPECULAR_COLOR, params.mSpecColor.mV[0], params.mSpecColor.mV[1], params.mSpecColor.mV[2], params.mSpecColor.mV[3]);
current_shader->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, params.mEnvIntensity);
if (params.mNormalMap)
{
params.mNormalMap->addTextureStats(params.mVSize);
current_shader->bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap);
} else {
LLViewerFetchedTexture::sFlatNormalImagep->addTextureStats(params.mVSize);
current_shader->bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap);
}
if (params.mSpecularMap)
{
params.mSpecularMap->addTextureStats(params.mVSize);
current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, params.mSpecularMap);
} else {
LLViewerFetchedTexture::sWhiteImagep->addTextureStats(params.mVSize);
current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep);
}
}
} else if (current_shader == simple_shader)
{
// No material. Propegate with default parameters.
if (LLPipeline::sRenderDeferred)
{
current_shader->uniform4f(LLShaderMgr::SPECULAR_COLOR, 0.0f, 0.0f, 0.0f, 0.0f);
current_shader->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, 0.0f);
LLViewerFetchedTexture::sFlatNormalImagep->addTextureStats(params.mVSize);
current_shader->bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap);
LLViewerFetchedTexture::sWhiteImagep->addTextureStats(params.mVSize);
current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep);
}
}
if (params.mGroup)
{

View File

@ -1206,9 +1206,9 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSkinnedAlphaProgram.mFeatures.disableTextureIndex = true;
gDeferredSkinnedAlphaProgram.mShaderFiles.clear();
gDeferredSkinnedAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaSkinnedV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredSkinnedAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredSkinnedAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredSkinnedAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
gDeferredSkinnedAlphaProgram.addPermutation("INDEX_MODE", "2");
success = gDeferredSkinnedAlphaProgram.createShader(NULL, NULL);
// Hack to include uniforms for lighting without linking in lighting file
@ -1385,6 +1385,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
gDeferredAlphaProgram.addPermutation("INDEX_MODE", "1");
success = gDeferredAlphaProgram.createShader(NULL, NULL);
@ -1554,9 +1555,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarAlphaProgram.mFeatures.disableTextureIndex = true;
gDeferredAvatarAlphaProgram.mShaderFiles.clear();
gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaNoColorV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedNoColorF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredAvatarAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
gDeferredAvatarAlphaProgram.addPermutation("INDEX_MODE", "3");
success = gDeferredAvatarAlphaProgram.createShader(NULL, &mAvatarUniforms);
gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = true;

View File

@ -70,6 +70,7 @@ LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sMissingAssetImagep =
LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sWhiteImagep = NULL;
LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sDefaultImagep = NULL;
LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sSmokeImagep = NULL;
LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sFlatNormalImagep = NULL;
LLViewerMediaTexture::media_map_t LLViewerMediaTexture::sMediaMap ;
LLTexturePipelineTester* LLViewerTextureManager::sTesterp = NULL ;
const std::string sTesterName("TextureTester");
@ -394,6 +395,7 @@ void LLViewerTextureManager::cleanup()
LLViewerFetchedTexture::sSmokeImagep = NULL;
LLViewerFetchedTexture::sMissingAssetImagep = NULL;
LLViewerFetchedTexture::sWhiteImagep = NULL;
LLViewerFetchedTexture::sFlatNormalImagep = NULL;
LLViewerMediaTexture::cleanUpClass() ;
}

View File

@ -596,6 +596,7 @@ public:
static LLPointer<LLViewerFetchedTexture> sWhiteImagep; // Texture to show NOTHING (whiteness)
static LLPointer<LLViewerFetchedTexture> sDefaultImagep; // "Default" texture for error cases, the only case of fetched texture which is generated in local.
static LLPointer<LLViewerFetchedTexture> sSmokeImagep; // Old "Default" translucent texture
static LLPointer<LLViewerFetchedTexture> sFlatNormalImagep; // Flat normal map denoting no bumpiness on a surface
};
//

View File

@ -119,6 +119,9 @@ void LLViewerTextureList::doPreloadImages()
LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName();
LLUIImageList* image_list = LLUIImageList::getInstance();
// Set the default flat normal map
LLViewerFetchedTexture::sFlatNormalImagep = LLViewerTextureManager::getFetchedTextureFromFile("flatnormal.tga", MIPMAP_NO, LLViewerFetchedTexture::BOOST_BUMP);
image_list->initFromFile();
// turn off clamping and bilinear filtering for uv picking images

View File

@ -4015,7 +4015,11 @@ static LLFastTimer::DeclareTimer FTM_REGISTER_FACE("Register Face");
void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U32 type)
{
LLFastTimer t(FTM_REGISTER_FACE);
if (type == LLRenderPass::PASS_ALPHA && facep->getTextureEntry()->getMaterialParams().notNull() && !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_BINORMAL))
{
LL_WARNS("RenderMaterials") << "Oh no! No binormals for this alpha blended face!" << LL_ENDL;
}
if (facep->getViewerObject()->isSelected() && LLSelectMgr::getInstance()->mHideSelectedObjects)
{
return;
@ -4758,7 +4762,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
bump_mask = bump_mask | LLVertexBuffer::MAP_BINORMAL;
simple_mask = simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX;
alpha_mask = alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX;
alpha_mask = alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_BINORMAL;
fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 B