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>2011-12-04 00:22:21 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-12-04 00:22:21 +0400
commitf2ae6b158913e817c0aab43eafb599af337a274e (patch)
treee860dbb9965e004835cf7bc8dd5f29541cd172f9 /intern/cycles
parent4344d84c02809e58faaf9516ec6431f3194389c4 (diff)
Fix #29444: cycles problem building BVH with NaN vertices.
Diffstat (limited to 'intern/cycles')
-rw-r--r--intern/cycles/bvh/bvh_build.cpp12
-rw-r--r--intern/cycles/util/util_boundbox.h5
-rw-r--r--intern/cycles/util/util_math.h1
3 files changed, 12 insertions, 6 deletions
diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp
index 67cff3f5873..38674c2c561 100644
--- a/intern/cycles/bvh/bvh_build.cpp
+++ b/intern/cycles/bvh/bvh_build.cpp
@@ -59,16 +59,18 @@ void BVHBuild::add_reference_mesh(NodeSpec& root, Mesh *mesh, int i)
Mesh::Triangle t = mesh->triangles[j];
Reference ref;
- ref.prim_index = j;
- ref.prim_object = i;
-
for(int k = 0; k < 3; k++) {
float3 pt = mesh->verts[t.v[k]];
ref.bounds.grow(pt);
}
- references.push_back(ref);
- root.bounds.grow(ref.bounds);
+ if(ref.bounds.valid()) {
+ ref.prim_index = j;
+ ref.prim_object = i;
+
+ references.push_back(ref);
+ root.bounds.grow(ref.bounds);
+ }
}
}
diff --git a/intern/cycles/util/util_boundbox.h b/intern/cycles/util/util_boundbox.h
index 34cc1d6e11c..b4c5e4e71ca 100644
--- a/intern/cycles/util/util_boundbox.h
+++ b/intern/cycles/util/util_boundbox.h
@@ -21,6 +21,7 @@
#include <float.h>
+#include "util_math.h"
#include "util_transform.h"
#include "util_types.h"
@@ -71,7 +72,9 @@ public:
bool valid(void) const
{
- return (min.x <= max.x) && (min.y <= max.y) && (min.z <= max.z);
+ 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));
}
BoundBox transformed(const Transform *tfm)
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h
index 2f9e00dbfcb..7c56f0fbb12 100644
--- a/intern/cycles/util/util_math.h
+++ b/intern/cycles/util/util_math.h
@@ -63,6 +63,7 @@ CCL_NAMESPACE_BEGIN
#if(!defined(FREE_WINDOWS))
#define copysignf(x, y) ((float)_copysign(x, y))
#define hypotf(x, y) _hypotf(x, y)
+#define isnan(x) _isnan(x)
#endif
#endif