This commit is contained in:
Branimir Karadžić 2017-04-05 20:18:59 -07:00
parent 42f6fe1430
commit 9b218c9644
2 changed files with 10 additions and 10 deletions

View File

@ -60,15 +60,6 @@ vec2 parallax_uv(vec2 uv, vec3 view_dir)
}
}
vec2 texture2DBc4(sampler2D _sampler, vec2 _uv)
{
#if BGFX_SHADER_LANGUAGE_HLSL && BGFX_SHADER_LANGUAGE_HLSL <= 3
return texture2D(_sampler, _uv).yx;
#else
return texture2D(_sampler, _uv).xy;
#endif
}
void main()
{
vec3 light_dir = normalize(v_ts_light_pos - v_ts_frag_pos);
@ -97,7 +88,7 @@ void main()
}
else
{
normal.xy = texture2DBc4(s_texNormal, uv) * 2.0 - 1.0;
normal.xy = texture2DBc5(s_texNormal, uv) * 2.0 - 1.0;
normal.z = sqrt(1.0 - dot(normal.xy, normal.xy) );
}

View File

@ -383,4 +383,13 @@ vec3 fixCubeLookup(vec3 _v, float _lod, float _topLevelCubeSize)
return _v;
}
vec2 texture2DBc5(sampler2D _sampler, vec2 _uv)
{
#if BGFX_SHADER_LANGUAGE_HLSL && BGFX_SHADER_LANGUAGE_HLSL <= 3
return texture2D(_sampler, _uv).yx;
#else
return texture2D(_sampler, _uv).xy;
#endif
}
#endif // __SHADERLIB_SH__