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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-04-10 00:48:53 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-04-10 00:48:53 +0400
commit34707c19f27043d534f1b2359b4f660d513f3cb6 (patch)
treee61675e02c7f9a62dec7efab5d79970f5688527c /intern/cycles/util/util_boundbox.h
parent84ba3f65210d535859357b23126c293c3987868f (diff)
Fix 34764: cycles issue rendering instanced mesh with NaN coordinates.
Diffstat (limited to 'intern/cycles/util/util_boundbox.h')
-rw-r--r--intern/cycles/util/util_boundbox.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/intern/cycles/util/util_boundbox.h b/intern/cycles/util/util_boundbox.h
index 7564c1f3c5c..3ee35b992f7 100644
--- a/intern/cycles/util/util_boundbox.h
+++ b/intern/cycles/util/util_boundbox.h
@@ -80,6 +80,31 @@ public:
grow(bbox.max);
}
+ __forceinline void grow_safe(const float3& pt)
+ {
+ /* the order of arguments to min is such that if pt is nan, it will not
+ * influence the resulting bounding box */
+ if(isfinite(pt.x) && isfinite(pt.y) && isfinite(pt.z)) {
+ min = ccl::min(pt, min);
+ max = ccl::max(pt, max);
+ }
+ }
+
+ __forceinline void grow_safe(const float3& pt, float border)
+ {
+ if(isfinite(pt.x) && isfinite(pt.y) && isfinite(pt.z) && isfinite(border)) {
+ float3 shift = {border, border, border, 0.0f};
+ min = ccl::min(pt - shift, min);
+ max = ccl::max(pt + shift, max);
+ }
+ }
+
+ __forceinline void grow_safe(const BoundBox& bbox)
+ {
+ grow_safe(bbox.min);
+ grow_safe(bbox.max);
+ }
+
__forceinline void intersect(const BoundBox& bbox)
{
min = ccl::max(min, bbox.min);
@@ -120,7 +145,7 @@ public:
{
return max - min;
}
-
+
__forceinline bool valid() const
{
return (min.x <= max.x) && (min.y <= max.y) && (min.z <= max.z) &&