diff options
Diffstat (limited to 'intern/cycles/kernel/osl/osl_closures.cpp')
-rw-r--r-- | intern/cycles/kernel/osl/osl_closures.cpp | 60 |
1 files changed, 50 insertions, 10 deletions
diff --git a/intern/cycles/kernel/osl/osl_closures.cpp b/intern/cycles/kernel/osl/osl_closures.cpp index c52230de86e..8acab1ab558 100644 --- a/intern/cycles/kernel/osl/osl_closures.cpp +++ b/intern/cycles/kernel/osl/osl_closures.cpp @@ -208,7 +208,11 @@ public: void setup(ShaderData *sd, int path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); - sd->flag |= (bsdf) ? bsdf_microfacet_ggx_clearcoat_setup(bsdf, sd) : 0; + if(!bsdf) { + return; + } + + sd->flag |= bsdf_microfacet_ggx_clearcoat_setup(bsdf, sd); } }; @@ -391,9 +395,13 @@ public: void setup(ShaderData *sd, int path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); + if(!bsdf) { + return; + } + bsdf->T = make_float3(0.0f, 0.0f, 0.0f); bsdf->alpha_y = bsdf->alpha_x; - sd->flag |= (bsdf) ? bsdf_microfacet_ggx_fresnel_setup(bsdf, sd) : 0; + sd->flag |= bsdf_microfacet_ggx_fresnel_setup(bsdf, sd); } }; @@ -417,7 +425,11 @@ public: void setup(ShaderData *sd, int path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); - sd->flag |= (bsdf) ? bsdf_microfacet_ggx_aniso_fresnel_setup(bsdf, sd) : 0; + if(!bsdf) { + return; + } + + sd->flag |= bsdf_microfacet_ggx_aniso_fresnel_setup(bsdf, sd); } }; @@ -478,10 +490,14 @@ public: void setup(ShaderData *sd, int path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); + if(!bsdf) { + return; + } + bsdf->ior = 0.0f; bsdf->T = make_float3(0.0f, 0.0f, 0.0f); bsdf->alpha_y = bsdf->alpha_x; - sd->flag |= (bsdf) ? bsdf_microfacet_multi_ggx_setup(bsdf) : 0; + sd->flag |= bsdf_microfacet_multi_ggx_setup(bsdf); } }; @@ -503,8 +519,12 @@ public: void setup(ShaderData *sd, int path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); + if(!bsdf) { + return; + } + bsdf->ior = 0.0f; - sd->flag |= (bsdf) ? bsdf_microfacet_multi_ggx_aniso_setup(bsdf) : 0; + sd->flag |= bsdf_microfacet_multi_ggx_aniso_setup(bsdf); } }; @@ -530,9 +550,13 @@ public: void setup(ShaderData *sd, int path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); + if(!bsdf) { + return; + } + bsdf->T = make_float3(0.0f, 0.0f, 0.0f); bsdf->alpha_y = bsdf->alpha_x; - sd->flag |= (bsdf) ? bsdf_microfacet_multi_ggx_glass_setup(bsdf) : 0; + sd->flag |= bsdf_microfacet_multi_ggx_glass_setup(bsdf); } }; @@ -591,9 +615,13 @@ public: void setup(ShaderData *sd, int path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); + if(!bsdf) { + return; + } + bsdf->T = make_float3(0.0f, 0.0f, 0.0f); bsdf->alpha_y = bsdf->alpha_x; - sd->flag |= (bsdf) ? bsdf_microfacet_multi_ggx_fresnel_setup(bsdf, sd) : 0; + sd->flag |= bsdf_microfacet_multi_ggx_fresnel_setup(bsdf, sd); } }; @@ -617,7 +645,11 @@ public: void setup(ShaderData *sd, int path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); - sd->flag |= (bsdf) ? bsdf_microfacet_multi_ggx_aniso_fresnel_setup(bsdf, sd) : 0; + if(!bsdf) { + return; + } + + sd->flag |= bsdf_microfacet_multi_ggx_aniso_fresnel_setup(bsdf, sd); } }; @@ -645,9 +677,13 @@ public: void setup(ShaderData *sd, int path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); + if(!bsdf) { + return; + } + bsdf->T = make_float3(0.0f, 0.0f, 0.0f); bsdf->alpha_y = bsdf->alpha_x; - sd->flag |= (bsdf) ? bsdf_microfacet_multi_ggx_glass_fresnel_setup(bsdf, sd) : 0; + sd->flag |= bsdf_microfacet_multi_ggx_glass_fresnel_setup(bsdf, sd); } }; @@ -720,7 +756,11 @@ public: volume_extinction_setup(sd, weight); HenyeyGreensteinVolume *volume = (HenyeyGreensteinVolume*)bsdf_alloc_osl(sd, sizeof(HenyeyGreensteinVolume), weight, ¶ms); - sd->flag |= (volume) ? volume_henyey_greenstein_setup(volume) : 0; + if(!volume) { + return; + } + + sd->flag |= volume_henyey_greenstein_setup(volume); } }; |