[Bf-blender-cvs] [6a0a205] master: Cycles: Simplify volume_phase_eval().

Thomas Dinges noreply at git.blender.org
Thu Jun 11 15:20:18 CEST 2015


Commit: 6a0a205cb4f648144729de98b39b91d44bf13752
Author: Thomas Dinges
Date:   Thu Jun 11 15:18:33 2015 +0200
Branches: master
https://developer.blender.org/rB6a0a205cb4f648144729de98b39b91d44bf13752

Cycles: Simplify volume_phase_eval().

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.

===================================================================

M	intern/cycles/kernel/closure/volume.h

===================================================================

diff --git a/intern/cycles/kernel/closure/volume.h b/intern/cycles/kernel/closure/volume.h
index 4396105..4d71ba5 100644
--- a/intern/cycles/kernel/closure/volume.h
+++ b/intern/cycles/kernel/closure/volume.h
@@ -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,




More information about the Bf-blender-cvs mailing list