BRL-CAD
dm_private.h
Go to the documentation of this file.
1 /* D M _ P R I V A T E . H
2  * BRL-CAD
3  *
4  * Copyright (c) 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 dm_private.h
21  *
22  * Internal header for the display manager library.
23  *
24  */
25 
26 #include "common.h"
27 
28 #ifndef DM_PRIVATE_H
29 #define DM_PRIVATE_H
30 
31 #include "vmath.h"
32 #include "dm.h"
33 
34 struct dm_vars {
35  void *pub_vars;
36  void *priv_vars;
37 };
38 
39 /**
40  * Interface to a specific Display Manager
41  */
42 struct dm_internal {
43  int (*dm_close)(struct dm_internal *dmp);
44  int (*dm_drawBegin)(struct dm_internal *dmp); /**< @brief formerly dmr_prolog */
45  int (*dm_drawEnd)(struct dm_internal *dmp); /**< @brief formerly dmr_epilog */
46  int (*dm_normal)(struct dm_internal *dmp);
47  int (*dm_loadMatrix)(struct dm_internal *dmp, fastf_t *mat, int which_eye);
48  int (*dm_loadPMatrix)(struct dm_internal *dmp, fastf_t *mat);
49  int (*dm_drawString2D)(struct dm_internal *dmp, const char *str, fastf_t x, fastf_t y, int size, int use_aspect); /**< @brief formerly dmr_puts */
50  int (*dm_drawLine2D)(struct dm_internal *dmp, fastf_t x_1, fastf_t y_1, fastf_t x_2, fastf_t y_2); /**< @brief formerly dmr_2d_line */
51  int (*dm_drawLine3D)(struct dm_internal *dmp, point_t pt1, point_t pt2);
52  int (*dm_drawLines3D)(struct dm_internal *dmp, int npoints, point_t *points, int sflag);
53  int (*dm_drawPoint2D)(struct dm_internal *dmp, fastf_t x, fastf_t y);
54  int (*dm_drawPoint3D)(struct dm_internal *dmp, point_t point);
55  int (*dm_drawPoints3D)(struct dm_internal *dmp, int npoints, point_t *points);
56  int (*dm_drawVList)(struct dm_internal *dmp, struct bn_vlist *vp);
57  int (*dm_drawVListHiddenLine)(struct dm_internal *dmp, register struct bn_vlist *vp);
58  int (*dm_draw)(struct dm_internal *dmp, struct bn_vlist *(*callback_function)(void *), void **data); /**< @brief formerly dmr_object */
59  int (*dm_setFGColor)(struct dm_internal *dmp, unsigned char r, unsigned char g, unsigned char b, int strict, fastf_t transparency);
60  int (*dm_setBGColor)(struct dm_internal *, unsigned char, unsigned char, unsigned char);
61  int (*dm_setLineAttr)(struct dm_internal *dmp, int width, int style); /**< @brief currently - linewidth, (not-)dashed */
62  int (*dm_configureWin)(struct dm_internal *dmp, int force);
63  int (*dm_setWinBounds)(struct dm_internal *dmp, fastf_t *w);
64  int (*dm_setLight)(struct dm_internal *dmp, int light_on);
65  int (*dm_setTransparency)(struct dm_internal *dmp, int transparency_on);
66  int (*dm_setDepthMask)(struct dm_internal *dmp, int depthMask_on);
67  int (*dm_setZBuffer)(struct dm_internal *dmp, int zbuffer_on);
68  int (*dm_debug)(struct dm_internal *dmp, int lvl); /**< @brief Set DM debug level */
69  int (*dm_logfile)(struct dm_internal *dmp, const char *filename); /**< @brief Set DM log file */
70  int (*dm_beginDList)(struct dm_internal *dmp, unsigned int list);
71  int (*dm_endDList)(struct dm_internal *dmp);
72  void (*dm_drawDList)(unsigned int list);
73  int (*dm_freeDLists)(struct dm_internal *dmp, unsigned int list, int range);
74  int (*dm_genDLists)(struct dm_internal *dmp, size_t range);
75  int (*dm_draw_obj)(struct dm_internal *dmp, struct display_list *obj);
76  int (*dm_getDisplayImage)(struct dm_internal *dmp, unsigned char **image);
77  void (*dm_reshape)(struct dm_internal *dmp, int width, int height);
78  int (*dm_makeCurrent)(struct dm_internal *dmp);
79  int (*dm_openFb)(struct dm_internal *dmp);
80  void (*dm_get_internal)(struct dm_internal *dmp);
81  void (*dm_put_internal)(struct dm_internal *dmp);
82  unsigned long dm_id; /**< @brief window id */
83  int dm_displaylist; /**< @brief !0 means device has displaylist */
84  int dm_stereo; /**< @brief stereo flag */
85  double dm_bound; /**< @brief zoom-in limit */
87  const char *dm_name; /**< @brief short name of device */
88  const char *dm_lname; /**< @brief long name of device */
89  int dm_type; /**< @brief display manager type */
90  int dm_top; /**< @brief !0 means toplevel window */
91  int dm_width;
92  int dm_height;
94  int dm_bits_per_channel; /* bits per color channel */
98  fastf_t *dm_vp; /**< @brief (FIXME: ogl still depends on this) Viewscale pointer */
99  struct dm_vars dm_vars; /**< @brief display manager dependent variables */
100  void *m_vars;
101  void *p_vars;
102  struct bu_vls dm_pathName; /**< @brief full Tcl/Tk name of drawing window */
103  struct bu_vls dm_tkName; /**< @brief short Tcl/Tk name of drawing window */
104  struct bu_vls dm_dName; /**< @brief Display name */
105  unsigned char dm_bg[3]; /**< @brief background color */
106  unsigned char dm_fg[3]; /**< @brief foreground color */
107  vect_t dm_clipmin; /**< @brief minimum clipping vector */
108  vect_t dm_clipmax; /**< @brief maximum clipping vector */
109  int dm_debugLevel; /**< @brief !0 means debugging */
110  struct bu_vls dm_log; /**< @brief !NULL && !empty means log debug output to the file */
111  int dm_perspective; /**< @brief !0 means perspective on */
112  int dm_light; /**< @brief !0 means lighting on */
113  int dm_transparency; /**< @brief !0 means transparency on */
114  int dm_depthMask; /**< @brief !0 means depth buffer is writable */
115  int dm_zbuffer; /**< @brief !0 means zbuffer on */
116  int dm_zclip; /**< @brief !0 means zclipping */
117  int dm_clearBufferAfter; /**< @brief 1 means clear back buffer after drawing and swap */
118  int dm_fontsize; /**< @brief !0 override's the auto font size */
119  struct bu_structparse *vparse; /**< @brief Table listing settable variables */
120  fb *fbp; /**< @brief Framebuffer associated with this display instance */
121  Tcl_Interp *dm_interp; /**< @brief Tcl interpreter */
122 };
123 
125 
126 int
127 drawLine3D(struct dm_internal *dmp, point_t pt1, point_t pt2, const char *log_bu, float *wireColor);
128 
129 int
130 drawLines3D(struct dm_internal *dmp, int npoints, point_t *points, int sflag, const char *log_bu, float *wireColor);
131 
132 int
133 drawLine2D(struct dm_internal *dmp, fastf_t X1, fastf_t Y1, fastf_t X2, fastf_t Y2, const char *log_bu);
134 
135 int
136 draw_Line3D(struct dm_internal *dmp, point_t pt1, point_t pt2);
137 
138 void
139 dm_generic_hook(const struct bu_structparse *sdp,
140  const char *name,
141  void *base,
142  const char *value,
143  void *data);
144 
146 
147 /************************************************/
148 /* dm-*.c macros for autogenerating common code */
149 /************************************************/
150 
151 #define HIDDEN_DM_FUNCTION_PROTOTYPES(_dmtype) \
152  HIDDEN int _dmtype##_close(dm *dmp); \
153  HIDDEN int _dmtype##_drawBegin(dm *dmp); \
154  HIDDEN int _dmtype##_drawEnd(dm *dmp); \
155  HIDDEN int _dmtype##_normal(dm *dmp); \
156  HIDDEN int _dmtype##_loadMatrix(dm *dmp, fastf_t *mat, int which_eye); \
157  HIDDEN int _dmtype##_drawString2D(dm *dmp, char *str, fastf_t x, fastf_t y, int size, int use_aspect); \
158  HIDDEN int _dmtype##_drawLine2D(dm *dmp, fastf_t x_1, fastf_t y_1, fastf_t x_2, fastf_t y_2); \
159  HIDDEN int _dmtype##_drawLine3D(dm *dmp, point_t pt1, point_t pt2); \
160  HIDDEN int _dmtype##_drawLines3D(dm *dmp, int npoints, point_t *points, int sflag); \
161  HIDDEN int _dmtype##_drawPoint2D(dm *dmp, fastf_t x, fastf_t y); \
162  HIDDEN int _dmtype##_drawPoint3D(dm *dmp, point_t point); \
163  HIDDEN int _dmtype##_drawPoints3D(dm *dmp, int npoints, point_t *points); \
164  HIDDEN int _dmtype##_drawVList(dm *dmp, struct bn_vlist *vp); \
165  HIDDEN int _dmtype##_draw(dm *dmp, struct bn_vlist *(*callback_function)(void *), void **data); \
166  HIDDEN int _dmtype##_setFGColor(dm *dmp, unsigned char r, unsigned char g, unsigned char b, int strict, fastf_t transparency); \
167  HIDDEN int _dmtype##_setBGColor(dm *dmp, unsigned char r, unsigned char g, unsigned char b); \
168  HIDDEN int _dmtype##_setLineAttr(dm *dmp, int width, int style); \
169  HIDDEN int _dmtype##_configureWin_guts(dm *dmp, int force); \
170  HIDDEN int _dmtype##_configureWin(dm *dmp, int force); \
171  HIDDEN int _dmtype##_setLight(dm *dmp, int lighting_on); \
172  HIDDEN int _dmtype##_setTransparency(dm *dmp, int transparency_on); \
173  HIDDEN int _dmtype##_setDepthMask(dm *dmp, int depthMask_on); \
174  HIDDEN int _dmtype##_setZBuffer(dm *dmp, int zbuffer_on); \
175  HIDDEN int _dmtype##_setWinBounds(dm *dmp, fastf_t *w); \
176  HIDDEN int _dmtype##_debug(dm *dmp, int lvl); \
177  HIDDEN int _dmtype##_beginDList(dm *dmp, unsigned int list); \
178  HIDDEN int _dmtype##_endDList(dm *dmp); \
179  HIDDEN int _dmtype##_drawDList(dm *dmp, unsigned int list); \
180  HIDDEN int _dmtype##_freeDLists(dm *dmp, unsigned int list, int range); \
181  HIDDEN int _dmtype##_getDisplayImage(dm *dmp, unsigned char **image);
182 
183 #endif /* DM_PRIVATE_H */
184 
185 /*
186  * Local Variables:
187  * tab-width: 8
188  * mode: C
189  * indent-tabs-mode: t
190  * c-file-style: "stroustrup"
191  * End:
192  * ex: shiftwidth=4 tabstop=8
193  */
int(* dm_close)(struct dm_internal *dmp)
Definition: dm_private.h:43
int(* dm_beginDList)(struct dm_internal *dmp, unsigned int list)
Definition: dm_private.h:70
char filename[MAXLENGTH]
Definition: human.c:105
int dm_top
!0 means toplevel window
Definition: dm_private.h:90
int dm_width
Definition: dm_private.h:91
void * pub_vars
Definition: dm_private.h:35
int dm_zclip
!0 means zclipping
Definition: dm_private.h:116
fb * fbp
Framebuffer associated with this display instance.
Definition: dm_private.h:120
int dm_displaylist
!0 means device has displaylist
Definition: dm_private.h:83
void * p_vars
Definition: dm_private.h:101
int(* dm_getDisplayImage)(struct dm_internal *dmp, unsigned char **image)
Definition: dm_private.h:76
Definition: clone.c:90
int(* dm_setLineAttr)(struct dm_internal *dmp, int width, int style)
currently - linewidth, (not-)dashed
Definition: dm_private.h:61
int(* dm_drawVList)(struct dm_internal *dmp, struct bn_vlist *vp)
Definition: dm_private.h:56
int draw_Line3D(struct dm_internal *dmp, point_t pt1, point_t pt2)
Definition: dm_util.c:167
vect_t dm_clipmax
maximum clipping vector
Definition: dm_private.h:108
Tcl_Interp * dm_interp
Tcl interpreter.
Definition: dm_private.h:121
int(* dm_makeCurrent)(struct dm_internal *dmp)
Definition: dm_private.h:78
unsigned char dm_fg[3]
foreground color
Definition: dm_private.h:106
int(* dm_drawPoint3D)(struct dm_internal *dmp, point_t point)
Definition: dm_private.h:54
int(* dm_genDLists)(struct dm_internal *dmp, size_t range)
Definition: dm_private.h:74
Header file for the BRL-CAD common definitions.
int dm_bits_per_channel
Definition: dm_private.h:94
int dm_light
!0 means lighting on
Definition: dm_private.h:112
int(* dm_setDepthMask)(struct dm_internal *dmp, int depthMask_on)
Definition: dm_private.h:66
ustring width
fastf_t dm_aspect
Definition: dm_private.h:97
int(* dm_setZBuffer)(struct dm_internal *dmp, int zbuffer_on)
Definition: dm_private.h:67
int dm_clearBufferAfter
1 means clear back buffer after drawing and swap
Definition: dm_private.h:117
int(* dm_normal)(struct dm_internal *dmp)
Definition: dm_private.h:46
struct bu_vls dm_tkName
short Tcl/Tk name of drawing window
Definition: dm_private.h:103
fastf_t * dm_vp
(FIXME: ogl still depends on this) Viewscale pointer
Definition: dm_private.h:98
int dm_bytes_per_pixel
Definition: dm_private.h:93
COMPLEX data[64]
Definition: fftest.c:34
void(* dm_put_internal)(struct dm_internal *dmp)
Definition: dm_private.h:81
const char * dm_name
short name of device
Definition: dm_private.h:87
int(* dm_debug)(struct dm_internal *dmp, int lvl)
Set DM debug level.
Definition: dm_private.h:68
int drawLine2D(struct dm_internal *dmp, fastf_t X1, fastf_t Y1, fastf_t X2, fastf_t Y2, const char *log_bu)
const char * dm_lname
long name of device
Definition: dm_private.h:88
int dm_perspective
!0 means perspective on
Definition: dm_private.h:111
unsigned long dm_id
window id
Definition: dm_private.h:82
struct bu_vls dm_log
!NULL && !empty means log debug output to the file
Definition: dm_private.h:110
#define __BEGIN_DECLS
Definition: common.h:73
int(* dm_drawVListHiddenLine)(struct dm_internal *dmp, register struct bn_vlist *vp)
Definition: dm_private.h:57
int(* dm_draw)(struct dm_internal *dmp, struct bn_vlist *(*callback_function)(void *), void **data)
formerly dmr_object
Definition: dm_private.h:58
int(* dm_setFGColor)(struct dm_internal *dmp, unsigned char r, unsigned char g, unsigned char b, int strict, fastf_t transparency)
Definition: dm_private.h:59
int(* dm_loadPMatrix)(struct dm_internal *dmp, fastf_t *mat)
Definition: dm_private.h:48
struct bu_vls dm_dName
Display name.
Definition: dm_private.h:104
Coord * point
Definition: chull3d.cpp:52
int(* dm_draw_obj)(struct dm_internal *dmp, struct display_list *obj)
Definition: dm_private.h:75
struct bu_structparse * vparse
Table listing settable variables.
Definition: dm_private.h:119
int(* dm_setWinBounds)(struct dm_internal *dmp, fastf_t *w)
Definition: dm_private.h:63
int(* dm_drawEnd)(struct dm_internal *dmp)
formerly dmr_epilog
Definition: dm_private.h:45
int(* dm_drawLines3D)(struct dm_internal *dmp, int npoints, point_t *points, int sflag)
Definition: dm_private.h:52
void(* dm_get_internal)(struct dm_internal *dmp)
Definition: dm_private.h:80
int(* dm_drawPoints3D)(struct dm_internal *dmp, int npoints, point_t *points)
Definition: dm_private.h:55
int dm_stereo
stereo flag
Definition: dm_private.h:84
int dm_lineWidth
Definition: dm_private.h:95
int drawLines3D(struct dm_internal *dmp, int npoints, point_t *points, int sflag, const char *log_bu, float *wireColor)
int(* dm_openFb)(struct dm_internal *dmp)
Definition: dm_private.h:79
int(* dm_drawLine2D)(struct dm_internal *dmp, fastf_t x_1, fastf_t y_1, fastf_t x_2, fastf_t y_2)
formerly dmr_2d_line
Definition: dm_private.h:50
int dm_fontsize
!0 override's the auto font size
Definition: dm_private.h:118
int drawLine3D(struct dm_internal *dmp, point_t pt1, point_t pt2, const char *log_bu, float *wireColor)
void * priv_vars
Definition: dm_private.h:36
vect_t dm_clipmin
minimum clipping vector
Definition: dm_private.h:107
int(* dm_configureWin)(struct dm_internal *dmp, int force)
Definition: dm_private.h:62
Definition: vlist.h:71
int(* dm_logfile)(struct dm_internal *dmp, const char *filename)
Set DM log file.
Definition: dm_private.h:69
int(* dm_drawLine3D)(struct dm_internal *dmp, point_t pt1, point_t pt2)
Definition: dm_private.h:51
int(* dm_loadMatrix)(struct dm_internal *dmp, fastf_t *mat, int which_eye)
Definition: dm_private.h:47
int dm_height
Definition: dm_private.h:92
int dm_zbuffer
!0 means zbuffer on
Definition: dm_private.h:115
int(* dm_endDList)(struct dm_internal *dmp)
Definition: dm_private.h:71
struct bu_vls dm_pathName
full Tcl/Tk name of drawing window
Definition: dm_private.h:102
void(* dm_reshape)(struct dm_internal *dmp, int width, int height)
Definition: dm_private.h:77
int(* dm_drawPoint2D)(struct dm_internal *dmp, fastf_t x, fastf_t y)
Definition: dm_private.h:53
int(* dm_setLight)(struct dm_internal *dmp, int light_on)
Definition: dm_private.h:64
double dm_bound
zoom-in limit
Definition: dm_private.h:85
unsigned char dm_bg[3]
background color
Definition: dm_private.h:105
#define __END_DECLS
Definition: common.h:74
int dm_transparency
!0 means transparency on
Definition: dm_private.h:113
void * m_vars
Definition: dm_private.h:100
A frame-buffer IO structure.
Definition: fb_private.h:80
int(* dm_drawBegin)(struct dm_internal *dmp)
formerly dmr_prolog
Definition: dm_private.h:44
int(* dm_freeDLists)(struct dm_internal *dmp, unsigned int list, int range)
Definition: dm_private.h:73
void dm_generic_hook(const struct bu_structparse *sdp, const char *name, void *base, const char *value, void *data)
Definition: dm-generic.c:831
int dm_boundFlag
Definition: dm_private.h:86
int dm_debugLevel
!0 means debugging
Definition: dm_private.h:109
int dm_type
display manager type
Definition: dm_private.h:89
Definition: vls.h:56
int(* dm_setBGColor)(struct dm_internal *, unsigned char, unsigned char, unsigned char)
Definition: dm_private.h:60
int(* dm_drawString2D)(struct dm_internal *dmp, const char *str, fastf_t x, fastf_t y, int size, int use_aspect)
formerly dmr_puts
Definition: dm_private.h:49
double fastf_t
Definition: defines.h:300
void(* dm_drawDList)(unsigned int list)
Definition: dm_private.h:72
int dm_lineStyle
Definition: dm_private.h:96
int(* dm_setTransparency)(struct dm_internal *dmp, int transparency_on)
Definition: dm_private.h:65
int dm_depthMask
!0 means depth buffer is writable
Definition: dm_private.h:114