Revision: 51742
          http://brlcad.svn.sourceforge.net/brlcad/?rev=51742&view=rev
Author:   starseeker
Date:     2012-08-01 14:52:51 +0000 (Wed, 01 Aug 2012)
Log Message:
-----------
Re-apply latest version of patch 3512039 from Ksenija Slivko (ksuzee) - in 
addition to refactoring, needed to add ifdef wrapper for OpenGL specific code 
in dm_util.c, so it doesn't break compilation if OpenGL is off.

Modified Paths:
--------------
    brlcad/trunk/src/libdm/CMakeLists.txt
    brlcad/trunk/src/libdm/Makefile.am
    brlcad/trunk/src/libdm/dm-X.c
    brlcad/trunk/src/libdm/dm-ogl.c
    brlcad/trunk/src/libdm/dm-plot.c
    brlcad/trunk/src/libdm/dm-ps.c
    brlcad/trunk/src/libdm/dm-rtgl.c
    brlcad/trunk/src/libdm/dm-wgl.c

Added Paths:
-----------
    brlcad/trunk/src/libdm/dm_util.c
    brlcad/trunk/src/libdm/dm_util.h

Modified: brlcad/trunk/src/libdm/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libdm/CMakeLists.txt       2012-08-01 14:50:46 UTC (rev 
51741)
+++ brlcad/trunk/src/libdm/CMakeLists.txt       2012-08-01 14:52:51 UTC (rev 
51742)
@@ -72,6 +72,7 @@
   dm-plot.c
   dm-ps.c
   dm_obj.c
+  dm_util.c
   focus.c
   grid.c
   knob.c
@@ -99,6 +100,7 @@
   TODO
   )
 CMAKEFILES(${libdm_ignore_files})
+CMAKEFILES(dm_util.h)
 CMAKEFILES(Makefile.am)
 
 # Local Variables:

Modified: brlcad/trunk/src/libdm/Makefile.am
===================================================================
--- brlcad/trunk/src/libdm/Makefile.am  2012-08-01 14:50:46 UTC (rev 51741)
+++ brlcad/trunk/src/libdm/Makefile.am  2012-08-01 14:52:51 UTC (rev 51742)
@@ -51,6 +51,7 @@
        dm-ps.c \
        dm-wgl.c \
        dm_obj.c \
+       dm_util.c \
        focus.c \
        grid.c \
        knob.c \
@@ -84,6 +85,7 @@
 
 EXTRA_DIST = \
        TODO \
+        dm_util.h \
        CMakeLists.txt
 
 DEPENDS = src/librt src/libfb src/libged

Modified: brlcad/trunk/src/libdm/dm-X.c
===================================================================
--- brlcad/trunk/src/libdm/dm-X.c       2012-08-01 14:50:46 UTC (rev 51741)
+++ brlcad/trunk/src/libdm/dm-X.c       2012-08-01 14:52:51 UTC (rev 51742)
@@ -62,6 +62,7 @@
 #include "dm_xvars.h"
 #include "solid.h"
 
+#include "./dm_util.h"
 
 #define PLOTBOUND 1000.0       /* Max magnification in Rot matrix */
 
@@ -1205,14 +1206,7 @@
 HIDDEN int
 X_drawLine3D(struct dm *dmp, point_t pt1, point_t pt2)
 {
-    if (!dmp)
-       return TCL_ERROR;
-
-    if (bn_pt3_pt3_equal(pt1, pt2, NULL)) {
-       /* nothing to do for a singular point */
-       return TCL_OK;
-    }
-    return TCL_OK;
+    return draw_Line3D(dmp, pt1, pt2);
 }
 
 

Modified: brlcad/trunk/src/libdm/dm-ogl.c
===================================================================
--- brlcad/trunk/src/libdm/dm-ogl.c     2012-08-01 14:50:46 UTC (rev 51741)
+++ brlcad/trunk/src/libdm/dm-ogl.c     2012-08-01 14:52:51 UTC (rev 51742)
@@ -79,6 +79,7 @@
 #include "dm_xvars.h"
 #include "solid.h"
 
+#include "./dm_util.h"
 
 #define VIEWFACTOR      (1.0/(*dmp->dm_vp))
 #define VIEWSIZE        (2.0*(*dmp->dm_vp))
