[brlcad-commits] SF.net SVN: brlcad:[39483] brlcad/branches/dmtogl
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <sta...@us...> - 2010-05-28 18:03:35
|
Revision: 39483 http://brlcad.svn.sourceforge.net/brlcad/?rev=39483&view=rev Author: starseeker Date: 2010-05-28 18:03:24 +0000 (Fri, 28 May 2010) Log Message: ----------- Update dmtogl branch to trunk r39482 Modified Paths: -------------- brlcad/branches/dmtogl/AUTHORS brlcad/branches/dmtogl/NEWS brlcad/branches/dmtogl/configure.ac brlcad/branches/dmtogl/doc/Makefile.am brlcad/branches/dmtogl/include/dm_xvars.h brlcad/branches/dmtogl/misc/win32-msvc/Dll/CMakeLists.txt brlcad/branches/dmtogl/src/adrt/Makefile.am brlcad/branches/dmtogl/src/conv/obj-g_new.c brlcad/branches/dmtogl/src/libdm/dm-togl.c brlcad/branches/dmtogl/src/librt/primitives/sketch/sketch.c brlcad/branches/dmtogl/src/other/Makefile.am brlcad/branches/dmtogl/src/tclscripts/mged/bindings.tcl brlcad/branches/dmtogl/src/tclscripts/mged/openw.tcl Added Paths: ----------- brlcad/branches/dmtogl/doc/STARTERS brlcad/branches/dmtogl/src/other/tktable/ brlcad/branches/dmtogl/src/other/tktable/ChangeLog brlcad/branches/dmtogl/src/other/tktable/Makefile.in brlcad/branches/dmtogl/src/other/tktable/README.blt brlcad/branches/dmtogl/src/other/tktable/README.txt brlcad/branches/dmtogl/src/other/tktable/TODO.txt brlcad/branches/dmtogl/src/other/tktable/aclocal.m4 brlcad/branches/dmtogl/src/other/tktable/configure.in brlcad/branches/dmtogl/src/other/tktable/demos/ brlcad/branches/dmtogl/src/other/tktable/demos/basic.tcl brlcad/branches/dmtogl/src/other/tktable/demos/buttons.tcl brlcad/branches/dmtogl/src/other/tktable/demos/command.tcl brlcad/branches/dmtogl/src/other/tktable/demos/debug.tcl brlcad/branches/dmtogl/src/other/tktable/demos/dynarows.tcl brlcad/branches/dmtogl/src/other/tktable/demos/loadtable.tcl brlcad/branches/dmtogl/src/other/tktable/demos/maxsize.tcl brlcad/branches/dmtogl/src/other/tktable/demos/spreadsheet.tcl brlcad/branches/dmtogl/src/other/tktable/demos/tcllogo.gif brlcad/branches/dmtogl/src/other/tktable/demos/tktable.py brlcad/branches/dmtogl/src/other/tktable/demos/valid.tcl brlcad/branches/dmtogl/src/other/tktable/doc/ brlcad/branches/dmtogl/src/other/tktable/doc/tkTable.html brlcad/branches/dmtogl/src/other/tktable/doc/tkTable.n brlcad/branches/dmtogl/src/other/tktable/generic/ brlcad/branches/dmtogl/src/other/tktable/generic/tkAppInit.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTable.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTable.h brlcad/branches/dmtogl/src/other/tktable/generic/tkTableCell.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTableCellSort.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTableCmds.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTableEdit.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTableInitScript.h brlcad/branches/dmtogl/src/other/tktable/generic/tkTablePs.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTableTag.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTableUtil.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTableWin.c brlcad/branches/dmtogl/src/other/tktable/generic/version.h brlcad/branches/dmtogl/src/other/tktable/library/ brlcad/branches/dmtogl/src/other/tktable/library/tkTable.tcl brlcad/branches/dmtogl/src/other/tktable/library/tktable.py brlcad/branches/dmtogl/src/other/tktable/license.txt brlcad/branches/dmtogl/src/other/tktable/mac/ brlcad/branches/dmtogl/src/other/tktable/mac/mac_tkTable.mcp.xml brlcad/branches/dmtogl/src/other/tktable/mac/mac_tkTable.r brlcad/branches/dmtogl/src/other/tktable/mac/mac_tkTable_prefix.h brlcad/branches/dmtogl/src/other/tktable/tclconfig/ brlcad/branches/dmtogl/src/other/tktable/tclconfig/README.txt brlcad/branches/dmtogl/src/other/tktable/tclconfig/install-sh brlcad/branches/dmtogl/src/other/tktable/tclconfig/tcl.m4 brlcad/branches/dmtogl/src/other/tktable/tests/ brlcad/branches/dmtogl/src/other/tktable/tests/all.tcl brlcad/branches/dmtogl/src/other/tktable/tests/tkTable.test brlcad/branches/dmtogl/src/other/tktable/unix/ brlcad/branches/dmtogl/src/other/tktable/unix/tktable.spec brlcad/branches/dmtogl/src/other/tktable/win/ brlcad/branches/dmtogl/src/other/tktable/win/makefile.vc Removed Paths: ------------- brlcad/branches/dmtogl/src/other/tktable/ChangeLog brlcad/branches/dmtogl/src/other/tktable/Makefile.in brlcad/branches/dmtogl/src/other/tktable/README.blt brlcad/branches/dmtogl/src/other/tktable/README.txt brlcad/branches/dmtogl/src/other/tktable/TODO.txt brlcad/branches/dmtogl/src/other/tktable/aclocal.m4 brlcad/branches/dmtogl/src/other/tktable/configure.in brlcad/branches/dmtogl/src/other/tktable/demos/ brlcad/branches/dmtogl/src/other/tktable/demos/basic.tcl brlcad/branches/dmtogl/src/other/tktable/demos/buttons.tcl brlcad/branches/dmtogl/src/other/tktable/demos/command.tcl brlcad/branches/dmtogl/src/other/tktable/demos/debug.tcl brlcad/branches/dmtogl/src/other/tktable/demos/dynarows.tcl brlcad/branches/dmtogl/src/other/tktable/demos/loadtable.tcl brlcad/branches/dmtogl/src/other/tktable/demos/maxsize.tcl brlcad/branches/dmtogl/src/other/tktable/demos/spreadsheet.tcl brlcad/branches/dmtogl/src/other/tktable/demos/tcllogo.gif brlcad/branches/dmtogl/src/other/tktable/demos/tktable.py brlcad/branches/dmtogl/src/other/tktable/demos/valid.tcl brlcad/branches/dmtogl/src/other/tktable/doc/ brlcad/branches/dmtogl/src/other/tktable/doc/tkTable.html brlcad/branches/dmtogl/src/other/tktable/doc/tkTable.n brlcad/branches/dmtogl/src/other/tktable/generic/ brlcad/branches/dmtogl/src/other/tktable/generic/tkAppInit.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTable.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTable.h brlcad/branches/dmtogl/src/other/tktable/generic/tkTableCell.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTableCellSort.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTableCmds.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTableEdit.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTableInitScript.h brlcad/branches/dmtogl/src/other/tktable/generic/tkTablePs.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTableTag.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTableUtil.c brlcad/branches/dmtogl/src/other/tktable/generic/tkTableWin.c brlcad/branches/dmtogl/src/other/tktable/generic/version.h brlcad/branches/dmtogl/src/other/tktable/library/ brlcad/branches/dmtogl/src/other/tktable/library/tkTable.tcl brlcad/branches/dmtogl/src/other/tktable/library/tktable.py brlcad/branches/dmtogl/src/other/tktable/license.txt brlcad/branches/dmtogl/src/other/tktable/mac/ brlcad/branches/dmtogl/src/other/tktable/mac/mac_tkTable.mcp.xml brlcad/branches/dmtogl/src/other/tktable/mac/mac_tkTable.r brlcad/branches/dmtogl/src/other/tktable/mac/mac_tkTable_prefix.h brlcad/branches/dmtogl/src/other/tktable/tclconfig/ brlcad/branches/dmtogl/src/other/tktable/tclconfig/README.txt brlcad/branches/dmtogl/src/other/tktable/tclconfig/install-sh brlcad/branches/dmtogl/src/other/tktable/tclconfig/tcl.m4 brlcad/branches/dmtogl/src/other/tktable/tests/ brlcad/branches/dmtogl/src/other/tktable/tests/all.tcl brlcad/branches/dmtogl/src/other/tktable/tests/tkTable.test brlcad/branches/dmtogl/src/other/tktable/unix/ brlcad/branches/dmtogl/src/other/tktable/unix/tktable.spec brlcad/branches/dmtogl/src/other/tktable/win/ brlcad/branches/dmtogl/src/other/tktable/win/makefile.vc Modified: brlcad/branches/dmtogl/AUTHORS =================================================================== --- brlcad/branches/dmtogl/AUTHORS 2010-05-28 00:38:17 UTC (rev 39482) +++ brlcad/branches/dmtogl/AUTHORS 2010-05-28 18:03:24 UTC (rev 39483) @@ -701,7 +701,11 @@ 2009 December ITT Corporation +Lundahl, Östen +2010 May +Open Source + CORPORATE AND ORGANIZATION SUPPORT ---------------------------------- Modified: brlcad/branches/dmtogl/NEWS =================================================================== --- brlcad/branches/dmtogl/NEWS 2010-05-28 00:38:17 UTC (rev 39482) +++ brlcad/branches/dmtogl/NEWS 2010-05-28 18:03:24 UTC (rev 39483) @@ -13,6 +13,7 @@ --- 2010-05-XX Release 7.16.10 --- ---------------------------------------------------------------------- +* fixed heap corruption writing NURBS sketch objects - Östen Lundahl * added fullscreen display mode via F5 keybinding to ISST - Cliff Yapp * restored archer view commands to work without a .g file - Bob Parker * fixed memory leak in ISST during window resizing - Erik Greenwald Modified: brlcad/branches/dmtogl/configure.ac =================================================================== --- brlcad/branches/dmtogl/configure.ac 2010-05-28 00:38:17 UTC (rev 39482) +++ brlcad/branches/dmtogl/configure.ac 2010-05-28 18:03:24 UTC (rev 39483) @@ -313,6 +313,9 @@ # tkpng BC_ARG_ENABLE([build_tkpng], [tkpng-build], [Build the included tkpng], [auto]) +# tktable +BC_ARG_ENABLE([build_tktable], [tktable-build], [Build the included tktable], [yes]) + # force enable/disable building of tnt BC_ARG_ENABLE([build_tnt], [tnt-install], [Install the included Template Numerical Toolkit], [auto]) @@ -510,6 +513,9 @@ # aliases to force building tkhtml3 (help uses tkhtml3-build) BC_ARG_ALIAS([build_tkhtml3], [tkhtml3]) +# aliases to force building tktable (help uses tktable-build) +BC_ARG_ALIAS([build_tktable], [tktable]) + # aliases to force building togl (help uses togl-build) BC_ARG_ALIAS([build_togl], [togl]) @@ -685,6 +691,9 @@ if test "x$bc_build_tkpng_set" = "xno" ; then bc_build_tkpng="$set_everything" fi + if test "x$bc_build_tktable" = "xno" ; then + bc_build_tktable="$set_everything" + fi if test "x$bc_build_tnt_set" = "xno" ; then bc_build_tnt="$set_everything" fi @@ -812,6 +821,9 @@ AC_MSG_CHECKING(whether to build the tkhtml3 library) AC_MSG_RESULT($bc_build_tkhtml3) +AC_MSG_CHECKING(whether to build the tktable library) +AC_MSG_RESULT($bc_build_tktable) + AC_MSG_CHECKING(whether to build the togl library) AC_MSG_RESULT($bc_build_togl) @@ -3192,6 +3204,20 @@ fi AC_SUBST(TOGL_CPPFLAGS) +dnl *** tktable *** +dnl figure out whether we need to build tktable +TKTABLE_VERSION="2.10" +AC_SUBST(TKTABLE_VERSION) +AC_MSG_CHECKING(whether to build tktable) +if test ! "x$bc_build_tktable" = "xno" ; then + build_brlcad_tktable=yes + AC_MSG_RESULT(yes) +else + build_brlcad_tktable=no + TKTABLE="" + AC_MSG_RESULT(no) +fi +AC_SUBST(TKTABLE) dnl *** tkpng *** @@ -3853,6 +3879,7 @@ AM_CONDITIONAL(BUILD_ITK, [test "x$build_brlcad_itk" = "xyes"]) AM_CONDITIONAL(BUILD_IWIDGETS, [test "x$build_brlcad_iwidgets" = "xyes"]) AM_CONDITIONAL(BUILD_TKHTML3, [test "x$build_brlcad_tkhtml3" = "xyes"]) +AM_CONDITIONAL(BUILD_TKTABLE, [test "x$build_brlcad_tktable" = "xyes"]) AM_CONDITIONAL(BUILD_TOGL, [test "x$build_brlcad_togl" = "xyes"]) AM_CONDITIONAL(BUILD_TKPNG, [test "x$build_brlcad_tkpng" = "xyes"]) AM_CONDITIONAL(BUILD_PNG, [test "x$build_brlcad_png" = "xyes"]) @@ -4146,6 +4173,15 @@ AC_CONFIG_SUBDIRS([src/other/togl]) fi +dnl configure tktable +if test "x$build_brlcad_tktable" = "xyes" ; then + ac_configure_args="$ac_configure_args --exec-prefix=\"$bc_prefix\"" + if test ! "x$TKINCDIR" = "x" ; then + ac_configure_args="$ac_configure_args --with-tkinclude=$TKINCDIR" + fi + AC_CONFIG_SUBDIRS([src/other/tktable]) +fi + AC_CONFIG_FILES([ Makefile bench/Makefile Modified: brlcad/branches/dmtogl/doc/Makefile.am =================================================================== --- brlcad/branches/dmtogl/doc/Makefile.am 2010-05-28 00:38:17 UTC (rev 39482) +++ brlcad/branches/dmtogl/doc/Makefile.am 2010-05-28 18:03:24 UTC (rev 39483) @@ -65,6 +65,7 @@ EXTRA_DIST = \ $(documentation_DATA) \ $(man_MANS) \ + STARTERS \ pad_file.xml.in DISTCLEANFILES = \ Copied: brlcad/branches/dmtogl/doc/STARTERS (from rev 39482, brlcad/trunk/doc/STARTERS) =================================================================== --- brlcad/branches/dmtogl/doc/STARTERS (rev 0) +++ brlcad/branches/dmtogl/doc/STARTERS 2010-05-28 18:03:24 UTC (rev 39483) @@ -0,0 +1,40 @@ +---------------------------------------------------------------------- +Summary: + * Starter project +Description: + * This describes an example starter project. +Objectives: + * Provides an example +Difficulty: + * Easy +Prerequisites: + * None +References: + * doc/STARTERS + + +---------------------------------------------------------------------- +Summary: + * Replace SCLstring with std::string +Description: + * The NIST STEP Class Library (SCL) was written before the standard + template library (STL) was prevalent, so a custom class was written + to encompass variable length strings called SCLstring. This task + involves updating the SCL to use STL strings and creating new + functions as necessary for any SCLstring capabilities not provided + by the STL. +Objectives: + * Replace all usage of SCLString within the NIST (SCL) with the + standard template library std::string type + * Delete SCLString class +Difficulty: + * Easy +Prerequisites: + * Basic familiarity with C++ STL +References: + * src/other/step + * src/conv/step + * include + * http://www.sgi.com/tech/stl/ + + Modified: brlcad/branches/dmtogl/include/dm_xvars.h =================================================================== --- brlcad/branches/dmtogl/include/dm_xvars.h 2010-05-28 00:38:17 UTC (rev 39482) +++ brlcad/branches/dmtogl/include/dm_xvars.h 2010-05-28 18:03:24 UTC (rev 39483) @@ -76,6 +76,9 @@ int tkfontset; Tk_Font tkfontstruct; #endif +#ifdef DM_TOGL + Tcl_Obj *fontstruct; +#endif int devmotionnotify; int devbuttonpress; int devbuttonrelease; Modified: brlcad/branches/dmtogl/misc/win32-msvc/Dll/CMakeLists.txt =================================================================== --- brlcad/branches/dmtogl/misc/win32-msvc/Dll/CMakeLists.txt 2010-05-28 00:38:17 UTC (rev 39482) +++ brlcad/branches/dmtogl/misc/win32-msvc/Dll/CMakeLists.txt 2010-05-28 18:03:24 UTC (rev 39483) @@ -89,6 +89,7 @@ ../../../../rt^3/src/coreInterface/Hyperboloid.cpp ../../../../rt^3/src/coreInterface/MemoryDatabase.cpp ../../../../rt^3/src/coreInterface/Object.cpp + ../../../../rt^3/src/coreInterface/Paraboloid.cpp ../../../../rt^3/src/coreInterface/Particle.cpp ../../../../rt^3/src/coreInterface/Torus.cpp ../../../../rt^3/src/coreInterface/Unknown.cpp Modified: brlcad/branches/dmtogl/src/adrt/Makefile.am =================================================================== --- brlcad/branches/dmtogl/src/adrt/Makefile.am 2010-05-28 00:38:17 UTC (rev 39482) +++ brlcad/branches/dmtogl/src/adrt/Makefile.am 2010-05-28 18:03:24 UTC (rev 39483) @@ -109,6 +109,8 @@ issttcltk_la_SOURCES = isst_tcltk.c +issttcltk_la_DEPENDENCIES = libtie.la librender.la + issttcltk_la_LIBADD = ${TIE} ${RENDER} ${TCL} ${TK} -L$(top_builddir)/src/other/togl -lToglstub2.1 issttcltk_la_CFLAGS = -I$(top_srcdir)/src/adrt/libtie -I$(top_srcdir)/src/adrt/librender -DTIE_PRECISION=0 ${TCL_CPPFLAGS} ${TK_CPPFLAGS} -I$(top_srcdir)/src/other/togl -I$(top_builddir)/src/other/togl ${GL_CPPFLAGS} issttcltk_la_LDFLAGS = -module -shrext .plugin Modified: brlcad/branches/dmtogl/src/conv/obj-g_new.c =================================================================== --- brlcad/branches/dmtogl/src/conv/obj-g_new.c 2010-05-28 00:38:17 UTC (rev 39482) +++ brlcad/branches/dmtogl/src/conv/obj-g_new.c 2010-05-28 18:03:24 UTC (rev 39483) @@ -69,6 +69,19 @@ #define SURF_CLOSED 1 #define SURF_OPEN 2 +/* normal vector processing */ +#define PROC_NORM 0 +#define IGNR_NORM 1 + +/* texture vertex processing */ +#define PROC_TEX 0 +#define IGNR_TEX 1 + +/* primitive output mode */ +#define OUT_PBOT 0 /* output plate mode bot */ +#define OUT_VBOT 1 /* output volume mode bot */ +#define OUT_NMG 2 /* output nmg */ + typedef const size_t (**arr_1D_t); /* 1 dimensional array type */ typedef const size_t (**arr_2D_t)[2]; /* 2 dimensional array type */ typedef const size_t (**arr_3D_t)[3]; /* 3 dimensional array type */ @@ -185,7 +198,7 @@ ga->numGroups = obj_groups(ga->contents, &ga->str_arr_obj_groups); bu_log("total number of groups in OBJ file; numGroups = (%lu)\n", ga->numGroups); - if (verbose) { + if (verbose > 1) { bu_log("list of all groups i.e. 'g' in OBJ file\n"); for (i = 0 ; i < ga->numGroups ; i++) bu_log("(%lu)(%s)\n", i, ga->str_arr_obj_groups[i]); @@ -194,7 +207,7 @@ ga->numObjects = obj_objects(ga->contents, &ga->str_arr_obj_objects); bu_log("total number of object groups in OBJ file; numObjects = (%lu)\n", ga->numObjects); - if (verbose) { + if (verbose > 1) { bu_log("list of all object groups i.e. 'o' in OBJ file\n"); for (i = 0 ; i < ga->numObjects ; i++) bu_log("(%lu)(%s)\n", i, ga->str_arr_obj_objects[i]); @@ -203,7 +216,7 @@ ga->numMaterials = obj_materials(ga->contents, &ga->str_arr_obj_materials); bu_log("total number of material names in OBJ file; numMaterials = (%lu)\n", ga->numMaterials); - if (verbose) { + if (verbose > 1) { bu_log("list of all material names i.e. 'usemtl' in OBJ file\n"); for (i = 0 ; i < ga->numMaterials ; i++) bu_log("(%lu)(%s)\n", i, ga->str_arr_obj_materials[i]); @@ -212,7 +225,7 @@ ga->numTexmaps = obj_texmaps(ga->contents, &ga->str_arr_obj_texmaps); bu_log("total number of texture map names in OBJ file; numTexmaps = (%lu)\n", ga->numTexmaps); - if (verbose) { + if (verbose > 1) { bu_log("list of all texture map names i.e. 'usemap' in OBJ file\n"); for (i = 0 ; i < ga->numTexmaps ; i++) bu_log("(%lu)(%s)\n", i, ga->str_arr_obj_texmaps[i]); @@ -334,7 +347,7 @@ /* copy current vertex weight into w */ *w = ga->vert_list[*vofi][3] ; - if (verbose) + if (debug) bu_log("fi=(%lu)vi=(%lu)fofi=(%lu)vofi=(%lu)v=(%f)(%f)(%f)w=(%f)\n", fi, vi, fofi+1, *vofi+1, vc[0], vc[1], vc[2], *w); break; @@ -350,7 +363,7 @@ *vofi = index_arr_faces_2D[fi][vi][0]; /* copy current texture coordinate obj file index into tofi */ *tofi = index_arr_faces_2D[fi][vi][1]; - if (verbose) + if (debug) bu_log("fi=(%lu)vi=(%lu)fofi=(%lu)vofi=(%lu)tofi=(%lu)v=(%f)(%f)(%f)w=(%f)t=(%f)(%f)(%f)\n", fi, vi, fofi+1, *vofi+1, *tofi+1, vc[0], vc[1], vc[2], *w, tc[0], tc[1], tc[2]); break; @@ -373,7 +386,7 @@ /* copy current normal into nc */ VMOVE(nc, ga->norm_list[*nofi]); - if (verbose) + if (debug) bu_log("fi=(%lu)vi=(%lu)fofi=(%lu)vofi=(%lu)nofi=(%lu)v=(%f)(%f)(%f)w=(%f)n=(%f)(%f)(%f)\n", fi, vi, fofi+1, *vofi+1, *nofi+1, vc[0], vc[1], vc[2], *w, nc[0], nc[1], nc[2]); break; @@ -393,7 +406,7 @@ *tofi = index_arr_faces_3D[fi][vi][1]; /* copy current normal obj file index into nofi */ *nofi = index_arr_faces_3D[fi][vi][2]; - if (verbose) + if (debug) bu_log("fi=(%lu)vi=(%lu)fofi=(%lu)vofi=(%lu)tofi=(%lu)nofi=(%lu)v=(%f)(%f)(%f)w=(%f)t=(%f)(%f)(%f)n=(%f)(%f)(%f)\n", fi, vi, fofi+1, *vofi+1, *tofi+1, *nofi+1, vc[0], vc[1], vc[2], *w, tc[0], tc[1], tc[2], nc[0], nc[1], nc[2]); @@ -863,7 +876,9 @@ void populate_triangle_indexes(struct ga_t *ga, struct gfi_t *gfi, struct ti_t *ti, - size_t face_idx) { + size_t face_idx, + int texture_mode, /* PROC_TEX, IGNR_TEX */ + int normal_mode) { /* PROC_NORM, IGNR_NORM */ /* it is assumed that when this function is called, the number of face vertices is >= 3 */ @@ -889,14 +904,41 @@ tri_arr_3D_t index_arr_tri_3D = NULL; if ( ti->index_arr_tri == (void *)NULL ) { - /* assign triangle type to the same type as the face */ - ti->tri_type = gfi->face_type; + /* adjust ti->tri_type for texture_mode and normal_mode */ + switch (gfi->face_type) { + case FACE_V : + ti->tri_type = gfi->face_type; + break; + case FACE_TV : + if (texture_mode == PROC_TEX) + ti->tri_type = gfi->face_type; + else + ti->tri_type = FACE_V; + break; + case FACE_NV : + if (normal_mode == PROC_NORM) + ti->tri_type = gfi->face_type; + else + ti->tri_type = FACE_V; + break; + case FACE_TNV : + if ((texture_mode == PROC_TEX) && (normal_mode == PROC_NORM)) + ti->tri_type = gfi->face_type; + else if ((texture_mode == IGNR_TEX) && (normal_mode == IGNR_NORM)) + ti->tri_type = FACE_V; + else if ((texture_mode == PROC_TEX) && (normal_mode == IGNR_NORM)) + ti->tri_type = FACE_TV; + else + ti->tri_type = FACE_NV; + break; + } + /* the initial size will be the number of faces in the grouping */ ti->max_tri = gfi->num_faces; /* allocate memory for initial 'ti->index_arr_tri' array */ - switch (gfi->face_type) { + switch (ti->tri_type) { case FACE_V : /* 3 vertice indexes */ ti->index_arr_tri = (void *)bu_calloc(ti->max_tri * 3, sizeof(size_t), "triangle_indexes"); @@ -911,13 +953,10 @@ /* 3 vertice indexes + 3 normal indexes + 3 texture vertice indexes */ ti->index_arr_tri = (void *)bu_calloc(ti->max_tri * 9, sizeof(size_t), "triangle_indexes"); break; - default: - bu_log("ERROR: logic error, invalid face_type in function 'populate_triangle_indexes'\n"); - break; } } - switch (gfi->face_type) { + switch (ti->tri_type) { case FACE_V : index_arr_tri_1D = (tri_arr_1D_t)ti->index_arr_tri; break; @@ -928,8 +967,6 @@ case FACE_TNV : index_arr_tri_3D = (tri_arr_3D_t)ti->index_arr_tri; break; - default: - break; } /* compute number of new triangles to create */ @@ -952,7 +989,7 @@ retrieve_coord_index(ga, gfi, face_idx, vert_idx + idx, tmp_v, tmp_n, tmp_t, &tmp_w, &vofi, &nofi, &tofi); } - switch (gfi->face_type) { + switch (ti->tri_type) { case FACE_V : index_arr_tri_1D[ti->num_tri][idx] = vofi; break; @@ -969,8 +1006,6 @@ index_arr_tri_3D[ti->num_tri][idx][1] = tofi; index_arr_tri_3D[ti->num_tri][idx][2] = nofi; break; - default: - break; } } ti->num_tri++; /* increment this at the end since arrays start at zero */ @@ -978,7 +1013,7 @@ /* if needed, increase size of 'ti->index_arr_tri' array */ if ( ti->num_tri >= ti->max_tri ) { ti->max_tri += max_tri_increment; - switch (gfi->face_type) { + switch (ti->tri_type) { case FACE_V : ti->index_arr_tri = (void *)bu_realloc(index_arr_tri_1D, sizeof(size_t) * ti->max_tri * 3, "index_arr_tri"); @@ -995,8 +1030,6 @@ sizeof(size_t) * ti->max_tri * 9, "index_arr_tri"); index_arr_tri_3D = (tri_arr_3D_t)(ti->index_arr_tri); break; - default: - break; } } } @@ -1761,7 +1794,7 @@ qsort(edges, edge_count, sizeof(size_t) * 2, (int (*)(const void *a, const void *b))comp_c); - if (1) + if (debug) for ( idx = 0 ; idx < edge_count ; idx++ ) bu_log("sorted edges (%lu)(%lu)(%lu)\n", idx, edges[idx][0], edges[idx][1]); @@ -1772,7 +1805,7 @@ match++; } else { if ( match == 0 ) { - if (1) + if (verbose > 1) bu_log("open edge (%lu)= %f %f %f (%lu)= %f %f %f \n", previous_edge[0], ga->vert_list[previous_edge[0]][0] * conv_factor, @@ -1813,7 +1846,8 @@ if ( open_edges ) { gfi->closure_status = SURF_OPEN; - bu_log("surface closure failed (%s), (%lu) open edges\n", bu_vls_addr(gfi->raw_grouping_name), open_edges); + bu_log("surface closure failed (%s), (%lu) open edges\n", + bu_vls_addr(gfi->raw_grouping_name), open_edges); } else { gfi->closure_status = SURF_CLOSED; bu_log("surface closure success (%s)\n", bu_vls_addr(gfi->raw_grouping_name)); @@ -1831,7 +1865,10 @@ struct gfi_t *gfi, struct rt_wdb *outfp, fastf_t conv_factor, - struct bn_tol *tol) { + struct bn_tol *tol, + int texture_mode, /* PROC_TEX, IGNR_TEX */ + int normal_mode, /* PROC_NORM, IGNR_NORM */ + int output_mode) { /* OUT_PBOT, OUT_VBOT */ struct ti_t ti; /* triangle indices structure */ @@ -1871,7 +1908,7 @@ /* loop thru all the polygons (i.e. faces) to be placed in the current bot */ for ( face_idx = 0 ; face_idx < gfi->num_faces ; face_idx++ ) { - if (verbose) + if (debug) bu_log("num vertices in current polygon = (%lu)\n", gfi->num_vertices_arr[face_idx]); /* test for degenerate face */ @@ -1882,7 +1919,7 @@ /* populates triangle indexes for the current face */ /* if necessary, allocates additional memory for the triangle indexes array */ /* if necessary, triangulates the face */ - populate_triangle_indexes(ga, gfi, &ti, face_idx); + populate_triangle_indexes(ga, gfi, &ti, face_idx, texture_mode, normal_mode); } } /* loop exits when all polygons within the current grouping have been triangulated (if necessary) and the vertex, normal and @@ -1931,40 +1968,43 @@ return; } -void output_to_nmg(struct ga_t *ga, - struct gfi_t *gfi, - struct rt_wdb *outfp, - fastf_t conv_factor, - struct bn_tol *tol) { +/* returns a failure if no faces were output, the surface + was not closed or an nmg bomb occured */ +int output_to_nmg(struct ga_t *ga, + struct gfi_t *gfi, + struct rt_wdb *outfp, + fastf_t conv_factor, + struct bn_tol *tol, + int normal_mode, + int output_mode) { struct model *m = (struct model *)NULL; struct nmgregion *r = (struct nmgregion *)NULL; struct shell *s = (struct shell *)NULL; struct bu_ptbl faces; /* table of faces for one element */ - struct faceuse *fu; - struct vertexuse *vu = NULL; - struct vertexuse *vu2 = NULL; - struct loopuse *lu = NULL; - struct edgeuse *eu = NULL; - struct loopuse *lu2 = NULL; - struct edgeuse *eu2 = NULL; + struct faceuse *fu = (struct faceuse *)NULL; + struct vertexuse *vu = (struct vertexuse *)NULL; + struct vertexuse *vu2 = (struct vertexuse *)NULL; + struct loopuse *lu = (struct loopuse *)NULL; + struct edgeuse *eu = (struct edgeuse *)NULL; + struct loopuse *lu2 = (struct loopuse *)NULL; + struct edgeuse *eu2 = (struct edgeuse *)NULL; size_t face_idx = 0; /* index into faces within for-loop */ size_t vert_idx = 0; /* index into vertices within for-loop */ size_t shell_vert_idx = 0; /* index into vertices for entire nmg shell */ - int total_fused_vertex = 0 ; + int num_entities_fused = 0; + int ret = 1 ; /* function return value, default to failure */ plane_t pl; /* plane equation for face */ fastf_t tmp_v[3] = { 0.0, 0.0, 0.0 }; /* temporary vertex */ fastf_t tmp_w = 0.0 ; /* temporary weight */ fastf_t tmp_rn[3] = { 0.0, 0.0, 0.0 }; /* temporary reverse normal */ fastf_t tmp_n[3] = { 0.0, 0.0, 0.0 }; /* temporary normal */ fastf_t tmp_t[3] = { 0.0, 0.0, 0.0 }; /* temporary texture vertex */ - vect_t norm; - fastf_t dot; size_t vofi = 0; /* vertex obj file index */ size_t nofi = 0; /* normal obj file index */ size_t tofi = 0; /* texture vertex obj file index */ - struct vertex **verts = NULL; + struct vertex **verts = (struct vertex **)NULL; size_t num_faces_killed = 0 ; /* number of degenerate faces killed in the current shell */ @@ -1981,12 +2021,25 @@ verts = (struct vertex **)bu_calloc(gfi->tot_vertices, sizeof(struct vertex *), "verts"); memset((void *)verts, 0, sizeof(struct vertex *) * gfi->tot_vertices); + /* begin bomb protection */ + if ( BU_SETJUMP ) { + BU_UNSETJUMP; /* relinquish bomb protection */ + + bu_ptbl_reset(&faces); + if ( verts != (struct vertex **)NULL ) /* sanity check */ + bu_free(verts,"verts"); + if ( m != (struct model *)NULL ) /* sanity check */ + nmg_km(m); + + bu_log("WARNING: caught nmg bomb for object (%s)\n", bu_vls_addr(gfi->raw_grouping_name)); + + return ret; + } + shell_vert_idx = 0; NMG_CK_SHELL(s); /* loop thru all the polygons (i.e. faces) to be placed in the current shell/region/model */ for ( face_idx = 0 ; face_idx < gfi->num_faces ; face_idx++ ) { - if (verbose) - bu_log("num vertices in current polygon = (%lu)\n", gfi->num_vertices_arr[face_idx]); /* test for degenerate face */ if (test_face(ga, gfi, face_idx, conv_factor, tol, 0)) { @@ -2004,27 +2057,31 @@ &tmp_w, &vofi, &nofi, &tofi); VSCALE(tmp_v, tmp_v, conv_factor); - VUNITIZE(tmp_n); - VREVERSE(tmp_rn, tmp_n); NMG_CK_VERTEX(eu->vu_p->v_p); nmg_vertex_gv(eu->vu_p->v_p, tmp_v); - switch (gfi->face_type) { - case FACE_NV : - case FACE_TNV : - /* assign this normal to all uses of this vertex */ - for (BU_LIST_FOR(vu, vertexuse, &eu->vu_p->v_p->vu_hd)) { - NMG_CK_VERTEXUSE(vu); - nmg_vertexuse_nv(vu, tmp_n); - } - for (BU_LIST_FOR(vu2, vertexuse, &eu2->vu_p->v_p->vu_hd)) { - NMG_CK_VERTEXUSE(vu2); - nmg_vertexuse_nv(vu2, tmp_rn); - } - break; - default: - break; + if ( (gfi->face_type == FACE_NV || gfi->face_type == FACE_TNV) && (normal_mode == PROC_NORM) ) { + if ( MAGNITUDE(tmp_n) < VDIVIDE_TOL ) + bu_log("ERROR: Unable to unitize normal (%f)(%f)(%f) for obj file face index (%lu), obj file face grouping name (%s), obj file face grouping index (%lu)\n", + tmp_n[0], tmp_n[1], tmp_n[2], + gfi->obj_file_face_idx_arr[face_idx] + 1, + bu_vls_addr(gfi->raw_grouping_name), + gfi->grouping_index); + else + VUNITIZE(tmp_n); + + VREVERSE(tmp_rn, tmp_n); + + /* assign this normal to all uses of this vertex */ + for (BU_LIST_FOR(vu, vertexuse, &eu->vu_p->v_p->vu_hd)) { + NMG_CK_VERTEXUSE(vu); + nmg_vertexuse_nv(vu, tmp_n); + } + for (BU_LIST_FOR(vu2, vertexuse, &eu2->vu_p->v_p->vu_hd)) { + NMG_CK_VERTEXUSE(vu2); + nmg_vertexuse_nv(vu2, tmp_rn); + } } eu = BU_LIST_NEXT(edgeuse, &eu->l); @@ -2037,14 +2094,19 @@ NMG_CK_FACEUSE(fu); if (nmg_loop_plane_area(BU_LIST_FIRST(loopuse, &fu->lu_hd), pl) < 0.0) { - bu_log("Failed nmg_loop_plane_area\n"); - nmg_pr_fu_briefly( fu, "" ); - nmg_kfu(fu); + if (verbose || debug) { + bu_log("WARNING: Failed nmg_loop_plane_area for obj file face index (%lu), obj file face grouping name (%s), obj file face grouping index (%lu)\n", + gfi->obj_file_face_idx_arr[face_idx] + 1, + bu_vls_addr(gfi->raw_grouping_name), + gfi->grouping_index); + nmg_pr_fu_briefly( fu, "" ); + } + (void)nmg_kfu(fu); fu = (struct faceuse *)NULL; num_faces_killed++; } else { - nmg_face_g(fu, pl); /* return is void */ - nmg_face_bb(fu->f_p, tol); /* return is void */ + nmg_face_g(fu, pl); + nmg_face_bb(fu->f_p, tol); bu_ptbl_ins(&faces, (long *)fu); } @@ -2054,72 +2116,144 @@ has been placed within one nmg shell, inside one nmg region and inside one nmg model */ - bu_log("num_faces_killed = (%lu)\n", num_faces_killed); + if (verbose || debug) + bu_log("Killed (%lu) faces in obj file face grouping name (%s), obj file face grouping index (%lu)\n", + num_faces_killed, bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); + if (!BU_PTBL_END(&faces)){ - bu_log("Object %s has no faces\n", bu_vls_addr(gfi->raw_grouping_name)); - nmg_km(m); + if (verbose || debug) + bu_log("No faces in obj file face grouping name (%s), obj file face grouping index (%lu)\n", + bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); } else { -#if 0 - /* run nmg_rebound before nmg_model_vertex_fuse */ - bu_log("about to run nmg_model_vertex_fuse\n"); - total_fused_vertex = nmg_model_vertex_fuse(m, tol); - bu_log("total_fused_vertex = (%d)\n", total_fused_vertex); -#endif - bu_log("about to run nmg_model_fuse\n"); - bu_log("total entities fused = (%d)\n", nmg_model_fuse(m, tol)); + /* run nmg_model_fuse */ + if (verbose || debug) + bu_log("Running nmg_model_fuse on (%ld) faces from obj file face grouping name (%s), obj file face grouping index (%lu)\n", + BU_PTBL_END(&faces), bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); + num_entities_fused = nmg_model_fuse(m, tol); + if (verbose || debug) { + bu_log("Completed nmg_model_fuse for obj file face grouping name (%s), obj file face grouping index (%lu)\n", + bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); + bu_log("Fused (%d) entities in obj file face grouping name (%s), obj file face grouping index (%lu)\n", + num_entities_fused, bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); + } + /* run nmg_gluefaces */ /* run nmg_model_vertex_fuse before nmg_gluefaces */ - bu_log("about to run nmg_gluefaces\n"); + if (verbose || debug) + bu_log("Running nmg_gluefaces on (%ld) faces from obj file face grouping name (%s), obj file face grouping index (%lu)\n", + BU_PTBL_END(&faces), bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); nmg_gluefaces((struct faceuse **)BU_PTBL_BASEADDR(&faces), BU_PTBL_END(&faces), tol); + if (verbose || debug) + bu_log("Completed nmg_gluefaces for obj file face grouping name (%s), obj file face grouping index (%lu)\n", + bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); - /* Mark edges as real */ - bu_log("about to run nmg_mark_edges_real\n"); + /* mark edges as real */ + if (verbose || debug) + bu_log("Running nmg_mark_edges_real with approx (%ld) faces from obj file face grouping name (%s), obj file face grouping index (%lu)\n", + BU_PTBL_END(&faces), bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); (void)nmg_mark_edges_real(&s->l.magic); + if (verbose || debug) + bu_log("Completed nmg_mark_edges_real for obj file face grouping name (%s), obj file face grouping index (%lu)\n", + bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); - /* Compute "geometry" for region and shell */ + /* compute geometry for region and shell */ bu_log("about to run nmg_region_a\n"); + if (verbose || debug) + bu_log("Running nmg_region_a with approx (%ld) faces from obj file face grouping name (%s), obj file face grouping index (%lu)\n", + BU_PTBL_END(&faces), bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); nmg_region_a(r, tol); + if (verbose || debug) + bu_log("Completed nmg_region_a for obj file face grouping name (%s), obj file face grouping index (%lu)\n", + bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); - bu_log("about to run nmg_kill_cracks\n"); + if (verbose || debug) + bu_log("Running nmg_kill_cracks with approx (%ld) faces from obj file face grouping name (%s), obj file face grouping index (%lu)\n", + BU_PTBL_END(&faces), bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); if (nmg_kill_cracks(s)) { + if (verbose || debug) + bu_log("Completed nmg_kill_cracks for obj file face grouping name (%s), obj file face grouping index (%lu)\n", + bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); bu_log("Object %s has no faces\n", bu_vls_addr(gfi->raw_grouping_name)); - nmg_km(m); } else { -#if 0 - /* Some faces may not be within tolerance, so triangulate faces where needed */ - /* run nmg_gluefaces before nmg_make_faces_within_tol */ - bu_log("about to run nmg_make_faces_within_tol\n"); - nmg_make_faces_within_tol(s, tol); -#endif + if (verbose || debug) + bu_log("Completed nmg_kill_cracks for obj file face grouping name (%s), obj file face grouping index (%lu)\n", + bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); - bu_log("about to run nmg_rebound\n"); + if (verbose || debug) + bu_log("Running nmg_rebound with approx (%ld) faces from obj file face grouping name (%s), obj file face grouping index (%lu)\n", + BU_PTBL_END(&faces), bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); nmg_rebound(m, tol); + if (verbose || debug) + bu_log("Completed nmg_rebound for obj file face grouping name (%s), obj file face grouping index (%lu)\n", + bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); /* run nmg_model_vertex_fuse before nmg_check_closed_shell */ - if ( nmg_check_closed_shell(s, tol) ) { - /* make bot for a open shell */ - bu_vls_printf(gfi->raw_grouping_name, ".%lu.bot.s", gfi->grouping_index); - cleanup_name(gfi->raw_grouping_name); - bu_log("about to mk_bot_from_nmg\n"); - mk_bot_from_nmg(outfp, bu_vls_addr(gfi->raw_grouping_name), s); - nmg_km(m); + if (verbose || debug) + bu_log("Running nmg_check_closed_shell with approx (%ld) faces from obj file face grouping name (%s), obj file face grouping index (%lu)\n", + BU_PTBL_END(&faces), bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); + if ( !nmg_check_closed_shell(s, tol) ) { /* true when surface is closed */ + if (verbose || debug) + bu_log("Completed nmg_check_closed_shell for obj file face grouping name (%s), obj file face grouping index (%lu)\n", + bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); + if ( output_mode == OUT_NMG ) { + /* make nmg */ + bu_vls_printf(gfi->raw_grouping_name, ".%lu.n.s", gfi->grouping_index); + cleanup_name(gfi->raw_grouping_name); + if (verbose || debug) + bu_log("Running mk_nmg with approx (%ld) faces from obj file face grouping name (%s), obj file face grouping index (%lu)\n", + BU_PTBL_END(&faces), bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); + /* the model (m) is freed when mk_nmg completes */ + if (mk_nmg(outfp, bu_vls_addr(gfi->raw_grouping_name), m) < 0) { + bu_log("ERROR: Completed mk_nmg but FAILED for obj file face grouping name (%s), obj file face grouping index (%lu)\n", + bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); + } else { + if (verbose || debug) + bu_log("Completed mk_nmg for obj file face grouping name (%s), obj file face grouping index (%lu)\n", + bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); + ret = 0; /* set return success */ + } + } else { + if (verbose || debug) + bu_log("Completed nmg_check_closed_shell for obj file face grouping name (%s), obj file face grouping index (%lu)\n", + bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); + /* make volume bot */ + if ( output_mode != OUT_VBOT ) + bu_log("NOTE: Currently bot-via-nmg can only create volume bots, ignoring plate mode option and creating volume bot instead.\n"); + + bu_vls_printf(gfi->raw_grouping_name, ".%lu.nvb.s", gfi->grouping_index); + cleanup_name(gfi->raw_grouping_name); + if (verbose || debug) + bu_log("Running mk_bot_from_nmg with approx (%ld) faces from obj file face grouping name (%s), obj file face grouping index (%lu)\n", + BU_PTBL_END(&faces), bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); + if (mk_bot_from_nmg(outfp, bu_vls_addr(gfi->raw_grouping_name), s) < 0) { + bu_log("ERROR: Completed mk_bot_from_nmg but FAILED for obj file face grouping name (%s), obj file face grouping index (%lu)\n", + bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); + } else { + if (verbose || debug) + bu_log("Completed mk_bot_from_nmg for obj file face grouping name (%s), obj file face grouping index (%lu)\n", + bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); + ret = 0; /* set return success */ + nmg_km(m); /* required for mk_bot_from_nmg but not mk_nmg */ + } + } } else { - /* make nmg for a closed shell */ - bu_vls_printf(gfi->raw_grouping_name, ".%lu.nmg.s", gfi->grouping_index); - cleanup_name(gfi->raw_grouping_name); - bu_log("about to run mk_nmg\n"); - /* the model (m) is freed when mk_nmg completes */ - if (mk_nmg(outfp, bu_vls_addr(gfi->raw_grouping_name), m)) { - bu_log("mk_nmg failed\n"); - } + bu_log("WARNING: Function nmg_check_closed_shell found no surface closure for obj file face grouping name (%s), obj file face grouping index (%lu)\n", + bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index); } } } - bu_free(verts,"verts"); + BU_UNSETJUMP; /* relinquish bomb catch protection */ + bu_ptbl_reset(&faces); + if ( verts != (struct vertex **)NULL ) /* sanity check */ + bu_free(verts,"verts"); + if ( ret ) /* if failure kill model */ + nmg_km(m); + + return ret; } /* @@ -2187,6 +2321,9 @@ struct bn_tol *tol ; int face_type_idx = 0; double dist_tmp = 0.0; + int texture_mode = IGNR_TEX; + int normal_mode = PROC_NORM; + int output_mode = OUT_PBOT; /* the raytracer tolerance values (rtip->rti_tol) need to match these otherwise raytrace errors will result. the defaults @@ -2337,23 +2474,39 @@ collect_global_obj_file_attributes(&ga); + /* these options are to be provided by the user from the command line */ + int fuse_vertex_option = 1; + int test_closure_option = 1; + int face_validation_level = 1; + int ignore_provided_normals = 0; + + texture_mode = IGNR_TEX; + normal_mode = IGNR_NORM; + output_mode = OUT_PBOT; + switch (grouping_option) { case 'n': - bu_log("ENTERED 'n' PROCESSING\n"); for ( face_type_idx = FACE_V ; face_type_idx <= FACE_TNV ; face_type_idx++ ) { collect_grouping_faces_indexes(&ga, &gfi, face_type_idx, GRP_NONE, 0); if (gfi != NULL) { - bu_log("name=(%s) #faces=(%lu)\n", bu_vls_addr(gfi->raw_grouping_name), - gfi->num_faces); - fuse_vertex(&ga, gfi, conv_factor, tol, FUSE_VERT, FUSE_WI_TOL); - retest_grouping_faces(&ga, gfi, conv_factor, tol); - test_closure(&ga, gfi, conv_factor, tol); + bu_log("START: (%lu) (%s)\n", gfi->grouping_index, bu_vls_addr(gfi->raw_grouping_name)); switch (mode_option) { case 'b': - output_to_bot(&ga, gfi, fd_out, conv_factor, tol); + if (fuse_vertex_option) + (void)fuse_vertex(&ga, gfi, conv_factor, tol, FUSE_VERT, FUSE_WI_TOL); + if (face_validation_level) + (void)retest_grouping_faces(&ga, gfi, conv_factor, tol); + if (test_closure_option) + (void)test_closure(&ga, gfi, conv_factor, tol); + output_to_bot(&ga, gfi, fd_out, conv_factor, tol, texture_mode, normal_mode, output_mode); break; case 'n': - output_to_nmg(&ga, gfi, fd_out, conv_factor, tol); + if ( output_to_nmg(&ga, gfi, fd_out, conv_factor, tol, PROC_NORM, OUT_NMG) ) { + (void)fuse_vertex(&ga, gfi, conv_factor, tol, FUSE_VERT, FUSE_WI_TOL); + (void)retest_grouping_faces(&ga, gfi, conv_factor, tol); + (void)test_closure(&ga, gfi, conv_factor, tol); + output_to_bot(&ga, gfi, fd_out, conv_factor, tol, texture_mode, normal_mode, output_mode); + } break; default: break; @@ -2361,25 +2514,30 @@ free_gfi(&gfi); } } - bu_log("EXITED 'n' PROCESSING\n"); break; case 'g': - bu_log("ENTERED 'g' PROCESSING\n"); for (i = 0 ; i < ga.numGroups ; i++) { for ( face_type_idx = FACE_V ; face_type_idx <= FACE_TNV ; face_type_idx++ ) { collect_grouping_faces_indexes(&ga, &gfi, face_type_idx, GRP_GROUP, i); if (gfi != NULL) { - bu_log("name=(%s) #faces=(%lu)\n", bu_vls_addr(gfi->raw_grouping_name), - gfi->num_faces); - fuse_vertex(&ga, gfi, conv_factor, tol, FUSE_VERT, FUSE_WI_TOL); - retest_grouping_faces(&ga, gfi, conv_factor, tol); - test_closure(&ga, gfi, conv_factor, tol); + bu_log("START: (%lu) (%s)\n", gfi->grouping_index, bu_vls_addr(gfi->raw_grouping_name)); switch (mode_option) { case 'b': - output_to_bot(&ga, gfi, fd_out, conv_factor, tol); + if (fuse_vertex_option) + (void)fuse_vertex(&ga, gfi, conv_factor, tol, FUSE_VERT, FUSE_WI_TOL); + if (face_validation_level) + (void)retest_grouping_faces(&ga, gfi, conv_factor, tol); + if (test_closure_option) + (void)test_closure(&ga, gfi, conv_factor, tol); + output_to_bot(&ga, gfi, fd_out, conv_factor, tol, texture_mode, normal_mode, output_mode); break; case 'n': - output_to_nmg(&ga, gfi, fd_out, conv_factor, tol); + if ( output_to_nmg(&ga, gfi, fd_out, conv_factor, tol, PROC_NORM, OUT_NMG) ) { + (void)fuse_vertex(&ga, gfi, conv_factor, tol, FUSE_VERT, FUSE_WI_TOL); + (void)retest_grouping_faces(&ga, gfi, conv_factor, tol); + (void)test_closure(&ga, gfi, conv_factor, tol); + output_to_bot(&ga, gfi, fd_out, conv_factor, tol, texture_mode, normal_mode, output_mode); + } break; default: break; @@ -2388,25 +2546,30 @@ } } } - bu_log("EXITED 'g' PROCESSING\n"); break; case 'o': - bu_log("ENTERED 'o' PROCESSING\n"); for (i = 0 ; i < ga.numObjects ; i++) { for ( face_type_idx = FACE_V ; face_type_idx <= FACE_TNV ; face_type_idx++ ) { collect_grouping_faces_indexes(&ga, &gfi, face_type_idx, GRP_OBJECT, i); if (gfi != NULL) { - bu_log("name=(%s) #faces=(%lu)\n", bu_vls_addr(gfi->raw_grouping_name), - gfi->num_faces); - fuse_vertex(&ga, gfi, conv_factor, tol, FUSE_VERT, FUSE_WI_TOL); - retest_grouping_faces(&ga, gfi, conv_factor, tol); - test_closure(&ga, gfi, conv_factor, tol); + bu_log("START: (%lu) (%s)\n", gfi->grouping_index, bu_vls_addr(gfi->raw_grouping_name)); switch (mode_option) { case 'b': - output_to_bot(&ga, gfi, fd_out, conv_factor, tol); + if (fuse_vertex_option) + (void)fuse_vertex(&ga, gfi, conv_factor, tol, FUSE_VERT, FUSE_WI_TOL); + if (face_validation_level) + (void)retest_grouping_faces(&ga, gfi, conv_factor, tol); + if (test_closure_option) + (void)test_closure(&ga, gfi, conv_factor, tol); + output_to_bot(&ga, gfi, fd_out, conv_factor, tol, texture_mode, normal_mode, output_mode); break; case 'n': - output_to_nmg(&ga, gfi, fd_out, conv_factor, tol); + if ( output_to_nmg(&ga, gfi, fd_out, conv_factor, tol, PROC_NORM, OUT_NMG) ) { + (void)fuse_vertex(&ga, gfi, conv_factor, tol, FUSE_VERT, FUSE_WI_TOL); + (void)retest_grouping_faces(&ga, gfi, conv_factor, tol); + (void)test_closure(&ga, gfi, conv_factor, tol); + output_to_bot(&ga, gfi, fd_out, conv_factor, tol, texture_mode, normal_mode, output_mode); + } break; default: break; @@ -2415,25 +2578,30 @@ } } } - bu_log("EXITED 'o' PROCESSING\n"); break; case 'm': - bu_log("ENTERED 'm' PROCESSING\n"); for (i = 0 ; i < ga.numMaterials ; i++) { for ( face_type_idx = FACE_V ; face_type_idx <= FACE_TNV ; face_type_idx++ ) { collect_grouping_faces_indexes(&ga, &gfi, face_type_idx, GRP_MATERIAL, i); if (gfi != NULL) { - bu_log("name=(%s) #faces=(%lu)\n", bu_vls_addr(gfi->raw_grouping_name), - gfi->num_faces); - fuse_vertex(&ga, gfi, conv_factor, tol, FUSE_VERT, FUSE_WI_TOL); - retest_grouping_faces(&ga, gfi, conv_factor, tol); - test_closure(&ga, gfi, conv_factor, tol); + bu_log("START: (%lu) (%s)\n", gfi->grouping_index, bu_vls_addr(gfi->raw_grouping_name)); switch (mode_option) { case 'b': - output_to_bot(&ga, gfi, fd_out, conv_factor, tol); + if (fuse_vertex_option) + (void)fuse_vertex(&ga, gfi, conv_factor, tol, FUSE_VERT, FUSE_WI_TOL); + if (face_validation_level) + (void)retest_grouping_faces(&ga, gfi, conv_factor, tol); + if (test_closure_option) + (void)test_closure(&ga, gfi, conv_factor, tol); + output_to_bot(&ga, gfi, fd_out, conv_factor, tol, texture_mode, normal_mode, output_mode); break; case 'n': - output_to_nmg(&ga, gfi, fd_out, conv_factor, tol); + if ( output_to_nmg(&ga, gfi, fd_out, conv_factor, tol, PROC_NORM, OUT_NMG) ) { + (void)fuse_vertex(&ga, gfi, conv_factor, tol, FUSE_VERT, FUSE_WI_TOL); + (void)retest_grouping_faces(&ga, gfi, conv_factor, tol); + (void)test_closure(&ga, gfi, conv_factor, tol); + output_to_bot(&ga, gfi, fd_out, conv_factor, tol, texture_mode, normal_mode, output_mode); + } break; default: break; @@ -2442,25 +2610,30 @@ } } } - bu_log("EXITED 'm' PROCESSING\n"); break; case 't': - bu_log("ENTERED 't' PROCESSING\n"); for (i = 0 ; i < ga.numTexmaps ; i++) { for ( face_type_idx = FACE_V ; face_type_idx <= FACE_TNV ; face_type_idx++ ) { collect_grouping_faces_indexes(&ga, &gfi, face_type_idx, GRP_TEXTURE, i); if (gfi != NULL) { - bu_log("name=(%s) #faces=(%lu)\n", bu_vls_addr(gfi->raw_grouping_name), - gfi->num_faces); - fuse_vertex(&ga, gfi, conv_factor, tol, FUSE_VERT, FUSE_WI_TOL); - retest_grouping_faces(&ga, gfi, conv_factor, tol); - test_closure(&ga, gfi, conv_factor, tol); + bu_log("START: (%lu) (%s)\n", gfi->grouping_index, bu_vls_addr(gfi->raw_grouping_name)); switch (mode_option) { case 'b': - output_to_bot(&ga, gfi, fd_out, conv_factor, tol); + if (fuse_vertex_option) + (void)fuse_vertex(&ga, gfi, conv_factor, tol, FUSE_VERT, FUSE_WI_TOL); + if (face_validation_level) + (void)retest_grouping_faces(&ga, gfi, conv_factor, tol); + if (test_closure_option) + (void)test_closure(&ga, gfi, conv_factor, tol); + output_to_bot(&ga, gfi, fd_out, conv_factor, tol, texture_mode, normal_mode, output_mode); break; case 'n': - output_to_nmg(&ga, gfi, fd_out, conv_factor, tol); + if ( output_to_nmg(&ga, gfi, fd_out, conv_factor, tol, PROC_NORM, OUT_NMG) ) { + (void)fuse_vertex(&ga, gfi, conv_factor, tol, FUSE_VERT, FUSE_WI_TOL); + (void)retest_grouping_faces(&ga, gfi, conv_factor, tol); + (void)test_closure(&ga, gfi, conv_factor, tol); + output_to_bot(&ga, gfi, fd_out, conv_factor, tol, texture_mode, normal_mode, output_mode); + } break; default: break; @@ -2469,20 +2642,22 @@ } } } - bu_log("EXITED 't' PROCESSING\n"); break; default: break; } /* running cleanup functions */ - bu_log("obj_contents_destroy\n"); + if (debug) + bu_log("obj_contents_destroy\n"); obj_contents_destroy(ga.contents); - bu_log("obj_parser_destroy\n"); + if (debug) + bu_log("obj_parser_destroy\n"); obj_parser_destroy(ga.parser); - bu_log("running fclose\n"); + if (debug) + bu_log("running fclose\n"); if (fclose(my_stream) != 0) { bu_log("Unable to close file.\n"); perror(prog); @@ -2491,6 +2666,8 @@ wdb_close(fd_out); + bu_log("Done\n"); + return 0; } Modified: brlcad/branches/dmtogl/src/libdm/dm-togl.c =================================================================== --- brlcad/branches/dmtogl/src/libdm/dm-togl.c 2010-05-28 00:38:17 UTC (rev 39482) +++ brlcad/branches/dmtogl/src/libdm/dm-togl.c 2010-05-28 18:03:24 UTC (rev 39483) @@ -565,6 +565,7 @@ /* Now that we have a parent tk window, pack the togl widget */ bu_vls_sprintf(&tclcmd, "package require Togl; togl %s.%s.togl -width %d -height %d -rgba true -double true", bu_vls_addr(&top_vls), (char *)Tk_Name(pubvars->xtkwin), dmp->dm_width, dmp->dm_height); + printf("%s\n", bu_vls_addr(&tclcmd)); Tcl_Eval(interp, bu_vls_addr(&tclcmd)); bu_log("%s\n", Tcl_GetStringResult(interp)); bu_vls_sprintf(&tclcmd, "pack %s.%s.togl; update", bu_vls_addr(&top_vls), (char *)Tk_Name(p... [truncated message content] |