diff options
Diffstat (limited to 'intern/cycles/util')
-rw-r--r-- | intern/cycles/util/util_boundbox.h | 6 | ||||
-rw-r--r-- | intern/cycles/util/util_transform.h | 10 |
2 files changed, 12 insertions, 4 deletions
diff --git a/intern/cycles/util/util_boundbox.h b/intern/cycles/util/util_boundbox.h index 0114a9a26a5..bb1df0b220f 100644 --- a/intern/cycles/util/util_boundbox.h +++ b/intern/cycles/util/util_boundbox.h @@ -76,8 +76,8 @@ public: bool valid(void) const { return (min.x <= max.x) && (min.y <= max.y) && (min.z <= max.z) && - !(isnan(min.x) || isnan(min.y) || isnan(min.z)) && - !(isnan(max.x) || isnan(max.y) || isnan(max.z)); + (isfinite(min.x) && isfinite(min.y) && isfinite(min.z)) && + (isfinite(max.x) && isfinite(max.y) && isfinite(max.z)); } BoundBox transformed(const Transform *tfm) @@ -91,7 +91,7 @@ public: p.y = (i & 2)? min.y: max.y; p.z = (i & 4)? min.z: max.z; - result.grow(transform(tfm, p)); + result.grow(transform_point(tfm, p)); } return result; diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h index 07db52f6392..aeaef7b0e21 100644 --- a/intern/cycles/util/util_transform.h +++ b/intern/cycles/util/util_transform.h @@ -37,7 +37,7 @@ typedef struct Transform { #endif } Transform; -__device_inline float3 transform(const Transform *t, const float3 a) +__device_inline float3 transform_perspective(const Transform *t, const float3 a) { float4 b = make_float4(a.x, a.y, a.z, 1.0f); float3 c = make_float3(dot(t->x, b), dot(t->y, b), dot(t->z, b)); @@ -46,6 +46,14 @@ __device_inline float3 transform(const Transform *t, const float3 a) return (w != 0.0f)? c/w: make_float3(0.0f, 0.0f, 0.0f); } +__device_inline float3 transform_point(const Transform *t, const float3 a) +{ + float4 b = make_float4(a.x, a.y, a.z, 1.0f); + float3 c = make_float3(dot(t->x, b), dot(t->y, b), dot(t->z, b)); + + return c; +} + __device_inline float3 transform_direction(const Transform *t, const float3 a) { float4 b = make_float4(a.x, a.y, a.z, 0.0f); |