Revision: 76083
          http://sourceforge.net/p/brlcad/code/76083
Author:   starseeker
Date:     2020-06-09 02:36:35 +0000 (Tue, 09 Jun 2020)
Log Message:
-----------
Revert most of the libgcv changes, and try the libdm approach from the branch 
of just using the export definition.  Plugins aren't going to be linked as 
libraries to executables, so they shouldn't need the dual behavior...

Modified Paths:
--------------
    brlcad/trunk/include/gcv/util.h
    brlcad/trunk/include/rt/tree.h
    brlcad/trunk/src/adrt/load_g.c
    brlcad/trunk/src/conv/CMakeLists.txt
    brlcad/trunk/src/conv/dxf/g-dxf.c
    brlcad/trunk/src/conv/g-egg.c
    brlcad/trunk/src/conv/raw/g-raw.c
    brlcad/trunk/src/conv/stl/g-stl.c
    brlcad/trunk/src/libgcv/CMakeLists.txt
    brlcad/trunk/src/libgcv/plugins/CMakeLists.txt
    brlcad/trunk/src/libgcv/plugins/decimate/decimate.c
    brlcad/trunk/src/libgcv/plugins/fastgen4/CMakeLists.txt
    brlcad/trunk/src/libgcv/plugins/fastgen4/fastgen4_read.c
    brlcad/trunk/src/libgcv/plugins/fastgen4/fastgen4_write.cpp
    brlcad/trunk/src/libgcv/plugins/gdal/CMakeLists.txt
    brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp
    brlcad/trunk/src/libgcv/plugins/obj/CMakeLists.txt
    brlcad/trunk/src/libgcv/plugins/obj/obj_read.c
    brlcad/trunk/src/libgcv/plugins/rhino/rhino_read.cpp
    brlcad/trunk/src/libgcv/plugins/stl/CMakeLists.txt
    brlcad/trunk/src/libgcv/plugins/stl/stl_read.c
    brlcad/trunk/src/libgcv/plugins/stl/stl_write.c
    brlcad/trunk/src/libgcv/plugins/vrml/CMakeLists.txt
    brlcad/trunk/src/libgcv/plugins/vrml/vrml_write.c
    brlcad/trunk/src/librt/CMakeLists.txt

Added Paths:
-----------
    brlcad/trunk/src/libgcv/region_end.c
    brlcad/trunk/src/libgcv/region_end_mc.c

Removed Paths:
-------------
    brlcad/trunk/src/librt/region_end.c
    brlcad/trunk/src/librt/region_end_mc.c

Modified: brlcad/trunk/include/gcv/util.h
===================================================================
--- brlcad/trunk/include/gcv/util.h     2020-06-09 02:23:10 UTC (rev 76082)
+++ brlcad/trunk/include/gcv/util.h     2020-06-09 02:36:35 UTC (rev 76083)
@@ -57,6 +57,34 @@
 GCV_EXPORT extern int gcv_bot_is_orientable(const struct rt_bot_internal *bot);
 
 
+/**
+ * write_region is a function pointer to a routine that will
+ * write out the region in a given file format.
+ *
+ * This routine must be prepared to run in parallel.
+ */
+struct gcv_region_end_data
+{
+    void (*write_region)(struct nmgregion *r, const struct db_full_path 
*pathp, int region_id, int material_id, float color[3], void *client_data);
+    void *client_data;
+};
+
+/**
+ * Perform Boolean evaluation on a tree of tessellated leaf nodes.
+ *
+ * Usually specified as the db_walk_tree() region_end callback,
+ * calling this routine for each positive region encountered.
+ *
+ * The client_data parameter is expected to point to a struct 
gcv_region_end_data.
+ */
+GCV_EXPORT extern union tree *gcv_region_end(struct db_tree_state *tsp, const 
struct db_full_path *pathp, union tree *curtree, void *client_data);
+
+/**
+ * Exact same as gcv_region_end, except using the marching cubes algorithm.
+ */
+GCV_EXPORT extern union tree *gcv_region_end_mc(struct db_tree_state *tsp, 
const struct db_full_path *pathp, union tree *curtree, void *client_data);
+
+
 GCV_EXPORT extern union tree *gcv_bottess_region_end(struct db_tree_state 
*tsp, const struct db_full_path *pathp, union tree *curtree, void *client_data);
 
 

Modified: brlcad/trunk/include/rt/tree.h
===================================================================
--- brlcad/trunk/include/rt/tree.h      2020-06-09 02:23:10 UTC (rev 76082)
+++ brlcad/trunk/include/rt/tree.h      2020-06-09 02:36:35 UTC (rev 76083)
@@ -774,33 +774,7 @@
                                    struct resource *resp);
 
 
-/**
- * write_region is a function pointer to a routine that will
- * write out the region in a given file format.
- *
- * This routine must be prepared to run in parallel.
- */
-struct rt_region_end_data
-{
-    void (*write_region)(struct nmgregion *r, const struct db_full_path 
*pathp, int region_id, int material_id, float color[3], void *client_data);
-    void *client_data;
-};
 
-/**
- * Perform Boolean evaluation on a tree of tessellated leaf nodes.
- *
- * Usually specified as the db_walk_tree() region_end callback,
- * calling this routine for each positive region encountered.
- *
- * The client_data parameter is expected to point to a struct 
rt_region_end_data.
- */
-RT_EXPORT extern union tree *rt_region_end(struct db_tree_state *tsp, const 
struct db_full_path *pathp, union tree *curtree, void *client_data);
-
-/**
- * Exact same as rt_region_end, except using the marching cubes algorithm.
- */
-RT_EXPORT extern union tree *rt_region_end_mc(struct db_tree_state *tsp, const 
struct db_full_path *pathp, union tree *curtree, void *client_data);
-
 __END_DECLS
 
 #endif /* RT_TREE_H */

Modified: brlcad/trunk/src/adrt/load_g.c
===================================================================
--- brlcad/trunk/src/adrt/load_g.c      2020-06-09 02:23:10 UTC (rev 76082)
+++ brlcad/trunk/src/adrt/load_g.c      2020-06-09 02:36:35 UTC (rev 76083)
@@ -54,7 +54,7 @@
 static void nmg_to_adrt_gcvwrite(struct nmgregion *r, const struct 
db_full_path *pathp, int region_id, int material_id, float color[3], void 
*client_data);
 
 struct gcv_data {
-    struct rt_region_end_data region_end_data;
+    struct gcv_region_end_data region_end_data;
     struct adrt_mesh_s **meshes;
 };
 static struct gcv_data gcvwriter = {{nmg_to_adrt_gcvwrite, NULL}, NULL};
@@ -309,7 +309,7 @@
                        1,                      /* ncpu */
                        &tree_state,            /* initial tree state */
                        nmg_to_adrt_regstart,   /* region start function */
-                       rt_region_end,          /* region end function */
+                       gcv_region_end,         /* region end function */
                        nmg_booltree_leaf_tess, /* leaf func */
                        (void *)&gcvwriter);    /* client data */
 

