commit 2a5b847954ea4cbd3faa8e8485217e09159cc99c
parent b214524d0716257ac51fc7d7934b1ff001152e33
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 23 Feb 2017 10:02:34 +0100
Merge remote-tracking branch 'origin/master' into rcv_primitive
Diffstat:
1 file changed, 18 insertions(+), 21 deletions(-)
diff --git a/src/ssol_scene.c b/src/ssol_scene.c
@@ -443,11 +443,10 @@ hit_filter_function
/* Discard self intersection for mesh, i.e. when the intersected
* primitive is the primitive from which the ray starts */
return 1;
- } else {
- /* No self intersection. Define which side of the primitive is hit.
- * Note that incoming direction points inward the primitive */
- hit_side = f3_dot(hit->normal, dirf) < 0 ? SSOL_FRONT : SSOL_BACK;
}
+ /* No self intersection. Define which side of the primitive is hit.
+ * Note that incoming direction points inward the primitive */
+ hit_side = f3_dot(hit->normal, dirf) < 0 ? SSOL_FRONT : SSOL_BACK;
break;
case SHAPE_PUNCHED:
/* Project the hit position into the punched shape */
@@ -458,21 +457,20 @@ hit_filter_function
if(dst >= FLT_MAX) {
/* No projection is found => the ray does not intersect the quadric */
return 1;
- } else if (inst != rdata->inst_from) {
- hit_side = d3_dot(dir, N) < 0 ? SSOL_FRONT : SSOL_BACK;
- } else {
- if(hit->distance <= rdata->range_min) {
- /* Handle RT numerical imprecision, the hit is below the lower bound
- * of the ray range. */
- return 1;
- } else {
- /* If the intersected instance is the one from which the ray starts,
- * ensure that the ray does not intersect the opposite side of the
- * quadric */
- if(hit_side != rdata->side_from) {
- return 1;
- }
- }
+ }
+ if(dst <= rdata->range_min) {
+ /* Handle RT numerical imprecision, the hit is below the lower bound
+ * of the ray range. */
+ return 1;
+ }
+ hit_side = d3_dot(dir, N) < 0 ? SSOL_FRONT : SSOL_BACK;
+ if(inst == rdata->inst_from && hit_side != rdata->side_from) {
+ /* The intersected instance is the one from which the ray starts,
+ * ensure that the ray does not intersect the opposite side of the
+ * quadric
+ *
+ * Note that reversed_ray is intentionally not considered here! */
+ return 1;
}
break;
default: FATAL("Unreachable code.\n"); break;
@@ -486,7 +484,7 @@ hit_filter_function
/* Discard all virtual materials */
if(rdata->discard_virtual_materials) return 1;
/* Discard virtual material that are not receivers */
- if((inst->receiver_mask&(int)hit_side) == 0) return 1;
+ if((inst->receiver_mask & (int)hit_side) == 0) return 1;
}
/* Save the nearest intersected quadric point */
@@ -497,4 +495,3 @@ hit_filter_function
return 0;
}
-