yum/3ner

A toon shader for Unity's BIRP.

git clone https://git.yummers.dev/yum/3ner

yumImpostors: begin optimization work50e4514

master
639 B32 linesraw
1#ifndef __TEXTURE_UTILS_INC
2#define __TEXTURE_UTILS_INC
3
4#include "interpolators.cginc"
5
6float2 get_uv_by_channel(v2f i, uint which_channel) {
7  [forcecase]
8  switch (which_channel) {
9    case 0:
10      return i.uv01.xy;
11      break;
12    case 1:
13      return i.uv01.zw;
14      break;
15    case 2:
16      return i.uv23.xy;
17      break;
18    case 3:
19      return i.uv23.zw;
20      break;
21    default:
22      return 0;
23      break;
24  }
25}
26
27#define UV_SCOFF_IMPL(uv, tex_st) (uv) * (tex_st).xy + (tex_st).zw
28
29#define UV_SCOFF(i, tex_st, which_channel) UV_SCOFF_IMPL(get_uv_by_channel(i, round(which_channel)), tex_st)
30
31#endif  // __TEXTURE_UTILS_INC
32