diff options
Diffstat (limited to 'src/renderergl2/glsl/lightall_vp.glsl')
-rw-r--r-- | src/renderergl2/glsl/lightall_vp.glsl | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/renderergl2/glsl/lightall_vp.glsl b/src/renderergl2/glsl/lightall_vp.glsl index 8230b9db..d9655ebe 100644 --- a/src/renderergl2/glsl/lightall_vp.glsl +++ b/src/renderergl2/glsl/lightall_vp.glsl @@ -113,7 +113,7 @@ vec2 ModTexCoords(vec2 st, vec3 position, vec4 texMatrix, vec4 offTurb) float phase = offTurb.w; vec2 st2 = vec2(dot(st, texMatrix.xz), dot(st, texMatrix.yw)) + offTurb.xy; - vec3 offsetPos = position * 0.0009765625; + vec3 offsetPos = position / 1024.0; offsetPos.x += offsetPos.z; vec2 texOffset = sin((offsetPos.xy + vec2(phase)) * 2.0 * M_PI); @@ -183,7 +183,7 @@ void main() #if defined(USE_LIGHT_VECTOR) vec3 L = u_LightOrigin.xyz - (position * u_LightOrigin.w); -#elif defined(USE_LIGHT) && !defined(USE_LIGHT_VECTOR) +#elif defined(USE_LIGHT) && !defined(USE_DELUXEMAP) vec3 L = attr_LightDirection; #if defined(USE_MODELMATRIX) L = (u_ModelMatrix * vec4(L, 0.0)).xyz; @@ -194,12 +194,10 @@ void main() var_TexCoords.zw = attr_TexCoord1.st; #endif + var_Color = u_VertColor * attr_Color + u_BaseColor; #if defined(USE_LIGHT_VERTEX) && !defined(USE_FAST_LIGHT) - var_LightColor = u_VertColor.rgb * attr_Color.rgb; + var_LightColor = var_Color.rgb; var_Color.rgb = vec3(1.0); - var_Color.a = u_VertColor.a * attr_Color.a + u_BaseColor.a; -#else - var_Color = u_VertColor * attr_Color + u_BaseColor; #endif #if defined(USE_LIGHT_VECTOR) && defined(USE_FAST_LIGHT) @@ -209,14 +207,8 @@ void main() var_Color.rgb *= u_DirectedLight * attenuation * NL + u_AmbientLight; #endif -#if (defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)) || defined(USE_PARALLAXMAP) - var_Normal.xyz = normal; - var_Tangent.xyz = tangent; - var_Bitangent.xyz = bitangent; -#endif - #if defined(USE_PRIMARY_LIGHT) || defined(USE_SHADOWMAP) - var_PrimaryLightDir.xyz = (u_PrimaryLightOrigin.xyz - (position * u_PrimaryLightOrigin.w)); + var_PrimaryLightDir.xyz = u_PrimaryLightOrigin.xyz - (position * u_PrimaryLightOrigin.w); var_PrimaryLightDir.w = u_PrimaryLightRadius * u_PrimaryLightRadius; #endif @@ -229,7 +221,7 @@ void main() #endif #if (defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)) || defined(USE_PARALLAXMAP) - vec3 viewDir = (u_ViewOrigin - position); + vec3 viewDir = u_ViewOrigin - position; #endif #if defined(USE_TANGENT_SPACE_LIGHT) @@ -250,8 +242,8 @@ void main() #if (defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)) || defined(USE_PARALLAXMAP) // store view direction in tangent space to save on varyings - var_Normal.w = viewDir.x; - var_Tangent.w = viewDir.y; - var_Bitangent.w = viewDir.z; + var_Normal = vec4(normal, viewDir.x); + var_Tangent = vec4(tangent, viewDir.y); + var_Bitangent = vec4(bitangent, viewDir.z); #endif } |