@@ -1770,32 +1771,7 @@
 HIDDEN int
 ogl_drawLine2D(struct dm *dmp, fastf_t X1, fastf_t Y1, fastf_t X2, fastf_t Y2)
 {
-    if (dmp->dm_debugLevel)
-       bu_log("ogl_drawLine2D()\n");
-
-    if (dmp->dm_debugLevel) {
-       GLfloat pmat[16];
-
-       glGetFloatv(GL_PROJECTION_MATRIX, pmat);
-       bu_log("projection matrix:\n");
-       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
-       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
-       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
-       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
-       glGetFloatv(GL_MODELVIEW_MATRIX, pmat);
-       bu_log("modelview matrix:\n");
-       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
-       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
-       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
-       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
-    }
-
-    glBegin(GL_LINES);
-    glVertex2f(X1, Y1);
-    glVertex2f(X2, Y2);
-    glEnd();
-
-    return TCL_OK;
+    return drawLine2D(dmp, X1, Y1, X2, Y2, "ogl_drawLine2D()\n");
 }
 
 
@@ -1806,44 +1782,7 @@
 HIDDEN int
 ogl_drawLine3D(struct dm *dmp, point_t pt1, point_t pt2)
 {
-    static float black[4] = {0.0, 0.0, 0.0, 0.0};
-
-    if (dmp->dm_debugLevel)
-       bu_log("ogl_drawLine3D()\n");
-
-    if (dmp->dm_debugLevel) {
-       GLfloat pmat[16];
-
-       glGetFloatv(GL_PROJECTION_MATRIX, pmat);
-       bu_log("projection matrix:\n");
-       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
-       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
-       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
-       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
-       glGetFloatv(GL_MODELVIEW_MATRIX, pmat);
-       bu_log("modelview matrix:\n");
-       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
-       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
-       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
-       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
-    }
-
-    if (dmp->dm_light) {
-       glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, wireColor);
-       glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, black);
-       glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, black);
-       glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, black);
-
-       if (dmp->dm_transparency)
-           glDisable(GL_BLEND);
-    }
-
-    glBegin(GL_LINES);
-    glVertex3dv(pt1);
-    glVertex3dv(pt2);
-    glEnd();
-
-    return TCL_OK;
+    return drawLine3D(dmp, pt1, pt2, "ogl_drawLine3D()\n", wireColor);
 }
 
 
@@ -1854,53 +1793,7 @@
 HIDDEN int
 ogl_drawLines3D(struct dm *dmp, int npoints, point_t *points, int sflag)
 {
-    int i;
-    static float black[4] = {0.0, 0.0, 0.0, 0.0};
-
-    if (dmp->dm_debugLevel)
-       bu_log("ogl_drawLine3D()\n");
-
-    if (dmp->dm_debugLevel) {
-       GLfloat pmat[16];
-
-       glGetFloatv(GL_PROJECTION_MATRIX, pmat);
-       bu_log("projection matrix:\n");
-       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
-       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
-       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
-       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
-       glGetFloatv(GL_MODELVIEW_MATRIX, pmat);
-       bu_log("modelview matrix:\n");
-       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
-       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
-       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
-       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
-    }
-
-    if (npoints < 2 || (!sflag && npoints%2))
-       return TCL_OK;
-
-    if (dmp->dm_light) {
-       glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, wireColor);
-       glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, black);
-       glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, black);
-       glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, black);
-
-       if (dmp->dm_transparency)
-           glDisable(GL_BLEND);
-    }
-
-    if (sflag)
-       glBegin(GL_LINE_STRIP);
-    else
-       glBegin(GL_LINES);
-
-    for (i = 0; i < npoints; ++i)
-       glVertex3dv(points[i]);
-
-    glEnd();
-
-    return TCL_OK;
+    return drawLines3D(dmp, npoints, points, sflag, "ogl_drawLine3D()\n", 
wireColor);
 }
 
 

Modified: brlcad/trunk/src/libdm/dm-plot.c
===================================================================
--- brlcad/trunk/src/libdm/dm-plot.c    2012-08-01 14:50:46 UTC (rev 51741)
+++ brlcad/trunk/src/libdm/dm-plot.c    2012-08-01 14:52:51 UTC (rev 51742)
@@ -51,6 +51,8 @@
 #include "solid.h"
 #include "plot3.h"
 