Modified: brlcad/trunk/src/conv/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/conv/CMakeLists.txt        2020-06-09 02:23:10 UTC (rev 
76082)
+++ brlcad/trunk/src/conv/CMakeLists.txt        2020-06-09 02:36:35 UTC (rev 
76083)
@@ -57,8 +57,10 @@
 BRLCAD_ADDEXEC(g-dot g-dot.c "libged;libbu")
 
 BRLCAD_ADDEXEC(g-dxf dxf/g-dxf.c "librt;libgcv;libnmg;libbu")
+add_dependencies(g-dxf libgcv_plugins)
 
-BRLCAD_ADDEXEC(g-egg g-egg.c "libwdb;librt;libgcv;libnmg")
+BRLCAD_ADDEXEC(g-egg g-egg.c "libwdb;libgcv;libnmg")
+add_dependencies(g-egg libgcv_plugins)
 
 BRLCAD_ADDEXEC(g-nff g-nff.c "libwdb;libnmg;${M_LIBRARY}")
 

Modified: brlcad/trunk/src/conv/dxf/g-dxf.c
===================================================================
--- brlcad/trunk/src/conv/dxf/g-dxf.c   2020-06-09 02:23:10 UTC (rev 76082)
+++ brlcad/trunk/src/conv/dxf/g-dxf.c   2020-06-09 02:36:35 UTC (rev 76083)
@@ -366,7 +366,7 @@
 }
 
 
-static struct rt_region_end_data gcvwriter = {nmg_to_dxf, NULL};
+static struct gcv_region_end_data gcvwriter = {nmg_to_dxf, NULL};
 
 
 /**
@@ -378,7 +378,7 @@
  * 4. db_walk_tree (get_layer) for layer names only
  * 5. Initialize tree_state
  * 6. Initialize model (nmg)\
- * 7. db_walk_tree (rt_region_end)
+ * 7. db_walk_tree (gcv_region_end)
  * 8. Cleanup
  */
 int
@@ -532,9 +532,9 @@
                        1,                      /* ncpu */
                        &tree_state,
                        0,                      /* take all regions */
-                       rt_region_end,
+                       gcv_region_end,
                        nmg_booltree_leaf_tess,
-                       (void *)&gcvwriter);    /* callback for rt_region_end */
+                       (void *)&gcvwriter);    /* callback for gcv_region_end 
*/
 
     percent = 0;
     if (regions_tried>0) {

Modified: brlcad/trunk/src/conv/g-egg.c
===================================================================
--- brlcad/trunk/src/conv/g-egg.c       2020-06-09 02:23:10 UTC (rev 76082)
+++ brlcad/trunk/src/conv/g-egg.c       2020-06-09 02:36:35 UTC (rev 76083)
@@ -38,6 +38,8 @@
 #include <string.h>
 #include "bio.h"
 
+#include "gcv.h"
+
 /* interface headers */
 #include "bu/app.h"
 #include "bu/getopt.h"
@@ -44,7 +46,6 @@
 #include "vmath.h"
 #include "nmg.h"
 #include "rt/geom.h"
-#include "rt/tree.h"
 #include "raytrace.h"
 #include "gcv.h"
 
@@ -191,7 +192,7 @@
 
     int i, use_mc = 0, use_bottess = 0;
     struct egg_conv_data conv_data;
-    struct rt_region_end_data gcvwriter = {nmg_to_egg, NULL};
+    struct gcv_region_end_data gcvwriter = {nmg_to_egg, NULL};
 
     gcvwriter.client_data = (void *)&conv_data;
 
@@ -326,7 +327,7 @@
                            ncpu,               /* ncpu */
                            &tree_state,        /* state */
                            NULL,               /* start func */
-                           
use_mc?rt_region_end_mc:use_bottess?gcv_bottess_region_end:rt_region_end,   /* 
end func */
+                           
use_mc?gcv_region_end_mc:use_bottess?gcv_bottess_region_end:gcv_region_end, /* 
end func */
                            use_mc?NULL:nmg_booltree_leaf_tess, /* leaf func */
                            (void *)&gcvwriter);  /* client_data */
        fprintf(conv_data.fp, "}\n");

Modified: brlcad/trunk/src/conv/raw/g-raw.c
===================================================================
--- brlcad/trunk/src/conv/raw/g-raw.c   2020-06-09 02:23:10 UTC (rev 76082)
+++ brlcad/trunk/src/conv/raw/g-raw.c   2020-06-09 02:36:35 UTC (rev 76083)
@@ -44,7 +44,6 @@
 #include "vmath.h"
 #include "nmg.h"
 #include "rt/geom.h"
-#include "rt/tree.h"
 #include "raytrace.h"
 #include "gcv.h"
 
@@ -211,7 +210,7 @@
 }
 
 
-static struct rt_region_end_data gcvwriter = {nmg_to_raw, NULL};
+static struct gcv_region_end_data gcvwriter = {nmg_to_raw, NULL};
 
 
 int
@@ -350,7 +349,7 @@
            1,
            &tree_state,
            0,                  /* take all regions */
-           use_mc?rt_region_end_mc:rt_region_end,
+           use_mc?gcv_region_end_mc:gcv_region_end,
            use_mc?NULL:nmg_booltree_leaf_tess,
            (void *)&gcvwriter);
 

Modified: brlcad/trunk/src/conv/stl/g-stl.c
===================================================================
--- brlcad/trunk/src/conv/stl/g-stl.c   2020-06-09 02:23:10 UTC (rev 76082)
+++ brlcad/trunk/src/conv/stl/g-stl.c   2020-06-09 02:36:35 UTC (rev 76083)
@@ -44,7 +44,6 @@
 #include "vmath.h"
 #include "nmg.h"
 #include "rt/geom.h"
-#include "rt/tree.h"
 #include "raytrace.h"
 #include "gcv.h"
 
@@ -302,7 +301,7 @@
 }
 
 
-static struct rt_region_end_data gcvwriter = {nmg_to_stl, NULL};
+static struct gcv_region_end_data gcvwriter = {nmg_to_stl, NULL};
 
 
 int
@@ -475,7 +474,7 @@
                        1,
                        &tree_state,
                        0,                      /* take all regions */
-                       use_mc?rt_region_end_mc:rt_region_end,
+                       use_mc?gcv_region_end_mc:gcv_region_end,
                        use_mc?NULL:nmg_booltree_leaf_tess,
                        (void *)&gcvwriter);
 

Modified: brlcad/trunk/src/libgcv/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libgcv/CMakeLists.txt      2020-06-09 02:23:10 UTC (rev 
76082)
+++ brlcad/trunk/src/libgcv/CMakeLists.txt      2020-06-09 02:36:35 UTC (rev 
76083)
@@ -21,6 +21,8 @@
   bottess.c
   facetize.c
   gcv.c
+  region_end.c
+  region_end_mc.c
   tri_intersect.c
   )
 
