Revision: 45861
          http://brlcad.svn.sourceforge.net/brlcad/?rev=45861&view=rev
Author:   brlcad
Date:     2011-08-09 22:31:33 +0000 (Tue, 09 Aug 2011)

Log Message:
-----------
make the dsp brep implementation use the new private dsp.h header for the DSP() 
macro instead of duplicating the code (bad, no donut for you).  similarly, 
there shouldn't need to be any need to validate the dsp_ip or load it because 
that would have already happened during import.  redoing that here will just 
leak memory and be not as good as what is done during import.

Modified Paths:
--------------
    brlcad/trunk/src/librt/primitives/dsp/dsp_brep.cpp

Modified: brlcad/trunk/src/librt/primitives/dsp/dsp_brep.cpp
===================================================================
--- brlcad/trunk/src/librt/primitives/dsp/dsp_brep.cpp  2011-08-09 22:25:21 UTC 
(rev 45860)
+++ brlcad/trunk/src/librt/primitives/dsp/dsp_brep.cpp  2011-08-09 22:31:33 UTC 
(rev 45861)
@@ -29,7 +29,10 @@
 #include "rtgeom.h"
 #include "brep.h"
 
+/* private header */
+#include "./dsp.h"
 
+
 /**
  * R T _ D S P _ B R E P
  */
@@ -44,49 +47,9 @@
     RT_CK_DB_INTERNAL(ip);
     dsp_ip = (struct rt_dsp_internal *)ip->idb_ptr;
     RT_DSP_CK_MAGIC(dsp_ip);
-    *b = NULL;
 
-    switch (dsp_ip->dsp_datasrc) {
-       case RT_DSP_SRC_V4_FILE:
-       case RT_DSP_SRC_FILE:
-           dsp_ip->dsp_mp = 
bu_open_mapped_file(bu_vls_addr(&dsp_ip->dsp_name), "dsp");
-           if (!dsp_ip->dsp_mp) {
-               bu_log("WARNING: Cannot find data file for displacement map 
(DSP)\n");
-               if (bu_vls_addr(&dsp_ip->dsp_name)) {
-                   bu_log("         DSP data file [%s] not found or empty\n", 
bu_vls_addr(&dsp_ip->dsp_name));
-               } else {
-                   bu_log("         DSP data file not found or not 
specified\n");
-               }
-               return;
-           }
-           BU_CK_MAPPED_FILE(dsp_ip->dsp_mp);
-           break;
-       case RT_DSP_SRC_OBJ:
-           if (!dsp_ip->dsp_bip) {
-               bu_log("WARNING: Cannot find data object for displacement map 
(DSP)\n");
-               if (bu_vls_addr(&dsp_ip->dsp_name)) {
-                   bu_log("         DSP data object [%s] not found or 
empty\n", bu_vls_addr(&dsp_ip->dsp_name));
-               } else {
-                   bu_log("         DSP data object not found or not 
specified\n");
-               }
-               return;
-           }
-           RT_CK_DB_INTERNAL(dsp_ip->dsp_bip);
-           RT_CK_BINUNIF(dsp_ip->dsp_bip->idb_ptr);
-           break;
-    }
-
     *b = ON_Brep::New();
 
-    // dsp.c defines utility functions for pulling dsp data - this seems like 
a good plan.
-# define DSP(_p, _x, _y) (\
-       (\
-         (unsigned short *) \
-         ((_p)->dsp_buf) \
-)[ \
-       (_y) * ((struct rt_dsp_internal *)_p)->dsp_xcnt + (_x) ])
-
-
     /* A DSP brep is broken down into faces as follows:
      *
      * 1.  The bottom face, a simple planar surface


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

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to