[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42370] trunk/blender/intern/cycles: Fix #29444: cycles problem building BVH with NaN vertices.
Brecht Van Lommel
brechtvanlommel at pandora.be
Sat Dec 3 21:22:27 CET 2011
Revision: 42370
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42370
Author: blendix
Date: 2011-12-03 20:22:21 +0000 (Sat, 03 Dec 2011)
Log Message:
-----------
Fix #29444: cycles problem building BVH with NaN vertices.
Modified Paths:
--------------
trunk/blender/intern/cycles/bvh/bvh_build.cpp
trunk/blender/intern/cycles/util/util_boundbox.h
trunk/blender/intern/cycles/util/util_math.h
Modified: trunk/blender/intern/cycles/bvh/bvh_build.cpp
===================================================================
--- trunk/blender/intern/cycles/bvh/bvh_build.cpp 2011-12-03 13:16:32 UTC (rev 42369)
+++ trunk/blender/intern/cycles/bvh/bvh_build.cpp 2011-12-03 20:22:21 UTC (rev 42370)
@@ -59,16 +59,18 @@
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);
+ }
}
}
Modified: trunk/blender/intern/cycles/util/util_boundbox.h
===================================================================
--- trunk/blender/intern/cycles/util/util_boundbox.h 2011-12-03 13:16:32 UTC (rev 42369)
+++ trunk/blender/intern/cycles/util/util_boundbox.h 2011-12-03 20:22:21 UTC (rev 42370)
@@ -21,6 +21,7 @@
#include <float.h>
+#include "util_math.h"
#include "util_transform.h"
#include "util_types.h"
@@ -71,7 +72,9 @@
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)
Modified: trunk/blender/intern/cycles/util/util_math.h
===================================================================
--- trunk/blender/intern/cycles/util/util_math.h 2011-12-03 13:16:32 UTC (rev 42369)
+++ trunk/blender/intern/cycles/util/util_math.h 2011-12-03 20:22:21 UTC (rev 42370)
@@ -63,6 +63,7 @@
#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
More information about the Bf-blender-cvs
mailing list