@@ -38,32 +38,24 @@ struct SOrenNayar
38
38
scalar_type VdotL;
39
39
};
40
40
41
- static this_t create (scalar_type A )
41
+ static this_t create (NBL_CONST_REF_ARG (creation_type) params )
42
42
{
43
43
this_t retval;
44
- retval.A2 = A * 0.5 ;
44
+ retval.A2 = params. A * 0.5 ;
45
45
retval.AB = vector2_type (1.0 , 0.0 ) + vector2_type (-0.5 , 0.45 ) * vector2_type (retval.A2, retval.A2) / vector2_type (retval.A2 + 0.33 , retval.A2 + 0.09 );
46
46
return retval;
47
47
}
48
- static this_t create (NBL_CONST_REF_ARG (creation_type) params)
49
- {
50
- return create (params.A);
51
- }
52
48
53
- scalar_type __rec_pi_factored_out_wo_clamps (scalar_type VdotL, scalar_type maxNdotL, scalar_type maxNdotV)
54
- {
55
- scalar_type C = 1.0 / max <scalar_type>(maxNdotL, maxNdotV);
56
-
57
- scalar_type cos_phi_sin_theta = max <scalar_type>(VdotL - maxNdotL * maxNdotV, 0.0 );
58
- return (AB.x + AB.y * cos_phi_sin_theta * C);
59
- }
60
49
template<typename Query>
61
50
spectral_type __eval (NBL_CONST_REF_ARG (Query) query, NBL_CONST_REF_ARG (sample_type) _sample, NBL_CONST_REF_ARG (isotropic_interaction_type) interaction)
62
51
{
63
52
scalar_type NdotL = _sample.getNdotL (_clamp);
64
- return hlsl::promote<spectral_type>(NdotL * numbers::inv_pi< scalar_type> * 0.5 * __rec_pi_factored_out_wo_clamps (query. getVdotL (), NdotL, interaction.getNdotV (_clamp)) );
65
- }
53
+ scalar_type NdotV = interaction.getNdotV (_clamp);
54
+ scalar_type C = 1.0 / max <scalar_type>(NdotL, NdotV);
66
55
56
+ scalar_type cos_phi_sin_theta = max <scalar_type>(VdotL - NdotL * NdotV, 0.0 );
57
+ return hlsl::promote<spectral_type>(NdotL * numbers::inv_pi<scalar_type> * 0.5 * (AB.x + AB.y * cos_phi_sin_theta * C));
58
+ }
67
59
spectral_type eval (NBL_CONST_REF_ARG (sample_type) _sample, NBL_CONST_REF_ARG (isotropic_interaction_type) interaction)
68
60
{
69
61
SQuery query;
0 commit comments