city_generator2

Generated conformal 3D meshes representing a city
git clone git://git.meso-star.fr/city_generator2.git
Log | Files | Refs | README | LICENSE

commit f6d82fe535493c3078b06c2006a3ce744a56e7ea
parent d13129caf468003043cabbc6e2243984e1d72a92
Author: Benjamin Piaud <benjamin.piaud@meso-star.com>
Date:   Wed, 22 Feb 2023 15:35:20 +0100

Minor fix. Build adjoining cad only if required

Diffstat:
Msrc/cg_construction_mode_0.c | 4+++-
Msrc/cg_construction_mode_1.c | 15++++++++++-----
2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/cg_construction_mode_0.c b/src/cg_construction_mode_0.c @@ -554,7 +554,9 @@ build_cad_cmode_0 ERR(build_fake_ground(pg, &data_cad->fake_ground)); /* build adjoining envelop */ - ERR(build_adjoining(building->adjoining, building->adjoining_n, &adjoining_cad)); + if (building->adjoining_n > 0) { + ERR(build_adjoining(building->adjoining, building->adjoining_n, &adjoining_cad)); + } ERR(scad_scene_partition()); diff --git a/src/cg_construction_mode_1.c b/src/cg_construction_mode_1.c @@ -806,10 +806,13 @@ build_windows /* check if hole intersect adjoining_cad */ /* push only if no intersect */ - ERR(scad_intersect_geometries(NULL, &hole, 1, &adjoining_cad, 1, - &hole_adjoining_intersect)); - - ERR(scad_geometry_get_count(hole_adjoining_intersect, &count)); + if (adjoining_cad) { + ERR(scad_intersect_geometries(NULL, &hole, 1, &adjoining_cad, 1, + &hole_adjoining_intersect)); + ERR(scad_geometry_get_count(hole_adjoining_intersect, &count)); + } else { + count = 0; + } if (count == 0) { ERR(darray_geometries_push_back(&hole_array, &hole)); @@ -1453,7 +1456,9 @@ build_cad_cmode_1 } /* build adjoining envelop */ - ERR(build_adjoining(building->adjoining, building->adjoining_n, &adjoining_cad)); + if (building->adjoining_n > 0) { + ERR(build_adjoining(building->adjoining, building->adjoining_n, &adjoining_cad)); + } /* windows */ if (data->glass_ratio > 0) {