[Bf-blender-cvs] [199f846072a] sculpt-dev: Merge branch 'master' into sculpt-dev
Pablo Dobarro
noreply at git.blender.org
Fri Jul 2 22:20:19 CEST 2021
Commit: 199f846072a5a9d1156c87e14556bf07ec4ce30b
Author: Pablo Dobarro
Date: Mon Jun 28 19:44:07 2021 +0200
Branches: sculpt-dev
https://developer.blender.org/rB199f846072a5a9d1156c87e14556bf07ec4ce30b
Merge branch 'master' into sculpt-dev
===================================================================
===================================================================
diff --cc source/blender/blenkernel/intern/pbvh.c
index 18584e05dd5,9f316ec60c0..0c80282f349
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@@ -2056,60 -2056,7 +2056,60 @@@ bool ray_face_intersection_tri(const fl
return false;
}
+bool ray_update_depth_and_hit_count(const float depth_test,
+ float *r_depth,
+ float *r_back_depth,
+ int *hit_count)
+{
+ (*hit_count)++;
+ if (depth_test < *r_depth) {
+ *r_back_depth = *r_depth;
+ *r_depth = depth_test;
+ return true;
+ }
+ else if (depth_test > *r_depth && depth_test <= *r_back_depth) {
+ *r_back_depth = depth_test;
+ return false;
+ }
+
+ return false;
+}
+
+float ray_face_intersection_depth_quad(const float ray_start[3],
+ struct IsectRayPrecalc *isect_precalc,
+ const float t0[3],
+ const float t1[3],
+ const float t2[3],
+ const float t3[3],
+ float *r_depth,
+ float *r_back_depth,
+ int *hit_count)
+{
+ float depth_test;
+ if (!(isect_ray_tri_watertight_v3(ray_start, isect_precalc, t0, t1, t2, &depth_test, NULL) ||
+ isect_ray_tri_watertight_v3(ray_start, isect_precalc, t0, t2, t3, &depth_test, NULL))) {
+ return false;
+ }
+ return ray_update_depth_and_hit_count(depth_test, r_depth, r_back_depth, hit_count);
+}
+
+bool ray_face_intersection_depth_tri(const float ray_start[3],
+ struct IsectRayPrecalc *isect_precalc,
+ const float t0[3],
+ const float t1[3],
+ const float t2[3],
+ float *r_depth,
+ float *r_back_depth,
+ int *hit_count)
+{
+ float depth_test;
+ if (!isect_ray_tri_watertight_v3(ray_start, isect_precalc, t0, t1, t2, &depth_test, NULL)) {
+ return false;
+ }
+ return ray_update_depth_and_hit_count(depth_test, r_depth, r_back_depth, hit_count);
+}
+
- /* Take advantage of the fact we know this wont be an intersection.
+ /* Take advantage of the fact we know this won't be an intersection.
* Just handle ray-tri edges. */
static float dist_squared_ray_to_tri_v3_fast(const float ray_origin[3],
const float ray_direction[3],
More information about the Bf-blender-cvs
mailing list