Geometry: detect when the sample uv is in multiple triangles

This commit is contained in:
Jacques Lucke 2022-07-25 11:32:27 +02:00
parent c5394f3db8
commit 53113a2e57
1 changed files with 3 additions and 3 deletions

View File

@ -67,9 +67,9 @@ ReverseUVSampler::Result ReverseUVSampler::sample(const float2 &query_uv) const
const float z_dist = std::max(-bary_weights.z, bary_weights.z - 1.0f);
const float dist = MAX3(x_dist, y_dist, z_dist);
if (dist <= 0.0f) {
/* Return early if the uv coordinate is in the triangle. */
return Result{ResultType::Ok, &looptri, bary_weights};
if (dist <= 0.0f && best_dist <= 0.0f) {
/* The uv sample is in multiple triangles. */
return Result{ResultType::Multiple};
}
if (dist < best_dist) {