+#include "./dm_util.h"
+
 /* Display Manager package interface */
 
 #define PLOTBOUND 1000.0       /* Max magnification in Rot matrix */
@@ -398,15 +400,7 @@
 HIDDEN int
 plot_drawLine3D(struct dm *dmp, point_t pt1, point_t pt2)
 {
-    if (!dmp)
-       return TCL_ERROR;
-
-    if (bn_pt3_pt3_equal(pt1, pt2, NULL)) {
-       /* nothing to do for a singular point */
-       return TCL_OK;
-    }
-
-    return TCL_OK;
+    return draw_Line3D(dmp, pt1, pt2);
 }
 
 

Modified: brlcad/trunk/src/libdm/dm-ps.c
===================================================================
--- brlcad/trunk/src/libdm/dm-ps.c      2012-08-01 14:50:46 UTC (rev 51741)
+++ brlcad/trunk/src/libdm/dm-ps.c      2012-08-01 14:52:51 UTC (rev 51742)
@@ -48,6 +48,8 @@
 #include "dm-ps.h"
 #include "solid.h"
 
+#include "./dm_util.h"
+
 #define EPSILON 0.0001
 
 /* Display Manager package interface */
@@ -410,15 +412,7 @@
 HIDDEN int
 ps_drawLine3D(struct dm *dmp, point_t pt1, point_t pt2)
 {
-    if (!dmp)
-       return TCL_ERROR;
-
-    if (bn_pt3_pt3_equal(pt1, pt2, NULL)) {
-       /* nothing to do for a singular point */
-       return TCL_OK;
-    }
-
-    return TCL_OK;
+    return draw_Line3D(dmp, pt1, pt2);
 }
 
 

Modified: brlcad/trunk/src/libdm/dm-rtgl.c
===================================================================
--- brlcad/trunk/src/libdm/dm-rtgl.c    2012-08-01 14:50:46 UTC (rev 51741)
+++ brlcad/trunk/src/libdm/dm-rtgl.c    2012-08-01 14:52:51 UTC (rev 51742)
@@ -59,6 +59,8 @@
 #include "dm_xvars.h"
 #include "solid.h"
 
+#include "./dm_util.h"
+
 #define VIEWFACTOR (1.0/(*dmp->dm_vp))
 #define VIEWSIZE (2.0*(*dmp->dm_vp))
 
@@ -2038,32 +2040,7 @@
 rtgl_drawLine2D(struct dm *dmp, fastf_t x1, fastf_t y1, fastf_t x2, fastf_t y2)
 {
 
-    if (dmp->dm_debugLevel)
-       bu_log("rtgl_drawLine2D()\n");
-
-    if (dmp->dm_debugLevel) {
-       GLfloat pmat[16];
-
-       glGetFloatv(GL_PROJECTION_MATRIX, pmat);
-       bu_log("projection matrix:\n");
-       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
-       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
-       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
-       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
-       glGetFloatv(GL_MODELVIEW_MATRIX, pmat);
-       bu_log("modelview matrix:\n");
-       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
-       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
-       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
-       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
-    }
-
-    glBegin(GL_LINES);
-    glVertex2f(x1, y1);
-    glVertex2f(x2, y2);
-    glEnd();
-
-    return TCL_OK;
+    return drawLine2D(dmp, x1, y1, x2, y2, "rtgl_drawLine2D()\n");
 }
 
 

Modified: brlcad/trunk/src/libdm/dm-wgl.c
===================================================================
--- brlcad/trunk/src/libdm/dm-wgl.c     2012-08-01 14:50:46 UTC (rev 51741)
+++ brlcad/trunk/src/libdm/dm-wgl.c     2012-08-01 14:52:51 UTC (rev 51742)
@@ -47,6 +47,8 @@
 #include "dm_xvars.h"
 #include "solid.h"
 
+#include "./dm_util.h"
+
 #define VIEWFACTOR      (1.0/(*dmp->dm_vp))
 #define VIEWSIZE        (2.0*(*dmp->dm_vp))
 
