summaryrefslogtreecommitdiffstats
path: root/texture_utils.cginc
blob: 4d02fbca62fdbaa0892017ab39741176d0ec7a59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef __TEXTURE_UTILS_INC
#define __TEXTURE_UTILS_INC

#include "interpolators.cginc"

float2 get_uv_by_channel(v2f i, uint which_channel) {
  [forcecase]
  switch (which_channel) {
    case 0:
      return i.uv01.xy;
      break;
    case 1:
      return i.uv01.zw;
      break;
    default:
      return 0;
      break;
  }
}

#define UV_SCOFF(i, tex_st, which_channel) get_uv_by_channel(i, round(which_channel)) * (tex_st).xy + (tex_st).zw

#endif  // __TEXTURE_UTILS_INC