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);
+ }
}
}
#include <float.h>
+#include "util_math.h"
#include "util_transform.h"
#include "util_types.h"
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)
#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