@@ -31,9 +33,6 @@
 set_property(SOURCE gcv.c APPEND PROPERTY COMPILE_DEFINITIONS 
"LIBGCV_PLUGINS_PATH=\"${LIBGCV_PLUGINS_PATH}\"")
 set_property(SOURCE gcv.c APPEND PROPERTY COMPILE_DEFINITIONS 
"LIBGCV_PLUGIN_SUFFIX=\"${CMAKE_SHARED_LIBRARY_SUFFIX}\"")
 
-# Make sure anyone building the library builds the plugins
-add_dependencies(libgcv libgcv_plugins)
-
 enable_testing()
 BRLCAD_ADDEXEC(test_bottess test_bottess.c libgcv NO_INSTALL)
 if(HIDE_INTERNAL_SYMBOLS)

Modified: brlcad/trunk/src/libgcv/plugins/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libgcv/plugins/CMakeLists.txt      2020-06-09 02:23:10 UTC 
(rev 76082)
+++ brlcad/trunk/src/libgcv/plugins/CMakeLists.txt      2020-06-09 02:36:35 UTC 
(rev 76083)
@@ -4,7 +4,7 @@
 
 function(LIBGCV_ADD_PLUGIN plugin_name sources libs)
   set(target_name libgcv_${plugin_name})
-  BRLCAD_ADDLIB(${target_name} "${sources}" "${libs}" SHARED NO_INSTALL FOLDER 
"LibGCV Plugins")
+  BRLCAD_ADDLIB(${target_name} "${sources}" "libgcv;${libs}" SHARED NO_INSTALL 
FOLDER "LibGCV Plugins")
   target_include_directories(${target_name} PRIVATE "${GCV_INCLUDE_DIRS}")
 
   set(DIR_TYPES LIBRARY RUNTIME ARCHIVE)
@@ -27,15 +27,6 @@
     endforeach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
   endif(NOT CMAKE_CONFIGURATION_TYPES)
 
