Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenkernel/intern/bvhutils.c6
-rw-r--r--source/blender/blenlib/BLI_kdopbvh.h5
2 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index 24583c124e6..752bdab2c00 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -383,6 +383,9 @@ static void mesh_faces_nearest_point(void *userdata, int index, const float co[3
nearest->dist = dist;
copy_v3_v3(nearest->co, nearest_tmp);
normal_tri_v3(nearest->no, t0, t1, t2);
+
+ if (t1 == vert[face->v3].co)
+ nearest->flags |= BVH_ONQUAD;
}
t1 = t2;
@@ -420,6 +423,9 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r
madd_v3_v3v3fl(hit->co, ray->origin, ray->direction, dist);
normal_tri_v3(hit->no, t0, t1, t2);
+
+ if (t1 == vert[face->v3].co)
+ hit->flags |= BVH_ONQUAD;
}
t1 = t2;
diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h
index 7041c122ff9..5ec8247c03a 100644
--- a/source/blender/blenlib/BLI_kdopbvh.h
+++ b/source/blender/blenlib/BLI_kdopbvh.h
@@ -49,11 +49,15 @@ typedef struct BVHTreeOverlap {
int indexB;
} BVHTreeOverlap;
+/* flags */
+#define BVH_ONQUAD (1<<0)
+
typedef struct BVHTreeNearest {
int index; /* the index of the nearest found (untouched if none is found within a dist radius from the given coordinates) */
float co[3]; /* nearest coordinates (untouched it none is found within a dist radius from the given coordinates) */
float no[3]; /* normal at nearest coordinates (untouched it none is found within a dist radius from the given coordinates) */
float dist; /* squared distance to search arround */
+ int flags;
} BVHTreeNearest;
typedef struct BVHTreeRay {
@@ -67,6 +71,7 @@ typedef struct BVHTreeRayHit {
float co[3]; /* coordinates of the hit point */
float no[3]; /* normal on hit point */
float dist; /* distance to the hit point */
+ int flags;
} BVHTreeRayHit;
/* callback must update nearest in case it finds a nearest result */