@@ -1346,44 +1348,7 @@
 HIDDEN int
 wgl_drawLine3D(struct dm *dmp, point_t pt1, point_t pt2)
 {
-    static float black[4] = {0.0, 0.0, 0.0, 0.0};
-
-    if (dmp->dm_debugLevel)
-       bu_log("wgl_drawLine3D()\n");
-
-    if (dmp->dm_debugLevel) {
-       GLfloat pmat[16];
-
-       glGetFloatv(GL_PROJECTION_MATRIX, pmat);
-       bu_log("projection matrix:\n");
-       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
-       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
-       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
-       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
-       glGetFloatv(GL_MODELVIEW_MATRIX, pmat);
-       bu_log("modelview matrix:\n");
-       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
-       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
-       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
-       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
-    }
-
-    if (dmp->dm_light) {
-       glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, wireColor);
-       glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, black);
-       glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, black);
-       glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, black);
-
-       if (dmp->dm_transparency)
-           glDisable(GL_BLEND);
-    }
-
-    glBegin(GL_LINES);
-    glVertex3dv(pt1);
-    glVertex3dv(pt2);
-    glEnd();
-
-    return TCL_OK;
+    return drawLine3D(dmp, pt1, pt2, "wgl_drawLine3D()\n", wireColor);
 }
 
 
@@ -1394,53 +1359,7 @@
 HIDDEN int
 wgl_drawLines3D(struct dm *dmp, int npoints, point_t *points, int sflag)
 {
-    register int i;
-    static float black[4] = {0.0, 0.0, 0.0, 0.0};
-
-    if (dmp->dm_debugLevel)
-       bu_log("wgl_drawLine3D()\n");
-
-    if (dmp->dm_debugLevel) {
-       GLfloat pmat[16];
-
-       glGetFloatv(GL_PROJECTION_MATRIX, pmat);
-       bu_log("projection matrix:\n");
-       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
-       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
-       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
-       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
-       glGetFloatv(GL_MODELVIEW_MATRIX, pmat);
-       bu_log("modelview matrix:\n");
-       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
-       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
-       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
-       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
-    }
-
-    if (npoints < 2 || (!sflag && npoints%2))
-       return TCL_OK;
-
-    if (dmp->dm_light) {
-       glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, wireColor);
-       glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, black);
-       glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, black);
-       glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, black);
-
-       if (dmp->dm_transparency)
-           glDisable(GL_BLEND);
-    }
-
-    if (sflag)
-       glBegin(GL_LINE_STRIP);
-    else
-       glBegin(GL_LINES);
-
-    for (i = 0; i < npoints; ++i)
-       glVertex3dv(points[i]);
-
-    glEnd();
-
-    return TCL_OK;
+    return drawLines3D(dmp, npoints, points, sflag, "wgl_drawLine3D()\n", 
wireColor);
 }
 
 

