* Removed useless vPosition varying from Lighting shader

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9009 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Sha..rd 13 years ago
parent 5d6ac60c58
commit 8d7aed43d1
  1. 6
      engine/src/core-data/Common/MatDefs/Light/Lighting.frag
  2. 6
      engine/src/core-data/Common/MatDefs/Light/Lighting.vert

@ -14,7 +14,7 @@ varying vec3 SpecularSum;
#ifndef VERTEX_LIGHTING #ifndef VERTEX_LIGHTING
uniform vec4 g_LightDirection; uniform vec4 g_LightDirection;
varying vec3 vPosition; //varying vec3 vPosition;
varying vec3 vViewDir; varying vec3 vViewDir;
varying vec4 vLightDir; varying vec4 vLightDir;
varying vec3 lightVec; varying vec3 lightVec;
@ -116,7 +116,7 @@ float lightComputeSpecular(in vec3 norm, in vec3 viewdir, in vec3 lightdir, in f
#endif #endif
} }
vec2 computeLighting(in vec3 wvPos, in vec3 wvNorm, in vec3 wvViewDir, in vec3 wvLightDir){ vec2 computeLighting(in vec3 wvNorm, in vec3 wvViewDir, in vec3 wvLightDir){
float diffuseFactor = lightComputeDiffuse(wvNorm, wvLightDir, wvViewDir); float diffuseFactor = lightComputeDiffuse(wvNorm, wvLightDir, wvViewDir);
float specularFactor = lightComputeSpecular(wvNorm, wvViewDir, wvLightDir, m_Shininess); float specularFactor = lightComputeSpecular(wvNorm, wvViewDir, wvLightDir, m_Shininess);
@ -250,7 +250,7 @@ void main(){
vec4 lightDir = vLightDir; vec4 lightDir = vLightDir;
lightDir.xyz = normalize(lightDir.xyz); lightDir.xyz = normalize(lightDir.xyz);
vec2 light = computeLighting(vPosition, normal, vViewDir.xyz, lightDir.xyz) * spotFallOff; vec2 light = computeLighting(normal, vViewDir.xyz, lightDir.xyz) * spotFallOff;
#ifdef COLORRAMP #ifdef COLORRAMP
diffuseColor.rgb *= texture2D(m_ColorRamp, vec2(light.x, 0.0)).rgb; diffuseColor.rgb *= texture2D(m_ColorRamp, vec2(light.x, 0.0)).rgb;
specularColor.rgb *= texture2D(m_ColorRamp, vec2(light.y, 0.0)).rgb; specularColor.rgb *= texture2D(m_ColorRamp, vec2(light.y, 0.0)).rgb;

@ -42,7 +42,7 @@ varying vec3 lightVec;
#ifndef NORMALMAP #ifndef NORMALMAP
varying vec3 vNormal; varying vec3 vNormal;
#endif #endif
varying vec3 vPosition; //varying vec3 vPosition;
varying vec3 vViewDir; varying vec3 vViewDir;
varying vec4 vLightDir; varying vec4 vLightDir;
#else #else
@ -157,14 +157,14 @@ void main(){
mat3 tbnMat = mat3(wvTangent, wvBinormal * -inTangent.w,wvNormal); mat3 tbnMat = mat3(wvTangent, wvBinormal * -inTangent.w,wvNormal);
vPosition = wvPosition * tbnMat; //vPosition = wvPosition * tbnMat;
vViewDir = viewDir * tbnMat; vViewDir = viewDir * tbnMat;
lightComputeDir(wvPosition, lightColor, wvLightPos, vLightDir); lightComputeDir(wvPosition, lightColor, wvLightPos, vLightDir);
vLightDir.xyz = (vLightDir.xyz * tbnMat).xyz; vLightDir.xyz = (vLightDir.xyz * tbnMat).xyz;
#elif !defined(VERTEX_LIGHTING) #elif !defined(VERTEX_LIGHTING)
vNormal = wvNormal; vNormal = wvNormal;
vPosition = wvPosition; //vPosition = wvPosition;
vViewDir = viewDir; vViewDir = viewDir;
lightComputeDir(wvPosition, lightColor, wvLightPos, vLightDir); lightComputeDir(wvPosition, lightColor, wvLightPos, vLightDir);

Loading…
Cancel
Save