commit e6112b3cb7876136e68d443590823078a6c8654f
parent 12dc9a305bbc417e37988d3b0e69690b3491f816
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 15 Feb 2024 15:20:07 +0100
Fix hit_filter when using a custom filter
The custom filter was ignored when there was no input data for the
regular filter. But in the case of a custom filter, the regular filter
and its input data are supposed to be ignored. What this commit now
ensures.
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/sdis_scene_Xd.h b/src/sdis_scene_Xd.h
@@ -447,11 +447,11 @@ XD(hit_filter_function)
void* global_data)
{
const struct hit_filter_data* filter_data = query_data;
- const struct sXd(hit)* hit_from = &filter_data->XD(hit);
+ const struct sXd(hit)* hit_from = NULL;
(void)org, (void)dir, (void)global_data, (void)range;
/* No user defined data. Do not filter */
- if(!filter_data || SXD_HIT_NONE(hit_from)) return 0;
+ if(!filter_data) return 0;
/* Call the custom filter function if it exists
* or perform regular filtering otherwise */
@@ -460,6 +460,10 @@ XD(hit_filter_function)
(hit, org, dir, range, filter_data->custom_filter_data, global_data);
}
+ /* There is no intersection to discard */
+ hit_from = &filter_data->XD(hit);
+ if(SXD_HIT_NONE(hit_from)) return 0;
+
if(SXD_PRIMITIVE_EQ(&hit_from->prim, &hit->prim)) return 1;
/* No displacement => assume self intersection in all situations */