"vec3 GetShadowMapTC2D(vec3 dir)\n"
"{\n"
" vec3 adir = abs(dir);\n"
-" vec2 aparams = ShadowMap_Parameters.xy / max(max(adir.x, adir.y), adir.z);\n"
+" vec2 mparams = ShadowMap_Parameters.xy / max(max(adir.x, adir.y), adir.z);\n"
" vec4 proj = dp_textureCube(Texture_CubeProjection, dir);\n"
-" return vec3(mix(dir.xy, dir.zz, proj.xy) * aparams.x + proj.zw * ShadowMap_Parameters.z, aparams.y + ShadowMap_Parameters.w);\n"
+" return vec3(mix(dir.xy, dir.zz, proj.xy) * mparams.x + proj.zw * ShadowMap_Parameters.z, mparams.y + ShadowMap_Parameters.w);\n"
"}\n"
"# else\n"
"vec3 GetShadowMapTC2D(vec3 dir)\n"
"{\n"
-" vec3 adir = abs(dir);\n"
-" vec2 aparams = ShadowMap_Parameters.xy / max(max(adir.x, adir.y), adir.z);\n"
-" vec4 proj = adir.x > adir.y ? (adir.x > adir.z ? vec4(dir.zy, dir.x < 0.0 ? 1.5 : 0.5, 0.5) : vec4(dir.xy, dir.z < 0.0 ? 1.5 : 0.5, 2.5)) :\n"
-" (adir.y > adir.z ? vec4(dir.xz, dir.y < 0.0 ? 1.5 : 0.5, 1.5) : vec4(dir.xy, dir.z < 0.0 ? 1.5 : 0.5, 2.5));\n"
-" return vec3(proj.xy * aparams.x + proj.zw * ShadowMap_Parameters.z, aparams.y + ShadowMap_Parameters.w);\n"
+" vec3 adir = abs(dir);\n"
+" float m; vec4 proj;\n"
+" if (adir.x > adir.y) { m = adir.x; proj = vec4(dir.zyx, 0.5); } else { m = adir.y; proj = vec4(dir.xzy, 1.5); }\n"
+" if (adir.z > m) { m = adir.z; proj = vec4(dir, 2.5); }\n"
+" vec2 mparams = ShadowMap_Parameters.xy / m;\n"
+" return vec3(proj.xy * mparams.x + vec2(proj.z < 0.0 ? 1.5 : 0.5, proj.w) * ShadowMap_Parameters.z, mparams.y + ShadowMap_Parameters.w);\n"
"}\n"
"# endif\n"
"# endif\n"
"float3 GetShadowMapTC2D(float3 dir, float4 ShadowMap_Parameters, samplerCUBE Texture_CubeProjection)\n"
"{\n"
" float3 adir = abs(dir);\n"
-" float2 aparams = ShadowMap_Parameters.xy / max(max(adir.x, adir.y), adir.z);\n"
+" float2 mparams = ShadowMap_Parameters.xy / max(max(adir.x, adir.y), adir.z);\n"
" float4 proj = texCUBE(Texture_CubeProjection, dir);\n"
-" return float3(lerp(dir.xy, dir.zz, proj.xy) * aparams.x + proj.zw * ShadowMap_Parameters.z, aparams.y + ShadowMap_Parameters.w);\n"
+" return float3(lerp(dir.xy, dir.zz, proj.xy) * mparams.x + proj.zw * ShadowMap_Parameters.z, mparams.y + ShadowMap_Parameters.w);\n"
"}\n"
"# else\n"
"float3 GetShadowMapTC2D(float3 dir, float4 ShadowMap_Parameters)\n"
"{\n"
" float3 adir = abs(dir);\n"
-" float ma = adir.z;\n"
-" float4 proj = float4(dir, 2.5);\n"
-" if (adir.x > ma) { ma = adir.x; proj = float4(dir.zyx, 0.5); }\n"
-" if (adir.y > ma) { ma = adir.y; proj = float4(dir.xzy, 1.5); }\n"
+" float m; float4 proj;\n"
+" if (adir.x > adir.y) { m = adir.x; proj = float4(dir.zyx, 0.5); } else { m = adir.y; proj = float4(dir.xzy, 1.5); }\n"
+" if (adir.z > m) { m = adir.z; proj = float4(dir, 2.5); }\n"
"#ifdef HLSL\n"
-" return float3(proj.xy * ShadowMap_Parameters.x / ma + float2(0.5,0.5) + float2(proj.z < 0.0 ? 1.5 : 0.5, proj.w) * ShadowMap_Parameters.z, ma + 64 * ShadowMap_Parameters.w);\n"
+" return float3(proj.xy * ShadowMap_Parameters.x / m + float2(0.5,0.5) + float2(proj.z < 0.0 ? 1.5 : 0.5, proj.w) * ShadowMap_Parameters.z, m + 64 * ShadowMap_Parameters.w);\n"
"#else\n"
-" float2 aparams = ShadowMap_Parameters.xy / ma;\n"
-" return float3(proj.xy * aparams.x + float2(proj.z < 0.0 ? 1.5 : 0.5, proj.w) * ShadowMap_Parameters.z, aparams.y + ShadowMap_Parameters.w);\n"
+" float2 mparams = ShadowMap_Parameters.xy / m;\n"
+" return float3(proj.xy * mparams.x + float2(proj.z < 0.0 ? 1.5 : 0.5, proj.w) * ShadowMap_Parameters.z, mparams.y + ShadowMap_Parameters.w);\n"
"#endif\n"
"}\n"
"# endif\n"