Cycles: Simplify volume_phase_eval().
authorThomas Dinges <blender@dingto.org>
Thu, 11 Jun 2015 13:18:33 +0000 (15:18 +0200)
committerThomas Dinges <blender@dingto.org>
Thu, 11 Jun 2015 13:18:33 +0000 (15:18 +0200)
This simplification is safe, as the call to volume_phase_eval() is guarded behind a CLOSURE_IS_PHASE check, which is equal to
CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID. I don't think we will add more phase functions anytime soon, if at all.

intern/cycles/kernel/closure/volume.h

index 439610546e5b2a808649955b8296e72bac6c6db1..4d71ba50ec3c6c50604c056788263ccf12020983 100644 (file)
@@ -107,18 +107,9 @@ ccl_device int volume_absorption_setup(ShaderClosure *sc)
 
 ccl_device float3 volume_phase_eval(const ShaderData *sd, const ShaderClosure *sc, float3 omega_in, float *pdf)
 {
-       float3 eval;
+       kernel_assert(sc->type == CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID);
 
-       switch(sc->type) {
-               case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID:
-                       eval = volume_henyey_greenstein_eval_phase(sc, sd->I, omega_in, pdf);
-                       break;
-               default:
-                       eval = make_float3(0.0f, 0.0f, 0.0f);
-                       break;
-       }
-
-       return eval;
+       return volume_henyey_greenstein_eval_phase(sc, sd->I, omega_in, pdf);
 }
 
 ccl_device int volume_phase_sample(const ShaderData *sd, const ShaderClosure *sc, float randu,