Skip to content

Commit

Permalink
Make use of geogram in bot manifold contional on finding geogram
Browse files Browse the repository at this point in the history
  • Loading branch information
starseeker committed Jan 27, 2024
1 parent 90ea2ba commit 87e9369
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/libged/bot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ if(ASSETIMPORT_LIBRARIES)
add_definitions(-DUSE_ASSETIMPORT)
endif(ASSETIMPORT_LIBRARIES)

if(ASSETIMPORT_LIBRARY)
add_definitions(-DUSE_GEOGRAM)
endif(ASSETIMPORT_LIBRARY)

set(BOT_LIBS libged libbg libbu ${MANIFOLD_LIBRARIES} ${ASSETIMPORT_LIBRARIES} ${GEOGRAM_LIBRARY})


Expand Down
6 changes: 6 additions & 0 deletions src/libged/bot/manifold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "manifold/meshIO.h"
#endif

#ifdef USE_GEOGRAM
#include "geogram/basic/process.h"
#include <geogram/basic/command_line.h>
#include <geogram/basic/command_line_args.h>
Expand All @@ -57,6 +58,7 @@
#include "geogram/mesh/mesh_preprocessing.h"
#include "geogram/mesh/mesh_repair.h"
#include "geogram/mesh/mesh_fill_holes.h"
#endif

#include "bu/cmd.h"
#include "bu/color.h"
Expand Down Expand Up @@ -137,6 +139,7 @@ manifold_process(struct rt_bot_internal *bot, int repair)
return nbot;
}

#ifdef USE_GEOGRAM
static struct rt_bot_internal *
geogram_mesh_repair(struct rt_bot_internal *bot)
{
Expand Down Expand Up @@ -258,6 +261,7 @@ geogram_mesh_repair(struct rt_bot_internal *bot)
}
return nbot;
}
#endif

//#define IN_PLACE_REPAIR

Expand Down Expand Up @@ -344,9 +348,11 @@ _bot_cmd_manifold(void *bs, int argc, const char **argv)
return BRLCAD_OK;
}

#ifdef USE_GEOGRAM
// Not manifold, not fixed by the first pass, and we want to repair it.
// Time to attempt mesh repair
mbot = geogram_mesh_repair(bot);
#endif

if (!mbot) {
bu_vls_printf(gb->gedp->ged_result_str, "Unable to repair BoT %s", gb->dp->d_namep);
Expand Down

0 comments on commit 87e9369

Please sign in to comment.