-  # We're using GCV_EXPORT for these plugins, so we need to set the 
DLL_EXPORTS accordingly
-  if(HIDE_INTERNAL_SYMBOLS)
-    set_property(TARGET ${target_name} APPEND PROPERTY COMPILE_DEFINITIONS 
"GCV_DLL_EXPORTS")
-    set_property(TARGET ${target_name} APPEND PROPERTY 
INTERFACE_COMPILE_DEFINITIONS "GCV_DLL_EXPORTS")
-    if (TARGET ${target_name}-obj)
-      set_property(TARGET ${target_name}-obj APPEND PROPERTY 
COMPILE_DEFINITIONS "GCV_DLL_EXPORTS")
-    endif (TARGET ${target_name}-obj)
-  endif(HIDE_INTERNAL_SYMBOLS)
-
   install(TARGETS ${target_name}
     RUNTIME DESTINATION ${BIN_DIR}/${LIBGCV_PLUGINS_DIRECTORY}
     LIBRARY DESTINATION ${LIB_DIR}/${LIBGCV_PLUGINS_DIRECTORY}

Modified: brlcad/trunk/src/libgcv/plugins/decimate/decimate.c
===================================================================
--- brlcad/trunk/src/libgcv/plugins/decimate/decimate.c 2020-06-09 02:23:10 UTC 
(rev 76082)
+++ brlcad/trunk/src/libgcv/plugins/decimate/decimate.c 2020-06-09 02:36:35 UTC 
(rev 76083)
@@ -101,7 +101,7 @@
 static const struct gcv_filter * const filters[] = {&gcv_filter_decimate, 
NULL};
 const struct gcv_plugin gcv_plugin_info_s = {filters};
 
-GCV_EXPORT const struct gcv_plugin *
+COMPILER_DLLEXPORT const struct gcv_plugin *
        gcv_plugin_info(){ return &gcv_plugin_info_s; }
 
 /*

Modified: brlcad/trunk/src/libgcv/plugins/fastgen4/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libgcv/plugins/fastgen4/CMakeLists.txt     2020-06-09 
02:23:10 UTC (rev 76082)
+++ brlcad/trunk/src/libgcv/plugins/fastgen4/CMakeLists.txt     2020-06-09 
02:36:35 UTC (rev 76083)
@@ -1,4 +1,4 @@
-LIBGCV_ADD_PLUGIN(fastgen4 "fastgen4_read.c;fastgen4_write.cpp" 
"libwdb;librt;libbu")
+LIBGCV_ADD_PLUGIN(fastgen4 "fastgen4_read.c;fastgen4_write.cpp" "librt;libbu")
 
 CMAKEFILES(NOTES)
 CMAKEFILES(CMakeLists.txt)

Modified: brlcad/trunk/src/libgcv/plugins/fastgen4/fastgen4_read.c
===================================================================
--- brlcad/trunk/src/libgcv/plugins/fastgen4/fastgen4_read.c    2020-06-09 
02:23:10 UTC (rev 76082)
+++ brlcad/trunk/src/libgcv/plugins/fastgen4/fastgen4_read.c    2020-06-09 
02:36:35 UTC (rev 76083)
@@ -2988,7 +2988,7 @@
 
 const struct gcv_plugin gcv_plugin_info_s = { filters };
 
-GCV_EXPORT const struct gcv_plugin *
+COMPILER_DLLEXPORT const struct gcv_plugin *
 gcv_plugin_info(){ return &gcv_plugin_info_s; }
 
 /*

Modified: brlcad/trunk/src/libgcv/plugins/fastgen4/fastgen4_write.cpp
===================================================================
--- brlcad/trunk/src/libgcv/plugins/fastgen4/fastgen4_write.cpp 2020-06-09 
02:23:10 UTC (rev 76082)
+++ brlcad/trunk/src/libgcv/plugins/fastgen4/fastgen4_write.cpp 2020-06-09 
02:36:35 UTC (rev 76083)
@@ -2522,8 +2522,8 @@
     if (tree_state->ts_mater.ma_color_valid)
        section.set_color(color_from_floats(tree_state->ts_mater.ma_color));
 
-    rt_region_end_data gcv_data = {write_nmg_region, &data};
-    return rt_region_end(tree_state, path, current_tree, &gcv_data);
+    gcv_region_end_data gcv_data = {write_nmg_region, &data};
+    return gcv_region_end(tree_state, path, current_tree, &gcv_data);
 }
 
 

Modified: brlcad/trunk/src/libgcv/plugins/gdal/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libgcv/plugins/gdal/CMakeLists.txt 2020-06-09 02:23:10 UTC 
(rev 76082)
+++ brlcad/trunk/src/libgcv/plugins/gdal/CMakeLists.txt 2020-06-09 02:36:35 UTC 
(rev 76083)
@@ -1,6 +1,6 @@
 if(GDAL_LIBRARY AND GDAL_INCLUDE_DIR)
   include_directories(SYSTEM ${GDAL_INCLUDE_DIR})
-  LIBGCV_ADD_PLUGIN(gdal "gdal.cpp" "libwdb;librt;libbu;${GDAL_LIBRARY}")
+  LIBGCV_ADD_PLUGIN(gdal "gdal.cpp" "librt;libbu;${GDAL_LIBRARY}")
 endif(GDAL_LIBRARY AND GDAL_INCLUDE_DIR)
 
 CMAKEFILES(gdal.cpp)

Modified: brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp
===================================================================
--- brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp       2020-06-09 02:23:10 UTC 
(rev 76082)
+++ brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp       2020-06-09 02:36:35 UTC 
(rev 76083)
@@ -483,7 +483,7 @@
 
     static const struct gcv_filter * const filters[] = {&gcv_conv_gdal_read, 
NULL};
     const struct gcv_plugin gcv_plugin_info_s = { filters };
-    GCV_EXPORT const struct gcv_plugin *gcv_plugin_info(){return 
&gcv_plugin_info_s;}
+    COMPILER_DLLEXPORT const struct gcv_plugin *gcv_plugin_info(){return 
&gcv_plugin_info_s;}
 }
 
 // Local Variables:

Modified: brlcad/trunk/src/libgcv/plugins/obj/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libgcv/plugins/obj/CMakeLists.txt  2020-06-09 02:23:10 UTC 
(rev 76082)
+++ brlcad/trunk/src/libgcv/plugins/obj/CMakeLists.txt  2020-06-09 02:36:35 UTC 
(rev 76083)
@@ -12,7 +12,7 @@
   ${CMAKE_CURRENT_BINARY_DIR}/wfobj
   )
 
-LIBGCV_ADD_PLUGIN(obj "obj_read.c;obj_write.c;tri_face.c" 
"libwdb;librt;libwfobj")
+LIBGCV_ADD_PLUGIN(obj "obj_read.c;obj_write.c;tri_face.c" "librt;libwfobj")
 
 set(obj_ignore_files
   CMakeLists.txt

Modified: brlcad/trunk/src/libgcv/plugins/obj/obj_read.c
===================================================================
--- brlcad/trunk/src/libgcv/plugins/obj/obj_read.c      2020-06-09 02:23:10 UTC 
(rev 76082)
+++ brlcad/trunk/src/libgcv/plugins/obj/obj_read.c      2020-06-09 02:36:35 UTC 
(rev 76083)
@@ -3614,7 +3614,7 @@
 
 const struct gcv_plugin gcv_plugin_info_s = { filters };
 
-GCV_EXPORT const struct gcv_plugin *
+COMPILER_DLLEXPORT const struct gcv_plugin *
 gcv_plugin_info(){ return &gcv_plugin_info_s; }
 
 /*

Modified: brlcad/trunk/src/libgcv/plugins/rhino/rhino_read.cpp
===================================================================
--- brlcad/trunk/src/libgcv/plugins/rhino/rhino_read.cpp        2020-06-09 
02:23:10 UTC (rev 76082)
+++ brlcad/trunk/src/libgcv/plugins/rhino/rhino_read.cpp        2020-06-09 
02:36:35 UTC (rev 76083)
@@ -993,7 +993,7 @@
 extern "C"
 {
     extern const gcv_plugin gcv_plugin_info_s = {rhino_read::filters};
-    GCV_EXPORT const struct gcv_plugin *
+    COMPILER_DLLEXPORT const struct gcv_plugin *
     gcv_plugin_info()
     {
        return &gcv_plugin_info_s;

Modified: brlcad/trunk/src/libgcv/plugins/stl/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libgcv/plugins/stl/CMakeLists.txt  2020-06-09 02:23:10 UTC 
(rev 76082)
+++ brlcad/trunk/src/libgcv/plugins/stl/CMakeLists.txt  2020-06-09 02:36:35 UTC 
(rev 76083)
@@ -1,2 +1,2 @@
-LIBGCV_ADD_PLUGIN(stl "stl_read.c;stl_write.c" "libwdb;librt")
+LIBGCV_ADD_PLUGIN(stl "stl_read.c;stl_write.c" "librt")
 CMAKEFILES(CMakeLists.txt)

Modified: brlcad/trunk/src/libgcv/plugins/stl/stl_read.c
===================================================================
--- brlcad/trunk/src/libgcv/plugins/stl/stl_read.c      2020-06-09 02:23:10 UTC 
(rev 76082)
+++ brlcad/trunk/src/libgcv/plugins/stl/stl_read.c      2020-06-09 02:36:35 UTC 
(rev 76083)
@@ -670,7 +670,7 @@
 
 const struct gcv_plugin gcv_plugin_info_s = { filters };
 
-GCV_EXPORT const struct gcv_plugin *
+COMPILER_DLLEXPORT const struct gcv_plugin *
 gcv_plugin_info(){ return &gcv_plugin_info_s; }
 
 /*

Modified: brlcad/trunk/src/libgcv/plugins/stl/stl_write.c
===================================================================
--- brlcad/trunk/src/libgcv/plugins/stl/stl_write.c     2020-06-09 02:23:10 UTC 
(rev 76082)
+++ brlcad/trunk/src/libgcv/plugins/stl/stl_write.c     2020-06-09 02:36:35 UTC 
(rev 76083)
@@ -350,7 +350,7 @@
     double percent;
     struct db_tree_state tree_state;
     struct conversion_state state;
-    struct rt_region_end_data gcvwriter;
+    struct gcv_region_end_data gcvwriter;
 
     gcvwriter.write_region = nmg_to_stl;
     gcvwriter.client_data = &state;
@@ -414,7 +414,7 @@
                        1,
                        &tree_state,
                        0,                      /* take all regions */
-                       (gcv_options->tessellation_algorithm == 
GCV_TESS_MARCHING_CUBES)?rt_region_end_mc:rt_region_end,
+                       (gcv_options->tessellation_algorithm == 
GCV_TESS_MARCHING_CUBES)?gcv_region_end_mc:gcv_region_end,
                        (gcv_options->tessellation_algorithm == 
GCV_TESS_MARCHING_CUBES)?NULL:nmg_booltree_leaf_tess,
                        (void *)&gcvwriter);
 

Modified: brlcad/trunk/src/libgcv/plugins/vrml/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libgcv/plugins/vrml/CMakeLists.txt 2020-06-09 02:23:10 UTC 
(rev 76082)
+++ brlcad/trunk/src/libgcv/plugins/vrml/CMakeLists.txt 2020-06-09 02:36:35 UTC 
(rev 76083)
@@ -10,7 +10,7 @@
   )
 
 