Added: brlcad/trunk/src/libdm/dm_util.c
===================================================================
--- brlcad/trunk/src/libdm/dm_util.c                            (rev 0)
+++ brlcad/trunk/src/libdm/dm_util.c    2012-08-01 14:52:51 UTC (rev 51742)
@@ -0,0 +1,179 @@
+/*                        D M _ U T I L . C
+ * BRL-CAD
+ *
+ * Copyright (c) 1988-2012 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 libdm/dm_util.c
+ */
+
+#include "bu.h"
+#include "bn.h"
+#include "dm.h"
+
+#include "./dm_util.h"
+
+#if defined(DM_OGL) || defined(DM_WGL) || defined(DM_RTGL)
+int
+drawLine3D(struct dm *dmp, point_t pt1, point_t pt2, char *log_bu, float 
*wireColor)
+{
+    static float black[4] = {0.0, 0.0, 0.0, 0.0};
+
+    if (dmp->dm_debugLevel)
+       bu_log(log_bu);
+
+    if (dmp->dm_debugLevel) {
+       GLfloat pmat[16];
+
+       glGetFloatv(GL_PROJECTION_MATRIX, pmat);
+       bu_log("projection matrix:\n");
+       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
+       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
+       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
+       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
+       glGetFloatv(GL_MODELVIEW_MATRIX, pmat);
+       bu_log("modelview matrix:\n");
+       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
+       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
+       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
+       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
+    }
+
+    if (dmp->dm_light) {
+       glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, wireColor);
+       glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, black);
+       glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, black);
+       glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, black);
+
+       if (dmp->dm_transparency)
+           glDisable(GL_BLEND);
+    }
+
+    glBegin(GL_LINES);
+    glVertex3dv(pt1);
+    glVertex3dv(pt2);
+    glEnd();
+
+    return TCL_OK;
+}
+
+int
+drawLines3D(struct dm *dmp, int npoints, point_t *points, int sflag, char 
*log_bu, float *wireColor)
+{
+    register int i;
+    static float black[4] = {0.0, 0.0, 0.0, 0.0};
+
+    if (dmp->dm_debugLevel)
+       bu_log(log_bu);
+
+    if (dmp->dm_debugLevel) {
+       GLfloat pmat[16];
+
+       glGetFloatv(GL_PROJECTION_MATRIX, pmat);
+       bu_log("projection matrix:\n");
+       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
+       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
+       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
+       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
+       glGetFloatv(GL_MODELVIEW_MATRIX, pmat);
+       bu_log("modelview matrix:\n");
+       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
+       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
+       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
+       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
+    }
+
+    if (npoints < 2 || (!sflag && npoints%2))
+       return TCL_OK;
+
+    if (dmp->dm_light) {
+       glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, wireColor);
+       glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, black);
+       glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, black);
+       glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, black);
+
+       if (dmp->dm_transparency)
+           glDisable(GL_BLEND);
+    }
+
+    if (sflag)
+       glBegin(GL_LINE_STRIP);
+    else
+       glBegin(GL_LINES);
+
+    for (i = 0; i < npoints; ++i)
+       glVertex3dv(points[i]);
+
+    glEnd();
+
+    return TCL_OK;
+}
+
+int
+drawLine2D(struct dm *dmp, fastf_t X1, fastf_t Y1, fastf_t X2, fastf_t Y2, 
char *log_bu)
+{
+    if (dmp->dm_debugLevel)
+       bu_log(log_bu);
+
+    if (dmp->dm_debugLevel) {
+       GLfloat pmat[16];
+
+       glGetFloatv(GL_PROJECTION_MATRIX, pmat);
+       bu_log("projection matrix:\n");
+       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
+       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
+       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
+       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
+       glGetFloatv(GL_MODELVIEW_MATRIX, pmat);
+       bu_log("modelview matrix:\n");
+       bu_log("%g %g %g %g\n", pmat[0], pmat[4], pmat[8], pmat[12]);
+       bu_log("%g %g %g %g\n", pmat[1], pmat[5], pmat[9], pmat[13]);
+       bu_log("%g %g %g %g\n", pmat[2], pmat[6], pmat[10], pmat[14]);
+       bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
+    }
+
+    glBegin(GL_LINES);
+    glVertex2f(X1, Y1);
+    glVertex2f(X2, Y2);
+    glEnd();
+
+    return TCL_OK;
+}
+#endif
+
+inline int
+draw_Line3D(struct dm *dmp, point_t pt1, point_t pt2)
+{
+    if (!dmp)
+       return TCL_ERROR;
+
+    if (bn_pt3_pt3_equal(pt1, pt2, NULL)) {
+       /* nothing to do for a singular point */
+       return TCL_OK;
+    }
+
+    return TCL_OK;
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */


Property changes on: brlcad/trunk/src/libdm/dm_util.c
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native

Added: brlcad/trunk/src/libdm/dm_util.h
===================================================================
--- brlcad/trunk/src/libdm/dm_util.h                            (rev 0)
+++ brlcad/trunk/src/libdm/dm_util.h    2012-08-01 14:52:51 UTC (rev 51742)
@@ -0,0 +1,47 @@
+/*                        D M _ U T I L . H
+ * BRL-CAD
+ *
+ * Copyright (c) 1988-2012 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 libdm/dm_util.h
+ */
+
+#include "vmath.h"
+#include "dm.h"
+
+
+int
+drawLine3D(struct dm *dmp, point_t pt1, point_t pt2, char *log_bu, float 
*wireColor);
+
+int
+drawLines3D(struct dm *dmp, int npoints, point_t *points, int sflag, char 
*log_bu, float *wireColor);
+
+int
+drawLine2D(struct dm *dmp, fastf_t X1, fastf_t Y1, fastf_t X2, fastf_t Y2, 
char *log_bu);
+
+int
+draw_Line3D(struct dm *dmp, point_t pt1, point_t pt2);
+
+/*
+ * Local Variables:
+ * mode: C
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */


Property changes on: brlcad/trunk/src/libdm/dm_util.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to