BRL-CAD
dm-plot.c
Go to the documentation of this file.
1 /* D M - P L O T . C
2  * BRL-CAD
3  *
4  * Copyright (c) 1985-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @file libdm/dm-plot.c
21  *
22  * An unsatisfying (but useful) hack to allow GED to generate
23  * UNIX-plot files that not only contain the drawn objects, but also
24  * contain the faceplate display as well. Mostly, a useful hack for
25  * making viewgraphs and photographs of an editing session. We assume
26  * that the UNIX-plot filter used can at least discard the
27  * non-standard extension to specify color (a Doug Gwyn addition).
28  *
29  */
30 
31 #include "common.h"
32 
33 #define __USE_POSIX2 1
34 #include <string.h>
35 #ifdef HAVE_SYS_TIME_H
36 # include <sys/time.h> /* for struct timeval */
37 #endif
38 
39 #include "tcl.h"
40 #include "vmath.h"
41 #include "bn.h"
42 #include "mater.h"
43 #include "raytrace.h"
44 #include "dm.h"
45 
46 #include "dm-plot.h"
47 #include "dm-Null.h"
48 
49 #include "solid.h"
50 #include "plot3.h"
51 
52 #include "./dm_private.h"
53 
54 /* Display Manager package interface */
55 
56 #define PLOTBOUND 1000.0 /* Max magnification in Rot matrix */
57 
59 static mat_t plotmat;
60 
61 
62 /**
63  * Gracefully release the display.
64  */
65 HIDDEN int
67 {
68  if (!dmp)
69  return TCL_ERROR;
70 
71  (void)fflush(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp);
72 
73  if (((struct plot_vars *)dmp->dm_vars.priv_vars)->is_pipe)
74  pclose(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp); /* close pipe, eat dead children */
75  else
76  fclose(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp);
77 
78  bu_vls_free(&dmp->dm_pathName);
79  bu_free((void *)dmp->dm_vars.priv_vars, "plot_close: plot_vars");
80  bu_free((void *)dmp, "plot_close: dmp");
81 
82  return TCL_OK;
83 }
84 
85 
86 /**
87  * There are global variables which are parameters to this routine.
88  */
89 HIDDEN int
91 {
92  if (!dmp)
93  return TCL_ERROR;
94 
95  /* We expect the screen to be blank so far, from last frame flush */
96 
97  return TCL_OK;
98 }
99 
100 
101 HIDDEN int
103 {
104  if (!dmp)
105  return TCL_ERROR;
106 
107  pl_flush(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp); /* BRL-specific command */
108  pl_erase(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp); /* forces drawing */
109  (void)fflush(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp);
110 
111  return TCL_OK;
112 }
113 
114 
115 /**
116  * Load a new transformation matrix. This will be followed by
117  * many calls to plot_draw().
118  */
119 HIDDEN int
120 plot_loadMatrix(dm *dmp, fastf_t *mat, int which_eye)
121 {
122  Tcl_Obj *obj;
123 
124  if (!dmp)
125  return TCL_ERROR;
126 
127  obj = Tcl_GetObjResult(dmp->dm_interp);
128  if (Tcl_IsShared(obj))
129  obj = Tcl_DuplicateObj(obj);
130 
131  if (((struct plot_vars *)dmp->dm_vars.priv_vars)->debug) {
132  struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
133 
134  Tcl_AppendStringsToObj(obj, "plot_loadMatrix()\n", (char *)NULL);
135 
136  bu_vls_printf(&tmp_vls, "which eye = %d\t", which_eye);
137  bu_vls_printf(&tmp_vls, "transformation matrix = \n");
138  bu_vls_printf(&tmp_vls, "%g %g %g %g\n", mat[0], mat[4], mat[8], mat[12]);
139  bu_vls_printf(&tmp_vls, "%g %g %g %g\n", mat[1], mat[5], mat[9], mat[13]);
140  bu_vls_printf(&tmp_vls, "%g %g %g %g\n", mat[2], mat[6], mat[10], mat[14]);
141  bu_vls_printf(&tmp_vls, "%g %g %g %g\n", mat[3], mat[7], mat[11], mat[15]);
142 
143  Tcl_AppendStringsToObj(obj, bu_vls_addr(&tmp_vls), (char *)NULL);
144  bu_vls_free(&tmp_vls);
145  }
146 
147  MAT_COPY(plotmat, mat);
148  Tcl_SetObjResult(dmp->dm_interp, obj);
149  return TCL_OK;
150 }
151 
152 
153 /**
154  * Set up for an object, transformed as indicated, and with an
155  * object center as specified. The ratio of object to screen size
156  * is passed in as a convenience.
157  *
158  * Returns 0 if object could be drawn, !0 if object was omitted.
159  */
160 HIDDEN int
161 plot_drawVList(dm *dmp, struct bn_vlist *vp)
162 {
163  static vect_t last;
164  struct bn_vlist *tvp;
165  point_t *pt_prev=NULL;
166  fastf_t dist_prev=1.0;
167  fastf_t dist;
168  fastf_t delta;
169  int useful = 0;
170 
171  if (((struct plot_vars *)dmp->dm_vars.priv_vars)->floating) {
172  rt_vlist_to_uplot(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp, &vp->l);
173 
174  return TCL_OK;
175  }
176 
177  /* delta is used in clipping to insure clipped endpoint is
178  * slightly in front of eye plane (perspective mode only). This
179  * value is a SWAG that seems to work OK.
180  */
181  delta = plotmat[15]*0.0001;
182  if (delta < 0.0)
183  delta = -delta;
184  if (delta < SQRT_SMALL_FASTF)
185  delta = SQRT_SMALL_FASTF;
186 
187  for (BU_LIST_FOR(tvp, bn_vlist, &vp->l)) {
188  int i;
189  int nused = tvp->nused;
190  int *cmd = tvp->cmd;
191  point_t *pt = tvp->pt;
192  for (i = 0; i < nused; i++, cmd++, pt++) {
193  static vect_t start, fin;
194  switch (*cmd) {
195  case BN_VLIST_POLY_START:
197  case BN_VLIST_TRI_START:
199  continue;
200  case BN_VLIST_POLY_MOVE:
201  case BN_VLIST_LINE_MOVE:
202  case BN_VLIST_TRI_MOVE:
203  /* Move, not draw */
204  if (dmp->dm_perspective > 0) {
205  /* cannot apply perspective transformation to
206  * points behind eye plane!!!!
207  */
208  dist = VDOT(*pt, &plotmat[12]) + plotmat[15];
209  if (dist <= 0.0) {
210  pt_prev = pt;
211  dist_prev = dist;
212  continue;
213  } else {
214  MAT4X3PNT(last, plotmat, *pt);
215  dist_prev = dist;
216  pt_prev = pt;
217  }
218  } else
219  MAT4X3PNT(last, plotmat, *pt);
220  continue;
221  case BN_VLIST_POLY_DRAW:
222  case BN_VLIST_POLY_END:
223  case BN_VLIST_LINE_DRAW:
224  case BN_VLIST_TRI_DRAW:
225  case BN_VLIST_TRI_END:
226  /* draw */
227  if (dmp->dm_perspective > 0) {
228  /* cannot apply perspective transformation to
229  * points behind eye plane!!!!
230  */
231  dist = VDOT(*pt, &plotmat[12]) + plotmat[15];
232  if (dist <= 0.0) {
233  if (dist_prev <= 0.0) {
234  /* nothing to plot */
235  dist_prev = dist;
236  pt_prev = pt;
237  continue;
238  } else {
239  if (pt_prev) {
240  fastf_t alpha;
241  vect_t diff;
242  point_t tmp_pt;
243 
244  /* clip this end */
245  VSUB2(diff, *pt, *pt_prev);
246  alpha = (dist_prev - delta) / (dist_prev - dist);
247  VJOIN1(tmp_pt, *pt_prev, alpha, diff);
248  MAT4X3PNT(fin, plotmat, tmp_pt);
249  }
250  }
251  } else {
252  if (dist_prev <= 0.0) {
253  if (pt_prev) {
254  fastf_t alpha;
255  vect_t diff;
256  point_t tmp_pt;
257 
258  /* clip other end */
259  VSUB2(diff, *pt, *pt_prev);
260  alpha = (-dist_prev + delta) / (dist - dist_prev);
261  VJOIN1(tmp_pt, *pt_prev, alpha, diff);
262  MAT4X3PNT(last, plotmat, tmp_pt);
263  MAT4X3PNT(fin, plotmat, *pt);
264  }
265  } else {
266  MAT4X3PNT(fin, plotmat, *pt);
267  }
268  }
269  } else
270  MAT4X3PNT(fin, plotmat, *pt);
271  VMOVE(start, last);
272  VMOVE(last, fin);
273  break;
274  }
275  if (vclip(start, fin, dmp->dm_clipmin, dmp->dm_clipmax) == 0)
276  continue;
277 
278  if (((struct plot_vars *)dmp->dm_vars.priv_vars)->is_3D)
279  pl_3line(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp,
280  (int)(start[X] * 2047),
281  (int)(start[Y] * 2047),
282  (int)(start[Z] * 2047),
283  (int)(fin[X] * 2047),
284  (int)(fin[Y] * 2047),
285  (int)(fin[Z] * 2047));
286  else
287  pl_line(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp,
288  (int)(start[X] * 2047),
289  (int)(start[Y] * 2047),
290  (int)(fin[X] * 2047),
291  (int)(fin[Y] * 2047));
292 
293  useful = 1;
294  }
295  }
296 
297  if (useful)
298  return TCL_OK;
299 
300  return TCL_ERROR;
301 }
302 
303 
304 HIDDEN int
305 plot_draw(dm *dmp, struct bn_vlist *(*callback_function)(void *), void **data)
306 {
307  struct bn_vlist *vp;
308  if (!callback_function) {
309  if (data) {
310  vp = (struct bn_vlist *)data;
311  plot_drawVList(dmp, vp);
312  }
313  } else {
314  if (!data) {
315  return TCL_ERROR;
316  } else {
317  (void)callback_function(data);
318  }
319  }
320  return TCL_OK;
321 }
322 
323 
324 /**
325  * Restore the display processor to a normal mode of operation (i.e.,
326  * not scaled, rotated, displaced, etc.). Turns off windowing.
327  */
328 HIDDEN int
330 {
331  if (!dmp)
332  return TCL_ERROR;
333 
334  return TCL_OK;
335 }
336 
337 
338 /**
339  * Output a string into the displaylist.
340  * The starting position of the beam is as specified.
341  */
342 HIDDEN int
343 plot_drawString2D(dm *dmp, const char *str, fastf_t x, fastf_t y, int size, int UNUSED(use_aspect))
344 {
345  int sx, sy;
346 
347  if (!dmp || !str || size < 0) {
348  return TCL_ERROR;
349  }
350 
351  sx = x * 2047;
352  sy = y + 2047;
353  pl_move(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp, sx, sy);
354  pl_label(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp, str);
355 
356  return TCL_OK;
357 }
358 
359 
360 HIDDEN int
361 plot_drawLine2D(dm *dmp, fastf_t xpos1, fastf_t ypos1, fastf_t xpos2, fastf_t ypos2)
362 {
363  int sx1, sy1;
364  int sx2, sy2;
365 
366  sx1 = xpos1 * 2047;
367  sx2 = xpos2 * 2047;
368  sy1 = ypos1 + 2047;
369  sy2 = ypos2 + 2047;
370  pl_move(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp, sx1, sy1);
371  pl_cont(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp, sx2, sy2);
372 
373  return TCL_OK;
374 }
375 
376 
377 HIDDEN int
378 plot_drawLine3D(dm *dmp, point_t pt1, point_t pt2)
379 {
380  return draw_Line3D(dmp, pt1, pt2);
381 }
382 
383 
384 HIDDEN int
385 plot_drawLines3D(dm *dmp, int npoints, point_t *points, int UNUSED(sflag))
386 {
387  if (!dmp || npoints < 0 || !points)
388  return TCL_ERROR;
389 
390  return TCL_OK;
391 }
392 
393 
394 HIDDEN int
396 {
397  return plot_drawLine2D(dmp, x, y, x, y);
398 }
399 
400 
401 HIDDEN int
402 plot_setFGColor(dm *dmp, unsigned char r, unsigned char g, unsigned char b, int strict, fastf_t transparency)
403 {
404  if (!dmp) {
405  bu_log("WARNING: NULL display (r/g/b => %d/%d/%d; strict => %d; transparency => %f)\n", r, g, b, strict, transparency);
406  return TCL_ERROR;
407  }
408 
409  pl_color(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp, (int)r, (int)g, (int)b);
410  return TCL_OK;
411 }
412 HIDDEN int
413 plot_setBGColor(dm *dmp, unsigned char r, unsigned char g, unsigned char b)
414 {
415  if (!dmp) {
416  bu_log("WARNING: Null display (r/g/b==%d/%d/%d)\n", r, g, b);
417  return TCL_ERROR;
418  }
419 
420  return TCL_OK;
421 }
422 
423 
424 HIDDEN int
425 plot_setLineAttr(dm *dmp, int width, int style)
426 {
427  dmp->dm_lineWidth = width;
428  dmp->dm_lineStyle = style;
429 
430  if (style == DM_DASHED_LINE)
431  pl_linmod(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp, "dotdashed");
432  else
433  pl_linmod(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp, "solid");
434 
435  return TCL_OK;
436 }
437 
438 
439 HIDDEN int
440 plot_debug(dm *dmp, int lvl)
441 {
442  Tcl_Obj *obj;
443 
444  obj = Tcl_GetObjResult(dmp->dm_interp);
445  if (Tcl_IsShared(obj))
446  obj = Tcl_DuplicateObj(obj);
447 
448  dmp->dm_debugLevel = lvl;
449  (void)fflush(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp);
450  Tcl_AppendStringsToObj(obj, "flushed\n", (char *)NULL);
451 
452  Tcl_SetObjResult(dmp->dm_interp, obj);
453  return TCL_OK;
454 }
455 
456 HIDDEN int
457 plot_logfile(dm *dmp, const char *filename)
458 {
459  Tcl_Obj *obj;
460 
461  obj = Tcl_GetObjResult(dmp->dm_interp);
462  if (Tcl_IsShared(obj))
463  obj = Tcl_DuplicateObj(obj);
464 
465  bu_vls_sprintf(&dmp->dm_log, "%s", filename);
466  (void)fflush(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp);
467  Tcl_AppendStringsToObj(obj, "flushed\n", (char *)NULL);
468 
469  Tcl_SetObjResult(dmp->dm_interp, obj);
470  return TCL_OK;
471 }
472 
473 
474 
475 HIDDEN int
477 {
478  /* Compute the clipping bounds */
479  dmp->dm_clipmin[0] = w[0] / 2048.0;
480  dmp->dm_clipmax[0] = w[1] / 2047.0;
481  dmp->dm_clipmin[1] = w[2] / 2048.0;
482  dmp->dm_clipmax[1] = w[3] / 2047.0;
483 
484  if (dmp->dm_zclip) {
485  dmp->dm_clipmin[2] = w[4] / 2048.0;
486  dmp->dm_clipmax[2] = w[5] / 2047.0;
487  } else {
488  dmp->dm_clipmin[2] = -1.0e20;
489  dmp->dm_clipmax[2] = 1.0e20;
490  }
491 
492  return TCL_OK;
493 }
494 
495 
497  plot_close,
499  plot_drawEnd,
500  plot_normal,
512  plot_draw,
522  plot_debug,
523  plot_logfile,
529  NULL,
530  null_getDisplayImage, /* display to image function */
531  null_reshape,
533  null_openFb,
534  NULL,
535  NULL,
536  0,
537  0, /* no displaylist */
538  0, /* no stereo */
539  PLOTBOUND, /* zoom-in limit */
540  1, /* bound flag */
541  "plot",
542  "Screen to UNIX-Plot",
543  DM_TYPE_PLOT,
544  0,
545  0,
546  0,
547  0, /* bytes per pixel */
548  0, /* bits per channel */
549  0,
550  0,
551  1.0, /* aspect ratio */
552  NULL,
553  {0, 0},
554  NULL,
555  NULL,
556  BU_VLS_INIT_ZERO, /* bu_vls path name*/
557  BU_VLS_INIT_ZERO, /* bu_vls full name drawing window */
558  BU_VLS_INIT_ZERO, /* bu_vls short name drawing window */
559  {0, 0, 0}, /* bg color */
560  {0, 0, 0}, /* fg color */
561  VINIT_ZERO, /* clipmin */
562  VINIT_ZERO, /* clipmax */
563  0, /* no debugging */
564  BU_VLS_INIT_ZERO, /* bu_vls logfile */
565  0, /* no perspective */
566  0, /* no lighting */
567  0, /* no transparency */
568  0, /* depth buffer is not writable */
569  0, /* no zbuffer */
570  0, /* no zclipping */
571  1, /* clear back buffer after drawing and swap */
572  0, /* not overriding the auto font size */
574  FB_NULL,
575  NULL /* Tcl interpreter */
576 };
577 
578 
579 /*
580  * Fire up the display manager, and the display processor.
581  *
582  */
583 dm *
584 plot_open(Tcl_Interp *interp, int argc, const char *argv[])
585 {
586  static int count = 0;
587  dm *dmp;
588  Tcl_Obj *obj;
589 
590  BU_ALLOC(dmp, struct dm_internal);
591 
592  *dmp = dm_plot; /* struct copy */
593  dmp->dm_interp = interp;
594 
595  BU_ALLOC(dmp->dm_vars.priv_vars, struct plot_vars);
596 
597  obj = Tcl_GetObjResult(interp);
598  if (Tcl_IsShared(obj))
599  obj = Tcl_DuplicateObj(obj);
600 
601  bu_vls_init(&((struct plot_vars *)dmp->dm_vars.priv_vars)->vls);
602  bu_vls_init(&dmp->dm_pathName);
603  bu_vls_init(&dmp->dm_tkName);
604  bu_vls_printf(&dmp->dm_pathName, ".dm_plot%d", count++);
605  bu_vls_printf(&dmp->dm_tkName, "dm_plot%d", count++);
606 
607  /* skip first argument */
608  --argc; ++argv;
609 
610  /* Process any options */
611  ((struct plot_vars *)dmp->dm_vars.priv_vars)->is_3D = 1; /* 3-D w/color, by default */
612  while (argv[0] != (char *)0 && argv[0][0] == '-') {
613  switch (argv[0][1]) {
614  case '3':
615  break;
616  case '2':
617  ((struct plot_vars *)dmp->dm_vars.priv_vars)->is_3D = 0; /* 2-D, for portability */
618  break;
619  case 'g':
620  ((struct plot_vars *)dmp->dm_vars.priv_vars)->grid = 1;
621  break;
622  case 'f':
623  ((struct plot_vars *)dmp->dm_vars.priv_vars)->floating = 1;
624  break;
625  case 'z':
626  case 'Z':
627  /* Enable Z clipping */
628  Tcl_AppendStringsToObj(obj, "Clipped in Z to viewing cube\n", (char *)NULL);
629 
630  dmp->dm_zclip = 1;
631  break;
632  default:
633  Tcl_AppendStringsToObj(obj, "bad PLOT option ", argv[0], "\n", (char *)NULL);
634  (void)plot_close(dmp);
635 
636  Tcl_SetObjResult(interp, obj);
637  return DM_NULL;
638  }
639  argv++;
640  }
641  if (argv[0] == (char *)0) {
642  Tcl_AppendStringsToObj(obj, "no filename or filter specified\n", (char *)NULL);
643  (void)plot_close(dmp);
644 
645  Tcl_SetObjResult(interp, obj);
646  return DM_NULL;
647  }
648 
649  if (argv[0][0] == '|') {
650  bu_vls_strcpy(&((struct plot_vars *)dmp->dm_vars.priv_vars)->vls, &argv[0][1]);
651  while ((++argv)[0] != (char *)0) {
652  bu_vls_strcat(&((struct plot_vars *)dmp->dm_vars.priv_vars)->vls, " ");
653  bu_vls_strcat(&((struct plot_vars *)dmp->dm_vars.priv_vars)->vls, argv[0]);
654  }
655 
656  ((struct plot_vars *)dmp->dm_vars.priv_vars)->is_pipe = 1;
657  } else {
658  bu_vls_strcpy(&((struct plot_vars *)dmp->dm_vars.priv_vars)->vls, argv[0]);
659  }
660 
661  if (((struct plot_vars *)dmp->dm_vars.priv_vars)->is_pipe) {
662  if ((((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp =
663  popen(bu_vls_addr(&((struct plot_vars *)dmp->dm_vars.priv_vars)->vls), "w")) == NULL) {
664  perror(bu_vls_addr(&((struct plot_vars *)dmp->dm_vars.priv_vars)->vls));
665  (void)plot_close(dmp);
666  Tcl_SetObjResult(interp, obj);
667  return DM_NULL;
668  }
669 
670  Tcl_AppendStringsToObj(obj, "piped to ",
671  bu_vls_addr(&((struct plot_vars *)dmp->dm_vars.priv_vars)->vls),
672  "\n", (char *)NULL);
673  } else {
674  if ((((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp =
675  fopen(bu_vls_addr(&((struct plot_vars *)dmp->dm_vars.priv_vars)->vls), "wb")) == NULL) {
676  perror(bu_vls_addr(&((struct plot_vars *)dmp->dm_vars.priv_vars)->vls));
677  (void)plot_close(dmp);
678  Tcl_SetObjResult(interp, obj);
679  return DM_NULL;
680  }
681 
682  Tcl_AppendStringsToObj(obj, "plot stored in ",
683  bu_vls_addr(&((struct plot_vars *)dmp->dm_vars.priv_vars)->vls),
684  "\n", (char *)NULL);
685  }
686 
687  setbuf(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp,
688  ((struct plot_vars *)dmp->dm_vars.priv_vars)->ttybuf);
689 
690  if (((struct plot_vars *)dmp->dm_vars.priv_vars)->is_3D)
691  pl_3space(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp,
692  -2048, -2048, -2048, 2048, 2048, 2048);
693  else
694  pl_space(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp,
695  -2048, -2048, 2048, 2048);
696 
697  MAT_IDN(plotmat);
698 
699  Tcl_SetObjResult(interp, obj);
700  return dmp;
701 }
702 
703 
704 /*
705  * Local Variables:
706  * mode: C
707  * tab-width: 8
708  * indent-tabs-mode: t
709  * c-file-style: "stroustrup"
710  * End:
711  * ex: shiftwidth=4 tabstop=8
712  */
dm dm_plot
Definition: dm-plot.c:496
void bu_vls_init(struct bu_vls *vp)
Definition: vls.c:56
int null_setDepthMask(struct dm_internal *dmp, int mask)
Definition: dm-Null.c:199
#define BU_LIST_FOR(p, structure, hp)
Definition: list.h:365
char filename[MAXLENGTH]
Definition: human.c:105
HIDDEN int plot_setWinBounds(dm *dmp, fastf_t *w)
Definition: dm-plot.c:476
size_t nused
elements 0..nused active
Definition: vlist.h:73
void bu_log(const char *,...) _BU_ATTR_PRINTF12
Definition: log.c:176
struct bu_list l
magic, forw, back
Definition: vlist.h:72
void pl_cont(register FILE *plotfp, int x, int y)
Definition: plot3.c:232
HIDDEN int plot_setFGColor(dm *dmp, unsigned char r, unsigned char g, unsigned char b, int strict, fastf_t transparency)
Definition: dm-plot.c:402
HIDDEN int plot_debug(dm *dmp, int lvl)
Definition: dm-plot.c:440
ustring interp
#define DM_DASHED_LINE
Definition: dm.h:109
int dm_zclip
!0 means zclipping
Definition: dm_private.h:116
int cmd[BN_VLIST_CHUNK]
VL_CMD_*.
Definition: vlist.h:74
HIDDEN int plot_drawLine2D(dm *dmp, fastf_t xpos1, fastf_t ypos1, fastf_t xpos2, fastf_t ypos2)
Definition: dm-plot.c:361
HIDDEN int plot_setBGColor(dm *dmp, unsigned char r, unsigned char g, unsigned char b)
Definition: dm-plot.c:413
int draw_Line3D(struct dm_internal *dmp, point_t pt1, point_t pt2)
Definition: dm_util.c:167
void bu_vls_strcat(struct bu_vls *vp, const char *s)
Definition: vls.c:368
vect_t dm_clipmax
maximum clipping vector
Definition: dm_private.h:108
Tcl_Interp * dm_interp
Tcl interpreter.
Definition: dm_private.h:121
dm * plot_open(Tcl_Interp *interp, int argc, const char *argv[])
Definition: dm-plot.c:584
void rt_vlist_to_uplot(FILE *fp, const struct bu_list *vhead)
Definition: vlist.c:446
void pl_line(register FILE *plotfp, int px1, int py1, int px2, int py2)
Definition: plot3.c:193
int null_genDLists(struct dm_internal *dmp, size_t range)
Definition: dm-Null.c:252
Header file for the BRL-CAD common definitions.
int null_loadPMatrix(struct dm_internal *dmp, fastf_t *mat)
Definition: dm-Null.c:73
HIDDEN int plot_drawString2D(dm *dmp, const char *str, fastf_t x, fastf_t y, int size, int use_aspect)
Definition: dm-plot.c:343
ustring width
int null_freeDLists(struct dm_internal *dmp, unsigned int list, int range)
Definition: dm-Null.c:245
void pl_erase(register FILE *plotfp)
Definition: plot3.c:271
#define HIDDEN
Definition: common.h:86
#define BN_VLIST_POLY_MOVE
move to first poly vertex
Definition: vlist.h:85
int null_openFb(struct dm_internal *dmp)
Definition: dm-Null.c:279
#define BN_VLIST_TRI_VERTNORM
per-vertex normal, for interpolation
Definition: vlist.h:93
void pl_space(register FILE *plotfp, int px1, int py1, int px2, int py2)
Definition: plot3.c:257
struct bu_vls dm_tkName
short Tcl/Tk name of drawing window
Definition: dm_private.h:103
HIDDEN int plot_drawPoint2D(dm *dmp, fastf_t x, fastf_t y)
Definition: dm-plot.c:395
void bu_vls_free(struct bu_vls *vp)
Definition: vls.c:248
Definition: color.c:49
COMPLEX data[64]
Definition: fftest.c:34
HIDDEN int plot_normal(dm *dmp)
Definition: dm-plot.c:329
#define DM_NULL
Definition: dm.h:43
HIDDEN int plot_logfile(dm *dmp, const char *filename)
Definition: dm-plot.c:457
HIDDEN int plot_close(dm *dmp)
Definition: dm-plot.c:66
#define FB_NULL
Definition: fb.h:95
#define BU_ALLOC(_ptr, _type)
Definition: malloc.h:223
int dm_perspective
!0 means perspective on
Definition: dm_private.h:111
struct bu_vls dm_log
!NULL && !empty means log debug output to the file
Definition: dm_private.h:110
void bu_vls_sprintf(struct bu_vls *vls, const char *fmt,...) _BU_ATTR_PRINTF23
Definition: vls.c:707
#define PLOTBOUND
Definition: dm-plot.c:56
int null_configureWin(struct dm_internal *dmp, int force)
Definition: dm-Null.c:171
#define BN_VLIST_POLY_START
pt[] has surface normal
Definition: vlist.h:84
#define BN_VLIST_LINE_MOVE
Definition: vlist.h:82
int null_makeCurrent(struct dm_internal *dmp)
Definition: dm-Null.c:272
#define SQRT_SMALL_FASTF
Definition: defines.h:346
int vclip(fastf_t *, fastf_t *, fastf_t *, fastf_t *)
#define BN_VLIST_LINE_DRAW
Definition: vlist.h:83
HIDDEN int plot_setLineAttr(dm *dmp, int width, int style)
Definition: dm-plot.c:425
void pl_label(register FILE *plotfp, const char *s)
Definition: plot3.c:244
#define UNUSED(parameter)
Definition: common.h:239
int null_beginDList(struct dm_internal *dmp, unsigned int list)
Definition: dm-Null.c:225
#define BN_VLIST_POLY_DRAW
subsequent poly vertex
Definition: vlist.h:86
#define DM_TYPE_PLOT
Definition: dm.h:93
char * bu_vls_addr(const struct bu_vls *vp)
Definition: vls.c:111
HIDDEN int plot_drawBegin(dm *dmp)
Definition: dm-plot.c:90
void pl_linmod(register FILE *plotfp, const char *s)
Definition: plot3.c:207
#define BN_VLIST_TRI_END
last vert (repeats 1st), draw poly
Definition: vlist.h:92
int dm_lineWidth
Definition: dm_private.h:95
void null_reshape(struct dm_internal *dmp, int width, int height)
Definition: dm-Null.c:266
ustring alpha
void pl_color(register FILE *plotfp, int r, int g, int b)
Definition: plot3.c:325
#define BU_STRUCTPARSE_NULL
Definition: parse.h:151
HIDDEN int plot_drawVList(dm *dmp, struct bn_vlist *vp)
Definition: dm-plot.c:161
#define BN_VLIST_TRI_START
pt[] has surface normal
Definition: vlist.h:89
void pl_3space(register FILE *plotfp, int px1, int py1, int pz1, int px2, int py2, int pz2)
Definition: plot3.c:350
void pl_3line(register FILE *plotfp, int px1, int py1, int pz1, int px2, int py2, int pz2)
Definition: plot3.c:384
void * priv_vars
Definition: dm_private.h:36
vect_t dm_clipmin
minimum clipping vector
Definition: dm_private.h:107
Definition: vlist.h:71
struct dm_vars dm_vars
display manager dependent variables
Definition: dm_private.h:99
HIDDEN int plot_draw(dm *dmp, struct bn_vlist *(*callback_function)(void *), void **data)
Definition: dm-plot.c:305
#define BN_VLIST_POLY_VERTNORM
per-vertex normal, for interpolation
Definition: vlist.h:88
void null_drawDList(unsigned int list)
Definition: dm-Null.c:239
HIDDEN int plot_loadMatrix(dm *dmp, fastf_t *mat, int which_eye)
Definition: dm-plot.c:120
#define BN_VLIST_POLY_END
last vert (repeats 1st), draw poly
Definition: vlist.h:87
void bu_vls_printf(struct bu_vls *vls, const char *fmt,...) _BU_ATTR_PRINTF23
Definition: vls.c:694
HIDDEN int plot_drawLine3D(dm *dmp, point_t pt1, point_t pt2)
Definition: dm-plot.c:378
int null_setTransparency(struct dm_internal *dmp, int transparency)
Definition: dm-Null.c:192
struct bu_vls dm_pathName
full Tcl/Tk name of drawing window
Definition: dm_private.h:102
void pl_flush(register FILE *plotfp)
Definition: plot3.c:338
#define BN_VLIST_TRI_DRAW
subsequent triangle vertex
Definition: vlist.h:91
HIDDEN int plot_drawLines3D(dm *dmp, int npoints, point_t *points, int sflag)
Definition: dm-plot.c:385
Definition: color.c:51
int null_drawPoint3D(struct dm_internal *dmp, point_t point)
Definition: dm-Null.c:115
void bu_vls_strcpy(struct bu_vls *vp, const char *s)
Definition: vls.c:310
int null_setZBuffer(struct dm_internal *dmp, int zbuffer_on)
Definition: dm-Null.c:206
void bu_free(void *ptr, const char *str)
Definition: malloc.c:328
HIDDEN int plot_drawEnd(dm *dmp)
Definition: dm-plot.c:102
int null_getDisplayImage(struct dm_internal *dmp, unsigned char **image)
Definition: dm-Null.c:259
void pl_move(register FILE *plotfp, int x, int y)
Definition: plot3.c:220
int null_drawPoints3D(struct dm_internal *dmp, int npoints, point_t *points)
Definition: dm-Null.c:122
#define BU_VLS_INIT_ZERO
Definition: vls.h:84
point_t pt[BN_VLIST_CHUNK]
associated 3-point/vect
Definition: vlist.h:75
int dm_debugLevel
!0 means debugging
Definition: dm_private.h:109
int null_endDList(struct dm_internal *dmp)
Definition: dm-Null.c:232
Definition: vls.h:56
HIDDEN const point_t delta
Definition: sh_prj.c:618
struct plot_vars head_plot_vars
Definition: dm-plot.c:58
double fastf_t
Definition: defines.h:300
int dm_lineStyle
Definition: dm_private.h:96
Definition: color.c:50
int null_setLight(struct dm_internal *dmp, int light_on)
Definition: dm-Null.c:185
#define BN_VLIST_TRI_MOVE
move to first triangle vertex
Definition: vlist.h:90