Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/util/math.h')
-rw-r--r--intern/cycles/util/math.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/intern/cycles/util/math.h b/intern/cycles/util/math.h
index f6400cb879f..0585dcc8ad5 100644
--- a/intern/cycles/util/math.h
+++ b/intern/cycles/util/math.h
@@ -595,26 +595,26 @@ ccl_device_inline void make_orthonormals(const float3 N,
/* Color division */
-ccl_device_inline float3 safe_invert_color(float3 a)
+ccl_device_inline Spectrum safe_invert_color(Spectrum a)
{
- float x, y, z;
-
- x = (a.x != 0.0f) ? 1.0f / a.x : 0.0f;
- y = (a.y != 0.0f) ? 1.0f / a.y : 0.0f;
- z = (a.z != 0.0f) ? 1.0f / a.z : 0.0f;
+ FOREACH_SPECTRUM_CHANNEL (i) {
+ GET_SPECTRUM_CHANNEL(a, i) = (GET_SPECTRUM_CHANNEL(a, i) != 0.0f) ?
+ 1.0f / GET_SPECTRUM_CHANNEL(a, i) :
+ 0.0f;
+ }
- return make_float3(x, y, z);
+ return a;
}
-ccl_device_inline float3 safe_divide_color(float3 a, float3 b)
+ccl_device_inline Spectrum safe_divide_color(Spectrum a, Spectrum b)
{
- float x, y, z;
-
- x = (b.x != 0.0f) ? a.x / b.x : 0.0f;
- y = (b.y != 0.0f) ? a.y / b.y : 0.0f;
- z = (b.z != 0.0f) ? a.z / b.z : 0.0f;
+ FOREACH_SPECTRUM_CHANNEL (i) {
+ GET_SPECTRUM_CHANNEL(a, i) = (GET_SPECTRUM_CHANNEL(b, i) != 0.0f) ?
+ GET_SPECTRUM_CHANNEL(a, i) / GET_SPECTRUM_CHANNEL(b, i) :
+ 0.0f;
+ }
- return make_float3(x, y, z);
+ return a;
}
ccl_device_inline float3 safe_divide_even_color(float3 a, float3 b)