blob: c82e432ff4be23ad65c11f5b9fe55d6e2fb3bf63 (
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
#ifndef __TEXTURE_MACROS_INC
#define __TEXTURE_MACROS_INC
#include "interpolators.cginc"
float2 get_uv_by_channel(v2f i, uint which_channel) {
switch (which_channel) {
case 0:
return i.uv0;
break;
#if !defined(_OPTIMIZE_INTERPOLATORS)
case 1:
return i.uv1;
break;
#if !defined(LIGHTMAP_ON)
case 2:
return i.uv2;
break;
case 3:
return i.uv3;
break;
case 4:
return i.uv4;
break;
case 5:
return i.uv5;
break;
case 6:
return i.uv6;
break;
case 7:
return i.uv7;
break;
#endif
#endif // _OPTIMIZE_INTERPOLATORS
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
#if defined(_PBR_SAMPLER_LINEAR_REPEAT)
#define GET_SAMPLER_PBR linear_repeat_s
#elif defined(_PBR_SAMPLER_LINEAR_CLAMP)
#define GET_SAMPLER_PBR linear_clamp_s
#elif defined(_PBR_SAMPLER_POINT_REPEAT)
#define GET_SAMPLER_PBR point_repeat_s
#elif defined(_PBR_SAMPLER_POINT_CLAMP)
#define GET_SAMPLER_PBR point_clamp_s
#elif defined(_PBR_SAMPLER_BILINEAR_REPEAT)
#define GET_SAMPLER_PBR bilinear_repeat_s
#elif defined(_PBR_SAMPLER_BILINEAR_CLAMP)
#define GET_SAMPLER_PBR bilinear_clamp_s
#else
#define GET_SAMPLER_PBR bilinear_clamp_s
#endif
#if defined(_PBR_OVERLAY0_SAMPLER_LINEAR_REPEAT)
#define GET_SAMPLER_OV0 linear_repeat_s
#elif defined(_PBR_OVERLAY0_SAMPLER_LINEAR_CLAMP)
#define GET_SAMPLER_OV0 linear_clamp_s
#elif defined(_PBR_OVERLAY0_SAMPLER_POINT_REPEAT)
#define GET_SAMPLER_OV0 point_repeat_s
#elif defined(_PBR_OVERLAY0_SAMPLER_POINT_CLAMP)
#define GET_SAMPLER_OV0 point_clamp_s
#elif defined(_PBR_OVERLAY0_SAMPLER_BILINEAR_REPEAT)
#define GET_SAMPLER_OV0 bilinear_repeat_s
#elif defined(_PBR_OVERLAY0_SAMPLER_BILINEAR_CLAMP)
#define GET_SAMPLER_OV0 bilinear_clamp_s
#else
#define GET_SAMPLER_OV0 linear_clamp_s
#endif
#if defined(_PBR_OVERLAY1_SAMPLER_LINEAR_REPEAT)
#define GET_SAMPLER_OV1 linear_repeat_s
#elif defined(_PBR_OVERLAY1_SAMPLER_LINEAR_CLAMP)
#define GET_SAMPLER_OV1 linear_clamp_s
#elif defined(_PBR_OVERLAY1_SAMPLER_POINT_REPEAT)
#define GET_SAMPLER_OV1 point_repeat_s
#elif defined(_PBR_OVERLAY1_SAMPLER_POINT_CLAMP)
#define GET_SAMPLER_OV1 point_clamp_s
#elif defined(_PBR_OVERLAY1_SAMPLER_BILINEAR_REPEAT)
#define GET_SAMPLER_OV1 bilinear_repeat_s
#elif defined(_PBR_OVERLAY1_SAMPLER_BILINEAR_CLAMP)
#define GET_SAMPLER_OV1 bilinear_clamp_s
#else
#define GET_SAMPLER_OV1 linear_clamp_s
#endif
#if defined(_PBR_OVERLAY2_SAMPLER_LINEAR_REPEAT)
#define GET_SAMPLER_OV2 linear_repeat_s
#elif defined(_PBR_OVERLAY2_SAMPLER_LINEAR_CLAMP)
#define GET_SAMPLER_OV2 linear_clamp_s
#elif defined(_PBR_OVERLAY2_SAMPLER_POINT_REPEAT)
#define GET_SAMPLER_OV2 point_repeat_s
#elif defined(_PBR_OVERLAY2_SAMPLER_POINT_CLAMP)
#define GET_SAMPLER_OV2 point_clamp_s
#elif defined(_PBR_OVERLAY2_SAMPLER_BILINEAR_REPEAT)
#define GET_SAMPLER_OV2 bilinear_repeat_s
#elif defined(_PBR_OVERLAY2_SAMPLER_BILINEAR_CLAMP)
#define GET_SAMPLER_OV2 bilinear_clamp_s
#else
#define GET_SAMPLER_OV2 linear_clamp_s
#endif
#if defined(_PBR_OVERLAY3_SAMPLER_LINEAR_REPEAT)
#define GET_SAMPLER_OV3 linear_repeat_s
#elif defined(_PBR_OVERLAY3_SAMPLER_LINEAR_CLAMP)
#define GET_SAMPLER_OV3 linear_clamp_s
#elif defined(_PBR_OVERLAY3_SAMPLER_POINT_REPEAT)
#define GET_SAMPLER_OV3 point_repeat_s
#elif defined(_PBR_OVERLAY3_SAMPLER_POINT_CLAMP)
#define GET_SAMPLER_OV3 point_clamp_s
#elif defined(_PBR_OVERLAY3_SAMPLER_BILINEAR_REPEAT)
#define GET_SAMPLER_OV3 bilinear_repeat_s
#elif defined(_PBR_OVERLAY3_SAMPLER_BILINEAR_CLAMP)
#define GET_SAMPLER_OV3 bilinear_clamp_s
#else
#define GET_SAMPLER_OV3 linear_clamp_s
#endif
#if defined(_RIM_LIGHTING0_SAMPLER_LINEAR_REPEAT)
#define GET_SAMPLER_RL0 linear_repeat_s
#elif defined(_RIM_LIGHTING0_SAMPLER_LINEAR_CLAMP)
#define GET_SAMPLER_RL0 linear_clamp_s
#elif defined(_RIM_LIGHTING0_SAMPLER_POINT_REPEAT)
#define GET_SAMPLER_RL0 point_repeat_s
#elif defined(_RIM_LIGHTING0_SAMPLER_POINT_CLAMP)
#define GET_SAMPLER_RL0 point_clamp_s
#elif defined(_RIM_LIGHTING0_SAMPLER_BILINEAR_REPEAT)
#define GET_SAMPLER_RL0 bilinear_repeat_s
#elif defined(_RIM_LIGHTING0_SAMPLER_BILINEAR_CLAMP)
#define GET_SAMPLER_RL0 bilinear_clamp_s
#else
#define GET_SAMPLER_RL0 linear_clamp_s
#endif
#if defined(_RIM_LIGHTING1_SAMPLER_LINEAR_REPEAT)
#define GET_SAMPLER_RL1 linear_repeat_s
#elif defined(_RIM_LIGHTING1_SAMPLER_LINEAR_CLAMP)
#define GET_SAMPLER_RL1 linear_clamp_s
#elif defined(_RIM_LIGHTING1_SAMPLER_POINT_REPEAT)
#define GET_SAMPLER_RL1 point_repeat_s
#elif defined(_RIM_LIGHTING1_SAMPLER_POINT_CLAMP)
#define GET_SAMPLER_RL1 point_clamp_s
#elif defined(_RIM_LIGHTING1_SAMPLER_BILINEAR_REPEAT)
#define GET_SAMPLER_RL1 bilinear_repeat_s
#elif defined(_RIM_LIGHTING1_SAMPLER_BILINEAR_CLAMP)
#define GET_SAMPLER_RL1 bilinear_clamp_s
#else
#define GET_SAMPLER_RL1 linear_clamp_s
#endif
#if defined(_RIM_LIGHTING2_SAMPLER_LINEAR_REPEAT)
#define GET_SAMPLER_RL2 linear_repeat_s
#elif defined(_RIM_LIGHTING2_SAMPLER_LINEAR_CLAMP)
#define GET_SAMPLER_RL2 linear_clamp_s
#elif defined(_RIM_LIGHTING2_SAMPLER_POINT_REPEAT)
#define GET_SAMPLER_RL2 point_repeat_s
#elif defined(_RIM_LIGHTING2_SAMPLER_POINT_CLAMP)
#define GET_SAMPLER_RL2 point_clamp_s
#elif defined(_RIM_LIGHTING2_SAMPLER_BILINEAR_REPEAT)
#define GET_SAMPLER_RL2 bilinear_repeat_s
#elif defined(_RIM_LIGHTING2_SAMPLER_BILINEAR_CLAMP)
#define GET_SAMPLER_RL2 bilinear_clamp_s
#else
#define GET_SAMPLER_RL2 linear_clamp_s
#endif
#if defined(_RIM_LIGHTING3_SAMPLER_LINEAR_REPEAT)
#define GET_SAMPLER_RL3 linear_repeat_s
#elif defined(_RIM_LIGHTING3_SAMPLER_LINEAR_CLAMP)
#define GET_SAMPLER_RL3 linear_clamp_s
#elif defined(_RIM_LIGHTING3_SAMPLER_POINT_REPEAT)
#define GET_SAMPLER_RL3 point_repeat_s
#elif defined(_RIM_LIGHTING3_SAMPLER_POINT_CLAMP)
#define GET_SAMPLER_RL3 point_clamp_s
#elif defined(_RIM_LIGHTING3_SAMPLER_BILINEAR_REPEAT)
#define GET_SAMPLER_RL3 bilinear_repeat_s
#elif defined(_RIM_LIGHTING3_SAMPLER_BILINEAR_CLAMP)
#define GET_SAMPLER_RL3 bilinear_clamp_s
#else
#define GET_SAMPLER_RL3 linear_clamp_s
#endif
#endif // __TEXTURE_MACROS_INC
|