@@ -287,6 +287,7 @@ struct GGX
287
287
NBL_CONSTEXPR_STATIC_INLINE bool IsAnisotropic = _IsAnisotropic;
288
288
NBL_CONSTEXPR_STATIC_INLINE bool IsBSDF = reflect_refract != MTT_REFLECT;
289
289
290
+ using this_t = GGX<T, _IsAnisotropic, reflect_refract>;
290
291
using scalar_type = T;
291
292
using base_type = impl::GGXCommon<T,IsBSDF,IsAnisotropic>;
292
293
using quant_type = SDualMeasureQuant<scalar_type>;
@@ -303,6 +304,28 @@ struct GGX
303
304
template<class MicrofacetCache>
304
305
NBL_CONSTEXPR_STATIC_INLINE bool RequiredMicrofacetCache = IsAnisotropic ? AnisotropicMicrofacetCache<MicrofacetCache> : ReadableIsotropicMicrofacetCache<MicrofacetCache>;
305
306
307
+ template<typename C=bool_constant<!IsAnisotropic> >
308
+ enable_if_t<C::value && !IsAnisotropic, this_t> create (scalar_type A)
309
+ {
310
+ this_t retval;
311
+ retval.__ndf_base.a2 = A*A;
312
+ retval.__ndf_base.one_minus_a2 = scalar_type (1.0 ) - A*A;
313
+ retval.__generate_base.ax = A;
314
+ retval.__generate_base.ay = A;
315
+ return retval;
316
+ }
317
+ template<typename C=bool_constant<IsAnisotropic> >
318
+ enable_if_t<C::value && IsAnisotropic, this_t> create (scalar_type ax, scalar_type ay)
319
+ {
320
+ this_t retval;
321
+ retval.__ndf_base.ax2 = ax*ax;
322
+ retval.__ndf_base.ay2 = ay*ay;
323
+ retval.__ndf_base.a2 = ax*ay;
324
+ retval.__generate_base.ax = ax;
325
+ retval.__generate_base.ay = ay;
326
+ return retval;
327
+ }
328
+
306
329
template<class MicrofacetCache, typename C=bool_constant<!IsBSDF> NBL_FUNC_REQUIRES (RequiredMicrofacetCache<MicrofacetCache>)
307
330
enable_if_t<C::value && !IsBSDF, quant_query_type> createQuantQuery (NBL_CONST_REF_ARG (MicrofacetCache) cache, scalar_type orientedEta)
308
331
{
0 commit comments