Revision: 41472
          http://brlcad.svn.sourceforge.net/brlcad/?rev=41472&view=rev
Author:   erikgreenwald
Date:     2010-11-29 21:59:00 +0000 (Mon, 29 Nov 2010)

Log Message:
-----------
migrate data packing for tie into the prep phase instead of the load phase

Modified Paths:
--------------
    brlcad/branches/bottie/src/librt/primitives/bot/bot.c
    brlcad/branches/bottie/src/librt/primitives/bot/btg.c
    brlcad/branches/bottie/src/librt/primitives/bot/g_bot_include.c

Modified: brlcad/branches/bottie/src/librt/primitives/bot/bot.c
===================================================================
--- brlcad/branches/bottie/src/librt/primitives/bot/bot.c       2010-11-29 
19:49:02 UTC (rev 41471)
+++ brlcad/branches/bottie/src/librt/primitives/bot/bot.c       2010-11-29 
21:59:00 UTC (rev 41472)
@@ -204,7 +204,7 @@
     bot_ip = (struct rt_bot_internal *)ip->idb_ptr;
     RT_BOT_CK_MAGIC(bot_ip);
 
-    if (bot_ip->tie != NULL)
+    if ( bot_ip->face_normals != NULL || bot_ip->orientation != 
RT_BOT_UNORIENTED )
        return bottie_prep_double(stp, bot_ip, rtip);
     else if (bot_ip->bot_flags & RT_BOT_USE_FLOATS)
        return rt_bot_prep_float(stp, bot_ip, rtip);
@@ -427,7 +427,9 @@
     if (bot->tie != NULL) {
        bottie_free_double(bot->tie);
        bot->tie = NULL;
-    } if (bot->bot_flags & RT_BOT_USE_FLOATS) {
+    }
+
+    if (bot->bot_flags & RT_BOT_USE_FLOATS) {
        rt_bot_free_float(bot);
     } else {
        rt_bot_free_double(bot);
@@ -984,28 +986,8 @@
        bip->num_face_normals = 0;
     }
 
-    /* alloc bip->tie and fill it in if reasonabe.
-     * do not ignore original, need it for plot 'n stuff. */
     bip->tie = NULL;
-    /* without known winding or normals, we cannot use tie. */
-    if ( bip->face_normals == NULL && bip->orientation == RT_BOT_UNORIENTED )
-       return 0;
-    {
-       int i;
 
-       bip->tie = bottie_allocn_double(bip->num_faces);
-
-       for(i=0;i< bip->num_faces; i++) {
-           fastf_t *v[3];
-
-           v[0] = &bip->vertices[bip->faces[i*3+0]*3];
-           v[1] = &bip->vertices[bip->faces[i*3+1]*3];
-           v[2] = &bip->vertices[bip->faces[i*3+2]*3];
-           bottie_push_double((struct tie_s *)bip->tie, v, 1, i, 0);
-       }
-    }
-    /* prep will wire the engine to bot_specific */
-
     return 0;                  /* OK */
 }
 
@@ -1289,6 +1271,9 @@
     RT_BOT_CK_MAGIC(bot_ip);
     bot_ip->magic = 0;                 /* sanity */
 
+    if (bot_ip->tie)
+       bot_ip->tie = NULL;
+
     if (bot_ip->vertices) {
        bu_free(bot_ip->vertices, "BOT vertices");
        bot_ip->vertices = NULL;

Modified: brlcad/branches/bottie/src/librt/primitives/bot/btg.c
===================================================================
--- brlcad/branches/bottie/src/librt/primitives/bot/btg.c       2010-11-29 
19:49:02 UTC (rev 41471)
+++ brlcad/branches/bottie/src/librt/primitives/bot/btg.c       2010-11-29 
21:59:00 UTC (rev 41472)
@@ -61,6 +61,7 @@
     struct tie_s *tie;
     struct bot_specific *bot;
     point_t p;
+    int i;
 
     RT_BOT_CK_MAGIC(bot_ip);
 
@@ -69,11 +70,20 @@
     bot->bot_mode = bot_ip->mode;
     bot->bot_orientation = bot_ip->orientation;
     bot->bot_flags = bot_ip->bot_flags;
-    bot->tie = bot_ip->tie;
-    tie = bot_ip->tie;
 
-    tie_prep1((struct tie_s *)bot_ip->tie);
+    tie = bot_ip->tie = bot->tie = bottie_allocn_double(bot_ip->num_faces);
 
+    for(i=0;i< bot_ip->num_faces; i++) {
+       fastf_t *v[3];
+
+       v[0] = &bot_ip->vertices[bot_ip->faces[i*3+0]*3];
+       v[1] = &bot_ip->vertices[bot_ip->faces[i*3+1]*3];
+       v[2] = &bot_ip->vertices[bot_ip->faces[i*3+2]*3];
+       bottie_push_double((struct tie_s *)tie, v, 1, i, 0);
+    }
+
+    tie_prep1((struct tie_s *)bot->tie);
+
     VMOVE(stp->st_min, tie->min.v);
     VMOVE(stp->st_max, tie->max.v);
     VMOVE(stp->st_center, tie->mid);

Modified: brlcad/branches/bottie/src/librt/primitives/bot/g_bot_include.c
===================================================================
--- brlcad/branches/bottie/src/librt/primitives/bot/g_bot_include.c     
2010-11-29 19:49:02 UTC (rev 41471)
+++ brlcad/branches/bottie/src/librt/primitives/bot/g_bot_include.c     
2010-11-29 21:59:00 UTC (rev 41472)
@@ -379,8 +379,6 @@
      * -c "set rt_bot_minpieces=0"
      */
 
-    bot->tie = bot_ip->tie;
-
     return 0;
 }
 


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

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to