[vulkan] Simplify cubemap frame conversion

Don't need a whole matrix multiply when a swizzle and single vector
multiply will do.
This commit is contained in:
Bill Currie 2023-08-03 11:56:01 +09:00
parent 71934b15f4
commit e4ed868023

View file

@ -21,9 +21,8 @@ shadow (uint map_id, uint layer, uint mat_id, vec3 pos, vec3 lpos)
vec4 p = shadow_mats[mat_id + ind] * vec4 (pos, 1);
p = p / (p.w - 0.5); //FIXME hard-coded bias
float depth = p.z;
dir = mat3(vec3( 0, 0, 1),
vec3(-1, 0, 0),
vec3( 0, 1, 0)) * dir;
// convert from the quake frame to the cubemap frame
dir = dir.yzx * vec3 (-1, 1, 1);
return texture (shadow_map[map_id], vec4 (dir, layer), depth);
}