Fix vertex picking on Vulkan (proper accounting for inverted NDCs).

This commit is contained in:
baldurk
2016-07-26 12:47:19 +02:00
parent 73d063281f
commit c6defdf1ef
+5 -5
View File
@@ -53,16 +53,16 @@ void main()
vec4 pos = vb.data[idx];
#ifdef VULKAN
if(meshpick.unproject == 1u)
pos = vec4(pos.x, -pos.y, pos.z, pos.w);
#endif
vec4 wpos = meshpick.mvp * pos;
wpos.xyz /= wpos.www;
#ifdef VULKAN
if(meshpick.unproject == 0u)
wpos.xy *= vec2(1.0f, -1.0f);
#else // OPENGL
wpos.xy *= vec2(1.0f, -1.0f);
#endif
vec2 scr = (wpos.xy + 1.0f) * 0.5f * meshpick.viewport;