From fafa21315f043ab51e3373e825c85646685778a6 Mon Sep 17 00:00:00 2001
From: g <divby0@gmail.com>
Date: Fri, 12 Apr 2013 15:21:35 -0700
Subject: Fix issue with alphaNonIndexedNoColorF shader and static init fail on
 default spec color (real source of NORSPEC-94, I think)

---
 indra/llprimitive/llmaterial.cpp                                    | 6 +++---
 indra/llprimitive/llmaterial.h                                      | 1 +
 .../shaders/class2/deferred/alphaNonIndexedNoColorF.glsl            | 5 +++--
 3 files changed, 7 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp
index 1e92847b38..bd98aa040a 100644
--- a/indra/llprimitive/llmaterial.cpp
+++ b/indra/llprimitive/llmaterial.cpp
@@ -51,7 +51,7 @@
 #define MATERIALS_CAP_ALPHA_MASK_CUTOFF_FIELD     "AlphaMaskCutoff"
 #define MATERIALS_CAP_DIFFUSE_ALPHA_MODE_FIELD    "DiffuseAlphaMode"
 
-const LLColor4U LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR = LLColor4U::white;
+const LLColor4U LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR(255,255,255,255);
 
 /**
  * Materials constants
@@ -103,8 +103,8 @@ LLMaterial::LLMaterial()
 	, mSpecularRotation(.0f)
 	, mSpecularLightColor(LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR)
 	, mSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT)
-	, mEnvironmentIntensity(0)
-	, mDiffuseAlphaMode(0)
+	, mEnvironmentIntensity(LLMaterial::DEFAULT_ENV_INTENSITY)
+	, mDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
 	, mAlphaMaskCutoff(0)
 {
 }
diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h
index bedfc8f8c2..c2e49985a4 100644
--- a/indra/llprimitive/llmaterial.h
+++ b/indra/llprimitive/llmaterial.h
@@ -54,6 +54,7 @@ public:
 	
 	static const U8			DEFAULT_SPECULAR_LIGHT_EXPONENT = ((U8)(0.2f * 255));
 	static const LLColor4U	DEFAULT_SPECULAR_LIGHT_COLOR;
+	static const U8			DEFAULT_ENV_INTENSITY = ((U8)(0.05f * 255));
 
 	LLMaterial();
 	LLMaterial(const LLSD& material_data);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl
index 4bd9ccca1d..566aefea6a 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl
@@ -53,6 +53,7 @@ VARYING vec3 vary_fragcoord;
 VARYING vec3 vary_position;
 VARYING vec3 vary_pointlight_col;
 VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_norm;
 
 uniform vec2 shadow_res;
 
@@ -65,10 +66,10 @@ uniform vec3 light_direction[8];
 uniform vec3 light_attenuation[8]; 
 uniform vec3 light_diffuse[8];
 
-float calcDirectionalLight(vec3 n, vec3 l)
+vec3 calcDirectionalLight(vec3 n, vec3 l)
 {
         float a = pow(max(dot(n,l),0.0), 0.7);
-        return a;
+        return vec3(a, a, a);
 }
 
 float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
-- 
cgit v1.2.3