diff options
| author | yum <yum.food.vr@gmail.com> | 2025-10-28 17:15:36 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-10-28 17:19:39 -0700 |
| commit | 6a10c50359aa62405118a78c69dccef0394f8591 (patch) | |
| tree | 59c7c55ec3d37780319bc066fd473e1b24b632ff /texture_utils.cginc | |
| parent | fd370eab7e4959895763514526efc878e53d4886 (diff) | |
add machinery for multiple uv channels
Diffstat (limited to 'texture_utils.cginc')
| -rw-r--r-- | texture_utils.cginc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/texture_utils.cginc b/texture_utils.cginc new file mode 100644 index 0000000..9d7bf2f --- /dev/null +++ b/texture_utils.cginc @@ -0,0 +1,32 @@ +#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; + case 2: + return i.uv23.xy; + break; + case 3: + return i.uv23.zw; + break; + default: + return 0; + break; + } +} + +#define UV_SCOFF_IMPL(uv, tex_st) (uv) * (tex_st).xy + (tex_st).zw + +#define UV_SCOFF(i, tex_st, which_channel) UV_SCOFF_IMPL(get_uv_by_channel(i, round(which_channel)), tex_st) + +#endif // __TEXTURE_UTILS_INC + |