-LIBGCV_ADD_PLUGIN(vrml "${LIBGCV_VRML_SOURCES}" "libwdb;librt;libbn;libbu")
+LIBGCV_ADD_PLUGIN(vrml "${LIBGCV_VRML_SOURCES}" "librt;libbn;libbu")
 
 CMAKEFILES(
   CMakeLists.txt

Modified: brlcad/trunk/src/libgcv/plugins/vrml/vrml_write.c
===================================================================
--- brlcad/trunk/src/libgcv/plugins/vrml/vrml_write.c   2020-06-09 02:23:10 UTC 
(rev 76082)
+++ brlcad/trunk/src/libgcv/plugins/vrml/vrml_write.c   2020-06-09 02:36:35 UTC 
(rev 76083)
@@ -1386,7 +1386,7 @@
 
 const struct gcv_plugin gcv_plugin_info_s = { filters };
 
-GCV_EXPORT const struct gcv_plugin *
+COMPILER_DLLEXPORT const struct gcv_plugin *
 gcv_plugin_info(){ return &gcv_plugin_info_s; }
 
 /*

Copied: brlcad/trunk/src/libgcv/region_end.c (from rev 76071, 
brlcad/trunk/src/libgcv/region_end.c)
===================================================================
--- brlcad/trunk/src/libgcv/region_end.c                                (rev 0)
+++ brlcad/trunk/src/libgcv/region_end.c        2020-06-09 02:36:35 UTC (rev 
76083)
@@ -0,0 +1,216 @@
+/*                    R E G I O N _ E N D . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file libgcv/region_end.c
+ *
+ * Routines to process regions during a db_walk_tree.
+ *
+ */
+
+#include "common.h"
+
+#include "bu/parallel.h"
+#include "rt/wdb.h"
+#include "rt/global.h"
+#include "gcv.h"
+
+
+union tree *
+_gcv_cleanup(int state, union tree *tp)
+{
+    /* restore previous debug state */
+    nmg_debug = state;
+
+    /* Dispose of original tree, so that all associated dynamic memory
+     * is released now, not at the end of all regions.  A return of
+     * TREE_NULL from this routine signals an error, and there is no
+     * point to adding _another_ message to our output, so we need to
+     * cons up an OP_NOP node to return.
+     */
+    db_free_tree(tp, &rt_uniresource); /* Does an nmg_kr() */
+
+    BU_ALLOC(tp, union tree);
+    RT_TREE_INIT(tp);
+    tp->tr_op = OP_NOP;
+    return tp;
+}
+
+
+union tree *
+gcv_region_end(struct db_tree_state *tsp, const struct db_full_path *pathp, 
union tree *curtree, void *client_data)
+{
+    union tree *tp = NULL;
+    union tree *ret_tree = NULL;
+    struct nmgregion *r = NULL;
+    struct shell *s = NULL;
+    struct bu_list vhead;
+
+    int empty_region = 0;
+    int empty_model = 0;
+    int NMG_debug_state = 0;
+
+    struct gcv_region_end_data *data = (struct gcv_region_end_data 
*)client_data;
+
+    if (!tsp || !curtree || !pathp || !client_data) {
+       bu_log("INTERNAL ERROR: gcv_region_end missing parameters\n");
+       return TREE_NULL;
+    }
+
+    if (!data->write_region) {
+       bu_log("INTERNAL ERROR: gcv_region_end missing conversion callback 
function\n");
+       return TREE_NULL;
+    }
+
+    RT_CK_FULL_PATH(pathp);
+    RT_CK_TREE(curtree);
+    BG_CK_TESS_TOL(tsp->ts_ttol);
+    BN_CK_TOL(tsp->ts_tol);
+    NMG_CK_MODEL(*tsp->ts_m);
+
+    BU_LIST_INIT(&vhead);
+
+    if (curtree->tr_op == OP_NOP)
+       return curtree;
+
+    /* get a copy to play with as the parameters might get clobbered
+     * by a longjmp.  FIXME: db_dup_subtree() doesn't create real copies
+     */
+    tp = db_dup_subtree(curtree, &rt_uniresource);
+
+    /* FIXME: we can't free curtree until we get a "real" copy form
+     * db_dup_subtree().  right now we get a fake copy just so we can
+     * keep the compiler quiet about clobbering curtree during longjmp
+     */
+    /* db_free_tree(curtree, &rt_uniresource); */
+
+    /* Sometimes the NMG library adds debugging bits when it detects
+     * an internal error, before bombing.  Stash.
+     */
+    NMG_debug_state = nmg_debug;
+
+    if (!BU_SETJUMP) {
+       /* try */
+       /* perform boolean evaluation on the NMG, presently modifies
+        * curtree to an evaluated result and returns it if the evaluation
+        * is successful.
+        */
+       ret_tree = nmg_booltree_evaluate(tp, &RTG.rtg_vlfree, tsp->ts_tol, 
&rt_uniresource);
+    } else {
+       /* catch */
+       /* Error, bail out */
+       char *sofar;
+
+       /* Relinquish bomb protection */
+       BU_UNSETJUMP;
+
+       sofar = db_path_to_string(pathp);
+       bu_log("FAILED in boolean evaluation: %s\n", sofar);
+       bu_free((char *)sofar, "sofar");
+
+       /* Release any intersector 2d tables */
+       nmg_isect2d_final_cleanup();
+
+       /* Get rid of (m)any other intermediate structures */
+       if ((*tsp->ts_m)->magic == NMG_MODEL_MAGIC)
+           nmg_km(*tsp->ts_m);
+       else
+           bu_log("WARNING: tsp->ts_m pointer corrupted, ignoring it.\n");
+
+       /* Now, make a new, clean model structure for next pass. */
+       *tsp->ts_m = nmg_mm();
+
+       return _gcv_cleanup(NMG_debug_state, tp);
+    } BU_UNSETJUMP; /* Relinquish bomb protection */
+
+    r = (struct nmgregion *)NULL;
+    if (ret_tree)
+       r = ret_tree->tr_d.td_r;
+
+    if (r == (struct nmgregion *)NULL)
+       return _gcv_cleanup(NMG_debug_state, tp);
+
+    /* Kill cracks */
+    s = BU_LIST_FIRST(shell, &r->s_hd);
+    while (BU_LIST_NOT_HEAD(&s->l, &r->s_hd)) {
+       struct shell *next_s;
+
+       next_s = BU_LIST_PNEXT(shell, &s->l);
+       if (nmg_kill_cracks(s)) {
+           if (nmg_ks(s)) {
+               empty_region = 1;
+               break;
+           }
+       }
+       s = next_s;
+    }
+    if (empty_region)
+       return _gcv_cleanup(NMG_debug_state, tp);
+
+    /* kill zero length edgeuses */
+    empty_model = nmg_kill_zero_length_edgeuses(*tsp->ts_m);
+    if (empty_model)
+       return _gcv_cleanup(NMG_debug_state, tp);
+
+    if (BU_SETJUMP) {
+       /* Error, bail out */
+       char *sofar;
+
+       /* Relinquish bomb protection */
+       BU_UNSETJUMP;
+
+       sofar = db_path_to_string(pathp);
+       bu_log("FAILED in triangulator: %s\n", sofar);
+       bu_free((char *)sofar, "sofar");
+
+       /* Release any intersector 2d tables */
+       nmg_isect2d_final_cleanup();
+
+       /* Get rid of (m)any other intermediate structures */
+       if ((*tsp->ts_m)->magic == NMG_MODEL_MAGIC)
+           nmg_km(*tsp->ts_m);
+       else
+           bu_log("WARNING: tsp->ts_m pointer corrupted, ignoring it.\n");
+
+       /* Now, make a new, clean model structure for next pass. */
+       *tsp->ts_m = nmg_mm();
+       nmg_kr(r);
+
+       return _gcv_cleanup(NMG_debug_state, tp);
+    } else {
+
+       /* Write the region out */
+       data->write_region(r, pathp, tsp->ts_regionid, tsp->ts_gmater, 
tsp->ts_mater.ma_color, data->client_data);
+
+    } BU_UNSETJUMP; /* Relinquish bomb protection */
+
+    nmg_kr(r);
+
+    return _gcv_cleanup(NMG_debug_state, tp);
+}
+
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */

Copied: brlcad/trunk/src/libgcv/region_end_mc.c (from rev 76071, 
brlcad/trunk/src/libgcv/region_end_mc.c)
===================================================================
--- brlcad/trunk/src/libgcv/region_end_mc.c                             (rev 0)
+++ brlcad/trunk/src/libgcv/region_end_mc.c     2020-06-09 02:36:35 UTC (rev 
76083)
@@ -0,0 +1,190 @@
+/*                 R E G I O N _ E N D _ M C . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+
+/** @file libgcv/region_end.c
+ *
+ * Routines to process regions during a db_walk_tree using the marching cubes
+ * algorithm.
+ *
+ */
+
+#include "common.h"
+
+#include "bu/parallel.h"
+#include "rt/rt_instance.h"
+#include "gcv.h"
+
+
+/* in region_end.c */
+union tree * _gcv_cleanup(int state, union tree *tp);
+
+union tree *
+gcv_region_end_mc(struct db_tree_state *tsp, const struct db_full_path *pathp, 
union tree *curtree, void *client_data)
+{
+    union tree *tp = NULL;
+    struct model *m = NULL;
+    struct nmgregion *r = NULL;
+    struct shell *s = NULL;
+    struct bu_list vhead;
+
+    int empty_region = 0;
+    int empty_model = 0;
+    int NMG_debug_state = 0;
+    int count = 0;
+
+    struct gcv_region_end_data *data = (struct gcv_region_end_data 
*)client_data;
+
+    if (!tsp || !pathp || !client_data) {
+       bu_log("INTERNAL ERROR: gcv_region_end_mc missing parameters\n");
+       return TREE_NULL;
+    }
+
+    if (!data->write_region) {
+       bu_log("INTERNAL ERROR: gcv_region_end missing conversion callback 
function\n");
+       return TREE_NULL;
+    }
+
+    RT_CK_FULL_PATH(pathp);
+    RT_CK_TREE(curtree);
+    BG_CK_TESS_TOL(tsp->ts_ttol);
+    BN_CK_TOL(tsp->ts_tol);
+    NMG_CK_MODEL(*tsp->ts_m);
+
+    BU_LIST_INIT(&vhead);
+
+    /*
+      if (curtree->tr_op == OP_NOP)
+      return 0;
+    */
+
+
+    /* get a copy to play with as the parameters might get clobbered
+     * by a longjmp.  FIXME: db_dup_subtree() doesn't create real copies
+     */
+    tp = db_dup_subtree(curtree, &rt_uniresource);
+
+    /* FIXME: we can't free curtree until we get a "real" copy form
+     * db_dup_subtree().  right now we get a fake copy just so we can
+     * keep the compiler quiet about clobbering curtree during longjmp
+     */
+    /* db_free_tree(curtree, &rt_uniresource); */
+
+    /* Sometimes the NMG library adds debugging bits when it detects
+     * an internal error, before bombing.  Stash.
+     */
+    NMG_debug_state = nmg_debug;
+
+    m = nmg_mmr();
+    r = nmg_mrsv(m);
+    s = BU_LIST_FIRST(shell, &r->s_hd);
+
+    if (tsp->ts_rtip == NULL)
+       tsp->ts_rtip = rt_new_rti(tsp->ts_dbip);
+
+    count += nmg_mc_evaluate (s, tsp->ts_rtip, pathp, tsp->ts_ttol, 
tsp->ts_tol);
+
+    /* empty region? */
+    if (count == 0) {
+       char *str_path = db_path_to_string(pathp);
+       bu_log("Region %s appears to be empty.\n", str_path);
+       bu_free(str_path, "str_path");
+       return TREE_NULL;
+    }
+
+    /*
+      bu_log("Target is shot, %d triangles seen.\n", count);
+
+      bu_log("Fusing\n"); fflush(stdout);
+      nmg_model_fuse(m, tsp->ts_tol);
+      bu_log("Done\n"); fflush(stdout);
+    */
+
+    /* Kill cracks */
+    while (BU_LIST_NOT_HEAD(&s->l, &r->s_hd)) {
+       struct shell *next_s;
+
+       next_s = BU_LIST_PNEXT(shell, &s->l);
+       if (nmg_kill_cracks(s)) {
+           if (nmg_ks(s)) {
+               empty_region = 1;
+               break;
+           }
+       }
+       /*
+         nmg_shell_coplanar_face_merge(s, tsp->ts_tol, 42);
+       */
+       s = next_s;
+    }
+    if (empty_region)
+       return _gcv_cleanup(NMG_debug_state, tp);
+
+    /* kill zero length edgeuses */
+    empty_model = nmg_kill_zero_length_edgeuses(*tsp->ts_m);
+    if (empty_model)
+       return _gcv_cleanup(NMG_debug_state, tp);
+
+    if (!BU_SETJUMP) {
+       /* try */
+       /* Write the region out */
+       data->write_region(r, pathp, tsp->ts_regionid, tsp->ts_gmater, 
tsp->ts_mater.ma_color, data->client_data);
+    } else {
+       /* catch */
+       /* Error, bail out */
+       char *sofar;
+
+       /* Relinquish bomb protection */
+       BU_UNSETJUMP;
+
+       sofar = db_path_to_string(pathp);
+       bu_log("FAILED in triangulator: %s\n", sofar);
+       bu_free((char *)sofar, "sofar");
+
+       /* Release any intersector 2d tables */
+       nmg_isect2d_final_cleanup();
+
+       /* Get rid of (m)any other intermediate structures */
+       if ((*tsp->ts_m)->magic == NMG_MODEL_MAGIC)
+           nmg_km(*tsp->ts_m);
+       else
+           bu_log("WARNING: tsp->ts_m pointer corrupted, ignoring it.\n");
+
+       /* Now, make a new, clean model structure for next pass. */
+       *tsp->ts_m = nmg_mm();
+       nmg_kr(r);
+
+       return _gcv_cleanup(NMG_debug_state, tp);
+
+    } BU_UNSETJUMP; /* Relinquish bomb protection */
+
+    nmg_kr(r);
+
+    return _gcv_cleanup(NMG_debug_state, tp);
+}
+
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */

Modified: brlcad/trunk/src/librt/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/librt/CMakeLists.txt       2020-06-09 02:23:10 UTC (rev 
76082)
+++ brlcad/trunk/src/librt/CMakeLists.txt       2020-06-09 02:36:35 UTC (rev 
76083)
@@ -211,8 +211,6 @@
   primitives/xxx/xxx.c
   reduce.c
   reduce_db.cpp
-  region_end.c
-  region_end_mc.c
   regionfix.c
   roots.c
   search.c

Deleted: brlcad/trunk/src/librt/region_end.c
===================================================================
--- brlcad/trunk/src/librt/region_end.c 2020-06-09 02:23:10 UTC (rev 76082)
+++ brlcad/trunk/src/librt/region_end.c 2020-06-09 02:36:35 UTC (rev 76083)
@@ -1,216 +0,0 @@
-/*                    R E G I O N _ E N D . C
- * BRL-CAD
- *
- * Copyright (c) 2008-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file libgcv/region_end.c
- *
- * Routines to process regions during a db_walk_tree.
- *
- */
-
-#include "common.h"
-
-#include "bu/parallel.h"
-#include "rt/wdb.h"
-#include "rt/global.h"
-#include "gcv.h"
-
-
-static union tree *
-_rt_region_end_cleanup(int state, union tree *tp)
-{
-    /* restore previous debug state */
-    nmg_debug = state;
-
-    /* Dispose of original tree, so that all associated dynamic memory
-     * is released now, not at the end of all regions.  A return of
-     * TREE_NULL from this routine signals an error, and there is no
-     * point to adding _another_ message to our output, so we need to
-     * cons up an OP_NOP node to return.
-     */
-    db_free_tree(tp, &rt_uniresource); /* Does an nmg_kr() */
-
-    BU_ALLOC(tp, union tree);
-    RT_TREE_INIT(tp);
-    tp->tr_op = OP_NOP;
-    return tp;
-}
-
-
-union tree *
-rt_region_end(struct db_tree_state *tsp, const struct db_full_path *pathp, 
union tree *curtree, void *client_data)
-{
-    union tree *tp = NULL;
-    union tree *ret_tree = NULL;
-    struct nmgregion *r = NULL;
-    struct shell *s = NULL;
-    struct bu_list vhead;
-
-    int empty_region = 0;
-    int empty_model = 0;
-    int NMG_debug_state = 0;
-
-    struct rt_region_end_data *data = (struct rt_region_end_data *)client_data;
-
-    if (!tsp || !curtree || !pathp || !client_data) {
-       bu_log("INTERNAL ERROR: rt_region_end_region_end missing parameters\n");
-       return TREE_NULL;
-    }
-
-    if (!data->write_region) {
-       bu_log("INTERNAL ERROR: rt_region_end_region_end missing conversion 
callback function\n");
-       return TREE_NULL;
-    }
-
-    RT_CK_FULL_PATH(pathp);
-    RT_CK_TREE(curtree);
-    BG_CK_TESS_TOL(tsp->ts_ttol);
-    BN_CK_TOL(tsp->ts_tol);
-    NMG_CK_MODEL(*tsp->ts_m);
-
-    BU_LIST_INIT(&vhead);
-
-    if (curtree->tr_op == OP_NOP)
-       return curtree;
-
-    /* get a copy to play with as the parameters might get clobbered
-     * by a longjmp.  FIXME: db_dup_subtree() doesn't create real copies
-     */
-    tp = db_dup_subtree(curtree, &rt_uniresource);
-
-    /* FIXME: we can't free curtree until we get a "real" copy form
-     * db_dup_subtree().  right now we get a fake copy just so we can
-     * keep the compiler quiet about clobbering curtree during longjmp
-     */
-    /* db_free_tree(curtree, &rt_uniresource); */
-
-    /* Sometimes the NMG library adds debugging bits when it detects
-     * an internal error, before bombing.  Stash.
-     */
-    NMG_debug_state = nmg_debug;
-
-    if (!BU_SETJUMP) {
-       /* try */
-       /* perform boolean evaluation on the NMG, presently modifies
-        * curtree to an evaluated result and returns it if the evaluation
-        * is successful.
-        */
-       ret_tree = nmg_booltree_evaluate(tp, &RTG.rtg_vlfree, tsp->ts_tol, 
&rt_uniresource);
-    } else {
-       /* catch */
-       /* Error, bail out */
-       char *sofar;
-
-       /* Relinquish bomb protection */
-       BU_UNSETJUMP;
-
-       sofar = db_path_to_string(pathp);
-       bu_log("FAILED in boolean evaluation: %s\n", sofar);
-       bu_free((char *)sofar, "sofar");
-
-       /* Release any intersector 2d tables */
-       nmg_isect2d_final_cleanup();
-
-       /* Get rid of (m)any other intermediate structures */
-       if ((*tsp->ts_m)->magic == NMG_MODEL_MAGIC)
-           nmg_km(*tsp->ts_m);
-       else
-           bu_log("WARNING: tsp->ts_m pointer corrupted, ignoring it.\n");
-
-       /* Now, make a new, clean model structure for next pass. */
-       *tsp->ts_m = nmg_mm();
-
-       return _rt_region_end_cleanup(NMG_debug_state, tp);
-    } BU_UNSETJUMP; /* Relinquish bomb protection */
-
-    r = (struct nmgregion *)NULL;
-    if (ret_tree)
-       r = ret_tree->tr_d.td_r;
-
-    if (r == (struct nmgregion *)NULL)
-       return _rt_region_end_cleanup(NMG_debug_state, tp);
-
-    /* Kill cracks */
-    s = BU_LIST_FIRST(shell, &r->s_hd);
-    while (BU_LIST_NOT_HEAD(&s->l, &r->s_hd)) {
-       struct shell *next_s;
-
-       next_s = BU_LIST_PNEXT(shell, &s->l);
-       if (nmg_kill_cracks(s)) {
-           if (nmg_ks(s)) {
-               empty_region = 1;
-               break;
-           }
-       }
-       s = next_s;
-    }
-    if (empty_region)
-       return _rt_region_end_cleanup(NMG_debug_state, tp);
-
-    /* kill zero length edgeuses */
-    empty_model = nmg_kill_zero_length_edgeuses(*tsp->ts_m);
-    if (empty_model)
-       return _rt_region_end_cleanup(NMG_debug_state, tp);
-
-    if (BU_SETJUMP) {
-       /* Error, bail out */
-       char *sofar;
-
-       /* Relinquish bomb protection */
-       BU_UNSETJUMP;
-
-       sofar = db_path_to_string(pathp);
-       bu_log("FAILED in triangulator: %s\n", sofar);
-       bu_free((char *)sofar, "sofar");
-
-       /* Release any intersector 2d tables */
-       nmg_isect2d_final_cleanup();
-
-       /* Get rid of (m)any other intermediate structures */
-       if ((*tsp->ts_m)->magic == NMG_MODEL_MAGIC)
-           nmg_km(*tsp->ts_m);
-       else
-           bu_log("WARNING: tsp->ts_m pointer corrupted, ignoring it.\n");
-
-       /* Now, make a new, clean model structure for next pass. */
-       *tsp->ts_m = nmg_mm();
-       nmg_kr(r);
-
-       return _rt_region_end_cleanup(NMG_debug_state, tp);
-    } else {
-
-       /* Write the region out */
-       data->write_region(r, pathp, tsp->ts_regionid, tsp->ts_gmater, 
tsp->ts_mater.ma_color, data->client_data);
-
-    } BU_UNSETJUMP; /* Relinquish bomb protection */
-
-    nmg_kr(r);
-
-    return _rt_region_end_cleanup(NMG_debug_state, tp);
-}
-
-
-/*
- * Local Variables:
- * tab-width: 8
- * mode: C
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */

Deleted: brlcad/trunk/src/librt/region_end_mc.c
===================================================================
--- brlcad/trunk/src/librt/region_end_mc.c      2020-06-09 02:23:10 UTC (rev 
76082)
+++ brlcad/trunk/src/librt/region_end_mc.c      2020-06-09 02:36:35 UTC (rev 
76083)
@@ -1,206 +0,0 @@
-/*                 R E G I O N _ E N D _ M C . C
- * BRL-CAD
- *
- * Copyright (c) 2008-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-
-/** @file librt/region_end.c
- *
- * Routines to process regions during a db_walk_tree using the marching cubes
- * algorithm.
- *
- */
-
-#include "common.h"
-
-#include "bu/parallel.h"
-#include "rt/rt_instance.h"
-#include "rt/tree.h"
-
-static union tree *
-_rt_cleanup(int state, union tree *tp)
-{
-    /* restore previous debug state */
-    nmg_debug = state;
-
-    /* Dispose of original tree, so that all associated dynamic memory
-     * is released now, not at the end of all regions.  A return of
-     * TREE_NULL from this routine signals an error, and there is no
-     * point to adding _another_ message to our output, so we need to
-     * cons up an OP_NOP node to return.
-     */
-    db_free_tree(tp, &rt_uniresource); /* Does an nmg_kr() */
-
-    BU_ALLOC(tp, union tree);
-    RT_TREE_INIT(tp);
-    tp->tr_op = OP_NOP;
-    return tp;
-}
-
-union tree *
-rt_region_end_mc(struct db_tree_state *tsp, const struct db_full_path *pathp, 
union tree *curtree, void *client_data)
-{
-    union tree *tp = NULL;
-    struct model *m = NULL;
-    struct nmgregion *r = NULL;
-    struct shell *s = NULL;
-    struct bu_list vhead;
-
-    int empty_region = 0;
-    int empty_model = 0;
-    int NMG_debug_state = 0;
-    int count = 0;
-
-    struct rt_region_end_data *data = (struct rt_region_end_data *)client_data;
-
-    if (!tsp || !pathp || !client_data) {
-       bu_log("INTERNAL ERROR: rt_region_end_mc missing parameters\n");
-       return TREE_NULL;
-    }
-
-    if (!data->write_region) {
-       bu_log("INTERNAL ERROR: rt_region_end missing conversion callback 
function\n");
-       return TREE_NULL;
-    }
-
-    RT_CK_FULL_PATH(pathp);
-    RT_CK_TREE(curtree);
-    BG_CK_TESS_TOL(tsp->ts_ttol);
-    BN_CK_TOL(tsp->ts_tol);
-    NMG_CK_MODEL(*tsp->ts_m);
-
-    BU_LIST_INIT(&vhead);
-
-    /*
-      if (curtree->tr_op == OP_NOP)
-      return 0;
-    */
-
-
-    /* get a copy to play with as the parameters might get clobbered
-     * by a longjmp.  FIXME: db_dup_subtree() doesn't create real copies
-     */
-    tp = db_dup_subtree(curtree, &rt_uniresource);
-
-    /* FIXME: we can't free curtree until we get a "real" copy form
-     * db_dup_subtree().  right now we get a fake copy just so we can
-     * keep the compiler quiet about clobbering curtree during longjmp
-     */
-    /* db_free_tree(curtree, &rt_uniresource); */
-
-    /* Sometimes the NMG library adds debugging bits when it detects
-     * an internal error, before bombing.  Stash.
-     */
-    NMG_debug_state = nmg_debug;
-
-    m = nmg_mmr();
-    r = nmg_mrsv(m);
-    s = BU_LIST_FIRST(shell, &r->s_hd);
-
-    if (tsp->ts_rtip == NULL)
-       tsp->ts_rtip = rt_new_rti(tsp->ts_dbip);
-
-    count += nmg_mc_evaluate (s, tsp->ts_rtip, pathp, tsp->ts_ttol, 
tsp->ts_tol);
-
-    /* empty region? */
-    if (count == 0) {
-       char *str_path = db_path_to_string(pathp);
-       bu_log("Region %s appears to be empty.\n", str_path);
-       bu_free(str_path, "str_path");
-       return TREE_NULL;
-    }
-
-    /*
-      bu_log("Target is shot, %d triangles seen.\n", count);
-
-      bu_log("Fusing\n"); fflush(stdout);
-      nmg_model_fuse(m, tsp->ts_tol);
-      bu_log("Done\n"); fflush(stdout);
-    */
-
-    /* Kill cracks */
-    while (BU_LIST_NOT_HEAD(&s->l, &r->s_hd)) {
-       struct shell *next_s;
-
-       next_s = BU_LIST_PNEXT(shell, &s->l);
-       if (nmg_kill_cracks(s)) {
-           if (nmg_ks(s)) {
-               empty_region = 1;
-               break;
-           }
-       }
-       /*
-         nmg_shell_coplanar_face_merge(s, tsp->ts_tol, 42);
-       */
-       s = next_s;
-    }
-    if (empty_region)
-       return _rt_cleanup(NMG_debug_state, tp);
-
-    /* kill zero length edgeuses */
-    empty_model = nmg_kill_zero_length_edgeuses(*tsp->ts_m);
-    if (empty_model)
-       return _rt_cleanup(NMG_debug_state, tp);
-
-    if (!BU_SETJUMP) {
-       /* try */
-       /* Write the region out */
-       data->write_region(r, pathp, tsp->ts_regionid, tsp->ts_gmater, 
tsp->ts_mater.ma_color, data->client_data);
-    } else {
-       /* catch */
-       /* Error, bail out */
-       char *sofar;
-
-       /* Relinquish bomb protection */
-       BU_UNSETJUMP;
-
-       sofar = db_path_to_string(pathp);
-       bu_log("FAILED in triangulator: %s\n", sofar);
-       bu_free((char *)sofar, "sofar");
-
-       /* Release any intersector 2d tables */
-       nmg_isect2d_final_cleanup();
-
-       /* Get rid of (m)any other intermediate structures */
-       if ((*tsp->ts_m)->magic == NMG_MODEL_MAGIC)
-           nmg_km(*tsp->ts_m);
-       else
-           bu_log("WARNING: tsp->ts_m pointer corrupted, ignoring it.\n");
-
-       /* Now, make a new, clean model structure for next pass. */
-       *tsp->ts_m = nmg_mm();
-       nmg_kr(r);
-
-       return _rt_cleanup(NMG_debug_state, tp);
-
-    } BU_UNSETJUMP; /* Relinquish bomb protection */
-
-    nmg_kr(r);
-
-    return _rt_cleanup(NMG_debug_state, tp);
-}
-
-
-/*
- * Local Variables:
- * tab-width: 8
- * mode: C
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to