Revision: 75416
http://sourceforge.net/p/brlcad/code/75416
Author: starseeker
Date: 2020-04-15 21:20:05 +0000 (Wed, 15 Apr 2020)
Log Message:
-----------
Make a stab at shifting libdm to the PImpl pattern for struct dm. Untested on
Windows.
Modified Paths:
--------------
brlcad/trunk/include/dm/calltable.h
brlcad/trunk/include/dm.h
brlcad/trunk/src/libdm/adc.c
brlcad/trunk/src/libdm/axes.c
brlcad/trunk/src/libdm/dm-Null.c
brlcad/trunk/src/libdm/dm-X.c
brlcad/trunk/src/libdm/dm-generic.c
brlcad/trunk/src/libdm/dm-ogl.c
brlcad/trunk/src/libdm/dm-osgl.cpp
brlcad/trunk/src/libdm/dm-plot.c
brlcad/trunk/src/libdm/dm-ps.c
brlcad/trunk/src/libdm/dm-qt.cpp
brlcad/trunk/src/libdm/dm-tk.c
brlcad/trunk/src/libdm/dm-txt.c
brlcad/trunk/src/libdm/dm-wgl.c
brlcad/trunk/src/libdm/dm_obj.c
brlcad/trunk/src/libdm/dm_private.h
brlcad/trunk/src/libdm/dm_util.c
brlcad/trunk/src/libdm/grid.c
brlcad/trunk/src/libdm/options.c
brlcad/trunk/src/libdm/rect.c
brlcad/trunk/src/libdm/scale.c
Modified: brlcad/trunk/include/dm/calltable.h
===================================================================
--- brlcad/trunk/include/dm/calltable.h 2020-04-15 20:45:38 UTC (rev 75415)
+++ brlcad/trunk/include/dm/calltable.h 2020-04-15 21:20:05 UTC (rev 75416)
@@ -52,7 +52,7 @@
* variables behind the vparse. The txt backend, for example, doesn't need
* Tk information...
*/
-struct dm {
+struct dm_impl {
int (*dm_close)(struct dm *dmp);
int (*dm_drawBegin)(struct dm *dmp); /**< @brief formerly dmr_prolog
*/
int (*dm_drawEnd)(struct dm *dmp); /**< @brief formerly dmr_epilog
*/
Modified: brlcad/trunk/include/dm.h
===================================================================
--- brlcad/trunk/include/dm.h 2020-04-15 20:45:38 UTC (rev 75415)
+++ brlcad/trunk/include/dm.h 2020-04-15 21:20:05 UTC (rev 75416)
@@ -107,10 +107,12 @@
void *dmh_data;
};
-/* Hide the dm structure behind a typedef */
-struct dm;
+/* The internals of the dm structure are hidden using the PImpl pattern*/
+struct dm_impl;
+struct dm {
+ struct dm_impl *i;
+};
-
DM_EXPORT extern struct dm dm_ogl;
DM_EXPORT extern struct dm dm_plot;
DM_EXPORT extern struct dm dm_ps;
Modified: brlcad/trunk/src/libdm/adc.c
===================================================================
--- brlcad/trunk/src/libdm/adc.c 2020-04-15 20:45:38 UTC (rev 75415)
+++ brlcad/trunk/src/libdm/adc.c 2020-04-15 21:20:05 UTC (rev 75416)
@@ -61,8 +61,8 @@
y2 = adcp->dv_y + d2 + t2;
if (bn_lseg_clip(&x1, &Y1, &x2, &y2, DM_MIN, DM_MAX) == 0) {
dm_draw_line_2d(dmp,
- GED_TO_PM1(x1), GED_TO_PM1(Y1) * dmp->dm_aspect,
- GED_TO_PM1(x2), GED_TO_PM1(y2) * dmp->dm_aspect);
+ GED_TO_PM1(x1), GED_TO_PM1(Y1) * dmp->i->dm_aspect,
+ GED_TO_PM1(x2), GED_TO_PM1(y2) * dmp->i->dm_aspect);
}
/* Quadrant 2 */
@@ -72,8 +72,8 @@
y2 = adcp->dv_y + d1 - t1;
if (bn_lseg_clip(&x1, &Y1, &x2, &y2, DM_MIN, DM_MAX) == 0) {
dm_draw_line_2d(dmp,
- GED_TO_PM1(x1), GED_TO_PM1(Y1) * dmp->dm_aspect,
- GED_TO_PM1(x2), GED_TO_PM1(y2) * dmp->dm_aspect);
+ GED_TO_PM1(x1), GED_TO_PM1(Y1) * dmp->i->dm_aspect,
+ GED_TO_PM1(x2), GED_TO_PM1(y2) * dmp->i->dm_aspect);
}
/* Quadrant 3 */
@@ -83,8 +83,8 @@
y2 = adcp->dv_y - d2 - t2;
if (bn_lseg_clip(&x1, &Y1, &x2, &y2, DM_MIN, DM_MAX) == 0) {
dm_draw_line_2d(dmp,
- GED_TO_PM1(x1), GED_TO_PM1(Y1) * dmp->dm_aspect,
- GED_TO_PM1(x2), GED_TO_PM1(y2) * dmp->dm_aspect);
+ GED_TO_PM1(x1), GED_TO_PM1(Y1) * dmp->i->dm_aspect,
+ GED_TO_PM1(x2), GED_TO_PM1(y2) * dmp->i->dm_aspect);
}
/* Quadrant 4 */
@@ -94,8 +94,8 @@
y2 = adcp->dv_y - d1 + t1;
if (bn_lseg_clip(&x1, &Y1, &x2, &y2, DM_MIN, DM_MAX) == 0) {
dm_draw_line_2d(dmp,
- GED_TO_PM1(x1), GED_TO_PM1(Y1) * dmp->dm_aspect,
- GED_TO_PM1(x2), GED_TO_PM1(y2) * dmp->dm_aspect);
+ GED_TO_PM1(x1), GED_TO_PM1(Y1) * dmp->i->dm_aspect,
+ GED_TO_PM1(x2), GED_TO_PM1(y2) * dmp->i->dm_aspect);
}
}
@@ -175,8 +175,8 @@
/* Horizontal */
dm_draw_line_2d(dmp,
- GED_TO_PM1(GED_MIN), GED_TO_PM1(adcp->dv_y) *
dmp->dm_aspect,
- GED_TO_PM1(GED_MAX), GED_TO_PM1(adcp->dv_y) *
dmp->dm_aspect);
+ GED_TO_PM1(GED_MIN), GED_TO_PM1(adcp->dv_y) *
dmp->i->dm_aspect,
+ GED_TO_PM1(GED_MAX), GED_TO_PM1(adcp->dv_y) *
dmp->i->dm_aspect);
/* Vertical */
dm_draw_line_2d(dmp,
@@ -200,11 +200,11 @@
y4 = adcp->dv_y + d1;
dm_draw_line_2d(dmp,
- GED_TO_PM1(x1), GED_TO_PM1(Y1) * dmp->dm_aspect,
- GED_TO_PM1(x2), GED_TO_PM1(y2) * dmp->dm_aspect);
+ GED_TO_PM1(x1), GED_TO_PM1(Y1) * dmp->i->dm_aspect,
+ GED_TO_PM1(x2), GED_TO_PM1(y2) * dmp->i->dm_aspect);
dm_draw_line_2d(dmp,
- GED_TO_PM1(x3), GED_TO_PM1(y3) * dmp->dm_aspect,
- GED_TO_PM1(x4), GED_TO_PM1(y4) * dmp->dm_aspect);
+ GED_TO_PM1(x3), GED_TO_PM1(y3) * dmp->i->dm_aspect,
+ GED_TO_PM1(x4), GED_TO_PM1(y4) * dmp->i->dm_aspect);
d1 = cos(angle2) * 8000.0;
d2 = sin(angle2) * 8000.0;
@@ -220,11 +220,11 @@
dm_set_line_attr(dmp, adcp->line_width, 1);
dm_draw_line_2d(dmp,
- GED_TO_PM1(x1), GED_TO_PM1(Y1) * dmp->dm_aspect,
- GED_TO_PM1(x2), GED_TO_PM1(y2) * dmp->dm_aspect);
+ GED_TO_PM1(x1), GED_TO_PM1(Y1) * dmp->i->dm_aspect,
+ GED_TO_PM1(x2), GED_TO_PM1(y2) * dmp->i->dm_aspect);
dm_draw_line_2d(dmp,
- GED_TO_PM1(x3), GED_TO_PM1(y3) * dmp->dm_aspect,
- GED_TO_PM1(x4), GED_TO_PM1(y4) * dmp->dm_aspect);
+ GED_TO_PM1(x3), GED_TO_PM1(y3) * dmp->i->dm_aspect,
+ GED_TO_PM1(x4), GED_TO_PM1(y4) * dmp->i->dm_aspect);
dm_set_line_attr(dmp, adcp->line_width, 0);
dm_set_fg(dmp,
Modified: brlcad/trunk/src/libdm/axes.c
===================================================================
--- brlcad/trunk/src/libdm/axes.c 2020-04-15 20:45:38 UTC (rev 75415)
+++ brlcad/trunk/src/libdm/axes.c 2020-04-15 21:20:05 UTC (rev 75416)
@@ -53,8 +53,8 @@
int npoints = bndasp->num_points * 6;
point_t *points;
/* Save the line attributes */
- int saveLineWidth = dmp->dm_lineWidth;
- int saveLineStyle = dmp->dm_lineStyle;
+ int saveLineWidth = dmp->i->dm_lineWidth;
+ int saveLineStyle = dmp->i->dm_lineStyle;
if (npoints < 1)
return;
@@ -64,7 +64,7 @@
#if defined(IF_OGL) || defined(IF_WGL)
if (bndasp->draw > 1) {
- if (dmp->dm_light)
+ if (dmp->i->dm_light)
glDisable(GL_LIGHTING);
glPointSize(bndasp->size);
@@ -71,7 +71,7 @@
dm_draw_points_3d(dmp, bndasp->num_points, bndasp->points);
glPointSize(1);
- if (dmp->dm_light)
+ if (dmp->i->dm_light)
glEnable(GL_LIGHTING);
return;
@@ -134,8 +134,8 @@
point_t rzv1, rzv2;
point_t o_rv2;
/* Save the line attributes */
- int saveLineWidth = dmp->dm_lineWidth;
- int saveLineStyle = dmp->dm_lineStyle;
+ int saveLineWidth = dmp->i->dm_lineWidth;
+ int saveLineStyle = dmp->i->dm_lineStyle;
halfAxesSize = bnasp->axes_size * 0.5;
@@ -170,8 +170,8 @@
dm_set_fg(dmp, bnasp->axes_color[0], bnasp->axes_color[1],
bnasp->axes_color[2], 1, 1.0);
/* draw X axis with x/y offsets */
- dm_draw_line_2d(dmp, rxv1[X] + bnasp->axes_pos[X], (rxv1[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect,
- rxv2[X] + bnasp->axes_pos[X], (rxv2[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect);
+ dm_draw_line_2d(dmp, rxv1[X] + bnasp->axes_pos[X], (rxv1[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect,
+ rxv2[X] + bnasp->axes_pos[X], (rxv2[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect);
/* build Y axis about view center */
VSET(v2, 0.0, halfAxesSize, 0.0);
@@ -199,8 +199,8 @@
}
/* draw Y axis with x/y offsets */
- dm_draw_line_2d(dmp, ryv1[X] + bnasp->axes_pos[X], (ryv1[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect,
- ryv2[X] + bnasp->axes_pos[X], (ryv2[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect);
+ dm_draw_line_2d(dmp, ryv1[X] + bnasp->axes_pos[X], (ryv1[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect,
+ ryv2[X] + bnasp->axes_pos[X], (ryv2[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect);
/* build Z axis about view center */
VSET(v2, 0.0, 0.0, halfAxesSize);
@@ -228,8 +228,8 @@
}
/* draw Z axis with x/y offsets */
- dm_draw_line_2d(dmp, rzv1[X] + bnasp->axes_pos[X], (rzv1[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect,
- rzv2[X] + bnasp->axes_pos[X], (rzv2[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect);
+ dm_draw_line_2d(dmp, rzv1[X] + bnasp->axes_pos[X], (rzv1[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect,
+ rzv2[X] + bnasp->axes_pos[X], (rzv2[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect);
if (!bnasp->triple_color) {
/* set axes string color */
@@ -260,10 +260,10 @@
vect_t maj_yend1, maj_yend2;
vect_t maj_zend1, maj_zend2;
- if (dmp->dm_width <= numTicks / halfAxesSize * bnasp->tick_threshold *
2) {
+ if (dmp->i->dm_width <= numTicks / halfAxesSize * bnasp->tick_threshold
* 2) {
int numMajorTicks = numTicks / bnasp->ticks_per_major;
- if (dmp->dm_width <= numMajorTicks / halfAxesSize *
bnasp->tick_threshold * 2) {
+ if (dmp->i->dm_width <= numMajorTicks / halfAxesSize *
bnasp->tick_threshold * 2) {
/* Restore the line attributes */
dm_set_line_attr(dmp, saveLineWidth, saveLineStyle);
return;
@@ -276,10 +276,10 @@
interval = bnasp->tick_interval / viewSize * 2.0;
/* convert tick length in pixels to view space */
- tlen = bnasp->tick_length / (fastf_t)dmp->dm_width * 2.0;
+ tlen = bnasp->tick_length / (fastf_t)dmp->i->dm_width * 2.0;
/* convert major tick length in pixels to view space */
- maj_tlen = bnasp->tick_major_length / (fastf_t)dmp->dm_width * 2.0;
+ maj_tlen = bnasp->tick_major_length / (fastf_t)dmp->i->dm_width * 2.0;
if (!doMajorOnly) {
/* calculate end points for x ticks */
@@ -360,8 +360,8 @@
VADD2(t1, maj_yend1, tvec);
VADD2(t2, maj_yend2, tvec);
}
- dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect,
- t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect);
+ dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect,
+ t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect);
/* draw tick in XZ plane */
if (notMajor) {
@@ -371,8 +371,8 @@
VADD2(t1, maj_zend1, tvec);
VADD2(t2, maj_zend2, tvec);
}
- dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect,
- t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect);
+ dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect,
+ t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect);
if (!bnasp->pos_only) {
/* negative X direction */
@@ -386,8 +386,8 @@
VADD2(t1, maj_yend1, tvec);
VADD2(t2, maj_yend2, tvec);
}
- dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect,
- t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect);
+ dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect,
+ t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect);
/* draw tick in XZ plane */
if (notMajor) {
@@ -397,8 +397,8 @@
VADD2(t1, maj_zend1, tvec);
VADD2(t2, maj_zend2, tvec);
}
- dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect,
- t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect);
+ dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect,
+ t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect);
}
/********* draw ticks along Y *********/
@@ -413,8 +413,8 @@
VADD2(t1, maj_xend1, tvec);
VADD2(t2, maj_xend2, tvec);
}
- dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect,
- t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect);
+ dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect,
+ t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect);
/* draw tick in YZ plane */
if (notMajor) {
@@ -424,8 +424,8 @@
VADD2(t1, maj_zend1, tvec);
VADD2(t2, maj_zend2, tvec);
}
- dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect,
- t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect);
+ dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect,
+ t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect);
if (!bnasp->pos_only) {
/* negative Y direction */
@@ -439,8 +439,8 @@
VADD2(t1, maj_xend1, tvec);
VADD2(t2, maj_xend2, tvec);
}
- dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect,
- t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect);
+ dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect,
+ t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect);
/* draw tick in XZ plane */
if (notMajor) {
@@ -450,8 +450,8 @@
VADD2(t1, maj_zend1, tvec);
VADD2(t2, maj_zend2, tvec);
}
- dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect,
- t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect);
+ dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect,
+ t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect);
}
/********* draw ticks along Z *********/
@@ -466,8 +466,8 @@
VADD2(t1, maj_xend1, tvec);
VADD2(t2, maj_xend2, tvec);
}
- dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect,
- t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect);
+ dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect,
+ t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect);
/* draw tick in ZY plane */
if (notMajor) {
@@ -477,8 +477,8 @@
VADD2(t1, maj_yend1, tvec);
VADD2(t2, maj_yend2, tvec);
}
- dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect,
- t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect);
+ dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect,
+ t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect);
if (!bnasp->pos_only) {
/* negative Z direction */
@@ -492,8 +492,8 @@
VADD2(t1, maj_xend1, tvec);
VADD2(t2, maj_xend2, tvec);
}
- dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect,
- t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect);
+ dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect,
+ t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect);
/* draw tick in ZY plane */
if (notMajor) {
@@ -503,8 +503,8 @@
VADD2(t1, maj_yend1, tvec);
VADD2(t2, maj_yend2, tvec);
}
- dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect,
- t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->dm_aspect);
+ dm_draw_line_2d(dmp, t1[X] + bnasp->axes_pos[X], (t1[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect,
+ t2[X] + bnasp->axes_pos[X], (t2[Y] +
bnasp->axes_pos[Y]) * dmp->i->dm_aspect);
}
}
}
Modified: brlcad/trunk/src/libdm/dm-Null.c
===================================================================
--- brlcad/trunk/src/libdm/dm-Null.c 2020-04-15 20:45:38 UTC (rev 75415)
+++ brlcad/trunk/src/libdm/dm-Null.c 2020-04-15 21:20:05 UTC (rev 75416)
@@ -284,7 +284,7 @@
}
-struct dm dm_null = {
+struct dm_impl dm_null_impl = {
null_close,
null_drawBegin,
null_drawEnd,
@@ -366,6 +366,7 @@
0 /* Tcl interpreter */
};
+struct dm dm_null = { &dm_null_impl };
/*
* Local Variables:
Modified: brlcad/trunk/src/libdm/dm-X.c
===================================================================
--- brlcad/trunk/src/libdm/dm-X.c 2020-04-15 20:45:38 UTC (rev 75415)
+++ brlcad/trunk/src/libdm/dm-X.c 2020-04-15 21:20:05 UTC (rev 75416)
@@ -144,14 +144,14 @@
HIDDEN int
X_reshape(struct dm *dmp, int width, int height)
{
- struct x_vars *privars = (struct x_vars *)dmp->dm_vars.priv_vars;
+ struct x_vars *privars = (struct x_vars *)dmp->i->dm_vars.priv_vars;
- dmp->dm_height = height;
- dmp->dm_width = width;
- dmp->dm_aspect = (fastf_t)dmp->dm_width / (fastf_t)dmp->dm_height;
+ dmp->i->dm_height = height;
+ dmp->i->dm_width = width;
+ dmp->i->dm_aspect = (fastf_t)dmp->i->dm_width / (fastf_t)dmp->i->dm_height;
- privars->disp_mat[0] = 2. * privars->ppmm_x / dmp->dm_width;
- privars->disp_mat[5] = 2. * privars->ppmm_y / dmp->dm_width;
+ privars->disp_mat[0] = 2. * privars->ppmm_x / dmp->i->dm_width;
+ privars->disp_mat[5] = 2. * privars->ppmm_y / dmp->i->dm_width;
return 0;
}
@@ -163,8 +163,8 @@
XWindowAttributes xwa;
XFontStruct *newfontstruct;
XGCValues gcv;
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct x_vars *privars = (struct x_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct x_vars *privars = (struct x_vars *)dmp->i->dm_vars.priv_vars;
XGetWindowAttributes(pubvars->dpy,
pubvars->win, &xwa);
@@ -171,15 +171,15 @@
/* nothing to do */
if (!force &&
- dmp->dm_height == xwa.height &&
- dmp->dm_width == xwa.width)
+ dmp->i->dm_height == xwa.height &&
+ dmp->i->dm_width == xwa.width)
return BRLCAD_OK;
X_reshape(dmp, xwa.width, xwa.height);
- if (dmp->dm_debugLevel) {
+ if (dmp->i->dm_debugLevel) {
bu_log("X_configureWin_guts()\n");
- bu_log("width = %d, height = %d\n", dmp->dm_width, dmp->dm_height);
+ bu_log("width = %d, height = %d\n", dmp->i->dm_width,
dmp->i->dm_height);
}
#ifdef HAVE_TK
@@ -188,8 +188,8 @@
privars->pix =
Tk_GetPixmap(pubvars->dpy,
DefaultRootWindow(pubvars->dpy),
- dmp->dm_width,
- dmp->dm_height,
+ dmp->i->dm_width,
+ dmp->i->dm_height,
Tk_Depth(pubvars->xtkwin));
#endif
@@ -213,7 +213,7 @@
/* Always try to choose a the font that best fits the window size.
*/
- if (dmp->dm_width < 582) {
+ if (dmp->i->dm_width < 582) {
if (pubvars->fontstruct->per_char->width != 5) {
if ((newfontstruct = XLoadQueryFont(pubvars->dpy,
FONT5)) != NULL) {
@@ -225,7 +225,7 @@
privars->gc, GCFont, &gcv);
}
}
- } else if (dmp->dm_width < 679) {
+ } else if (dmp->i->dm_width < 679) {
if (pubvars->fontstruct->per_char->width != 6) {
if ((newfontstruct = XLoadQueryFont(pubvars->dpy,
FONT6)) != NULL) {
@@ -237,7 +237,7 @@
privars->gc, GCFont, &gcv);
}
}
- } else if (dmp->dm_width < 776) {
+ } else if (dmp->i->dm_width < 776) {
if (pubvars->fontstruct->per_char->width != 7) {
if ((newfontstruct = XLoadQueryFont(pubvars->dpy,
FONT7)) != NULL) {
@@ -249,7 +249,7 @@
privars->gc, GCFont, &gcv);
}
}
- } else if (dmp->dm_width < 873) {
+ } else if (dmp->i->dm_width < 873) {
if (pubvars->fontstruct->per_char->width != 8) {
if ((newfontstruct = XLoadQueryFont(pubvars->dpy,
FONT8)) != NULL) {
@@ -289,11 +289,11 @@
int min_depth = 8;
int *good = NULL;
int screen;
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct x_vars *privars = (struct x_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct x_vars *privars = (struct x_vars *)dmp->i->dm_vars.priv_vars;
vibase = XGetVisualInfo(pubvars->dpy, 0, &vitemp, &num);
- screen = DefaultScreen(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy);
+ screen = DefaultScreen(((struct dm_xvars *)dmp->i->dm_vars.pub_vars)->dpy);
good = (int *)bu_malloc(sizeof(int)*num, "alloc good visuals");
@@ -378,8 +378,8 @@
HIDDEN int
X_close(struct dm *dmp)
{
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct x_vars *privars = (struct x_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct x_vars *privars = (struct x_vars *)dmp->i->dm_vars.priv_vars;
if (pubvars->dpy) {
if (privars->gc)
@@ -404,11 +404,12 @@
}
- bu_vls_free(&dmp->dm_pathName);
- bu_vls_free(&dmp->dm_tkName);
- bu_vls_free(&dmp->dm_dName);
- bu_free((void *)dmp->dm_vars.priv_vars, "X_close: x_vars");
- bu_free((void *)dmp->dm_vars.pub_vars, "X_close: dm_xvars");
+ bu_vls_free(&dmp->i->dm_pathName);
+ bu_vls_free(&dmp->i->dm_tkName);
+ bu_vls_free(&dmp->i->dm_dName);
+ bu_free((void *)dmp->i->dm_vars.priv_vars, "X_close: x_vars");
+ bu_free((void *)dmp->i->dm_vars.pub_vars, "X_close: dm_xvars");
+ bu_free((void *)dmp->i, "X_close: dmp->i");
bu_free((void *)dmp, "X_close: dmp");
return BRLCAD_OK;
@@ -437,7 +438,8 @@
#endif
struct bu_vls str = BU_VLS_INIT_ZERO;
struct bu_vls init_proc_vls = BU_VLS_INIT_ZERO;
- struct dm *dmp = (struct dm *)NULL;
+ struct dm *dmp = NULL;
+ struct dm_impl *dmpi = NULL;
Tk_Window tkwin = (Tk_Window)NULL;
Screen *screen = (Screen *)NULL;
@@ -451,34 +453,36 @@
#endif
BU_ALLOC(dmp, struct dm);
+ BU_ALLOC(dmpi, struct dm_impl);
- *dmp = dm_X; /* struct copy */
- dmp->dm_interp = interp;
+ *dmpi = *dm_X.i; /* struct copy */
+ dmp->i = dmpi;
+ dmp->i->dm_interp = interp;
- BU_ALLOC(dmp->dm_vars.pub_vars, struct dm_xvars);
- pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
+ BU_ALLOC(dmp->i->dm_vars.pub_vars, struct dm_xvars);
+ pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
- BU_ALLOC(dmp->dm_vars.priv_vars, struct x_vars);
- privars = (struct x_vars *)dmp->dm_vars.priv_vars;
+ BU_ALLOC(dmp->i->dm_vars.priv_vars, struct x_vars);
+ privars = (struct x_vars *)dmp->i->dm_vars.priv_vars;
- bu_vls_init(&dmp->dm_pathName);
- bu_vls_init(&dmp->dm_tkName);
- bu_vls_init(&dmp->dm_dName);
+ bu_vls_init(&dmp->i->dm_pathName);
+ bu_vls_init(&dmp->i->dm_tkName);
+ bu_vls_init(&dmp->i->dm_dName);
dm_processOptions(dmp, &init_proc_vls, --argc, ++argv);
- if (bu_vls_strlen(&dmp->dm_pathName) == 0)
- bu_vls_printf(&dmp->dm_pathName, ".dm_X%d", count);
+ if (bu_vls_strlen(&dmp->i->dm_pathName) == 0)
+ bu_vls_printf(&dmp->i->dm_pathName, ".dm_X%d", count);
++count;
- if (bu_vls_strlen(&dmp->dm_dName) == 0) {
+ if (bu_vls_strlen(&dmp->i->dm_dName) == 0) {
char *dp;
dp = getenv("DISPLAY");
if (dp)
- bu_vls_strcpy(&dmp->dm_dName, dp);
+ bu_vls_strcpy(&dmp->i->dm_dName, dp);
else
- bu_vls_strcpy(&dmp->dm_dName, ":0.0");
+ bu_vls_strcpy(&dmp->i->dm_dName, ":0.0");
}
if (bu_vls_strlen(&init_proc_vls) == 0)
bu_vls_strcpy(&init_proc_vls, "bind_dm");
@@ -487,28 +491,28 @@
pubvars->devmotionnotify = LASTEvent;
pubvars->devbuttonpress = LASTEvent;
pubvars->devbuttonrelease = LASTEvent;
- dmp->dm_aspect = 1.0;
+ dmp->i->dm_aspect = 1.0;
pubvars->fontstruct = NULL;
- if (dmp->dm_top) {
+ if (dmp->i->dm_top) {
#ifdef HAVE_TK
/* Make xtkwin a toplevel window */
pubvars->xtkwin = Tk_CreateWindowFromPath(interp, tkwin,
-
bu_vls_addr(&dmp->dm_pathName),
- bu_vls_addr(&dmp->dm_dName));
+
bu_vls_addr(&dmp->i->dm_pathName),
+
bu_vls_addr(&dmp->i->dm_dName));
pubvars->top = pubvars->xtkwin;
#endif
} else {
char *cp;
- cp = strrchr(bu_vls_addr(&dmp->dm_pathName), (int)'.');
- if (cp == bu_vls_addr(&dmp->dm_pathName)) {
+ cp = strrchr(bu_vls_addr(&dmp->i->dm_pathName), (int)'.');
+ if (cp == bu_vls_addr(&dmp->i->dm_pathName)) {
pubvars->top = tkwin;
} else {
struct bu_vls top_vls = BU_VLS_INIT_ZERO;
- bu_vls_strncpy(&top_vls, (const char
*)bu_vls_addr(&dmp->dm_pathName), cp - bu_vls_addr(&dmp->dm_pathName));
+ bu_vls_strncpy(&top_vls, (const char
*)bu_vls_addr(&dmp->i->dm_pathName), cp - bu_vls_addr(&dmp->i->dm_pathName));
#ifdef HAVE_TK
pubvars->top =
@@ -526,19 +530,19 @@
}
if (pubvars->xtkwin == NULL) {
- bu_log("X_open_dm: Failed to open %s\n",
bu_vls_addr(&dmp->dm_pathName));
+ bu_log("X_open_dm: Failed to open %s\n",
bu_vls_addr(&dmp->i->dm_pathName));
(void)X_close(dmp);
return DM_NULL;
}
#ifdef HAVE_TK
- bu_vls_printf(&dmp->dm_tkName, "%s",
+ bu_vls_printf(&dmp->i->dm_tkName, "%s",
(char *)Tk_Name(pubvars->xtkwin));
#endif
bu_vls_printf(&str, "_init_dm %s %s\n",
bu_vls_addr(&init_proc_vls),
- bu_vls_addr(&dmp->dm_pathName));
+ bu_vls_addr(&dmp->i->dm_pathName));
if (Tcl_Eval(interp, bu_vls_addr(&str)) == BRLCAD_ERROR) {
bu_vls_free(&str);
@@ -556,7 +560,7 @@
/* make sure there really is a display before proceeding. */
if (!pubvars->dpy) {
- bu_log("ERROR: Unable to attach to display (%s)\n",
bu_vls_addr(&dmp->dm_pathName));
+ bu_log("ERROR: Unable to attach to display (%s)\n",
bu_vls_addr(&dmp->i->dm_pathName));
(void)X_close(dmp);
return DM_NULL;
}
@@ -572,7 +576,7 @@
/* make sure there really is a screen before processing. */
if (!screen) {
- bu_log("ERROR: Unable to attach to screen (%s)\n",
bu_vls_addr(&dmp->dm_pathName));
+ bu_log("ERROR: Unable to attach to screen (%s)\n",
bu_vls_addr(&dmp->i->dm_pathName));
(void)X_close(dmp);
return DM_NULL;
}
@@ -586,15 +590,15 @@
privars->ppmm_x = screen->width / screen->mwidth;
privars->ppmm_y = screen->height / screen->mheight;
- if (dmp->dm_width == 0) {
- dmp->dm_width =
+ if (dmp->i->dm_width == 0) {
+ dmp->i->dm_width =
DisplayWidth(pubvars->dpy,
DefaultScreen(pubvars->dpy)) - 30;
++make_square;
}
- if (dmp->dm_height == 0) {
- dmp->dm_height =
+ if (dmp->i->dm_height == 0) {
+ dmp->i->dm_height =
DisplayHeight(pubvars->dpy,
DefaultScreen(pubvars->dpy)) - 30;
++make_square;
@@ -602,17 +606,17 @@
if (make_square > 0) {
/* Make window square */
- if (dmp->dm_height <
- dmp->dm_width)
- dmp->dm_width = dmp->dm_height;
+ if (dmp->i->dm_height <
+ dmp->i->dm_width)
+ dmp->i->dm_width = dmp->i->dm_height;
else
- dmp->dm_height = dmp->dm_width;
+ dmp->i->dm_height = dmp->i->dm_width;
}
#ifdef HAVE_TK
Tk_GeometryRequest(pubvars->xtkwin,
- dmp->dm_width,
- dmp->dm_height);
+ dmp->i->dm_width,
+ dmp->i->dm_height);
#endif
/* must do this before MakeExist */
@@ -625,12 +629,12 @@
#ifdef HAVE_TK
Tk_MakeWindowExist(pubvars->xtkwin);
pubvars->win = Tk_WindowId(pubvars->xtkwin);
- dmp->dm_id = pubvars->win;
+ dmp->i->dm_id = pubvars->win;
privars->pix =
Tk_GetPixmap(pubvars->dpy,
pubvars->win,
- dmp->dm_width,
- dmp->dm_height,
+ dmp->i->dm_width,
+ dmp->i->dm_height,
Tk_Depth(pubvars->xtkwin));
#endif
@@ -765,10 +769,10 @@
X_drawBegin(struct dm *dmp)
{
XGCValues gcv;
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct x_vars *privars = (struct x_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct x_vars *privars = (struct x_vars *)dmp->i->dm_vars.priv_vars;
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("X_drawBegin()\n");
/* clear pixmap */
@@ -779,8 +783,8 @@
XFillRectangle(pubvars->dpy,
privars->pix,
privars->gc, 0,
- 0, dmp->dm_width + 1,
- dmp->dm_height + 1);
+ 0, dmp->i->dm_width + 1,
+ dmp->i->dm_height + 1);
/* reset foreground */
gcv.foreground = privars->fg;
@@ -795,10 +799,10 @@
HIDDEN int
X_drawEnd(struct dm *dmp)
{
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct x_vars *privars = (struct x_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct x_vars *privars = (struct x_vars *)dmp->i->dm_vars.priv_vars;
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("X_drawEnd()\n");
XCopyArea(pubvars->dpy,
@@ -805,8 +809,8 @@
privars->pix,
pubvars->win,
privars->gc,
- 0, 0, dmp->dm_width,
- dmp->dm_height, 0, 0);
+ 0, 0, dmp->i->dm_width,
+ dmp->i->dm_height, 0, 0);
/* Prevent lag between events and updates */
XSync(pubvars->dpy, 0);
@@ -822,9 +826,9 @@
HIDDEN int
X_loadMatrix(struct dm *dmp, fastf_t *mat, int which_eye)
{
- struct x_vars *privars = (struct x_vars *)dmp->dm_vars.priv_vars;
+ struct x_vars *privars = (struct x_vars *)dmp->i->dm_vars.priv_vars;
- if (dmp->dm_debugLevel) {
+ if (dmp->i->dm_debugLevel) {
bu_log("X_load_Matrix()\n");
bu_log("which eye = %d\t", which_eye);
@@ -858,8 +862,8 @@
fastf_t pointSize = DM_X_DEFAULT_POINT_SIZE;
static int nvectors = 0;
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct x_vars *privars = (struct x_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct x_vars *privars = (struct x_vars *)dmp->i->dm_vars.priv_vars;
/* delta is used in clipping to insure clipped endpoint is
* slightly in front of eye plane (perspective mode only). This
@@ -906,12 +910,12 @@
case BN_VLIST_LINE_MOVE:
case BN_VLIST_TRI_MOVE:
/* Move, not draw */
- if (dmp->dm_debugLevel > 2) {
+ if (dmp->i->dm_debugLevel > 2) {
bu_log("before transformation:\n");
bu_log("pt - %lf %lf %lf\n", V3ARGS(*pt));
}
- if (dmp->dm_perspective > 0) {
+ if (dmp->i->dm_perspective > 0) {
/* cannot apply perspective transformation to
* points behind eye plane!!!!
*/
@@ -930,7 +934,7 @@
}
lpnt[0] *= 2047;
- lpnt[1] *= 2047 * dmp->dm_aspect;
+ lpnt[1] *= 2047 * dmp->i->dm_aspect;
lpnt[2] *= 2047;
continue;
case BN_VLIST_POLY_DRAW:
@@ -939,17 +943,17 @@
case BN_VLIST_TRI_DRAW:
case BN_VLIST_TRI_END:
/* draw */
- if (dmp->dm_debugLevel > 2) {
+ if (dmp->i->dm_debugLevel > 2) {
bu_log("before transformation:\n");
bu_log("pt - %lf %lf %lf\n", V3ARGS(*pt));
}
- if (dmp->dm_perspective > 0) {
+ if (dmp->i->dm_perspective > 0) {
/* cannot apply perspective transformation to
* points behind eye plane!!!!
*/
dist = VDOT(*pt, &(privars->xmat)[12]) +
privars->xmat[15];
- if (dmp->dm_debugLevel > 2)
+ if (dmp->i->dm_debugLevel > 2)
bu_log("dist=%g, dist_prev=%g\n", dist, dist_prev);
if (dist <= 0.0) {
if (dist_prev <= 0.0) {
@@ -983,7 +987,7 @@
VJOIN1(tmp_pt, *pt_prev, alpha, diff);
MAT4X3PNT(lpnt, privars->xmat, tmp_pt);
lpnt[0] *= 2047;
- lpnt[1] *= 2047 * dmp->dm_aspect;
+ lpnt[1] *= 2047 * dmp->i->dm_aspect;
lpnt[2] *= 2047;
MAT4X3PNT(pnt, privars->xmat, *pt);
}
@@ -997,7 +1001,7 @@
}
pnt[0] *= 2047;
- pnt[1] *= 2047 * dmp->dm_aspect;
+ pnt[1] *= 2047 * dmp->i->dm_aspect;
pnt[2] *= 2047;
/* save pnt --- it might get changed by clip() */
@@ -1004,24 +1008,24 @@
VMOVE(spnt, pnt);
pt_prev = pt;
- if (dmp->dm_debugLevel > 2) {
+ if (dmp->i->dm_debugLevel > 2) {
bu_log("before clipping:\n");
bu_log("clipmin - %lf %lf %lf\n",
- dmp->dm_clipmin[X],
- dmp->dm_clipmin[Y],
- dmp->dm_clipmin[Z]);
+ dmp->i->dm_clipmin[X],
+ dmp->i->dm_clipmin[Y],
+ dmp->i->dm_clipmin[Z]);
bu_log("clipmax - %lf %lf %lf\n",
- dmp->dm_clipmax[X],
- dmp->dm_clipmax[Y],
- dmp->dm_clipmax[Z]);
+ dmp->i->dm_clipmax[X],
+ dmp->i->dm_clipmax[Y],
+ dmp->i->dm_clipmax[Z]);
bu_log("pt1 - %lf %lf %lf\n", lpnt[X], lpnt[Y],
lpnt[Z]);
bu_log("pt2 - %lf %lf %lf\n", pnt[X], pnt[Y], pnt[Z]);
}
- if (dmp->dm_zclip) {
+ if (dmp->i->dm_zclip) {
if (vclip(lpnt, pnt,
- dmp->dm_clipmin,
- dmp->dm_clipmax) == 0) {
+ dmp->i->dm_clipmin,
+ dmp->i->dm_clipmax) == 0) {
VMOVE(lpnt, spnt);
continue;
}
@@ -1049,7 +1053,7 @@
}
}
- if (dmp->dm_debugLevel > 2) {
+ if (dmp->i->dm_debugLevel > 2) {
bu_log("after clipping:\n");
bu_log("pt1 - %lf %lf %lf\n", lpnt[X], lpnt[Y],
lpnt[Z]);
bu_log("pt2 - %lf %lf %lf\n", pnt[X], pnt[Y], pnt[Z]);
@@ -1075,12 +1079,12 @@
}
break;
case BN_VLIST_POINT_DRAW:
- if (dmp->dm_debugLevel > 2) {
+ if (dmp->i->dm_debugLevel > 2) {
bu_log("before transformation:\n");
bu_log("pt - %lf %lf %lf\n", V3ARGS(*pt));
}
- if (dmp->dm_perspective > 0) {
+ if (dmp->i->dm_perspective > 0) {
dist = VDOT(*pt, &(privars->xmat)[12]) +
privars->xmat[15];
if (dist <= 0.0) {
@@ -1092,11 +1096,11 @@
MAT4X3PNT(pnt, privars->xmat, *pt);
pnt[0] *= 2047;
- pnt[1] *= 2047 * dmp->dm_aspect;
+ pnt[1] *= 2047 * dmp->i->dm_aspect;
pnt[2] *= 2047;
VMOVE(lpnt, pnt);
- if (dmp->dm_debugLevel > 2) {
+ if (dmp->i->dm_debugLevel > 2) {
bu_log("after clipping:\n");
bu_log("pt - %lf %lf %lf\n", pnt[X], pnt[Y], pnt[Z]);
}
@@ -1135,7 +1139,7 @@
nvectors += nused;
if (nvectors >= vectorThreshold) {
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("X_drawVList(): handle Tcl events\n");
nvectors = 0;
@@ -1182,7 +1186,7 @@
HIDDEN int
X_normal(struct dm *dmp)
{
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("X_normal()\n");
return BRLCAD_OK;
@@ -1197,10 +1201,10 @@
X_drawString2D(struct dm *dmp, const char *str, fastf_t x, fastf_t y, int
size, int use_aspect)
{
int sx, sy;
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct x_vars *privars = (struct x_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct x_vars *privars = (struct x_vars *)dmp->i->dm_vars.priv_vars;
- if (dmp->dm_debugLevel) {
+ if (dmp->i->dm_debugLevel) {
bu_log("X_drawString2D():\n");
bu_log("\tstr - %s\n", str);
bu_log("\tx - %g\n", x);
@@ -1207,7 +1211,7 @@
bu_log("\ty - %g\n", y);
bu_log("\tsize - %d\n", size);
if (use_aspect) {
- bu_log("\tuse_aspect - %d\t\taspect ratio - %g\n", use_aspect,
dmp->dm_aspect);
+ bu_log("\tuse_aspect - %d\t\taspect ratio - %g\n", use_aspect,
dmp->i->dm_aspect);
} else
bu_log("\tuse_aspect - 0");
}
@@ -1228,8 +1232,8 @@
X_drawLine2D(struct dm *dmp, fastf_t x_1, fastf_t y_1, fastf_t x_2, fastf_t
y_2)
{
int sx1, sy1, sx2, sy2;
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct x_vars *privars = (struct x_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct x_vars *privars = (struct x_vars *)dmp->i->dm_vars.priv_vars;
sx1 = dm_Normal2Xx(dmp, x_1);
sx2 = dm_Normal2Xx(dmp, x_2);
@@ -1236,7 +1240,7 @@
sy1 = dm_Normal2Xy(dmp, y_1, 0);
sy2 = dm_Normal2Xy(dmp, y_2, 0);
- if (dmp->dm_debugLevel) {
+ if (dmp->i->dm_debugLevel) {
bu_log("X_drawLine2D()\n");
bu_log("x1 = %g, y1 = %g\n", x_1, y_1);
bu_log("x2 = %g, y2 = %g\n", x_2, y_2);
@@ -1274,13 +1278,13 @@
X_drawPoint2D(struct dm *dmp, fastf_t x, fastf_t y)
{
int sx, sy;
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct x_vars *privars = (struct x_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct x_vars *privars = (struct x_vars *)dmp->i->dm_vars.priv_vars;
sx = dm_Normal2Xx(dmp, x);
sy = dm_Normal2Xy(dmp, y, 0);
- if (dmp->dm_debugLevel) {
+ if (dmp->i->dm_debugLevel) {
bu_log("X_drawPoint2D()\n");
bu_log("x = %g, y = %g\n", x, y);
bu_log("sx = %d, sy = %d\n", sx, sy);
@@ -1298,15 +1302,15 @@
X_setFGColor(struct dm *dmp, unsigned char r, unsigned char g, unsigned char
b, int strict, fastf_t transparency)
{
XGCValues gcv;
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct x_vars *privars = (struct x_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct x_vars *privars = (struct x_vars *)dmp->i->dm_vars.priv_vars;
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("X_setFGColor() rgb=[%d, %d, %d] strict=%d transparency=%f\n",
r, g, b, strict, transparency);
- dmp->dm_fg[0] = r;
- dmp->dm_fg[1] = g;
- dmp->dm_fg[2] = b;
+ dmp->i->dm_fg[0] = r;
+ dmp->i->dm_fg[1] = g;
+ dmp->i->dm_fg[2] = b;
if (privars->is_trueColor) {
XColor color;
@@ -1339,15 +1343,15 @@
HIDDEN int
X_setBGColor(struct dm *dmp, unsigned char r, unsigned char g, unsigned char b)
{
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct x_vars *privars = (struct x_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct x_vars *privars = (struct x_vars *)dmp->i->dm_vars.priv_vars;
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("X_setBGColor()\n");
- dmp->dm_bg[0] = r;
- dmp->dm_bg[1] = g;
- dmp->dm_bg[2] = b;
+ dmp->i->dm_bg[0] = r;
+ dmp->i->dm_bg[1] = g;
+ dmp->i->dm_bg[2] = b;
if (privars->is_trueColor) {
XColor color;
@@ -1375,14 +1379,14 @@
X_setLineAttr(struct dm *dmp, int width, int style)
{
int linestyle;
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct x_vars *privars = (struct x_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct x_vars *privars = (struct x_vars *)dmp->i->dm_vars.priv_vars;
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("X_setLineAttr()\n");
- dmp->dm_lineWidth = width;
- dmp->dm_lineStyle = style;
+ dmp->i->dm_lineWidth = width;
+ dmp->i->dm_lineStyle = style;
if (width <= 1)
width = 0;
@@ -1403,7 +1407,7 @@
HIDDEN int
X_debug(struct dm *dmp, int lvl)
{
- dmp->dm_debugLevel = lvl;
+ dmp->i->dm_debugLevel = lvl;
return BRLCAD_OK;
}
@@ -1412,7 +1416,7 @@
HIDDEN int
X_logfile(struct dm *dmp, const char *filename)
{
- bu_vls_sprintf(&dmp->dm_log, "%s", filename);
+ bu_vls_sprintf(&dmp->i->dm_log, "%s", filename);
return BRLCAD_OK;
}
@@ -1421,15 +1425,15 @@
HIDDEN int
X_setWinBounds(struct dm *dmp, fastf_t *w)
{
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("X_setWinBounds()\n");
- dmp->dm_clipmin[0] = w[0];
- dmp->dm_clipmin[1] = w[2];
- dmp->dm_clipmin[2] = w[4];
- dmp->dm_clipmax[0] = w[1];
- dmp->dm_clipmax[1] = w[3];
- dmp->dm_clipmax[2] = w[5];
+ dmp->i->dm_clipmin[0] = w[0];
+ dmp->i->dm_clipmin[1] = w[2];
+ dmp->i->dm_clipmin[2] = w[4];
+ dmp->i->dm_clipmax[0] = w[1];
+ dmp->i->dm_clipmax[1] = w[3];
+ dmp->i->dm_clipmax[2] = w[5];
return BRLCAD_OK;
}
@@ -1446,10 +1450,10 @@
HIDDEN int
X_setLight(struct dm *dmp, int light_on)
{
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("X_setLight:\n");
- dmp->dm_light = light_on;
+ dmp->i->dm_light = light_on;
return BRLCAD_OK;
}
@@ -1458,10 +1462,10 @@
HIDDEN int
X_setZBuffer(struct dm *dmp, int zbuffer_on)
{
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("X_setZBuffer:\n");
- dmp->dm_zbuffer = zbuffer_on;
+ dmp->i->dm_zbuffer = zbuffer_on;
return BRLCAD_OK;
}
@@ -1487,11 +1491,11 @@
int blue_bits;
- ximage_p = XGetImage(((struct dm_xvars *)dmp->dm_vars.pub_vars)->dpy,
- ((struct dm_xvars *)dmp->dm_vars.pub_vars)->win,
+ ximage_p = XGetImage(((struct dm_xvars *)dmp->i->dm_vars.pub_vars)->dpy,
+ ((struct dm_xvars *)dmp->i->dm_vars.pub_vars)->win,
0, 0,
- dmp->dm_width,
- dmp->dm_height,
+ dmp->i->dm_width,
+ dmp->i->dm_height,
~0, ZPixmap);
if (!ximage_p) {
@@ -1686,8 +1690,8 @@
{
struct fb_platform_specific *fb_ps;
struct X24_fb_info *xfb_ps;
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct x_vars *privars = (struct x_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct x_vars *privars = (struct x_vars *)dmp->i->dm_vars.priv_vars;
fb_ps = fb_get_platform_specific(FB_X24_MAGIC);
xfb_ps = (struct X24_fb_info *)fb_ps->data;
@@ -1698,7 +1702,7 @@
xfb_ps->vip = pubvars->vip;
xfb_ps->gc = privars->gc;
- dmp->fbp = fb_open_existing("X", dm_get_width(dmp), dm_get_height(dmp),
fb_ps);
+ dmp->i->fbp = fb_open_existing("X", dm_get_width(dmp), dm_get_height(dmp),
fb_ps);
fb_put_platform_specific(fb_ps);
return 0;
}
@@ -1712,7 +1716,7 @@
};
/* Display Manager package interface */
-struct dm dm_X = {
+struct dm_impl dm_X_impl = {
X_close,
X_drawBegin,
X_drawEnd,
@@ -1794,6 +1798,8 @@
0 /* Tcl interpreter */
};
+struct dm dm_X = { &dm_X_impl };
+
/* Because class is actually used to access a struct
* entry in this file, preserve our redefinition
* of class for the benefit of avoiding C++ name
Modified: brlcad/trunk/src/libdm/dm-generic.c
===================================================================
--- brlcad/trunk/src/libdm/dm-generic.c 2020-04-15 20:45:38 UTC (rev 75415)
+++ brlcad/trunk/src/libdm/dm-generic.c 2020-04-15 21:20:05 UTC (rev 75416)
@@ -89,7 +89,7 @@
BU_ALLOC(dmp, struct dm);
*dmp = dm_null;
- dmp->dm_interp = interp;
+ dmp->i->dm_interp = interp;
return dmp;
}
@@ -150,7 +150,7 @@
dm_interp(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return NULL;
- return (void *)dmp->dm_interp;
+ return (void *)dmp->i->dm_interp;
}
/*
@@ -169,11 +169,11 @@
* XXX - need a better way to check if using the same OGL server.
*/
if (dmp2 != DM_NULL)
- if (dmp1->dm_type != dmp2->dm_type ||
- bu_vls_strcmp(&dmp1->dm_dName, &dmp2->dm_dName))
+ if (dmp1->i->dm_type != dmp2->i->dm_type ||
+ bu_vls_strcmp(&dmp1->i->dm_dName, &dmp2->i->dm_dName))
return BRLCAD_ERROR;
- switch (dmp1->dm_type) {
+ switch (dmp1->i->dm_type) {
#ifdef DM_OGL
# if defined(HAVE_TK)
case DM_TYPE_OGL:
@@ -202,7 +202,7 @@
{
if (!dmp) return;
#if (defined HAVE_TK)
- Tk_GeometryRequest(((struct dm_xvars *)dmp->dm_vars.pub_vars)->xtkwin,
width, height);
+ Tk_GeometryRequest(((struct dm_xvars *)dmp->i->dm_vars.pub_vars)->xtkwin,
width, height);
#endif
}
@@ -229,11 +229,11 @@
if (!dmp || !result) return;
if (!key) {
// Print all current vars
- bu_vls_struct_print2(result, "dm internal X variables",
dm_xvars_vparse, (const char *)dmp->dm_vars.pub_vars);
+ bu_vls_struct_print2(result, "dm internal X variables",
dm_xvars_vparse, (const char *)dmp->i->dm_vars.pub_vars);
return;
}
// Print specific var
- bu_vls_struct_item_named(result, dm_xvars_vparse, key, (const char
*)dmp->dm_vars.pub_vars, ',');
+ bu_vls_struct_item_named(result, dm_xvars_vparse, key, (const char
*)dmp->i->dm_vars.pub_vars, ',');
}
/* Properly generic function */
@@ -242,7 +242,7 @@
dm_Xx2Normal(struct dm *dmp, int x)
{
if (UNLIKELY(!dmp)) return 0.0;
- return ((x / (fastf_t)dmp->dm_width - 0.5) * 2.0);
+ return ((x / (fastf_t)dmp->i->dm_width - 0.5) * 2.0);
}
int
@@ -249,7 +249,7 @@
dm_Normal2Xx(struct dm *dmp, fastf_t f)
{
if (UNLIKELY(!dmp)) return 0.0;
- return (f * 0.5 + 0.5) * dmp->dm_width;
+ return (f * 0.5 + 0.5) * dmp->i->dm_width;
}
fastf_t
@@ -257,9 +257,9 @@
{
if (UNLIKELY(!dmp)) return 0.0;
if (use_aspect)
- return ((0.5 - y / (fastf_t)dmp->dm_height) / dmp->dm_aspect * 2.0);
+ return ((0.5 - y / (fastf_t)dmp->i->dm_height) / dmp->i->dm_aspect *
2.0);
else
- return ((0.5 - y / (fastf_t)dmp->dm_height) * 2.0);
+ return ((0.5 - y / (fastf_t)dmp->i->dm_height) * 2.0);
}
int
@@ -267,9 +267,9 @@
{
if (UNLIKELY(!dmp)) return 0.0;
if (use_aspect)
- return (0.5 - f * 0.5 * dmp->dm_aspect) * dmp->dm_height;
+ return (0.5 - f * 0.5 * dmp->i->dm_aspect) * dmp->i->dm_height;
else
- return (0.5 - f * 0.5) * dmp->dm_height;
+ return (0.5 - f * 0.5) * dmp->i->dm_height;
}
void
@@ -280,7 +280,7 @@
return;
}
- switch (dmp->dm_type) {
+ switch (dmp->i->dm_type) {
#ifdef DM_OGL
# if defined(HAVE_TK)
case DM_TYPE_OGL:
@@ -303,8 +303,9 @@
{
struct dm *new_dm = DM_NULL;
BU_GET(new_dm, struct dm);
- bu_vls_init(&new_dm->dm_pathName);
- bu_vls_init(&new_dm->dm_dName);
+ BU_GET(new_dm->i, struct dm_impl);
+ bu_vls_init(&new_dm->i->dm_pathName);
+ bu_vls_init(&new_dm->i->dm_dName);
return new_dm;
}
@@ -313,11 +314,12 @@
dm_put(struct dm *dmp)
{
if (dmp && dmp != DM_NULL) {
- bu_vls_free(&dmp->dm_pathName);
- bu_vls_free(&dmp->dm_dName);
- if (dmp->fbp) fb_put(dmp->fbp);
- if (dmp->dm_put_internal)
- dmp->dm_put_internal(dmp);
+ bu_vls_free(&dmp->i->dm_pathName);
+ bu_vls_free(&dmp->i->dm_dName);
+ if (dmp->i->fbp) fb_put(dmp->i->fbp);
+ if (dmp->i->dm_put_internal)
+ dmp->i->dm_put_internal(dmp);
+ BU_PUT(dmp->i, struct dm_impl);
BU_PUT(dmp, struct dm);
}
}
@@ -333,9 +335,9 @@
dm_get_fb(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return NULL;
- if (dmp->fbp == FB_NULL)
- dmp->dm_openFb(dmp);
- return dmp->fbp;
+ if (dmp->i->fbp == FB_NULL)
+ dmp->i->dm_openFb(dmp);
+ return dmp->i->fbp;
}
const char *
@@ -342,7 +344,7 @@
dm_get_dm_name(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return NULL;
- return dmp->dm_name;
+ return dmp->i->dm_name;
}
const char *
@@ -349,7 +351,7 @@
dm_get_dm_lname(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return NULL;
- return dmp->dm_lname;
+ return dmp->i->dm_lname;
}
int
@@ -356,7 +358,7 @@
dm_get_width(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_width;
+ return dmp->i->dm_width;
}
int
@@ -363,7 +365,7 @@
dm_get_height(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_height;
+ return dmp->i->dm_height;
}
void
@@ -370,7 +372,7 @@
dm_set_width(struct dm *dmp, int width)
{
if (UNLIKELY(!dmp)) return;
- dmp->dm_width = width;
+ dmp->i->dm_width = width;
}
void
@@ -377,7 +379,7 @@
dm_set_height(struct dm *dmp, int height)
{
if (UNLIKELY(!dmp)) return;
- dmp->dm_height = height;
+ dmp->i->dm_height = height;
}
@@ -385,7 +387,7 @@
dm_get_type(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_type;
+ return dmp->i->dm_type;
}
int
@@ -392,7 +394,7 @@
dm_get_displaylist(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_displaylist;
+ return dmp->i->dm_displaylist;
}
fastf_t
@@ -399,7 +401,7 @@
dm_get_aspect(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_aspect;
+ return dmp->i->dm_aspect;
}
int
@@ -406,7 +408,7 @@
dm_get_fontsize(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_fontsize;
+ return dmp->i->dm_fontsize;
}
void
@@ -413,7 +415,7 @@
dm_set_fontsize(struct dm *dmp, int size)
{
if (UNLIKELY(!dmp)) return;
- dmp->dm_fontsize = size;
+ dmp->i->dm_fontsize = size;
}
int
@@ -420,7 +422,7 @@
dm_get_light_flag(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_light;
+ return dmp->i->dm_light;
}
void
@@ -427,7 +429,7 @@
dm_set_light_flag(struct dm *dmp, int val)
{
if (UNLIKELY(!dmp)) return;
- dmp->dm_light = val;
+ dmp->i->dm_light = val;
}
int
@@ -434,7 +436,7 @@
dm_close(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_close(dmp);
+ return dmp->i->dm_close(dmp);
}
unsigned char *
@@ -441,7 +443,7 @@
dm_get_bg(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return NULL;
- return dmp->dm_bg;
+ return dmp->i->dm_bg;
}
int
@@ -448,7 +450,7 @@
dm_set_bg(struct dm *dmp, unsigned char r, unsigned char g, unsigned char b)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_setBGColor(dmp, r, g, b);
+ return dmp->i->dm_setBGColor(dmp, r, g, b);
}
unsigned char *
@@ -455,7 +457,7 @@
dm_get_fg(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return NULL;
- return dmp->dm_fg;
+ return dmp->i->dm_fg;
}
int
@@ -462,7 +464,7 @@
dm_set_fg(struct dm *dmp, unsigned char r, unsigned char g, unsigned char b,
int strict, fastf_t transparency)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_setFGColor(dmp, r, g, b, strict, transparency);
+ return dmp->i->dm_setFGColor(dmp, r, g, b, strict, transparency);
}
int
@@ -469,7 +471,7 @@
dm_reshape(struct dm *dmp, int width, int height)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_reshape(dmp, width, height);
+ return dmp->i->dm_reshape(dmp, width, height);
}
int
@@ -476,7 +478,7 @@
dm_make_current(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_makeCurrent(dmp);
+ return dmp->i->dm_makeCurrent(dmp);
}
vect_t *
@@ -483,7 +485,7 @@
dm_get_clipmin(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return &(dmp->dm_clipmin);
+ return &(dmp->i->dm_clipmin);
}
@@ -491,7 +493,7 @@
dm_get_clipmax(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return &(dmp->dm_clipmax);
+ return &(dmp->i->dm_clipmax);
}
int
@@ -498,7 +500,7 @@
dm_get_bound_flag(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_boundFlag;
+ return dmp->i->dm_boundFlag;
}
void
@@ -505,7 +507,7 @@
dm_set_bound(struct dm *dmp, fastf_t val)
{
if (UNLIKELY(!dmp)) return;
- dmp->dm_bound = val;
+ dmp->i->dm_bound = val;
}
int
@@ -512,7 +514,7 @@
dm_set_win_bounds(struct dm *dmp, fastf_t *w)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_setWinBounds(dmp, w);
+ return dmp->i->dm_setWinBounds(dmp, w);
}
int
@@ -519,13 +521,13 @@
dm_get_stereo(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_stereo;
+ return dmp->i->dm_stereo;
}
int
dm_configure_win(struct dm *dmp, int force)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_configureWin(dmp, force);
+ return dmp->i->dm_configureWin(dmp, force);
}
struct bu_vls *
@@ -532,7 +534,7 @@
dm_get_pathname(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return NULL;
- return &(dmp->dm_pathName);
+ return &(dmp->i->dm_pathName);
}
@@ -540,7 +542,7 @@
dm_get_dname(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return NULL;
- return &(dmp->dm_dName);
+ return &(dmp->i->dm_dName);
}
struct bu_vls *
@@ -547,7 +549,7 @@
dm_get_tkname(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return NULL;
- return &(dmp->dm_tkName);
+ return &(dmp->i->dm_tkName);
}
unsigned long
@@ -554,7 +556,7 @@
dm_get_id(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_id;
+ return dmp->i->dm_id;
}
void
@@ -561,7 +563,7 @@
dm_set_id(struct dm *dmp, unsigned long new_id)
{
if (UNLIKELY(!dmp)) return;
- dmp->dm_id = new_id;
+ dmp->i->dm_id = new_id;
}
int
@@ -568,7 +570,7 @@
dm_set_light(struct dm *dmp, int light)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_setLight(dmp, light);
+ return dmp->i->dm_setLight(dmp, light);
}
int
@@ -575,7 +577,7 @@
dm_get_transparency(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_transparency;
+ return dmp->i->dm_transparency;
}
int
@@ -582,7 +584,7 @@
dm_set_transparency(struct dm *dmp, int transparency)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_setTransparency(dmp, transparency);
+ return dmp->i->dm_setTransparency(dmp, transparency);
}
int
@@ -589,7 +591,7 @@
dm_get_zbuffer(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_zbuffer;
+ return dmp->i->dm_zbuffer;
}
int
@@ -596,7 +598,7 @@
dm_set_zbuffer(struct dm *dmp, int zbuffer)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_setZBuffer(dmp, zbuffer);
+ return dmp->i->dm_setZBuffer(dmp, zbuffer);
}
int
@@ -603,7 +605,7 @@
dm_get_linewidth(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_lineWidth;
+ return dmp->i->dm_lineWidth;
}
void
@@ -610,7 +612,7 @@
dm_set_linewidth(struct dm *dmp, int linewidth)
{
if (UNLIKELY(!dmp)) return;
- dmp->dm_lineWidth = linewidth;
+ dmp->i->dm_lineWidth = linewidth;
}
int
@@ -617,7 +619,7 @@
dm_get_linestyle(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_lineStyle;
+ return dmp->i->dm_lineStyle;
}
void
@@ -624,7 +626,7 @@
dm_set_linestyle(struct dm *dmp, int linestyle)
{
if (UNLIKELY(!dmp)) return;
- dmp->dm_lineStyle = linestyle;
+ dmp->i->dm_lineStyle = linestyle;
}
int
@@ -631,7 +633,7 @@
dm_set_line_attr(struct dm *dmp, int width, int style)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_setLineAttr(dmp, width, style);
+ return dmp->i->dm_setLineAttr(dmp, width, style);
}
@@ -639,7 +641,7 @@
dm_get_zclip(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_zclip;
+ return dmp->i->dm_zclip;
}
void
@@ -646,7 +648,7 @@
dm_set_zclip(struct dm *dmp, int zclip)
{
if (UNLIKELY(!dmp)) return;
- dmp->dm_zclip = zclip;
+ dmp->i->dm_zclip = zclip;
}
int
@@ -653,7 +655,7 @@
dm_get_perspective(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_perspective;
+ return dmp->i->dm_perspective;
}
void
@@ -660,7 +662,7 @@
dm_set_perspective(struct dm *dmp, fastf_t perspective)
{
if (UNLIKELY(!dmp)) return;
- dmp->dm_perspective = perspective;
+ dmp->i->dm_perspective = perspective;
}
int
@@ -667,7 +669,7 @@
dm_get_display_image(struct dm *dmp, unsigned char **image)
{
if (!dmp || !image) return 0;
- return dmp->dm_getDisplayImage(dmp, image);
+ return dmp->i->dm_getDisplayImage(dmp, image);
}
int
@@ -674,7 +676,7 @@
dm_gen_dlists(struct dm *dmp, size_t range)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_genDLists(dmp, range);
+ return dmp->i->dm_genDLists(dmp, range);
}
int
@@ -681,25 +683,25 @@
dm_begin_dlist(struct dm *dmp, unsigned int list)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_beginDList(dmp, list);
+ return dmp->i->dm_beginDList(dmp, list);
}
int
dm_draw_dlist(struct dm *dmp, unsigned int list)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_drawDList(list);
+ return dmp->i->dm_drawDList(list);
}
int
dm_end_dlist(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_endDList(dmp);
+ return dmp->i->dm_endDList(dmp);
}
int
dm_free_dlists(struct dm *dmp, unsigned int list, int range)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_freeDLists(dmp, list, range);
+ return dmp->i->dm_freeDLists(dmp, list, range);
}
int
@@ -706,7 +708,7 @@
dm_draw_vlist(struct dm *dmp, struct bn_vlist *vp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_drawVList(dmp, vp);
+ return dmp->i->dm_drawVList(dmp, vp);
}
int
@@ -713,49 +715,49 @@
dm_draw_vlist_hidden_line(struct dm *dmp, struct bn_vlist *vp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_drawVListHiddenLine(dmp, vp);
+ return dmp->i->dm_drawVListHiddenLine(dmp, vp);
}
int
dm_draw_begin(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_drawBegin(dmp);
+ return dmp->i->dm_drawBegin(dmp);
}
int
dm_draw_end(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_drawEnd(dmp);
+ return dmp->i->dm_drawEnd(dmp);
}
int
dm_normal(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_normal(dmp);
+ return dmp->i->dm_normal(dmp);
}
int
dm_loadmatrix(struct dm *dmp, fastf_t *mat, int eye)
{
if (!dmp || !mat) return 0;
- return dmp->dm_loadMatrix(dmp, mat, eye);
+ return dmp->i->dm_loadMatrix(dmp, mat, eye);
}
int
dm_loadpmatrix(struct dm *dmp, fastf_t *mat)
{
if (!dmp || !mat) return 0;
- return dmp->dm_loadPMatrix(dmp, mat);
+ return dmp->i->dm_loadPMatrix(dmp, mat);
}
int
dm_draw_string_2d(struct dm *dmp, const char *str, fastf_t x, fastf_t y, int
size, int use_aspect)
{
if (!dmp || !str) return 0;
- return dmp->dm_drawString2D(dmp, str, x, y, size, use_aspect);
+ return dmp->i->dm_drawString2D(dmp, str, x, y, size, use_aspect);
}
int
dm_draw_line_2d(struct dm *dmp, fastf_t x1, fastf_t y1_2d, fastf_t x2, fastf_t
y2)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_drawLine2D(dmp, x1, y1_2d, x2, y2);
+ return dmp->i->dm_drawLine2D(dmp, x1, y1_2d, x2, y2);
}
int
dm_draw_line_3d(struct dm *dmp, point_t pt1, point_t pt2)
@@ -762,61 +764,61 @@
{
if (UNLIKELY(!dmp)) return 0;
if (!!pt1 || !pt2) return 0;
- return dmp->dm_drawLine3D(dmp, pt1, pt2);
+ return dmp->i->dm_drawLine3D(dmp, pt1, pt2);
}
int
dm_draw_lines_3d(struct dm *dmp, int npoints, point_t *points, int sflag)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_drawLines3D(dmp, npoints, points, sflag);
+ return dmp->i->dm_drawLines3D(dmp, npoints, points, sflag);
}
int
dm_draw_point_2d(struct dm *dmp, fastf_t x, fastf_t y)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_drawPoint2D(dmp, x, y);
+ return dmp->i->dm_drawPoint2D(dmp, x, y);
}
int
dm_draw_point_3d(struct dm *dmp, point_t pt)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_drawPoint3D(dmp, pt);
+ return dmp->i->dm_drawPoint3D(dmp, pt);
}
int
dm_draw_points_3d(struct dm *dmp, int npoints, point_t *points)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_drawPoints3D(dmp, npoints, points);
+ return dmp->i->dm_drawPoints3D(dmp, npoints, points);
}
int
dm_draw(struct dm *dmp, struct bn_vlist *(*callback)(void *), void **data)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_draw(dmp, callback, data);
+ return dmp->i->dm_draw(dmp, callback, data);
}
int
dm_draw_obj(struct dm *dmp, struct display_list *obj)
{
if (!dmp || !obj) return 0;
- return dmp->dm_draw_obj(dmp, obj);
+ return dmp->i->dm_draw_obj(dmp, obj);
}
int
dm_set_depth_mask(struct dm *dmp, int d_on)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_setDepthMask(dmp, d_on);
+ return dmp->i->dm_setDepthMask(dmp, d_on);
}
int
dm_debug(struct dm *dmp, int lvl)
{
if (UNLIKELY(!dmp)) return 0;
- return dmp->dm_debug(dmp, lvl);
+ return dmp->i->dm_debug(dmp, lvl);
}
int
dm_logfile(struct dm *dmp, const char *filename)
{
if (!dmp || !filename) return 0;
- return dmp->dm_logfile(dmp, filename);
+ return dmp->i->dm_logfile(dmp, filename);
}
fastf_t *
@@ -823,7 +825,7 @@
dm_get_vp(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return NULL;
- return dmp->dm_vp;
+ return dmp->i->dm_vp;
}
void
@@ -830,7 +832,7 @@
dm_set_vp(struct dm *dmp, fastf_t *vp)
{
if (UNLIKELY(!dmp)) return;
- dmp->dm_vp = vp;
+ dmp->i->dm_vp = vp;
}
/* This is the generic "catch-all" hook that is used
@@ -877,7 +879,7 @@
dm_get_vparse(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return NULL;
- return dmp->vparse;
+ return dmp->i->vparse;
}
void *
@@ -884,8 +886,8 @@
dm_get_mvars(struct dm *dmp)
{
if (UNLIKELY(!dmp)) return NULL;
- if (!dmp->m_vars) return (void *)dmp;
- return dmp->m_vars;
+ if (!dmp->i->m_vars) return (void *)dmp;
+ return dmp->i->m_vars;
}
@@ -971,7 +973,7 @@
/*
* Check for this object being bigger than
- * dmp->dm_bound * the window size, or smaller than a speck.
+ * dmp->i->dm_bound * the window size, or smaller than a speck.
*/
if (ratio < 0.001)
continue;
Modified: brlcad/trunk/src/libdm/dm-ogl.c
===================================================================
--- brlcad/trunk/src/libdm/dm-ogl.c 2020-04-15 20:45:38 UTC (rev 75415)
+++ brlcad/trunk/src/libdm/dm-ogl.c 2020-04-15 21:20:05 UTC (rev 75416)
@@ -87,8 +87,8 @@
#define ENABLE_POINT_SMOOTH 1
-#define VIEWFACTOR (1.0/(*dmp->dm_vp))
-#define VIEWSIZE (2.0*(*dmp->dm_vp))
+#define VIEWFACTOR (1.0/(*dmp->i->dm_vp))
+#define VIEWSIZE (2.0*(*dmp->i->dm_vp))
/* these are from /usr/include/gl.h could be device dependent */
#define XMAXSCREEN 1279
@@ -177,7 +177,7 @@
void
ogl_fogHint(struct dm *dmp, int fastfog)
{
- struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->m_vars;
+ struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->i->m_vars;
mvars->fastfog = fastfog;
glHint(GL_FOG_HINT, fastfog ? GL_FASTEST : GL_NICEST);
}
@@ -186,15 +186,15 @@
HIDDEN int
ogl_setBGColor(struct dm *dmp, unsigned char r, unsigned char g, unsigned char
b)
{
- struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->m_vars;
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct ogl_vars *privars = (struct ogl_vars *)dmp->dm_vars.priv_vars;
- if (dmp->dm_debugLevel == 1)
+ struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->i->m_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct ogl_vars *privars = (struct ogl_vars *)dmp->i->dm_vars.priv_vars;
+ if (dmp->i->dm_debugLevel == 1)
bu_log("ogl_setBGColor()\n");
- dmp->dm_bg[0] = r;
- dmp->dm_bg[1] = g;
- dmp->dm_bg[2] = b;
+ dmp->i->dm_bg[0] = r;
+ dmp->i->dm_bg[1] = g;
+ dmp->i->dm_bg[2] = b;
privars->r = r / 255.0;
privars->g = g / 255.0;
@@ -227,10 +227,10 @@
XWindowAttributes xwa;
XFontStruct *newfontstruct;
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct ogl_vars *privars = (struct ogl_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct ogl_vars *privars = (struct ogl_vars *)dmp->i->dm_vars.priv_vars;
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("ogl_configureWin_guts()\n");
XGetWindowAttributes(pubvars->dpy,
@@ -238,8 +238,8 @@
/* nothing to do */
if (!force &&
- dmp->dm_height == xwa.height &&
- dmp->dm_width == xwa.width)
+ dmp->i->dm_height == xwa.height &&
+ dmp->i->dm_width == xwa.width)
return BRLCAD_OK;
ogl_reshape(dmp, xwa.width, xwa.height);
@@ -261,10 +261,10 @@
0, 127, privars->fontOffset);
}
- if (DM_VALID_FONT_SIZE(dmp->dm_fontsize)) {
- if (pubvars->fontstruct->per_char->width != dmp->dm_fontsize) {
+ if (DM_VALID_FONT_SIZE(dmp->i->dm_fontsize)) {
+ if (pubvars->fontstruct->per_char->width != dmp->i->dm_fontsize) {
if ((newfontstruct = XLoadQueryFont(pubvars->dpy,
-
DM_FONT_SIZE_TO_NAME(dmp->dm_fontsize))) != NULL) {
+
DM_FONT_SIZE_TO_NAME(dmp->i->dm_fontsize))) != NULL) {
XFreeFont(pubvars->dpy,
pubvars->fontstruct);
pubvars->fontstruct = newfontstruct;
@@ -276,7 +276,7 @@
/* Always try to choose a the font that best fits the window size.
*/
- if (dmp->dm_width < 582) {
+ if (dmp->i->dm_width < 582) {
if (pubvars->fontstruct->per_char->width != 5) {
if ((newfontstruct = XLoadQueryFont(pubvars->dpy,
FONT5)) != NULL) {
@@ -287,7 +287,7 @@
0, 127, privars->fontOffset);
}
}
- } else if (dmp->dm_width < 679) {
+ } else if (dmp->i->dm_width < 679) {
if (pubvars->fontstruct->per_char->width != 6) {
if ((newfontstruct = XLoadQueryFont(pubvars->dpy,
FONT6)) != NULL) {
@@ -298,7 +298,7 @@
0, 127, privars->fontOffset);
}
}
- } else if (dmp->dm_width < 776) {
+ } else if (dmp->i->dm_width < 776) {
if (pubvars->fontstruct->per_char->width != 7) {
if ((newfontstruct = XLoadQueryFont(pubvars->dpy,
FONT7)) != NULL) {
@@ -309,7 +309,7 @@
0, 127, privars->fontOffset);
}
}
- } else if (dmp->dm_width < 873) {
+ } else if (dmp->i->dm_width < 873) {
if (pubvars->fontstruct->per_char->width != 8) {
if ((newfontstruct = XLoadQueryFont(pubvars->dpy,
FONT8)) != NULL) {
@@ -320,7 +320,7 @@
0, 127, privars->fontOffset);
}
}
- } else if (dmp->dm_width < 1455) {
+ } else if (dmp->i->dm_width < 1455) {
if (pubvars->fontstruct->per_char->width != 9) {
if ((newfontstruct = XLoadQueryFont(pubvars->dpy,
FONT9)) != NULL) {
@@ -331,7 +331,7 @@
0, 127, privars->fontOffset);
}
}
- } else if (dmp->dm_width < 2037) {
+ } else if (dmp->i->dm_width < 2037) {
if (pubvars->fontstruct->per_char->width != 10) {
if ((newfontstruct = XLoadQueryFont(pubvars->dpy,
FONT10)) != NULL) {
@@ -365,21 +365,21 @@
{
GLint mm;
- struct ogl_vars *privars = (struct ogl_vars *)dmp->dm_vars.priv_vars;
+ struct ogl_vars *privars = (struct ogl_vars *)dmp->i->dm_vars.priv_vars;
- dmp->dm_height = height;
- dmp->dm_width = width;
- dmp->dm_aspect = (fastf_t)dmp->dm_width / (fastf_t)dmp->dm_height;
+ dmp->i->dm_height = height;
+ dmp->i->dm_width = width;
+ dmp->i->dm_aspect = (fastf_t)dmp->i->dm_width / (fastf_t)dmp->i->dm_height;
- if (dmp->dm_debugLevel) {
+ if (dmp->i->dm_debugLevel) {
GLfloat m[16];
bu_log("ogl_reshape()\n");
- bu_log("width = %d, height = %d\n", dmp->dm_width, dmp->dm_height);
+ bu_log("width = %d, height = %d\n", dmp->i->dm_width,
dmp->i->dm_height);
glGetFloatv (GL_MODELVIEW_MATRIX, m);
glGetFloatv (GL_PROJECTION_MATRIX, m);
}
- glViewport(0, 0, dmp->dm_width, dmp->dm_height);
+ glViewport(0, 0, dmp->i->dm_width, dmp->i->dm_height);
glClearColor(privars->r,
privars->g,
@@ -390,7 +390,7 @@
glGetIntegerv(GL_MATRIX_MODE, &mm);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glOrtho(-xlim_view, xlim_view, -ylim_view, ylim_view, dmp->dm_clipmin[2],
dmp->dm_clipmax[2]);
+ glOrtho(-xlim_view, xlim_view, -ylim_view, ylim_view,
dmp->i->dm_clipmin[2], dmp->i->dm_clipmax[2]);
glMatrixMode(mm);
return 0;
@@ -400,10 +400,10 @@
HIDDEN int
ogl_makeCurrent(struct dm *dmp)
{
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct ogl_vars *privars = (struct ogl_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct ogl_vars *privars = (struct ogl_vars *)dmp->i->dm_vars.priv_vars;
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("ogl_makeCurrent()\n");
if (!glXMakeCurrent(pubvars->dpy,
@@ -420,8 +420,8 @@
HIDDEN int
ogl_configureWin(struct dm *dmp, int force)
{
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct ogl_vars *privars = (struct ogl_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct ogl_vars *privars = (struct ogl_vars *)dmp->i->dm_vars.priv_vars;
if (!glXMakeCurrent(pubvars->dpy,
pubvars->win,
@@ -437,20 +437,20 @@
HIDDEN int
ogl_setLight(struct dm *dmp, int lighting_on)
{
- struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->m_vars;
- if (dmp->dm_debugLevel)
+ struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->i->m_vars;
+ if (dmp->i->dm_debugLevel)
bu_log("ogl_setLight()\n");
- dmp->dm_light = lighting_on;
- mvars->lighting_on = dmp->dm_light;
+ dmp->i->dm_light = lighting_on;
+ mvars->lighting_on = dmp->i->dm_light;
- if (!dmp->dm_light) {
+ if (!dmp->i->dm_light) {
/* Turn it off */
glDisable(GL_LIGHTING);
} else {
/* Turn it on */
- if (1 < dmp->dm_light)
+ if (1 < dmp->i->dm_light)
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
else
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
@@ -476,8 +476,8 @@
HIDDEN XVisualInfo *
ogl_choose_visual(struct dm *dmp, Tk_Window tkwin)
{
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->m_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->i->m_vars;
XVisualInfo *vip, vitemp, *vibase, *maxvip;
int tries, baddepth;
int num, i, j;
@@ -497,7 +497,7 @@
int m_stereo; /* m_stereo - try to get stereo */
int stereo;
- if (dmp->dm_stereo) {
+ if (dmp->i->dm_stereo) {
m_stereo = 1;
} else {
m_stereo = 0;
@@ -621,8 +621,8 @@
HIDDEN int
ogl_close(struct dm *dmp)
{
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct ogl_vars *privars = (struct ogl_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct ogl_vars *privars = (struct ogl_vars *)dmp->i->dm_vars.priv_vars;
if (pubvars->dpy) {
if (privars->glxc) {
@@ -639,12 +639,13 @@
Tk_DestroyWindow(pubvars->xtkwin);
}
- bu_vls_free(&dmp->dm_pathName);
- bu_vls_free(&dmp->dm_tkName);
- bu_vls_free(&dmp->dm_dName);
- bu_free(dmp->dm_vars.priv_vars, "ogl_close: ogl_vars");
- bu_free(dmp->dm_vars.pub_vars, "ogl_close: dm_xvars");
- bu_free(dmp, "ogl_close: dmp");
+ bu_vls_free(&dmp->i->dm_pathName);
+ bu_vls_free(&dmp->i->dm_tkName);
+ bu_vls_free(&dmp->i->dm_dName);
+ bu_free(dmp->i->dm_vars.priv_vars, "ogl_close: ogl_vars");
+ bu_free(dmp->i->dm_vars.pub_vars, "ogl_close: dm_xvars");
+ BU_PUT(dmp->i, struct dm_impl);
+ BU_PUT(dmp, struct dm);
return BRLCAD_OK;
}
@@ -676,7 +677,8 @@
struct bu_vls str = BU_VLS_INIT_ZERO;
struct bu_vls init_proc_vls = BU_VLS_INIT_ZERO;
Display *tmp_dpy = (Display *)NULL;
- struct dm *dmp = (struct dm *)NULL;
+ struct dm *dmp = NULL;
+ struct dm_impl *dmpi = NULL;
struct modifiable_ogl_vars *mvars = NULL;
Tk_Window tkwin = (Tk_Window)NULL;
int screen_number = -1;
@@ -689,52 +691,54 @@
}
BU_GET(dmp, struct dm);
+ BU_GET(dmpi, struct dm_impl);
+ *dmpi = *dm_ogl.i; /* struct copy */
+ dmp->i = dmpi;
- *dmp = dm_ogl; /* struct copy */
- dmp->dm_interp = interp;
- dmp->dm_lineWidth = 1;
- dmp->dm_light = 1;
- dmp->dm_bytes_per_pixel = sizeof(GLuint);
- dmp->dm_bits_per_channel = 8;
- bu_vls_init(&(dmp->dm_log));
+ dmp->i->dm_interp = interp;
+ dmp->i->dm_lineWidth = 1;
+ dmp->i->dm_light = 1;
+ dmp->i->dm_bytes_per_pixel = sizeof(GLuint);
+ dmp->i->dm_bits_per_channel = 8;
+ bu_vls_init(&(dmp->i->dm_log));
- BU_ALLOC(dmp->dm_vars.pub_vars, struct dm_xvars);
- if (dmp->dm_vars.pub_vars == (void *)NULL) {
+ BU_ALLOC(dmp->i->dm_vars.pub_vars, struct dm_xvars);
+ if (dmp->i->dm_vars.pub_vars == (void *)NULL) {
bu_free(dmp, "ogl_open: dmp");
return DM_NULL;
}
- pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
+ pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
- BU_ALLOC(dmp->dm_vars.priv_vars, struct ogl_vars);
- if (dmp->dm_vars.priv_vars == (void *)NULL) {
- bu_free(dmp->dm_vars.pub_vars, "ogl_open: dmp->dm_vars.pub_vars");
+ BU_ALLOC(dmp->i->dm_vars.priv_vars, struct ogl_vars);
+ if (dmp->i->dm_vars.priv_vars == (void *)NULL) {
+ bu_free(dmp->i->dm_vars.pub_vars, "ogl_open: dmp->i->dm_vars.pub_vars");
bu_free(dmp, "ogl_open: dmp");
return DM_NULL;
}
- privvars = (struct ogl_vars *)dmp->dm_vars.priv_vars;
+ privvars = (struct ogl_vars *)dmp->i->dm_vars.priv_vars;
- dmp->dm_get_internal(dmp);
- mvars = (struct modifiable_ogl_vars *)dmp->m_vars;
+ dmp->i->dm_get_internal(dmp);
+ mvars = (struct modifiable_ogl_vars *)dmp->i->m_vars;
- dmp->dm_vp = &default_viewscale;
+ dmp->i->dm_vp = &default_viewscale;
- bu_vls_init(&dmp->dm_pathName);
- bu_vls_init(&dmp->dm_tkName);
- bu_vls_init(&dmp->dm_dName);
+ bu_vls_init(&dmp->i->dm_pathName);
+ bu_vls_init(&dmp->i->dm_tkName);
+ bu_vls_init(&dmp->i->dm_dName);
dm_processOptions(dmp, &init_proc_vls, --argc, ++argv);
- if (bu_vls_strlen(&dmp->dm_pathName) == 0)
- bu_vls_printf(&dmp->dm_pathName, ".dm_ogl%d", count);
+ if (bu_vls_strlen(&dmp->i->dm_pathName) == 0)
+ bu_vls_printf(&dmp->i->dm_pathName, ".dm_ogl%d", count);
++count;
- if (bu_vls_strlen(&dmp->dm_dName) == 0) {
+ if (bu_vls_strlen(&dmp->i->dm_dName) == 0) {
char *dp;
dp = getenv("DISPLAY");
if (dp)
- bu_vls_strcpy(&dmp->dm_dName, dp);
+ bu_vls_strcpy(&dmp->i->dm_dName, dp);
else
- bu_vls_strcpy(&dmp->dm_dName, ":0.0");
+ bu_vls_strcpy(&dmp->i->dm_dName, ":0.0");
}
if (bu_vls_strlen(&init_proc_vls) == 0)
bu_vls_strcpy(&init_proc_vls, "bind_dm");
@@ -743,7 +747,7 @@
pubvars->devmotionnotify = LASTEvent;
pubvars->devbuttonpress = LASTEvent;
pubvars->devbuttonrelease = LASTEvent;
- dmp->dm_aspect = 1.0;
+ dmp->i->dm_aspect = 1.0;
/* initialize modifiable variables */
mvars->rgb = 1;
@@ -750,17 +754,17 @@
mvars->doublebuffer = 1;
mvars->fastfog = 1;
mvars->fogdensity = 1.0;
- mvars->lighting_on = dmp->dm_light;
- mvars->zbuffer_on = dmp->dm_zbuffer;
- mvars->zclipping_on = dmp->dm_zclip;
- mvars->debug = dmp->dm_debugLevel;
- mvars->bound = dmp->dm_bound;
- mvars->boundFlag = dmp->dm_boundFlag;
+ mvars->lighting_on = dmp->i->dm_light;
+ mvars->zbuffer_on = dmp->i->dm_zbuffer;
+ mvars->zclipping_on = dmp->i->dm_zclip;
+ mvars->debug = dmp->i->dm_debugLevel;
+ mvars->bound = dmp->i->dm_bound;
+ mvars->boundFlag = dmp->i->dm_boundFlag;
/* this is important so that ogl_configureWin knows to set the font */
pubvars->fontstruct = NULL;
- if ((tmp_dpy = XOpenDisplay(bu_vls_addr(&dmp->dm_dName))) == NULL) {
+ if ((tmp_dpy = XOpenDisplay(bu_vls_addr(&dmp->i->dm_dName))) == NULL) {
bu_vls_free(&init_proc_vls);
(void)ogl_close(dmp);
return DM_NULL;
@@ -782,46 +786,46 @@
if (screen_number < 0)
bu_log("WARNING: screen number is [%d]\n", screen_number);
- if (dmp->dm_width == 0) {
- dmp->dm_width = XDisplayWidth(tmp_dpy, screen_number) - 30;
+ if (dmp->i->dm_width == 0) {
+ dmp->i->dm_width = XDisplayWidth(tmp_dpy, screen_number) - 30;
++make_square;
}
- if (dmp->dm_height == 0) {
- dmp->dm_height = XDisplayHeight(tmp_dpy, screen_number) - 30;
+ if (dmp->i->dm_height == 0) {
+ dmp->i->dm_height = XDisplayHeight(tmp_dpy, screen_number) - 30;
++make_square;
}
if (make_square > 0) {
/* Make window square */
- if (dmp->dm_height <
- dmp->dm_width)
- dmp->dm_width =
- dmp->dm_height;
+ if (dmp->i->dm_height <
+ dmp->i->dm_width)
+ dmp->i->dm_width =
+ dmp->i->dm_height;
else
- dmp->dm_height =
- dmp->dm_width;
+ dmp->i->dm_height =
+ dmp->i->dm_width;
}
XCloseDisplay(tmp_dpy);
- if (dmp->dm_top) {
+ if (dmp->i->dm_top) {
/* Make xtkwin a toplevel window */
pubvars->xtkwin =
Tk_CreateWindowFromPath(interp,
tkwin,
- bu_vls_addr(&dmp->dm_pathName),
- bu_vls_addr(&dmp->dm_dName));
+ bu_vls_addr(&dmp->i->dm_pathName),
+ bu_vls_addr(&dmp->i->dm_dName));
pubvars->top = pubvars->xtkwin;
} else {
char *cp;
- cp = strrchr(bu_vls_addr(&dmp->dm_pathName), (int)'.');
- if (cp == bu_vls_addr(&dmp->dm_pathName)) {
+ cp = strrchr(bu_vls_addr(&dmp->i->dm_pathName), (int)'.');
+ if (cp == bu_vls_addr(&dmp->i->dm_pathName)) {
pubvars->top = tkwin;
} else {
struct bu_vls top_vls = BU_VLS_INIT_ZERO;
- bu_vls_strncpy(&top_vls, (const char
*)bu_vls_addr(&dmp->dm_pathName), cp - bu_vls_addr(&dmp->dm_pathName));
+ bu_vls_strncpy(&top_vls, (const char
*)bu_vls_addr(&dmp->i->dm_pathName), cp - bu_vls_addr(&dmp->i->dm_pathName));
pubvars->top =
Tk_NameToWindow(interp, bu_vls_addr(&top_vls), tkwin);
@@ -835,18 +839,18 @@
}
if (pubvars->xtkwin == NULL) {
- bu_log("dm-Ogl: Failed to open %s\n", bu_vls_addr(&dmp->dm_pathName));
+ bu_log("dm-Ogl: Failed to open %s\n",
bu_vls_addr(&dmp->i->dm_pathName));
bu_vls_free(&init_proc_vls);
(void)ogl_close(dmp);
return DM_NULL;
}
- bu_vls_printf(&dmp->dm_tkName, "%s",
+ bu_vls_printf(&dmp->i->dm_tkName, "%s",
(char *)Tk_Name(pubvars->xtkwin));
bu_vls_printf(&str, "_init_dm %s %s\n",
bu_vls_addr(&init_proc_vls),
- bu_vls_addr(&dmp->dm_pathName));
+ bu_vls_addr(&dmp->i->dm_pathName));
if (Tcl_Eval(interp, bu_vls_addr(&str)) == BRLCAD_ERROR) {
bu_vls_free(&init_proc_vls);
@@ -870,8 +874,8 @@
}
Tk_GeometryRequest(pubvars->xtkwin,
- dmp->dm_width,
- dmp->dm_height);
+ dmp->i->dm_width,
+ dmp->i->dm_height);
/* must do this before MakeExist */
if ((pubvars->vip=ogl_choose_visual(dmp, pubvars->xtkwin)) == NULL) {
@@ -885,7 +889,7 @@
Tk_MakeWindowExist(pubvars->xtkwin);
pubvars->win = Tk_WindowId(pubvars->xtkwin);
- dmp->dm_id = pubvars->win;
+ dmp->i->dm_id = pubvars->win;
/* open GLX context */
if ((privvars->glxc =
@@ -972,7 +976,7 @@
}
/* This is the applications display list offset */
- dmp->dm_displaylist = privvars->fontOffset + 128;
+ dmp->i->dm_displaylist = privvars->fontOffset + 128;
ogl_setBGColor(dmp, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -1011,8 +1015,8 @@
glLoadIdentity();
privvars->face_flag = 1; /* faceplate matrix is on top of stack */
- ogl_setZBuffer(dmp, dmp->dm_zbuffer);
- ogl_setLight(dmp, dmp->dm_light);
+ ogl_setZBuffer(dmp, dmp->i->dm_zbuffer);
+ ogl_setLight(dmp, dmp->i->dm_light);
return dmp;
}
@@ -1021,8 +1025,8 @@
int
ogl_share_dlist(struct dm *dmp1, struct dm *dmp2)
{
- struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp1->m_vars;
- struct ogl_vars *privars = (struct ogl_vars *)dmp1->dm_vars.priv_vars;
+ struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp1->i->m_vars;
+ struct ogl_vars *privars = (struct ogl_vars *)dmp1->i->dm_vars.priv_vars;
GLfloat backgnd[4];
GLfloat vf;
GLXContext old_glxContext;
@@ -1036,8 +1040,8 @@
old_glxContext = privars->glxc;
if ((privars->glxc =
- glXCreateContext(((struct dm_xvars *)dmp1->dm_vars.pub_vars)->dpy,
- ((struct dm_xvars *)dmp1->dm_vars.pub_vars)->vip,
+ glXCreateContext(((struct dm_xvars
*)dmp1->i->dm_vars.pub_vars)->dpy,
+ ((struct dm_xvars
*)dmp1->i->dm_vars.pub_vars)->vip,
(GLXContext)NULL, GL_TRUE))==NULL) {
bu_log("ogl_share_dlist: couldn't create glXContext.\nUsing old
context\n.");
privars->glxc = old_glxContext;
@@ -1045,8 +1049,8 @@
return BRLCAD_ERROR;
}
- if (!glXMakeCurrent(((struct dm_xvars *)dmp1->dm_vars.pub_vars)->dpy,
- ((struct dm_xvars *)dmp1->dm_vars.pub_vars)->win,
+ if (!glXMakeCurrent(((struct dm_xvars *)dmp1->i->dm_vars.pub_vars)->dpy,
+ ((struct dm_xvars *)dmp1->i->dm_vars.pub_vars)->win,
privars->glxc)) {
bu_log("ogl_share_dlist: Couldn't make context current\nUsing old
context\n.");
privars->glxc = old_glxContext;
@@ -1063,7 +1067,7 @@
}
/* This is the applications display list offset */
- dmp1->dm_displaylist = privars->fontOffset + 128;
+ dmp1->i->dm_displaylist = privars->fontOffset + 128;
ogl_setBGColor(dmp1, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -1074,7 +1078,7 @@
glDrawBuffer(GL_FRONT);
/* this is important so that ogl_configureWin knows to set the font */
- ((struct dm_xvars *)dmp1->dm_vars.pub_vars)->fontstruct = NULL;
+ ((struct dm_xvars *)dmp1->i->dm_vars.pub_vars)->fontstruct = NULL;
/* do viewport, ortho commands and initialize font */
(void)ogl_configureWin_guts(dmp1, 1);
@@ -1090,7 +1094,7 @@
glFogfv(GL_FOG_COLOR, backgnd);
/*XXX Need to do something about VIEWFACTOR */
- vf = 1.0/(*dmp1->dm_vp);
+ vf = 1.0/(*dmp1->i->dm_vp);
glFogf(GL_FOG_DENSITY, vf);
/* Initialize matrices */
@@ -1107,35 +1111,35 @@
privars->face_flag = 1; /* faceplate matrix is on top of stack */
/* destroy old context */
- glXMakeCurrent(((struct dm_xvars *)dmp1->dm_vars.pub_vars)->dpy, None,
NULL);
- glXDestroyContext(((struct dm_xvars *)dmp1->dm_vars.pub_vars)->dpy,
old_glxContext);
+ glXMakeCurrent(((struct dm_xvars *)dmp1->i->dm_vars.pub_vars)->dpy,
None, NULL);
+ glXDestroyContext(((struct dm_xvars *)dmp1->i->dm_vars.pub_vars)->dpy,
old_glxContext);
} else {
/* dmp1 will share its display lists with dmp2 */
- old_glxContext = ((struct ogl_vars *)dmp2->dm_vars.priv_vars)->glxc;
+ old_glxContext = ((struct ogl_vars *)dmp2->i->dm_vars.priv_vars)->glxc;
- if ((((struct ogl_vars *)dmp2->dm_vars.priv_vars)->glxc =
- glXCreateContext(((struct dm_xvars *)dmp2->dm_vars.pub_vars)->dpy,
- ((struct dm_xvars *)dmp2->dm_vars.pub_vars)->vip,
+ if ((((struct ogl_vars *)dmp2->i->dm_vars.priv_vars)->glxc =
+ glXCreateContext(((struct dm_xvars
*)dmp2->i->dm_vars.pub_vars)->dpy,
+ ((struct dm_xvars
*)dmp2->i->dm_vars.pub_vars)->vip,
privars->glxc,
GL_TRUE))==NULL) {
bu_log("ogl_share_dlist: couldn't create glXContext.\nUsing old
context\n.");
- ((struct ogl_vars *)dmp2->dm_vars.priv_vars)->glxc = old_glxContext;
+ ((struct ogl_vars *)dmp2->i->dm_vars.priv_vars)->glxc =
old_glxContext;
return BRLCAD_ERROR;
}
- if (!glXMakeCurrent(((struct dm_xvars *)dmp2->dm_vars.pub_vars)->dpy,
- ((struct dm_xvars *)dmp2->dm_vars.pub_vars)->win,
- ((struct ogl_vars
*)dmp2->dm_vars.priv_vars)->glxc)) {
+ if (!glXMakeCurrent(((struct dm_xvars *)dmp2->i->dm_vars.pub_vars)->dpy,
+ ((struct dm_xvars *)dmp2->i->dm_vars.pub_vars)->win,
+ ((struct ogl_vars
*)dmp2->i->dm_vars.priv_vars)->glxc)) {
bu_log("ogl_share_dlist: Couldn't make context current\nUsing old
context\n.");
- ((struct ogl_vars *)dmp2->dm_vars.priv_vars)->glxc = old_glxContext;
+ ((struct ogl_vars *)dmp2->i->dm_vars.priv_vars)->glxc =
old_glxContext;
return BRLCAD_ERROR;
}
- ((struct ogl_vars *)dmp2->dm_vars.priv_vars)->fontOffset =
privars->fontOffset;
- dmp2->dm_displaylist = dmp1->dm_displaylist;
+ ((struct ogl_vars *)dmp2->i->dm_vars.priv_vars)->fontOffset =
privars->fontOffset;
+ dmp2->i->dm_displaylist = dmp1->i->dm_displaylist;
ogl_setBGColor(dmp2, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -1159,7 +1163,7 @@
glFogfv(GL_FOG_COLOR, backgnd);
/*XXX Need to do something about VIEWFACTOR */
- vf = 1.0/(*dmp2->dm_vp);
+ vf = 1.0/(*dmp2->i->dm_vp);
glFogf(GL_FOG_DENSITY, vf);
/* Initialize matrices */
@@ -1167,17 +1171,17 @@
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-xlim_view, xlim_view, -ylim_view, ylim_view, 0.0, 2.0);
- glGetDoublev(GL_PROJECTION_MATRIX, ((struct ogl_vars
*)dmp2->dm_vars.priv_vars)->faceplate_mat);
+ glGetDoublev(GL_PROJECTION_MATRIX, ((struct ogl_vars
*)dmp2->i->dm_vars.priv_vars)->faceplate_mat);
glPushMatrix();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glPushMatrix();
glLoadIdentity();
- ((struct ogl_vars *)dmp2->dm_vars.priv_vars)->face_flag = 1; /*
faceplate matrix is on top of stack */
+ ((struct ogl_vars *)dmp2->i->dm_vars.priv_vars)->face_flag = 1; /*
faceplate matrix is on top of stack */
/* destroy old context */
- glXMakeCurrent(((struct dm_xvars *)dmp2->dm_vars.pub_vars)->dpy, None,
NULL);
- glXDestroyContext(((struct dm_xvars *)dmp2->dm_vars.pub_vars)->dpy,
old_glxContext);
+ glXMakeCurrent(((struct dm_xvars *)dmp2->i->dm_vars.pub_vars)->dpy,
None, NULL);
+ glXDestroyContext(((struct dm_xvars *)dmp2->i->dm_vars.pub_vars)->dpy,
old_glxContext);
}
return BRLCAD_OK;
@@ -1190,17 +1194,17 @@
HIDDEN int
ogl_drawBegin(struct dm *dmp)
{
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->m_vars;
- struct ogl_vars *privars = (struct ogl_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->i->m_vars;
+ struct ogl_vars *privars = (struct ogl_vars *)dmp->i->dm_vars.priv_vars;
GLfloat fogdepth;
- if (dmp->dm_debugLevel) {
+ if (dmp->i->dm_debugLevel) {
bu_log("ogl_drawBegin\n");
}
- if (dmp->dm_debugLevel == 3) {
+ if (dmp->i->dm_debugLevel == 3) {
GLfloat m[16];
struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
@@ -1226,7 +1230,7 @@
}
/* clear back buffer */
- if (!dmp->dm_clearBufferAfter && mvars->doublebuffer) {
+ if (!dmp->i->dm_clearBufferAfter && mvars->doublebuffer) {
glClearColor(privars->r,
privars->g,
privars->b,
@@ -1243,19 +1247,19 @@
if (mvars->cueing_on) {
glEnable(GL_FOG);
/*XXX Need to do something with Viewscale */
- fogdepth = 2.2 * (*dmp->dm_vp); /* 2.2 is heuristic */
+ fogdepth = 2.2 * (*dmp->i->dm_vp); /* 2.2 is heuristic */
glFogf(GL_FOG_END, fogdepth);
fogdepth = (GLfloat) (0.5*mvars->fogdensity/
- (*dmp->dm_vp));
+ (*dmp->i->dm_vp));
glFogf(GL_FOG_DENSITY, fogdepth);
- glFogi(GL_FOG_MODE, dmp->dm_perspective ? GL_EXP : GL_LINEAR);
+ glFogi(GL_FOG_MODE, dmp->i->dm_perspective ? GL_EXP : GL_LINEAR);
}
- if (dmp->dm_light) {
+ if (dmp->i->dm_light) {
glEnable(GL_LIGHTING);
}
}
- if (dmp->dm_debugLevel == 3) {
+ if (dmp->i->dm_debugLevel == 3) {
GLfloat m[16];
struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
@@ -1279,14 +1283,14 @@
HIDDEN int
ogl_drawEnd(struct dm *dmp)
{
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->m_vars;
- struct ogl_vars *privars = (struct ogl_vars *)dmp->dm_vars.priv_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->i->m_vars;
+ struct ogl_vars *privars = (struct ogl_vars *)dmp->i->dm_vars.priv_vars;
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("ogl_drawEnd\n");
- if (dmp->dm_debugLevel == 3) {
+ if (dmp->i->dm_debugLevel == 3) {
GLfloat m[16];
struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
bu_vls_printf(&tmp_vls, "beginning of end view matrix = \n");
@@ -1300,7 +1304,7 @@
}
- if (dmp->dm_light) {
+ if (dmp->i->dm_light) {
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
@@ -1310,7 +1314,7 @@
glXSwapBuffers(pubvars->dpy,
pubvars->win);
- if (dmp->dm_clearBufferAfter) {
+ if (dmp->i->dm_clearBufferAfter) {
/* give Graphics pipe time to work */
glClearColor(privars->r,
privars->g,
@@ -1320,7 +1324,7 @@
}
}
- if (dmp->dm_debugLevel) {
+ if (dmp->i->dm_debugLevel) {
int error;
struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
@@ -1334,7 +1338,7 @@
bu_vls_free(&tmp_vls);
}
- if (dmp->dm_debugLevel == 3) {
+ if (dmp->i->dm_debugLevel == 3) {
GLfloat m[16];
struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
bu_vls_printf(&tmp_vls, "end of drawend view matrix = \n");
@@ -1362,10 +1366,10 @@
fastf_t *mptr;
GLfloat gtmat[16];
- if (dmp->dm_debugLevel == 1)
+ if (dmp->i->dm_debugLevel == 1)
bu_log("ogl_loadMatrix()\n");
- if (dmp->dm_debugLevel == 3) {
+ if (dmp->i->dm_debugLevel == 3) {
GLfloat m[16];
struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
bu_vls_printf(&tmp_vls, "beginning of loadMatrix view matrix = \n");
@@ -1379,7 +1383,7 @@
}
- if (dmp->dm_debugLevel == 3) {
+ if (dmp->i->dm_debugLevel == 3) {
struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
bu_vls_printf(&tmp_vls, "transformation matrix = \n");
@@ -1415,10 +1419,10 @@
gtmat[8] = *(mptr++);
gtmat[12] = *(mptr++);
- gtmat[1] = *(mptr++) * dmp->dm_aspect;
- gtmat[5] = *(mptr++) * dmp->dm_aspect;
- gtmat[9] = *(mptr++) * dmp->dm_aspect;
- gtmat[13] = *(mptr++) * dmp->dm_aspect;
+ gtmat[1] = *(mptr++) * dmp->i->dm_aspect;
+ gtmat[5] = *(mptr++) * dmp->i->dm_aspect;
+ gtmat[9] = *(mptr++) * dmp->i->dm_aspect;
+ gtmat[13] = *(mptr++) * dmp->i->dm_aspect;
gtmat[2] = *(mptr++);
gtmat[6] = *(mptr++);
@@ -1434,7 +1438,7 @@
glLoadIdentity();
glLoadMatrixf(gtmat);
- if (dmp->dm_debugLevel == 3) {
+ if (dmp->i->dm_debugLevel == 3) {
GLfloat m[16];
struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
bu_vls_printf(&tmp_vls, "end of loadMatrix view matrix = \n");
@@ -1461,7 +1465,7 @@
fastf_t *mptr;
GLfloat gtmat[16];
- struct ogl_vars *privars = (struct ogl_vars *)dmp->dm_vars.priv_vars;
+ struct ogl_vars *privars = (struct ogl_vars *)dmp->i->dm_vars.priv_vars;
glMatrixMode(GL_PROJECTION);
@@ -1469,12 +1473,12 @@
if (privars->face_flag) {
glPopMatrix();
glLoadIdentity();
- glOrtho(-xlim_view, xlim_view, -ylim_view, ylim_view,
dmp->dm_clipmin[2], dmp->dm_clipmax[2]);
+ glOrtho(-xlim_view, xlim_view, -ylim_view, ylim_view,
dmp->i->dm_clipmin[2], dmp->i->dm_clipmax[2]);
glPushMatrix();
glLoadMatrixd(privars->faceplate_mat);
} else {
glLoadIdentity();
- glOrtho(-xlim_view, xlim_view, -ylim_view, ylim_view,
dmp->dm_clipmin[2], dmp->dm_clipmax[2]);
+ glOrtho(-xlim_view, xlim_view, -ylim_view, ylim_view,
dmp->i->dm_clipmin[2], dmp->i->dm_clipmax[2]);
}
return BRLCAD_OK;
@@ -1512,19 +1516,19 @@
HIDDEN int
ogl_drawVListHiddenLine(struct dm *dmp, register struct bn_vlist *vp)
{
- struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->m_vars;
- struct ogl_vars *privars = (struct ogl_vars *)dmp->dm_vars.priv_vars;
+ struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->i->m_vars;
+ struct ogl_vars *privars = (struct ogl_vars *)dmp->i->dm_vars.priv_vars;
register struct bn_vlist *tvp;
register int first;
- if (dmp->dm_debugLevel == 1)
+ if (dmp->i->dm_debugLevel == 1)
bu_log("ogl_drawVList()\n");
/* First, draw polygons using background color. */
- if (dmp->dm_light) {
+ if (dmp->i->dm_light) {
glDisable(GL_LIGHTING);
}
@@ -1552,7 +1556,7 @@
GLdouble dpt[3];
VMOVE(dpt, *pt); /* fastf_t-to-double */
/*
- if (dmp->dm_debugLevel > 2)
+ if (dmp->i->dm_debugLevel > 2)
bu_log(" %d (%g %g %g)\n", *cmd, V3ARGS(dpt));*/
switch (*cmd) {
@@ -1621,7 +1625,7 @@
GLdouble dpt[3];
VMOVE(dpt, *pt); /* fastf_t-to-double */
/*
- if (dmp->dm_debugLevel > 2)
+ if (dmp->i->dm_debugLevel > 2)
bu_log(" %d (%g %g %g)\n", *cmd, V3ARGS(dpt));*/
switch (*cmd) {
@@ -1669,7 +1673,7 @@
if (first == 0)
glEnd();
- if (dmp->dm_light) {
+ if (dmp->i->dm_light) {
glEnable(GL_LIGHTING);
}
@@ -1676,7 +1680,7 @@
if (!mvars->zbuffer_on)
glDisable(GL_DEPTH_TEST);
- if (!dmp->dm_depthMask)
+ if (!dmp->i->dm_depthMask)
glDepthMask(GL_FALSE);
glDisable(GL_POLYGON_OFFSET_FILL);
@@ -1700,7 +1704,7 @@
glGetFloatv(GL_POINT_SIZE, &originalPointSize);
glGetFloatv(GL_LINE_WIDTH, &originalLineWidth);
- if (dmp->dm_debugLevel == 1)
+ if (dmp->i->dm_debugLevel == 1)
bu_log("ogl_drawVList()\n");
/* Viewing region is from -1.0 to +1.0 */
@@ -1714,7 +1718,7 @@
GLdouble dpt[3];
VMOVE(dpt, *pt);
/*
- if (dmp->dm_debugLevel > 2)
+ if (dmp->i->dm_debugLevel > 2)
bu_log(" %d (%g %g %g)\n", *cmd, V3ARGS(dpt));*/
switch (*cmd) {
@@ -1724,7 +1728,7 @@
glEnd();
first = 0;
- if (dmp->dm_light && mflag) {
+ if (dmp->i->dm_light && mflag) {
mflag = 0;
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, wireColor);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, black);
@@ -1731,7 +1735,7 @@
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, black);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, black);
- if (dmp->dm_transparency)
+ if (dmp->i->dm_transparency)
glDisable(GL_BLEND);
}
@@ -1758,8 +1762,8 @@
glLoadIdentity();
glTranslated(tlate[0], tlate[1], tlate[2]);
/* 96 dpi = 3.78 pixel/mm hardcoded */
- glScaled(2. * 3.78 / dmp->dm_width,
- 2. * 3.78 / dmp->dm_height,
+ glScaled(2. * 3.78 / dmp->i->dm_width,
+ 2. * 3.78 / dmp->i->dm_height,
1.);
break;
case BN_VLIST_POLY_START:
@@ -1766,7 +1770,7 @@
case BN_VLIST_TRI_START:
/* Start poly marker & normal */
- if (dmp->dm_light && mflag) {
+ if (dmp->i->dm_light && mflag) {
mflag = 0;
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, black);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT,
ambientColor);
@@ -1773,7 +1777,7 @@
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR,
specularColor);
glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuseColor);
- switch (dmp->dm_light) {
+ switch (dmp->i->dm_light) {
case 1:
break;
case 2:
@@ -1787,7 +1791,7 @@
break;
}
- if (dmp->dm_transparency)
+ if (dmp->i->dm_transparency)
glEnable(GL_BLEND);
}
@@ -1855,7 +1859,7 @@
if (first == 0)
glEnd();
- if (dmp->dm_light && dmp->dm_transparency)
+ if (dmp->i->dm_light && dmp->i->dm_transparency)
glDisable(GL_BLEND);
glPointSize(originalPointSize);
@@ -1892,13 +1896,13 @@
HIDDEN int
ogl_normal(struct dm *dmp)
{
- struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->m_vars;
- struct ogl_vars *privars = (struct ogl_vars *)dmp->dm_vars.priv_vars;
+ struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->i->m_vars;
+ struct ogl_vars *privars = (struct ogl_vars *)dmp->i->dm_vars.priv_vars;
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("ogl_normal\n");
- if (dmp->dm_debugLevel == 3) {
+ if (dmp->i->dm_debugLevel == 3) {
GLfloat m[16];
struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
bu_vls_printf(&tmp_vls, "beginning of ogl_normal view matrix = \n");
@@ -1921,11 +1925,11 @@
privars->face_flag = 1;
if (mvars->cueing_on)
glDisable(GL_FOG);
- if (dmp->dm_light)
+ if (dmp->i->dm_light)
glDisable(GL_LIGHTING);
}
- if (dmp->dm_debugLevel == 3) {
+ if (dmp->i->dm_debugLevel == 3) {
GLfloat m[16];
struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
bu_vls_printf(&tmp_vls, "end of ogl_normal view matrix = \n");
@@ -1949,12 +1953,12 @@
HIDDEN int
ogl_drawString2D(struct dm *dmp, const char *str, fastf_t x, fastf_t y, int
UNUSED(size), int use_aspect)
{
- struct ogl_vars *privars = (struct ogl_vars *)dmp->dm_vars.priv_vars;
- if (dmp->dm_debugLevel)
+ struct ogl_vars *privars = (struct ogl_vars *)dmp->i->dm_vars.priv_vars;
+ if (dmp->i->dm_debugLevel)
bu_log("ogl_drawString2D()\n");
if (use_aspect)
- glRasterPos2f(x, y * dmp->dm_aspect);
+ glRasterPos2f(x, y * dmp->i->dm_aspect);
else
glRasterPos2f(x, y);
@@ -1989,7 +1993,7 @@
HIDDEN int
ogl_drawPoint2D(struct dm *dmp, fastf_t x, fastf_t y)
{
- if (dmp->dm_debugLevel) {
+ if (dmp->i->dm_debugLevel) {
bu_log("ogl_drawPoint2D():\n");
bu_log("\tdmp: %p\tx - %lf\ty - %lf\n", (void *)dmp, x, y);
}
@@ -2013,7 +2017,7 @@
if (!dmp || !point)
return BRLCAD_ERROR;
- if (dmp->dm_debugLevel) {
+ if (dmp->i->dm_debugLevel) {
bu_log("ogl_drawPoint3D():\n");
bu_log("\tdmp: %p\tpt - %lf %lf %lf\n", (void*)dmp, V3ARGS(point));
}
@@ -2041,7 +2045,7 @@
if (!dmp || npoints < 0 || !points)
return BRLCAD_ERROR;
- if (dmp->dm_debugLevel) {
+ if (dmp->i->dm_debugLevel) {
bu_log("ogl_drawPoint3D():\n");
}
@@ -2063,12 +2067,12 @@
HIDDEN int
ogl_setFGColor(struct dm *dmp, unsigned char r, unsigned char g, unsigned char
b, int strict, fastf_t transparency)
{
- /*if (dmp->dm_debugLevel)
+ /*if (dmp->i->dm_debugLevel)
bu_log("ogl_setFGColor()\n");*/
- dmp->dm_fg[0] = r;
- dmp->dm_fg[1] = g;
- dmp->dm_fg[2] = b;
+ dmp->i->dm_fg[0] = r;
+ dmp->i->dm_fg[1] = g;
+ dmp->i->dm_fg[2] = b;
/* wireColor gets the full rgb */
wireColor[0] = r / 255.0;
@@ -2080,7 +2084,7 @@
glColor3ub((GLubyte)r, (GLubyte)g, (GLubyte)b);
} else {
- if (dmp->dm_light) {
+ if (dmp->i->dm_light) {
/* Ambient = .2, Diffuse = .6, Specular = .2 */
ambientColor[0] = wireColor[0] * 0.2;
@@ -2123,11 +2127,11 @@
HIDDEN int
ogl_setLineAttr(struct dm *dmp, int width, int style)
{
- /*if (dmp->dm_debugLevel)
+ /*if (dmp->i->dm_debugLevel)
bu_log("ogl_setLineAttr()\n");*/
- dmp->dm_lineWidth = width;
- dmp->dm_lineStyle = style;
+ dmp->i->dm_lineWidth = width;
+ dmp->i->dm_lineStyle = style;
glLineWidth((GLfloat) width);
@@ -2143,7 +2147,7 @@
HIDDEN int
ogl_debug(struct dm *dmp, int lvl)
{
- dmp->dm_debugLevel = lvl;
+ dmp->i->dm_debugLevel = lvl;
return BRLCAD_OK;
}
@@ -2151,7 +2155,7 @@
HIDDEN int
ogl_logfile(struct dm *dmp, const char *filename)
{
- bu_vls_sprintf(&dmp->dm_log, "%s", filename);
+ bu_vls_sprintf(&dmp->i->dm_log, "%s", filename);
return BRLCAD_OK;
}
@@ -2161,21 +2165,21 @@
{
GLint mm;
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("ogl_setWinBounds()\n");
- dmp->dm_clipmin[0] = w[0];
- dmp->dm_clipmin[1] = w[2];
- dmp->dm_clipmin[2] = w[4];
- dmp->dm_clipmax[0] = w[1];
- dmp->dm_clipmax[1] = w[3];
- dmp->dm_clipmax[2] = w[5];
+ dmp->i->dm_clipmin[0] = w[0];
+ dmp->i->dm_clipmin[1] = w[2];
+ dmp->i->dm_clipmin[2] = w[4];
+ dmp->i->dm_clipmax[0] = w[1];
+ dmp->i->dm_clipmax[1] = w[3];
+ dmp->i->dm_clipmax[2] = w[5];
glGetIntegerv(GL_MATRIX_MODE, &mm);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glLoadIdentity();
- glOrtho(-xlim_view, xlim_view, -ylim_view, ylim_view, dmp->dm_clipmin[2],
dmp->dm_clipmax[2]);
+ glOrtho(-xlim_view, xlim_view, -ylim_view, ylim_view,
dmp->i->dm_clipmin[2], dmp->i->dm_clipmax[2]);
glPushMatrix();
glMatrixMode(mm);
@@ -2187,12 +2191,12 @@
ogl_setTransparency(struct dm *dmp,
int transparency_on)
{
- struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->m_vars;
- if (dmp->dm_debugLevel)
+ struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->i->m_vars;
+ if (dmp->i->dm_debugLevel)
bu_log("ogl_setTransparency()\n");
- dmp->dm_transparency = transparency_on;
- mvars->transparency_on = dmp->dm_transparency;
+ dmp->i->dm_transparency = transparency_on;
+ mvars->transparency_on = dmp->i->dm_transparency;
if (transparency_on) {
/* Turn it on */
@@ -2210,10 +2214,10 @@
HIDDEN int
ogl_setDepthMask(struct dm *dmp,
int enable) {
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("ogl_setDepthMask()\n");
- dmp->dm_depthMask = enable;
+ dmp->i->dm_depthMask = enable;
if (enable)
glDepthMask(GL_TRUE);
@@ -2227,16 +2231,16 @@
HIDDEN int
ogl_setZBuffer(struct dm *dmp, int zbuffer_on)
{
- struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->m_vars;
- if (dmp->dm_debugLevel)
+ struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->i->m_vars;
+ if (dmp->i->dm_debugLevel)
bu_log("ogl_setZBuffer:\n");
- dmp->dm_zbuffer = zbuffer_on;
- mvars->zbuffer_on = dmp->dm_zbuffer;
+ dmp->i->dm_zbuffer = zbuffer_on;
+ mvars->zbuffer_on = dmp->i->dm_zbuffer;
if (mvars->zbuf == 0) {
- dmp->dm_zbuffer = 0;
- mvars->zbuffer_on = dmp->dm_zbuffer;
+ dmp->i->dm_zbuffer = 0;
+ mvars->zbuffer_on = dmp->i->dm_zbuffer;
}
if (mvars->zbuffer_on) {
@@ -2253,7 +2257,7 @@
HIDDEN int
ogl_beginDList(struct dm *dmp, unsigned int list)
{
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("ogl_beginDList()\n");
glNewList((GLuint)list, GL_COMPILE);
@@ -2264,7 +2268,7 @@
HIDDEN int
ogl_endDList(struct dm *dmp)
{
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("ogl_endDList()\n");
glEndList();
@@ -2283,7 +2287,7 @@
HIDDEN int
ogl_freeDLists(struct dm *dmp, unsigned int list, int range)
{
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("ogl_freeDLists()\n");
glDeleteLists((GLuint)list, (GLsizei)range);
@@ -2294,7 +2298,7 @@
HIDDEN int
ogl_genDLists(struct dm *dmp, size_t range)
{
- if (dmp->dm_debugLevel)
+ if (dmp->i->dm_debugLevel)
bu_log("ogl_freeDLists()\n");
return glGenLists((GLsizei)range);
@@ -2326,13 +2330,13 @@
HIDDEN int
ogl_getDisplayImage(struct dm *dmp, unsigned char **image)
{
- if (dmp->dm_type == DM_TYPE_WGL || dmp->dm_type == DM_TYPE_OGL) {
+ if (dmp->i->dm_type == DM_TYPE_WGL || dmp->i->dm_type == DM_TYPE_OGL) {
unsigned char *idata;
int width;
int height;
- width = dmp->dm_width;
- height = dmp->dm_height;
+ width = dmp->i->dm_width;
+ height = dmp->i->dm_height;
idata = (unsigned char*)bu_calloc(height * width * 3, sizeof(unsigned
char), "rgb data");
@@ -2354,9 +2358,9 @@
{
struct fb_platform_specific *fb_ps;
struct ogl_fb_info *ofb_ps;
- struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->m_vars;
- struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
- struct ogl_vars *privars = (struct ogl_vars *)dmp->dm_vars.priv_vars;
+ struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars
*)dmp->i->m_vars;
+ struct dm_xvars *pubvars = (struct dm_xvars *)dmp->i->dm_vars.pub_vars;
+ struct ogl_vars *privars = (struct ogl_vars *)dmp->i->dm_vars.priv_vars;
fb_ps = fb_get_platform_specific(FB_OGL_MAGIC);
ofb_ps = (struct ogl_fb_info *)fb_ps->data;
@@ -2367,7 +2371,7 @@
ofb_ps->glxc = privars->glxc;
ofb_ps->double_buffer = mvars->doublebuffer;
ofb_ps->soft_cmap = 0;
- dmp->fbp = fb_open_existing("ogl", dm_get_width(dmp), dm_get_height(dmp),
fb_ps);
+ dmp->i->fbp = fb_open_existing("ogl", dm_get_width(dmp),
dm_get_height(dmp), fb_ps);
fb_put_platform_specific(fb_ps);
return 0;
}
@@ -2376,9 +2380,9 @@
ogl_get_internal(struct dm *dmp)
{
struct modifiable_ogl_vars *mvars = NULL;
- if (!dmp->m_vars) {
- BU_GET(dmp->m_vars, struct modifiable_ogl_vars);
- mvars = (struct modifiable_ogl_vars *)dmp->m_vars;
+ if (!dmp->i->m_vars) {
+ BU_GET(dmp->i->m_vars, struct modifiable_ogl_vars);
+ mvars = (struct modifiable_ogl_vars *)dmp->i->m_vars;
mvars->this_dm = dmp;
bu_vls_init(&(mvars->log));
}
@@ -2389,10 +2393,10 @@
ogl_put_internal(struct dm *dmp)
{
struct modifiable_ogl_vars *mvars = NULL;
- if (dmp->m_vars) {
- mvars = (struct modifiable_ogl_vars *)dmp->m_vars;
+ if (dmp->i->m_vars) {
+ mvars = (struct modifiable_ogl_vars *)dmp->i->m_vars;
bu_vls_free(&(mvars->log));
- BU_PUT(dmp->m_vars, struct modifiable_ogl_vars);
+ BU_PUT(dmp->i->m_vars, struct modifiable_ogl_vars);
}
return 0;
}
@@ -2425,9 +2429,9 @@
struct dm *dmp = mvars->this_dm;
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits