diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-18 15:39:22 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-18 15:39:22 +0300 |
commit | 6a17d52f062e8dd5f0791d618d2657a6a6375aef (patch) | |
tree | 9317542db5e69f9afa3989f231a735ac86804294 /intern | |
parent | 3e8abc0535aaeb736310a1b7a5447df1721ff349 (diff) | |
parent | 01a0649354a4052e3f826663c50753833a257d1f (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/bvh/bvh_build.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/render/light.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/render/mesh.cpp | 7 | ||||
-rw-r--r-- | intern/cycles/render/mesh.h | 2 |
4 files changed, 13 insertions, 1 deletions
diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp index 649ce52da05..39e14dba3ee 100644 --- a/intern/cycles/bvh/bvh_build.cpp +++ b/intern/cycles/bvh/bvh_build.cpp @@ -129,7 +129,7 @@ void BVHBuild::add_reference_triangles(BoundBox& root, BoundBox& center, Mesh *m if(attr_mP == NULL) { BoundBox bounds = BoundBox::empty; t.bounds_grow(verts, bounds); - if(bounds.valid()) { + if(bounds.valid() && t.valid(verts)) { references.push_back(BVHReference(bounds, j, i, diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 6a7f985b756..bb73ebd7e41 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -345,6 +345,9 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen offset++; Mesh::Triangle t = mesh->get_triangle(i); + if(!t.valid(&mesh->verts[0])) { + continue; + } float3 p1 = mesh->verts[t.v[0]]; float3 p2 = mesh->verts[t.v[1]]; float3 p3 = mesh->verts[t.v[2]]; diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index c5eb3a0d3a8..6470b3b1075 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -120,6 +120,13 @@ float3 Mesh::Triangle::compute_normal(const float3 *verts) const return norm / normlen; } +bool Mesh::Triangle::valid(const float3 *verts) const +{ + return isfinite3_safe(verts[v[0]]) && + isfinite3_safe(verts[v[1]]) && + isfinite3_safe(verts[v[2]]); +} + /* Curve */ void Mesh::Curve::bounds_grow(const int k, const float3 *curve_keys, const float *curve_radius, BoundBox& bounds) const diff --git a/intern/cycles/render/mesh.h b/intern/cycles/render/mesh.h index 3483ab4fd69..ed7cb881e91 100644 --- a/intern/cycles/render/mesh.h +++ b/intern/cycles/render/mesh.h @@ -72,6 +72,8 @@ public: float3 r_verts[3]) const; float3 compute_normal(const float3 *verts) const; + + bool valid(const float3 *verts) const; }; Triangle get_triangle(size_t i) const |