@@ -332,7 +332,7 @@ struct Schlick
332
332
333
333
T operator ()(const scalar_type clampedCosTheta)
334
334
{
335
- assert (clampedCosTheta > scalar_type (0.0 ));
335
+ assert (clampedCosTheta >= scalar_type (0.0 ));
336
336
assert (hlsl::all (hlsl::promote<T>(0.02 ) < F0 && F0 <= hlsl::promote<T>(1.0 )));
337
337
T x = 1.0 - clampedCosTheta;
338
338
return F0 + (1.0 - F0) * x*x*x*x*x;
@@ -394,10 +394,11 @@ struct Dielectric
394
394
using scalar_type = typename vector_traits<T>::scalar_type;
395
395
using vector_type = T;
396
396
397
- static Dielectric<T> create (NBL_CONST_REF_ARG (T) eta )
397
+ static Dielectric<T> create (NBL_CONST_REF_ARG (OrientedEtas<T>) orientedEta )
398
398
{
399
399
Dielectric<T> retval;
400
- retval.orientedEta = OrientedEtas<T>::create (1.0 , eta);
400
+ retval.orientedEta = orientedEta;
401
+ retval.orientedEta2 = orientedEta.value * orientedEta.value;
401
402
return retval;
402
403
}
403
404
@@ -417,34 +418,13 @@ struct Dielectric
417
418
418
419
T operator ()(const scalar_type clampedCosTheta)
419
420
{
420
- return __call (orientedEta.value * orientedEta.value, clampedCosTheta);
421
- }
422
-
423
- OrientedEtas<T> orientedEta;
424
- };
425
-
426
- template<typename T NBL_PRIMARY_REQUIRES (concepts::FloatingPointLikeVectorial<T>)
427
- struct DielectricFrontFaceOnly
428
- {
429
- using scalar_type = typename vector_traits<T>::scalar_type;
430
- using vector_type = T;
431
-
432
- static DielectricFrontFaceOnly<T> create (NBL_CONST_REF_ARG (T) eta)
433
- {
434
- Dielectric<T> retval;
435
- retval.orientedEta = OrientedEtas<T>::create (1.0 , eta);
436
- return retval;
437
- }
438
-
439
- T operator ()(const scalar_type clampedCosTheta)
440
- {
441
- return Dielectric<T>::__call (orientedEta.value * orientedEta.value, clampedCosTheta);
421
+ return __call (orientedEta2, clampedCosTheta);
442
422
}
443
423
444
424
OrientedEtas<T> orientedEta;
425
+ T orientedEta2;
445
426
};
446
427
447
-
448
428
// gets the sum of all R, T R T, T R^3 T, T R^5 T, ... paths
449
429
template<typename T NBL_FUNC_REQUIRES (concepts::FloatingPointLikeScalar<T> || concepts::FloatingPointLikeVectorial<T>)
450
430
T thinDielectricInfiniteScatter (const T singleInterfaceReflectance)
0 commit comments