commit a5fbe24d7a8a24322ddc9cd04622c1611bec34d8
parent bb6c45e452b08e150ba5a869aa02395d66f81c6a
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Tue, 13 Feb 2024 11:01:48 +0100
BugFix: access to a wrong triangle's data
When property conflicts where found, the wrong triangle was flaged, then
dumped. As a consequence, the geometry dumps of conflicting geometry
where wrong.
Diffstat:
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/sg3d_geometry.c b/src/sg3d_geometry.c
@@ -494,22 +494,22 @@ sg3d_geometry_add
= darray_trg_descriptions_data_get(&geom->trg_descriptions);
if(!same)
SWAP(prop_id_t, tmp.properties[SG3D_FRONT], tmp.properties[SG3D_BACK]);
- already_conflict = trg_descriptions[nt].merge_conflict;
+ already_conflict = trg_descriptions[unique_id].merge_conflict;
if(mrg_trg) {
/* Let the client app rule. */
ERR(mrg_trg(unique_id, nt, !same, trg[*p_trg].properties,
- tmp.properties, ctx, &trg_descriptions[nt].merge_conflict));
+ tmp.properties, ctx, &trg_descriptions[unique_id].merge_conflict));
} else {
FOR_EACH(j, 0, SG3D_PROP_TYPES_COUNT__) {
if(!sg3d_compatible_property(trg[*p_trg].properties[j],
tmp.properties[j]))
{
- trg_descriptions[nt].merge_conflict = 1;
+ trg_descriptions[unique_id].merge_conflict = 1;
break;
}
}
}
- if(trg_descriptions[nt].merge_conflict && !already_conflict)
+ if(trg_descriptions[unique_id].merge_conflict && !already_conflict)
geom->merge_conflict_count++;
/* Replace SG3D_UNSPECIFIED_PROPERTY properties */
FOR_EACH(j, 0, SG3D_PROP_TYPES_COUNT__) {
@@ -530,6 +530,7 @@ sg3d_geometry_add
trg_descriptions
= darray_trg_descriptions_data_get(&geom->trg_descriptions);
ERR(darray_triangle_push_back(&geom->unique_triangles, &tmp));
+ trg = darray_triangle_data_get(&geom->unique_triangles);
FOR_EACH(j, 0, SG3D_PROP_TYPES_COUNT__) {
if((j == SG3D_FRONT || j == SG3D_BACK)
&& tmp.properties[j] != SG3D_UNSPECIFIED_PROPERTY)
@@ -540,8 +541,8 @@ sg3d_geometry_add
n_new_utris++;
}
ERR(geometry_register_triangle(geom, &tmp, unique_id, geom->set_id,
- trg_descriptions[nt].properties_conflict));
- if(trg_descriptions[nt].properties_conflict)
+ trg_descriptions[unique_id].properties_conflict));
+ if(trg_descriptions[unique_id].properties_conflict)
geom->merge_conflict_count++;
}