chiark / gitweb /
sotextpit
[moebius.git] / dualx11.cc
index 5c40ba2ea2d93c683f52f4829c06a3895dfb4a1f..6a2edd5a796aeaac6e8e6fe288b62ea39cd0a9dd 100644 (file)
@@ -63,21 +63,36 @@ DualX11Output::~DualX11Output() {
   XCloseDisplay(display);
 }
 
-void DualX11Output::drawcell(const Point* list, int n) {
-  static Parameter<double> eyeseparation("eyesep",
-                                         "Distance from projection eye to origin", 
-                                         0.3, .1, 0., 100.);
+void DualX11Output::drawcell(const Point* list, int n, Colour colour) {
+  static Parameter<double>
+    eyeseparation("eyesep", "Distance from projection eye to origin", 
+                 0.3, .1, 0., 100.);
+
   for (int i=0; i<2; i++) {
+    GC fill;
+    bool draw;
+    
     Point::seteyex(eyeseparation*(i-0.5));
+
+    switch (colour) {
+    case grid:       fill= fabric[i]; draw= true;  break;
+    case solidblack: fill= fabric[i]; draw= false; break;
+    case solidwhite: fill= mesh[i];   draw= false; break;
+    default: abort();
+    }
+
     XPoint xp[n+1];
     for (int j=0; j<n; j++) {
       Onscreen here= Onscreen(list[j]);
       xp[j].x= (int)((here.x+1.0)*(dualx11size*0.5));
       xp[j].y= (int)((-here.y+1.0)*(dualx11size*0.5));
     }
-    XFillPolygon(display,window,fabric[i],xp,n,Nonconvex,CoordModeOrigin);
-    xp[n]= xp[0];
-    XDrawLines(display,window,mesh[i],xp,n+1,CoordModeOrigin);
+
+    XFillPolygon(display,window,fill,xp,n,Nonconvex,CoordModeOrigin);
+    if (draw) {
+      xp[n]= xp[0];
+      XDrawLines(display,window,mesh[i],xp,n+1,CoordModeOrigin);
+    }
   }
   Point::seteyex(0);
 }