From 6803c0abd279fcb640c38b3881b751bab982cbe0 Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Fri, 6 Jul 2012 12:42:16 -0700 Subject: Remove trailing spaces --- assets/shaders/Cloud.frag.glsl | 4 +- assets/shaders/Cloud.vert.glsl | 2 +- assets/shaders/Flag.vert.glsl | 2 +- assets/shaders/linearGradient.frag.glsl | 18 +++--- assets/shaders/linearGradient.vert.glsl | 16 ++--- assets/shaders/radialGradient.frag.glsl | 18 +++--- assets/shaders/test_fshader.glsl | 44 +++++++------- assets/shaders/test_fshader_full.glsl | 22 +++---- assets/shaders/test_vshader.glsl | 10 ++-- assets/shaders/ub_fshader.glsl | 102 ++++++++++++++++---------------- assets/shaders/ub_vshader.glsl | 44 +++++++------- 11 files changed, 141 insertions(+), 141 deletions(-) (limited to 'assets/shaders') diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl index dc984191..1149f11b 100644 --- a/assets/shaders/Cloud.frag.glsl +++ b/assets/shaders/Cloud.frag.glsl @@ -43,5 +43,5 @@ void main() { vec4 c = texture2D(u_tex0, v_texCoord0); gl_FragColor = c; -} - +} + diff --git a/assets/shaders/Cloud.vert.glsl b/assets/shaders/Cloud.vert.glsl index c709bc27..a33429fe 100644 --- a/assets/shaders/Cloud.vert.glsl +++ b/assets/shaders/Cloud.vert.glsl @@ -70,6 +70,6 @@ void main() pos.z = z; gl_Position = u_projMatrix * u_mvMatrix * pos; - + v_texCoord0 = texcoord; } diff --git a/assets/shaders/Flag.vert.glsl b/assets/shaders/Flag.vert.glsl index 49eaaccb..51ec8f8b 100644 --- a/assets/shaders/Flag.vert.glsl +++ b/assets/shaders/Flag.vert.glsl @@ -70,6 +70,6 @@ void main() v.z *= u_waveHeight; v.z -= 2.0*u_waveHeight; v.z *= x * 0.09; - + gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ; } diff --git a/assets/shaders/linearGradient.frag.glsl b/assets/shaders/linearGradient.frag.glsl index 56a55d86..03310255 100755 --- a/assets/shaders/linearGradient.frag.glsl +++ b/assets/shaders/linearGradient.frag.glsl @@ -33,14 +33,14 @@ precision highp float; #endif -uniform vec4 u_color1; -uniform vec4 u_color2; -uniform vec4 u_color3; -uniform vec4 u_color4; -uniform float u_colorStop1; -uniform float u_colorStop2; -uniform float u_colorStop3; -uniform float u_colorStop4; +uniform vec4 u_color1; +uniform vec4 u_color2; +uniform vec4 u_color3; +uniform vec4 u_color4; +uniform float u_colorStop1; +uniform float u_colorStop2; +uniform float u_colorStop3; +uniform float u_colorStop4; uniform vec2 u_cos_sin_angle; //uniform int u_colorCount; // currently using 4 @@ -73,4 +73,4 @@ void main(void) color = u_color4; gl_FragColor =color; -} +} diff --git a/assets/shaders/linearGradient.vert.glsl b/assets/shaders/linearGradient.vert.glsl index fcdc5e96..12b36c0f 100755 --- a/assets/shaders/linearGradient.vert.glsl +++ b/assets/shaders/linearGradient.vert.glsl @@ -51,14 +51,14 @@ uniform mat4 u_normalMatrix; uniform mat4 u_projMatrix; uniform mat4 u_worldMatrix; -uniform vec4 u_color1; -uniform vec4 u_color2; -uniform vec4 u_color3; -uniform vec4 u_color4; -uniform float u_colorStop1; -uniform float u_colorStop2; -uniform float u_colorStop3; -uniform float u_colorStop4; +uniform vec4 u_color1; +uniform vec4 u_color2; +uniform vec4 u_color3; +uniform vec4 u_color4; +uniform float u_colorStop1; +uniform float u_colorStop2; +uniform float u_colorStop3; +uniform float u_colorStop4; uniform vec2 u_cos_sin_angle; //uniform int u_colorCount; // currently using 4 uniform mat3 u_texTransform; diff --git a/assets/shaders/radialGradient.frag.glsl b/assets/shaders/radialGradient.frag.glsl index b78e38bb..58b43a74 100644 --- a/assets/shaders/radialGradient.frag.glsl +++ b/assets/shaders/radialGradient.frag.glsl @@ -32,17 +32,17 @@ POSSIBILITY OF SUCH DAMAGE. precision highp float; #endif -uniform vec4 u_color1; -uniform vec4 u_color2; -uniform vec4 u_color3; -uniform vec4 u_color4; -uniform float u_colorStop1; -uniform float u_colorStop2; -uniform float u_colorStop3; -uniform float u_colorStop4; +uniform vec4 u_color1; +uniform vec4 u_color2; +uniform vec4 u_color3; +uniform vec4 u_color4; +uniform float u_colorStop1; +uniform float u_colorStop2; +uniform float u_colorStop3; +uniform float u_colorStop4; uniform vec2 u_cos_sin_angle; //uniform int u_colorCount; // currently using all 4 - + varying vec2 v_uv; void main(void) diff --git a/assets/shaders/test_fshader.glsl b/assets/shaders/test_fshader.glsl index 1fa78e44..de5da773 100755 --- a/assets/shaders/test_fshader.glsl +++ b/assets/shaders/test_fshader.glsl @@ -40,7 +40,7 @@ uniform vec4 u_light0Amb; // diffuse map uniform sampler2D u_colMap; -// environment map +// environment map uniform sampler2D envMap; // normal map @@ -77,7 +77,7 @@ void main() float dist = vShadowCoord.w/200.0; float d = dot(rgba_depth, bit_shift); float shadowCoef = (dist > d + 0.00779) ? (0.6) : (1.0); - + vec4 colMapTexel = vec4(0); if (u_renderGlow <= 0.5) { colMapTexel = vec4(texture2D(u_colMap, vec2(vNormal.w, vECPos.w)).rgb, 1.0); @@ -89,32 +89,32 @@ void main() vec3 normal = normalize(vNormal.xyz); vec3 mapNormal = texture2D(u_normalMap, vec2(vNormal.w, vECPos.w)).xyz * 2.0 - 1.0; mapNormal = normalize(mapNormal.x*vec3(normal.z, 0.0, -normal.x) + vec3(0.0, mapNormal.y, 0.0) + mapNormal.z*normal); - + // create envmap coordinates vec3 r = reflect( normalize(vec3(vECPos.xyz - vEyePos.xyz)), mapNormal); float m = 2.0 * sqrt( r.x*r.x + r.y*r.y + r.z*r.z ); - + // calculate environment map texel vec4 envMapTexel = vec4(texture2D(envMap, vec2(r.x/m + 0.5, r.y/m + 0.5)).rgb, 0.0); - + // lighting vec3 lightDirection = u_light0Pos - vECPos.xyz; float lightDist = length(lightDirection); lightDirection /= lightDist; - + float attenuation = clamp(1.0 - lightDist * 0.01, 0.0, 1.0); - + vec3 halfVec = normalize(lightDirection + vEyePos); - + float diffuseIntensity = max(0.0, dot(mapNormal, lightDirection)); float specularModifier = max(0.0, dot(mapNormal, halfVec)); - + float pf; if(diffuseIntensity == 0.0) pf = 0.0; else pf = pow(specularModifier, 76.0); - + vec4 ambient = u_matAmbient * u_light0Amb; vec4 diffuse = u_matDiffuse * (colMapTexel + envMapTexel)*shadowCoef; @@ -122,9 +122,9 @@ void main() if (u_renderGlow <= 0.5) { diffuse *= u_light0Diff; } - + vec4 specular = 2.0 * pf * envMapTexel; - + //gl_FragColor = vec4(dist, dist, dist, 1.0); gl_FragColor = ((colMapTexel*(ambient + diffuse)) + specular); } @@ -141,40 +141,40 @@ void main() vec3 normal = normalize(vNormal.xyz); // vec3 mapNormal = texture2D(u_normalMap, vec2(vNormal.w, vECPos.w)).xyz * 2.0 - 1.0; // mapNormal = normalize(mapNormal.x*vec3(normal.z, 0.0, -normal.x) + vec3(0.0, mapNormal.y, 0.0) + mapNormal.z*normal); -// +// // // create envmap coordinates // vec3 r = reflect( (vec3(vECPos.xyz - vEyePos.xyz)), mapNormal); // float m = 2.0 * length(r); - + // calculate environment map texel //vec4 envMapTexel = vec4(texture2D(envMap, vec2(r.x/m + 0.5, r.y/m + 0.5)).rgb, 0.0); vec4 envMapTexel = vec4(texture2D(envMap, vEnvTexCoord).rgb, 0.0); - + // lighting //vec3 lightDirection = normalize(u_light0Pos - vECPos.xyz); // float lightDist = length(lightDirection); // lightDirection /= lightDist; - - + + //vec3 halfVec = normalize(lightDirection + vEyePos); - + //float diffuseIntensity = max(0.0, dot(normal, lightDirection)); // float specularModifier = max(0.0, dot(mapNormal, halfVec)); - + // float pf; //if(diffuseIntensity == 0.0) //pf = 0.0; //else //pf = pow(specularModifier, 76.0); - + // vec4 ambient = u_matAmbient * u_light0Amb; vec4 diffuse = u_matDiffuse*(colMapTexel + envMapTexel)*(vDiffuseIntensity + u_matAmbient); //diffuse *= u_light0Diff * diffuseIntensity; - + //vec4 specular = envMapTexel; - + //gl_FragColor = vec4(dist, dist, dist, 1.0); gl_FragColor = diffuse;//(colMapTexel*(ambient + diffuse)) + specular; } diff --git a/assets/shaders/test_fshader_full.glsl b/assets/shaders/test_fshader_full.glsl index 5fcc280b..c381c6bf 100755 --- a/assets/shaders/test_fshader_full.glsl +++ b/assets/shaders/test_fshader_full.glsl @@ -41,7 +41,7 @@ uniform vec4 u_lightAmb; // diffuse map uniform sampler2D colMap; -// environment map +// environment map uniform sampler2D envMap; // normal map @@ -68,39 +68,39 @@ void main() vec3 normal = normalize(vNormal.xyz); vec3 mapNormal = texture2D(normalMap, vec2(vNormal.w, vECPos.w)).xyz * 2.0 - 1.0; mapNormal = normalize(mapNormal.x*vec3(normal.z, 0.0, -normal.x) + vec3(0.0, mapNormal.y, 0.0) + mapNormal.z*normal); - + // create envmap coordinates vec3 r = reflect( normalize(vec3(vECPos.xyz - vEyePos.xyz)), mapNormal); float m = 2.0 * sqrt( r.x*r.x + r.y*r.y + r.z*r.z ); - + // calculate environment map texel vec4 envMapTexel = vec4(texture2D(envMap, vec2(r.x/m + 0.5, r.y/m + 0.5)).rgb, 0.0); - + // lighting vec3 lightDirection = u_lightPos - vECPos.xyz; float lightDist = length(lightDirection); lightDirection /= lightDist; - + float attenuation = clamp(1.0 - lightDist * 0.01, 0.0, 1.0); - + vec3 halfVec = normalize(lightDirection + vEyePos); - + float diffuseIntensity = max(0.0, dot(mapNormal, lightDirection)); float specularModifier = max(0.0, dot(mapNormal, halfVec)); - + float pf; if(diffuseIntensity == 0.0) pf = 0.0; else pf = pow(specularModifier, 76.0); - + vec4 ambient = u_matAmbient * u_lightAmb; vec4 diffuse = u_matDiffuse * (colMapTexel + envMapTexel); if (u_renderGlow <= 0.5) diffuse *= u_lightDiff * diffuseIntensity * attenuation; - + vec4 specular = 2.0 * pf * envMapTexel; - + gl_FragColor = (colMapTexel*(ambient + diffuse)) + specular + vec4(0.0,0.0,0.0,1.0); } diff --git a/assets/shaders/test_vshader.glsl b/assets/shaders/test_vshader.glsl index 69015b78..22c91590 100755 --- a/assets/shaders/test_vshader.glsl +++ b/assets/shaders/test_vshader.glsl @@ -66,7 +66,7 @@ void main() // pass along the geo gl_Position = u_projMatrix * vec4(vECPos.xyz, 1.0); - + mat4 shadowMat = u_shadowBiasMatrix*u_projMatrix*u_vShadowLight*u_worldMatrix; vShadowCoord = shadowMat * vec4(vert, 1.0); } @@ -86,10 +86,10 @@ void main() // pass along the geo gl_Position = u_projMatrix * vec4(vECPos.xyz, 1.0); - + //mat4 shadowMat = u_shadowBiasMatrix*u_projMatrix*u_vShadowLight*u_worldMatrix; //vShadowCoord = shadowMat * vec4(vert, 1.0); - + // normal mapping vec3 normal = normalize(vNormal.xyz); @@ -97,10 +97,10 @@ void main() vec3 r = reflect( vec3(vECPos.xyz - u_eye.xyz), normal); float m = 2.0 * length(r); vEnvTexCoord = vec2(r.x/m + 0.5, r.y/m + 0.5); - + vec3 lightDirection = normalize(u_lightPos - vECPos.xyz); vDiffuseIntensity = max(0.0, dot(normal, lightDirection)); - + } #endif diff --git a/assets/shaders/ub_fshader.glsl b/assets/shaders/ub_fshader.glsl index 840a97b6..9b37899d 100755 --- a/assets/shaders/ub_fshader.glsl +++ b/assets/shaders/ub_fshader.glsl @@ -51,9 +51,9 @@ uniform mat4 u_viewMatrix; uniform vec3 u_light0Atten; uniform vec2 u_light0Spot; uniform vec4 u_light0Color; - uniform vec4 u_light0Specular; + uniform vec4 u_light0Specular; varying vec3 v_light0Dir; - varying vec3 v_light0SpotDir; + varying vec3 v_light0SpotDir; #endif #if defined( LIGHT_1 ) @@ -63,9 +63,9 @@ uniform mat4 u_viewMatrix; uniform vec3 u_light1Atten; uniform vec2 u_light1Spot; uniform vec4 u_light1Color; - uniform vec4 u_light1Specular; + uniform vec4 u_light1Specular; varying vec3 v_light1Dir; - varying vec3 v_light1SpotDir; + varying vec3 v_light1SpotDir; #endif #if defined( LIGHT_2 ) @@ -75,9 +75,9 @@ uniform mat4 u_viewMatrix; uniform vec3 u_light2Atten; uniform vec2 u_light2Spot; uniform vec4 u_light2Color; - uniform vec4 u_light2Specular; + uniform vec4 u_light2Specular; varying vec3 v_light2Dir; - varying vec3 v_light2SpotDir; + varying vec3 v_light2SpotDir; #endif #if defined( LIGHT_3 ) @@ -87,9 +87,9 @@ uniform mat4 u_viewMatrix; uniform vec3 u_light3Atten; uniform vec2 u_light3Spot; uniform vec4 u_light3Color; - uniform vec4 u_light3Specular; + uniform vec4 u_light3Specular; varying vec3 v_light3Dir; - varying vec3 v_light3SpotDir; + varying vec3 v_light3SpotDir; #endif #endif @@ -114,7 +114,7 @@ void main() { vec4 d = vec4(0.0,0.0,0.0,0.0); // diffuse contribution vec4 s = vec4(0.0,0.0,0.0,0.0); // specular contribution vec4 l = vec4(0.0,0.0,0.0,0.0); // lighting contribution - + #if defined( MATERIAL ) a += u_ambientColor; d += u_diffuseColor; @@ -124,10 +124,10 @@ void main() { d *= texture2D(s_diffuseMap, v_texcoord); #endif -#if ( defined( LIGHTING ) || defined( ENVIRONMENT_MAPPING ) ) +#if ( defined( LIGHTING ) || defined( ENVIRONMENT_MAPPING ) ) vec3 normal = normalize( v_normal ); #endif - + #if defined( LIGHTING ) #if defined( NORMAL_MAP ) vec4 normalMap = texture2D(s_normalMap, v_texcoord); @@ -136,25 +136,25 @@ void main() { #endif // NORMAL_MAP #if defined( LIGHT_0 ) - { + { // diffuse lighting float ldist = length( v_light0Dir.xyz ); vec3 ldir = v_light0Dir.xyz / ldist; - + float atten = 1.0; - + #if ( LIGHT_0 > 0 ) atten = 1.0 / ( u_light0Atten.x + u_light0Atten.y * ldist + u_light0Atten.z * ( ldist * ldist ) ); #if (LIGHT_0 == 2) float spotAngle = dot( ldir, normalize( v_light0SpotDir ) ); float spotAtten = 0.0; if ( spotAngle > u_light0Spot.y ) { - spotAtten = min(1.0, max( 0.0, ( spotAngle - u_light0Spot.y ) / ( u_light0Spot.x - u_light0Spot.y ) ) ); - } - atten *= spotAtten; + spotAtten = min(1.0, max( 0.0, ( spotAngle - u_light0Spot.y ) / ( u_light0Spot.x - u_light0Spot.y ) ) ); + } + atten *= spotAtten; #endif #endif - + float ndotl = max( 0.0, dot( normal, ldir ) ); l += ndotl * atten * u_light0Color; @@ -166,27 +166,27 @@ void main() { #endif } #endif // LIGHT_0 - + #if defined( LIGHT_1 ) - { + { // diffuse lighting float ldist = length( v_light1Dir.xyz ); vec3 ldir = v_light1Dir.xyz / ldist; - + float atten = 1.0; - + #if ( LIGHT_1 > 0 ) atten = 1.0 / ( u_light1Atten.x + u_light1Atten.y * ldist + u_light1Atten.z * ( ldist * ldist ) ); #if (LIGHT_1 == 2) float spotAngle = dot( ldir, normalize( v_light1SpotDir ) ); float spotAtten = 0.0; if ( spotAngle > u_light1Spot.y ) { - spotAtten = min(1.0, max( 0.0, ( spotAngle - u_light1Spot.y ) / ( u_light1Spot.x - u_light1Spot.y ) ) ); - } - atten *= spotAtten; + spotAtten = min(1.0, max( 0.0, ( spotAngle - u_light1Spot.y ) / ( u_light1Spot.x - u_light1Spot.y ) ) ); + } + atten *= spotAtten; #endif #endif - + float ndotl = max( 0.0, dot( normal, ldir ) ); l += ndotl * atten * u_light1Color; @@ -198,27 +198,27 @@ void main() { #endif } #endif // LIGHT_1 - + #if defined( LIGHT_2 ) - { + { // diffuse lighting float ldist = length( v_light2Dir.xyz ); vec3 ldir = v_light2Dir.xyz / ldist; - + float atten = 1.0; - + #if ( LIGHT_2 > 0 ) atten = 1.0 / ( u_light2Atten.x + u_light2Atten.y * ldist + u_light2Atten.z * ( ldist * ldist ) ); #if (LIGHT_2 == 2) float spotAngle = dot( ldir, normalize( v_light2SpotDir ) ); float spotAtten = 0.0; if ( spotAngle > u_light2Spot.y ) { - spotAtten = min(1.0, max( 0.0, ( spotAngle - u_light2Spot.y ) / ( u_light2Spot.x - u_light2Spot.y ) ) ); - } - atten *= spotAtten; + spotAtten = min(1.0, max( 0.0, ( spotAngle - u_light2Spot.y ) / ( u_light2Spot.x - u_light2Spot.y ) ) ); + } + atten *= spotAtten; #endif #endif - + float ndotl = max( 0.0, dot( normal, ldir ) ); l += ndotl * atten * u_light2Color; @@ -228,29 +228,29 @@ void main() { float ndoth = max( 0.0, dot( normal, halfAngleVec ) ); s += atten * pow( ndoth, u_specularPower ) * (u_specularColor * u_light2Specular); #endif - } - #endif // LIGHT_2 - + } + #endif // LIGHT_2 + #if defined( LIGHT_3 ) - { + { // diffuse lighting float ldist = length( v_light3Dir.xyz ); vec3 ldir = v_light3Dir.xyz / ldist; - + float atten = 1.0; - + #if ( LIGHT_3 > 0 ) atten = 1.0 / ( u_light3Atten.x + u_light3Atten.y * ldist + u_light3Atten.z * ( ldist * ldist ) ); #if (LIGHT_3 == 2) float spotAngle = dot( ldir, normalize( v_light3SpotDir ) ); float spotAtten = 0.0; if ( spotAngle > u_light3Spot.y ) { - spotAtten = min(1.0, max( 0.0, ( spotAngle - u_light3Spot.y ) / ( u_light3Spot.x - u_light3Spot.y ) ) ); - } - atten *= spotAtten; + spotAtten = min(1.0, max( 0.0, ( spotAngle - u_light3Spot.y ) / ( u_light3Spot.x - u_light3Spot.y ) ) ); + } + atten *= spotAtten; #endif #endif - + float ndotl = max( 0.0, dot( normal, ldir ) ); l += ndotl * atten * u_light3Color; @@ -260,8 +260,8 @@ void main() { float ndoth = max( 0.0, dot( normal, halfAngleVec ) ); s += atten * pow( ndoth, u_specularPower ) * (u_specularColor * u_light3Specular); #endif - } - #endif // LIGHT_3 + } + #endif // LIGHT_3 #endif // LIGHTING #if defined( SPECULAR ) && defined( SPECULAR_MAP ) @@ -271,15 +271,15 @@ void main() { #if defined( ENVIRONMENT_MAP ) vec3 r = reflect( normalize( vec3(0.0,0.0,1.0) ), normal ); - float m = 2.0 * length(r); + float m = 2.0 * length(r); vec4 envMapColor = texture2D(s_envMap, vec2(r.x/m + 0.5, r.y/m + 0.5)) * u_envReflection; - + #if defined( GLOSS_MAP ) - // this is an option to modulate the alpha channel of the specular map with the environment - // map (i.e. - gloss mapping). + // this is an option to modulate the alpha channel of the specular map with the environment + // map (i.e. - gloss mapping). envMapColor *= specMapColor.a; #endif - + s += envMapColor; #endif diff --git a/assets/shaders/ub_vshader.glsl b/assets/shaders/ub_vshader.glsl index da8a8660..43c7c9fc 100755 --- a/assets/shaders/ub_vshader.glsl +++ b/assets/shaders/ub_vshader.glsl @@ -59,9 +59,9 @@ uniform vec3 u_eye; uniform vec3 u_light0Atten; uniform vec2 u_light0Spot; uniform vec4 u_light0Color; - uniform vec4 u_light0Specular; + uniform vec4 u_light0Specular; varying vec3 v_light0Dir; - varying vec3 v_light0SpotDir; + varying vec3 v_light0SpotDir; #endif #if defined( LIGHT_1 ) @@ -71,9 +71,9 @@ uniform vec3 u_eye; uniform vec3 u_light1Atten; uniform vec2 u_light1Spot; uniform vec3 u_light1Color; - uniform vec4 u_light1Specular; + uniform vec4 u_light1Specular; varying vec3 v_light1Dir; - varying vec3 v_light1SpotDir; + varying vec3 v_light1SpotDir; #endif #if defined( LIGHT_2 ) @@ -83,9 +83,9 @@ uniform vec3 u_eye; uniform vec3 u_light2Atten; uniform vec2 u_light2Spot; // 0 - spot light cutoff angle, 1 - spot light exponent uniform vec3 u_light2Color; - uniform vec4 u_light2Specular; + uniform vec4 u_light2Specular; varying vec3 v_light2Dir; - varying vec3 v_light2SpotDir; + varying vec3 v_light2SpotDir; #endif #if defined( LIGHT_3 ) @@ -95,9 +95,9 @@ uniform vec3 u_eye; uniform vec3 u_light3Atten; uniform vec2 u_light3Spot; uniform vec3 u_light3Color; - uniform vec4 u_light3Specular; + uniform vec4 u_light3Specular; varying vec3 v_light3Dir; - varying vec3 v_light3SpotDir; + varying vec3 v_light3SpotDir; #endif #endif @@ -123,60 +123,60 @@ void main() { v_eyeDir = vec3(-u_viewMatrix[3][0], -u_viewMatrix[3][1], -u_viewMatrix[3][2]); #if defined( LIGHT_0 ) { - vec3 lpos = ( u_viewMatrix * vec4( u_light0Pos, 1.0 ) ).xyz; - + vec3 lpos = ( u_viewMatrix * vec4( u_light0Pos, 1.0 ) ).xyz; + #if ( LIGHT_0 == 0 ) v_light0Dir = ( u_viewMatrix * vec4( -u_light0Dir, 0.0 ) ).xyz; #else v_light0Dir = lpos - v_mvPos; #if ( LIGHT_0 == 2 ) - v_light0SpotDir = (u_viewMatrix * vec4( -u_light0Dir, 0.0 )).xyz; + v_light0SpotDir = (u_viewMatrix * vec4( -u_light0Dir, 0.0 )).xyz; #endif // ( LIGHT_0 == 2 ) #endif // ( LIGHT_0 == 0 ) } - #endif // defined( LIGHT_0 ) + #endif // defined( LIGHT_0 ) #if defined( LIGHT_1 ) { - vec3 lpos = ( u_viewMatrix * vec4( u_light1Pos, 1.0 ) ).xyz; - + vec3 lpos = ( u_viewMatrix * vec4( u_light1Pos, 1.0 ) ).xyz; + #if ( LIGHT_1 == 0 ) v_light1Dir = ( u_viewMatrix * vec4( -u_light1Dir, 0.0 ) ).xyz; #else v_light1Dir = lpos - v_mvPos; #if ( LIGHT_1 == 2 ) - v_light1SpotDir = (u_viewMatrix * vec4( -u_light1Dir, 0.0 )).xyz; + v_light1SpotDir = (u_viewMatrix * vec4( -u_light1Dir, 0.0 )).xyz; #endif // ( LIGHT_1 == 2 ) #endif // ( LIGHT_1 == 0 ) } #endif // defined( LIGHT_1 ) #if defined( LIGHT_2 ) { - vec3 lpos = ( u_viewMatrix * vec4( u_light2Pos, 1.0 ) ).xyz; - + vec3 lpos = ( u_viewMatrix * vec4( u_light2Pos, 1.0 ) ).xyz; + #if ( LIGHT_2 == 0 ) v_light2Dir = ( u_viewMatrix * vec4( -u_light2Dir, 0.0 ) ).xyz; #else v_light2Dir = lpos - v_mvPos; #if ( LIGHT_2 == 2 ) - v_light2SpotDir = (u_viewMatrix * vec4( -u_light2Dir, 0.0 )).xyz; + v_light2SpotDir = (u_viewMatrix * vec4( -u_light2Dir, 0.0 )).xyz; #endif // ( LIGHT_2 == 2 ) #endif // ( LIGHT_2 == 0 ) } #endif // defined( LIGHT_2 ) #if defined( LIGHT_3 ) { - vec3 lpos = ( u_viewMatrix * vec4( u_light3Pos, 1.0 ) ).xyz; - + vec3 lpos = ( u_viewMatrix * vec4( u_light3Pos, 1.0 ) ).xyz; + #if ( LIGHT_3 == 0 ) v_light3Dir = ( u_viewMatrix * vec4( -u_light3Dir, 0.0 ) ).xyz; #else v_light3Dir = lpos - v_mvPos; #if ( LIGHT_3 == 2 ) - v_light3SpotDir = (u_viewMatrix * vec4( -u_light3Dir, 0.0 )).xyz; + v_light3SpotDir = (u_viewMatrix * vec4( -u_light3Dir, 0.0 )).xyz; #endif // ( LIGHT_3 == 2 ) #endif // ( LIGHT_3 == 0 ) } - #endif // defined( LIGHT_3 ) + #endif // defined( LIGHT_3 ) #endif // defined( LIGHTING ) // pass along the geo -- cgit v1.2.3