Fix #29444: cycles problem building BVH with NaN vertices.
This commit is contained in:
parent
4344d84c02
commit
f2ae6b1589
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user