@@ -287,6 +287,7 @@ struct GGX
287287 NBL_CONSTEXPR_STATIC_INLINE bool IsAnisotropic = _IsAnisotropic;
288288 NBL_CONSTEXPR_STATIC_INLINE bool IsBSDF = reflect_refract != MTT_REFLECT;
289289
290+ using this_t = GGX<T, _IsAnisotropic, reflect_refract>;
290291 using scalar_type = T;
291292 using base_type = impl::GGXCommon<T,IsBSDF,IsAnisotropic>;
292293 using quant_type = SDualMeasureQuant<scalar_type>;
@@ -303,6 +304,28 @@ struct GGX
303304 template<class MicrofacetCache>
304305 NBL_CONSTEXPR_STATIC_INLINE bool RequiredMicrofacetCache = IsAnisotropic ? AnisotropicMicrofacetCache<MicrofacetCache> : ReadableIsotropicMicrofacetCache<MicrofacetCache>;
305306
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+
306329 template<class MicrofacetCache, typename C=bool_constant<!IsBSDF> NBL_FUNC_REQUIRES (RequiredMicrofacetCache<MicrofacetCache>)
307330 enable_if_t<C::value && !IsBSDF, quant_query_type> createQuantQuery (NBL_CONST_REF_ARG (MicrofacetCache) cache, scalar_type orientedEta)
308331 {
0 commit comments