File tree Expand file tree Collapse file tree 1 file changed +35
-4
lines changed
include/nbl/builtin/hlsl/bxdf Expand file tree Collapse file tree 1 file changed +35
-4
lines changed Original file line number Diff line number Diff line change 4
4
#ifndef _NBL_BUILTIN_HLSL_BXDF_COMMON_INCLUDED_
5
5
#define _NBL_BUILTIN_HLSL_BXDF_COMMON_INCLUDED_
6
6
7
+ #include <nbl/builtin/hlsl/limits.hlsl>
8
+
7
9
namespace nbl
8
10
{
9
11
namespace hlsl
@@ -20,6 +22,20 @@ struct Basic
20
22
{
21
23
float3 getDirection () {return direction;}
22
24
25
+ Basic transmit ()
26
+ {
27
+ Basic retval;
28
+ retval.direction = -direction;
29
+ return retval;
30
+ }
31
+
32
+ Basic reflect (const float3 N, const float directionDotN)
33
+ {
34
+ Basic retval;
35
+ retval.direction = nbl::hlsl::reflect (direction,N,directionDotN);
36
+ return retval;
37
+ }
38
+
23
39
float3 direction;
24
40
};
25
41
// more to come!
@@ -211,11 +227,26 @@ struct AnisotropicMicrofacetCache : IsotropicMicrofacetCache
211
227
212
228
213
229
// finally fixed the semantic F-up, value/pdf = quotient not remainder
214
- template<typename SpectralBuckets >
215
- SpectralBuckets quotient_to_value ( const SpectralBuckets quotient, const float pdf)
230
+ template<typename SpectralBins >
231
+ struct quotient_and_pdf
216
232
{
217
- return quotient*pdf;
218
- }
233
+ quotient_and_pdf<SpectralBins> create (const SpectralBins _quotient, const float _pdf)
234
+ {
235
+ quotient_and_pdf<SpectralBins> retval;
236
+ retval.quotient = _quotient;
237
+ retval.pdf = _pdf;
238
+ return retval;
239
+ }
240
+
241
+ SpectralBins value ()
242
+ {
243
+ return quotient*pdf;
244
+ }
245
+
246
+ SpectralBins quotient;
247
+ float pdf;
248
+ };
249
+
219
250
220
251
}
221
252
}
You can’t perform that action at this time.
0 commit comments