riley@mipsdal.mips.com (Riley Rainey) (10/08/90)
Submitted-by: riley@mipsdal.mips.com (Riley Rainey) Posting-number: Volume 9, Issue 69 Archive-name: acm/part01 acm is a multi-user aerial combat simulation written for X. The sources are in shar format broken into 5 parts. acm requires an 8-plane color display and a reasonably fast (> 10 SPECmark) workstation to perform reasonably well. To unpack these shar format files, first save each article as acm.shar.N, where N is the part number, delete the headers and trailers from each file, and then type: $ cat acm.shar.* | sh acm is divided into two directories, V and fsim. V contains the 3-D routines and fsim is everything else. V must be "made" first. -------> CUT HERE <--------- mkdir V mkdir V/test mkdir V/lib mkdir fsim echo x - ./V sed 's/^X//' >./V <<'*-*-END-of-./V-*-*' *-*-END-of-./V-*-* echo x - ./V/lib sed 's/^X//' >./V/lib <<'*-*-END-of-./V/lib-*-*' *-*-END-of-./V/lib-*-* echo x - ./V/lib/Makefile sed 's/^X//' >./V/lib/Makefile <<'*-*-END-of-./V/lib/Makefile-*-*' X# Makefile generated by imake - do not edit! X# $XConsortium: imake.c,v 1.37 88/10/08 20:08:30 jim Exp $ X X########################################################################### X# X Window System Makefile generated from template file Imake.tmpl X# $XConsortium: Imake.tmpl,v 1.91 88/10/23 22:37:10 jim Exp $ X# X# Do not change the body of the imake template file. Server-specific X# parameters may be set in the appropriate .macros file; site-specific X# parameters (but shared by all servers) may be set in site.def. If you X# make any changes, you'll need to rebuild the makefiles using X# "make World" (at best) or "make Makefile; make Makefiles" (at least) in X# the top level directory. X# X# If your C preprocessor doesn't define any unique symbols, you'll need X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing X# "make Makefile", "make Makefiles", or "make World"). X# X# If you absolutely can't get imake to work, you'll need to set the X# variables at the top of each Makefile as well as the dependencies at the X# bottom (makedepend will do this automatically). X# X X########################################################################### X# platform-specific configuration parameters - edit Mips.macros to change X X# platform: $XConsortium: Mips.macros,v 1.27 88/10/23 11:00:43 jim Exp $ X X AS = as X CC = cc X CPP = /lib/cpp X LD = ld X LINT = lint X INSTALL = /etc/mipsinstall X TAGS = ctags X RM = rm -f X MV = mv X LN = ln -s X RANLIB = ranlib XRANLIBINSTFLAGS = X AR = ar clq X LS = ls X LINTOPTS = -axz X LINTLIBFLAG = -C X MAKE = make XSTD_CPP_DEFINES = -DSYSV X STD_DEFINES = -I$(XLIBSRC)/mips -I/usr/include/bsd -DSYSV X XSYSAUX_LIBRARIES = -lbsd -lmld X X INSTFILEFLAGS = -f X X########################################################################### X# site-specific configuration parameters - edit site.def to change X X# site: $XConsortium: site.def,v 1.16 88/10/12 10:30:24 jim Exp $ X X########################################################################### X# definitions common to all Makefiles - do not edit X X SHELL = /bin/sh X X MFLAGS = -$(MAKEFLAGS) X X DESTDIR = X USRLIBDIR = $(DESTDIR)/usr/lib X BINDIR = $(DESTDIR)/usr/bin/X11 X INCDIR = $(DESTDIR)/usr/include/X11 X ADMDIR = $(DESTDIR)/usr/adm X LIBDIR = $(USRLIBDIR)/X11 X LINTLIBDIR = $(USRLIBDIR)/lint X FONTDIR = $(LIBDIR)/fonts X XINITDIR = $(LIBDIR)/xinit X XDMDIR = $(LIBDIR)/xdm X UWMDIR = $(LIBDIR)/uwm X AWMDIR = $(LIBDIR)/awm X TWMDIR = $(LIBDIR)/twm X MANPATH = $(DESTDIR)/usr/man X MANSOURCEPATH = $(MANPATH)/man X MANDIR = $(MANSOURCEPATH)1 X LIBMANDIR = $(MANSOURCEPATH)3 X XAPPLOADDIR = $(LIBDIR)/app-defaults X X INSTBINFLAGS = -m 0755 X INSTUIDFLAGS = -m 4755 X INSTLIBFLAGS = -m 0664 X INSTINCFLAGS = -m 0444 X INSTMANFLAGS = -m 0444 X INSTAPPFLAGS = -m 0444 X INSTKMEMFLAGS = -m 4755 X FCFLAGS = -t X CDEBUGFLAGS = X X PATHSEP = / X DEPEND = $(DEPENDSRC)/makedepend X IMAKE = $(IMAKESRC)/imake X RGB = $(RGBSRC)/rgb X FC = $(BDFTOSNFSRC)/bdftosnf X MKFONTDIR = $(MKFONTDIRSRC)/mkfontdir X MKDIRHIER = $(SCRIPTSSRC)/mkdirhier.sh X X CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) X LINTFLAGS = $(LINTOPTS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) -DLINT X LDFLAGS = $(CDEBUGFLAGS) $(SYS_LIBRARIES) $(SYSAUX_LIBRARIES) X TOP = /people/riley/R3 X CLIENTSRC = $(TOP)/clients X DEMOSRC = $(TOP)/demos X LIBSRC = $(TOP)/lib X FONTSRC = $(TOP)/fonts X INCLUDESRC = $(TOP)/X11 X SERVERSRC = $(TOP)/server X UTILSRC = $(TOP)/util X SCRIPTSSRC = $(UTILSRC)/scripts X EXAMPLESRC = $(TOP)/examples X CONTRIBSRC = $(TOP)/contrib X DOCSRC = $(TOP)/doc X RGBSRC = $(TOP)/rgb X DEPENDSRC = $(UTILSRC)/makedepend X IMAKESRC = $(UTILSRC)/imake X IRULESRC = $(UTILSRC)/imake.includes X XLIBSRC = $(LIBSRC)/X X XMUSRC = $(LIBSRC)/Xmu X TOOLKITSRC = $(LIBSRC)/Xt X AWIDGETSRC = $(LIBSRC)/Xaw X OLDXLIBSRC = $(LIBSRC)/oldX X BDFTOSNFSRC = $(FONTSRC)/bdftosnf X MKFONTDIRSRC = $(FONTSRC)/mkfontdir X EXTENSIONSRC = $(TOP)/extensions X EXTENSIONLIB = $(EXTENSIONSRC)/lib/libXext.a X XLIB = $(XLIBSRC)/libX11.a X XMULIB = $(XMUSRC)/libXmu.a X OLDXLIB = $(OLDXLIBSRC)/liboldX.a X XTOOLLIB = $(TOOLKITSRC)/libXt.a X XAWLIB = $(AWIDGETSRC)/libXaw.a X LINTXLIB = $(XLIBSRC)/llib-lX11.ln X LINTXMU = $(XMUSRC)/llib-lXmu.ln X LINTXTOOL = $(TOOLKITSRC)/llib-lXt.ln X LINTXAW = $(AWIDGETSRC)/llib-lXaw.ln X INCLUDES = -I$(TOP) X MACROFILE = Mips.macros X ICONFIGFILES = $(IRULESRC)/Imake.tmpl \ X $(IRULESRC)/$(MACROFILE) $(IRULESRC)/site.def X IMAKE_DEFINES = X IMAKE_CMD = $(NEWTOP)$(IMAKE) -TImake.tmpl -I$(NEWTOP)$(IRULESRC) \ X -s Makefile $(IMAKE_DEFINES) X RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \ X .emacs_* tags TAGS make.log MakeOut X X########################################################################### X# rules: $XConsortium: Imake.rules,v 1.71 88/10/23 22:46:34 jim Exp $ X X########################################################################### X# start of Imakefile X XCDEBUGFLAGS = -O2 XLIBOBJS = \ X VOpenViewport.o \ X VResizeViewport.o \ X VCloseViewport.o \ X VGetEyeSpace.o \ X VGetPlanes.o \ X VReadObject.o \ X VWriteObject.o \ X VAllocColor.o \ X VBindColors.o \ X VExposeBuffer.o \ X VCreatePolygon.o \ X VCreatePoints.o \ X VCopyPolygon.o \ X VDrawPolygon.o \ X VFillPolygon.o \ X VDrawString.o \ X VClipPolygon.o \ X VDotProd.o \ X VRotate.o \ X VTransformPolygon.o \ X VTransform.o \ X VIdentMatrix.o \ X VMatrixMult.o \ X VMatrixDeterminant.o \ X VMatrixInvert.o \ X VPrintPolygon.o \ X Vmalloc.o X Xall:: libV.a X XlibV.a: $(LIBOBJS) X $(RM) $@ X $(AR) $@ $(LIBOBJS) X $(RANLIB) $@ X Xinstall:: libV.a X $(INSTALL) -c $(INSTLIBFLAGS) libV.a $(USRLIBDIR) X $(RANLIB) $(RANLIBINSTFLAGS) $(USRLIBDIR)/libV.a X X# DO NOT DELETE THIS LINE -- make depend depends on it. X X########################################################################### X# Imake.tmpl common rules for all Makefiles - do not edit X Xemptyrule:: X Xclean:: X $(RM_CMD) \#* X XMakefile:: $(IMAKE) X XMakefile:: Imakefile \ X $(IRULESRC)/Imake.tmpl \ X $(IRULESRC)/Imake.rules \ X $(IRULESRC)/site.def \ X $(IRULESRC)/$(MACROFILE) X -@if [ -f Makefile ]; then \ X echo "$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \ X $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ X else exit 0; fi X $(IMAKE_CMD) -DTOPDIR=$(TOP) X X$(IMAKE): X @echo "making $@"; \ X cd $(IMAKESRC); $(MAKE) BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS) X Xtags:: X $(TAGS) -w *.[ch] X $(TAGS) -xw *.[ch] > TAGS X X########################################################################### X# empty rules for directories that do not have SUBDIRS - do not edit X Xinstall:: X @echo "install done" X Xinstall.man:: X @echo "install.man done" X XMakefiles:: X X########################################################################### X# dependencies generated by makedepend X *-*-END-of-./V/lib/Makefile-*-* echo x - ./V/lib/VPrintPolygon.c sed 's/^X//' >./V/lib/VPrintPolygon.c <<'*-*-END-of-./V/lib/VPrintPolygon.c-*-*' X#include "Vlib.h" X Xvoid VPrintPolygon (file, p) XFILE *file; XVPolygon *p; { X X int i; X char *nullPoly = "*** Null Polygon ***\n"; X X if (p == (VPolygon *) NULL) X fprintf (file, nullPoly); X else { X if (p->numVtces == 0) { X fprintf (file, nullPoly); X return; X } X X fprintf (file, "%d vertices:\n", p->numVtces); X X for (i=0; i<p->numVtces; ++i) X fprintf(file, "%9.6g %9.6g %9.6g\n", p->vertex[i].x, X p->vertex[i].y, p->vertex[i].z); X } X X return; X} *-*-END-of-./V/lib/VPrintPolygon.c-*-* echo x - ./V/lib/Vlib.h sed 's/^X//' >./V/lib/Vlib.h <<'*-*-END-of-./V/lib/Vlib.h-*-*' X#ifndef __Vlib X#define __Vlib X X#define VmaxVP 32 /* max # of vertices in a polygon */ X X#define MAXCOLORS 8 /* max number of colors available */ X /* when double buffering */ X#if (MAXCOLORS==4) X#define PLANES 2 X#endif X#if (MAXCOLORS==8) X#define PLANES 3 X#endif X#if (MAXCOLORS==16) X#define PLANES 4 X#endif X X#include <X11/Xlib.h> X#include <stdio.h> X#include <memory.h> X Xtypedef struct _vcolor { X char *color_name; /* text name */ X short index; /* index into pixel value table */ X XColor xcolor; /* representation of this color */ X struct _vcolor *next; X } VColor; X Xtypedef struct { X double x, y, z; /* A point or vector in 3-space */ X } VPoint; X Xtypedef struct { X short numVtces; /* vertex count */ X VPoint *vertex; /* pointer to array of vertices */ X VColor *color; /* pointer to color descriptor */ X } VPolygon; X Xtypedef struct { X char *name; /* object name */ X int numPolys; /* polygon count */ X VPolygon **polygon; /* pointer to array of polygon pointers */ X } VObject; X Xtypedef struct { X double m[4][4]; X } VMatrix; X Xtypedef struct { X unsigned long flags; /* viewport flags */ X VMatrix eyeSpace; /* transforms from world to eyeSpace system */ X VPolygon *clipPoly; /* planes to clip viewed polygons */ X double units; /* world units expressed in meters */ X double dist; /* distance in units from eye to screen */ X double xres; /* x screen resolution in dots per unit */ X double yres; /* y screen resolution in dots per unit */ X int width; /* width of window in dots */ X int height; /* height of window in dots */ X VPoint Middl; /* center of window */ X VPoint Scale; /* scaling factor */ X Display *dpy; /* Display associated with this viewport */ X int screen; /* X screen number */ X Window *win; X Pixmap monoPixmap; /* Pixmap used to buffer monochrome drawing */ X X int colors; /* color count */ X int set; /* id of buffer currently in use */ X unsigned long mask; /* current plane mask */ X unsigned long aMask, bMask; X unsigned long *pixel; /* current pixel drawing values */ X unsigned long aPixel[MAXCOLORS]; X unsigned long bPixel[MAXCOLORS]; X XColor aColor[MAXCOLORS*MAXCOLORS]; X XColor bColor[MAXCOLORS*MAXCOLORS]; X Colormap cmap; X } Viewport; X X#define VGetPolygonPixel(p) (p->color->xcolor.pixel) X#define VLookupViewportColor(v,n) (v->pixel[n]) X#define VGetViewportMask(v) (v->mask) X X/* X * Globals X */ X XVColor *VColorList; /* list of colors needed for drawing */ X X/* X * V macros and function prototypes X */ X X#define VDestroyPoints(a) free((char *) a) X#define VDestroyPolygon(a) {free((char *) a->vertex); free((char *) a);} X XViewport *VOpenViewport(); /* (Display *, .. ) */ Xvoid VResizeViewport(); /* (Viewport *, ... ) */ Xvoid VCloseViewport(); /* (Viewport *) */ XVPolygon *VCreatePolygon(); /* (VPoint *, int, VColor *) */ XVPolygon *VCopyPolygon(); /* (VPolygon *) */ XVPolygon *VClipPolygon(); /* (VPolygon *, VPoint) */ XVPoint *VCreatePoints(); /* (int) */ XVColor *VAllocColor(); /* (char *) */ Xint VBindColors(); /* (Viewport *, char *) */ Xvoid VExposeBuffer(); /* (Viewport *, GC) */ XVObject *VReadObject(); /* (FILE *) */ Xint VWriteObject(); /* (FILE *, VObject *) */ XVMatrix *VRotate(); /* (VMatrix *, int) */ XVMatrix *VTranslate(); /* (VMatrix *, double, double, double) */ XVMatrix *VTranslatePoint(); /* (VMatrix *, VPoint) */ Xdouble VMatrixDeterminant(); /* (VMatrix *) */ XVMatrix *VMatrixInvert(); /* (VMatrix *, VMatrix *) */ Xvoid VTransform(); /* (VPoint *, VMatrix *, VPoint *) */ Xdouble VDotProd(); /* (Vpoint *, VPoint *) */ Xchar *Vmalloc(); /* (int) */ X X/* X * Viewport flags (must be changed manually after VOpenViewport for now) X */ X X#define VPClip 1 /* polygons should be clipped before drawing */ X#define VPPerspective 2 /* Z coordinate used for depth information */ X#define VPMono 4 /* Monochrome environment */ X X/* X * VRotate options X */ X X#define XRotation 1 /* rotate about X axis */ X#define YRotation 2 /* rotate about Y axis */ X#define ZRotation 3 /* rotate about Z axis */ X X#endif *-*-END-of-./V/lib/Vlib.h-*-* echo x - ./V/lib/VCreatePolygon.c sed 's/^X//' >./V/lib/VCreatePolygon.c <<'*-*-END-of-./V/lib/VCreatePolygon.c-*-*' X#include "Vlib.h" X XVPolygon *VCreatePolygon (numVtces, vert, color) Xint numVtces; XVPoint *vert; XVColor *color; { X X VPolygon *p; X X p = (VPolygon *) Vmalloc (sizeof (VPolygon)); X X p->numVtces = numVtces; X p->vertex = (VPoint *) Vmalloc (sizeof (VPoint) * numVtces); X memcpy ((char *) p->vertex, (char *) vert, sizeof(VPoint) * numVtces); X p->color = color; X X return p; X} *-*-END-of-./V/lib/VCreatePolygon.c-*-* echo x - ./V/lib/VCreatePoints.c sed 's/^X//' >./V/lib/VCreatePoints.c <<'*-*-END-of-./V/lib/VCreatePoints.c-*-*' X#include "Vlib.h" X XVPoint *VCreatePoints (numPts) Xint numPts; { X X return (VPoint *) Vmalloc (sizeof(VPoint) * numPts); X} *-*-END-of-./V/lib/VCreatePoints.c-*-* echo x - ./V/lib/VCopyPolygon.c sed 's/^X//' >./V/lib/VCopyPolygon.c <<'*-*-END-of-./V/lib/VCopyPolygon.c-*-*' X#include "Vlib.h" X XVPolygon *VCopyPolygon (poly) XVPolygon *poly; { X X return VCreatePolygon (poly->numVtces, poly->vertex, poly->color); X} *-*-END-of-./V/lib/VCopyPolygon.c-*-* echo x - ./V/lib/VDotProd.c sed 's/^X//' >./V/lib/VDotProd.c <<'*-*-END-of-./V/lib/VDotProd.c-*-*' X#include "Vlib.h" X Xdouble VDotProd (a, b) XVPoint *a, *b; { X X return a->x * b->x + a->y * b->y + a->z * b->z; X} *-*-END-of-./V/lib/VDotProd.c-*-* echo x - ./V/lib/VClipPolygon.c sed 's/^X//' >./V/lib/VClipPolygon.c <<'*-*-END-of-./V/lib/VClipPolygon.c-*-*' X#include "Vlib.h" X XVPolygon * _VClipPolygon (poly, clipPlane) XVPolygon *poly; XVPoint *clipPlane; { X X register int j, lastj, numPts = 0, clipped = 0; X double d1, d2, a; X VPoint tmpPoint[64]; X VPolygon *p; X X if (poly->numVtces > 0) { X X lastj = poly->numVtces-1; X d1 = VDotProd(&(poly->vertex[poly->numVtces-1]), clipPlane); X numPts = 0; X X/* X * Examine each vertex and determine if it is inside or outside of the X * specified clipping plane. X */ X X for (j=0; j<poly->numVtces; ++j) { X X/* Leading vertex inside? */ X X if (d1 > 0.0) X tmpPoint[numPts++] = poly->vertex[lastj]; X X d2 = VDotProd(&(poly->vertex[j]), clipPlane); X X/* Does the edge straddle the window? If so, add a vertex on the window */ X X if (d1 * d2 < 0.0) { X clipped = 1; X a = d1 / (d1 - d2); X tmpPoint[numPts].x = a * poly->vertex[j].x + X (1.0 - a) * poly->vertex[lastj].x; X tmpPoint[numPts].y = a * poly->vertex[j].y + X (1.0 - a) * poly->vertex[lastj].y; X tmpPoint[numPts++].z = a * poly->vertex[j].z + X (1.0 - a) * poly->vertex[lastj].z; X } X X lastj = j; X d1 = d2; X } X } X X/* X * If the polygon was completely out of bounds, delete this polygon. X */ X X if (numPts == 0) { X p = (VPolygon *) NULL; X VDestroyPolygon (poly); X#ifdef DEBUG X fprintf (stderr, "VClipPolygon: polygon outside area of interest\n"); X#endif X } X X/* X * If we did any clipping, return the clipped polygon. X */ X X else if (clipped != 0) { X p = VCreatePolygon(numPts, &tmpPoint[0], poly->color); X#ifdef DEBUG X fprintf (stderr, "VClipPolygon: Polygon has been clipped:\n"); X fprintf (stderr, "Before Clipping:\n"); X VPrintPolygon (stderr, poly); X fprintf (stderr, "\nAfter Clipping:\n\n"); X VPrintPolygon (stderr, p); X#endif X VDestroyPolygon (poly); X } X else X p = poly; X X return p; X} X XVPolygon * VClipPolygon (poly, clipPoly) XVPolygon *poly, *clipPoly; { X X int i; X VPolygon *p = poly; X X/* X * Clip against each clipping plane supplied, one at a time. X */ X X for (i=0; i<clipPoly->numVtces; ++i) { X X if (p == (VPolygon *) NULL) X break; X X p = _VClipPolygon (p, &(clipPoly->vertex[i])); X X } X X return p; X} *-*-END-of-./V/lib/VClipPolygon.c-*-* echo x - ./V/lib/Imakefile sed 's/^X//' >./V/lib/Imakefile <<'*-*-END-of-./V/lib/Imakefile-*-*' XCDEBUGFLAGS = -O2 XLIBOBJS = \ X VOpenViewport.o \ X VResizeViewport.o \ X VCloseViewport.o \ X VGetEyeSpace.o \ X VGetPlanes.o \ X VReadObject.o \ X VWriteObject.o \ X VAllocColor.o \ X VBindColors.o \ X VExposeBuffer.o \ X VCreatePolygon.o \ X VCreatePoints.o \ X VCopyPolygon.o \ X VDrawPolygon.o \ X VFillPolygon.o \ X VDrawString.o \ X VClipPolygon.o \ X VDotProd.o \ X VRotate.o \ X VTransformPolygon.o \ X VTransform.o \ X VIdentMatrix.o \ X VMatrixMult.o \ X VMatrixDeterminant.o \ X VMatrixInvert.o \ X VPrintPolygon.o \ X Vmalloc.o X XNormalLibraryTarget(V,$(LIBOBJS)) XInstallLibrary(V,$(USRLIBDIR)) X X# DO NOT DELETE THIS LINE -- make depend depends on it. *-*-END-of-./V/lib/Imakefile-*-* echo x - ./V/lib/VGetEyeSpace.c sed 's/^X//' >./V/lib/VGetEyeSpace.c <<'*-*-END-of-./V/lib/VGetEyeSpace.c-*-*' X#include "Vlib.h" X#include <math.h> X Xvoid VGetEyeSpace (v, EyePt, CntrInt, up) XViewport *v; XVPoint EyePt, CntrInt, up; { X X VMatrix Mtx, es; X VPoint C1, C2; X double Hypotenuse, h1, CosA, SinA; X X/* X * Calculate the eye space transformation matrix X * X * First, orient the Z axis towards the center of interest. X */ X X VIdentMatrix (&(v->eyeSpace)); X v->eyeSpace.m[0][3] = -EyePt.x; X v->eyeSpace.m[1][3] = -EyePt.y; X v->eyeSpace.m[2][3] = -EyePt.z; X VTransform(&CntrInt, &(v->eyeSpace), &C1); X X VIdentMatrix (&Mtx); X Hypotenuse = sqrt(C1.x * C1.x + C1.y * C1.y); X if (Hypotenuse > 0.0) { X CosA = C1.y / Hypotenuse; X SinA = C1.x / Hypotenuse; X Mtx.m[0][0] = CosA; X Mtx.m[1][0] = SinA; X Mtx.m[0][1] = -SinA; X Mtx.m[1][1] = CosA; X es = v->eyeSpace; X VMatrixMult(&es, &Mtx, &(v->eyeSpace)); X } X X VTransform(&CntrInt, &(v->eyeSpace), &C2); X VIdentMatrix (&Mtx); X Hypotenuse = sqrt(C2.y * C2.y + C2.z * C2.z); X if (Hypotenuse > 0.0) { X CosA = C2.y / Hypotenuse; X SinA = -C2.z / Hypotenuse; X Mtx.m[1][1] = CosA; X Mtx.m[2][1] = SinA; X Mtx.m[1][2] = -SinA; X Mtx.m[2][2] = CosA; X es = v->eyeSpace; X VMatrixMult(&es, &Mtx, &(v->eyeSpace)); X } X X/* X * Orient the y axis towards "up". Swap y and z axes. X */ X X VTransform (&up, &(v->eyeSpace), &C2); X VIdentMatrix (&Mtx); X h1 = sqrt (C2.y * C2.y + C2.z * C2.z); X Hypotenuse = sqrt(C2.x * C2.x + h1 * h1); X if (Hypotenuse > 0.0) { X CosA = h1 / Hypotenuse; X SinA = C2.x / Hypotenuse; X if (C2.z < 0.0) { X CosA = -CosA; X } X Mtx.m[0][0] = CosA; X Mtx.m[2][0] = SinA; X Mtx.m[0][2] = -SinA; X Mtx.m[2][2] = CosA; X es = v->eyeSpace; X VMatrixMult(&es, &Mtx, &(v->eyeSpace)); X } X X VIdentMatrix (&Mtx); X Mtx.m[1][1] = 0.0; X Mtx.m[2][1] = 1.0; X Mtx.m[1][2] = 1.0; X Mtx.m[2][2] = 0.0; X es = v->eyeSpace; X VMatrixMult(&es, &Mtx, &(v->eyeSpace)); X X} *-*-END-of-./V/lib/VGetEyeSpace.c-*-* echo x - ./V/lib/VDrawPolygon.c sed 's/^X//' >./V/lib/VDrawPolygon.c <<'*-*-END-of-./V/lib/VDrawPolygon.c-*-*' X#include "Vlib.h" X Xvoid VDrawPolygon(v, win, gc, poly) XViewport *v; XWindow *win; XGC gc; XVPolygon *poly; { X X VPoint TmpPt, *p; X XPoint xpt[VmaxVP]; X int i; X Drawable d; X X d = (v->flags & VPMono) ? (Drawable) v->monoPixmap : (Drawable) win; X X if (poly == (VPolygon *) NULL) X return; X X for ((i=0, p=poly->vertex); i<poly->numVtces; (++i, ++p)) { X if (v->flags & VPPerspective) { X TmpPt.x = v->Middl.x + v->Scale.x * p->x / p->z; X TmpPt.y = v->Middl.y - v->Scale.y * p->y / p->z; X } X else { X TmpPt.x = v->Middl.x + v->Scale.x * p->x; X TmpPt.y = v->Middl.y - v->Scale.y * p->y; X } X xpt[i].x = TmpPt.x + 0.5; X xpt[i].y = TmpPt.y + 0.5; X } X X if (i > 0) { X xpt[i] = xpt[0]; X XDrawLines (v->dpy, d, gc, xpt, i+1, CoordModeOrigin); X } X X} *-*-END-of-./V/lib/VDrawPolygon.c-*-* echo x - ./V/lib/Vmalloc.c sed 's/^X//' >./V/lib/Vmalloc.c <<'*-*-END-of-./V/lib/Vmalloc.c-*-*' X#include "Vlib.h" X Xextern char * malloc(); X Xchar *Vmalloc(size) Xint size; { X X char *p; X X if ((p = malloc(size)) == (char *) NULL) { X fprintf (stderr, "V package memory allocation error.\n"); X fprintf (stderr, "An error was encountered allocating\ X %d bytes.\n", size); X exit (1); X } X return p; X} *-*-END-of-./V/lib/Vmalloc.c-*-* echo x - ./V/lib/VReadObject.c sed 's/^X//' >./V/lib/VReadObject.c <<'*-*-END-of-./V/lib/VReadObject.c-*-*' X#include "Vlib.h" X#include <string.h> X XVObject *VReadObject(f) XFILE *f; { X X short I, J, vertex, vertices, NumPts, NumPolys; X float x, y, z; X char str[64], name[128]; X VPoint *tmpPts, pts[VmaxVP]; X VPolygon **polygons; X VObject *object; X X fscanf(f, "%s\n", name); X fscanf(f, "%hd", &NumPts); X fscanf(f, "%hd", &NumPolys); X X tmpPts = (VPoint *) Vmalloc (NumPts * sizeof(VPoint)); X polygons = (VPolygon **) Vmalloc (NumPolys * sizeof(VPolygon *)); X X for (I=0; I<NumPts; ++I) { X fscanf(f, "%hd", &J); X fscanf(f, "%f", &x); X fscanf(f, "%f", &y); X fscanf(f, "%f", &z); X tmpPts[I].x = x; X tmpPts[I].y = y; X tmpPts[I].z = z; X } X X for (I=0; I<NumPolys; ++I) { X fscanf(f, "%s %hd", str, &(vertices)); X for (J=0; J<vertices; ++J) { X fscanf(f, "%hd", &(vertex)); X pts[J] = tmpPts[vertex - 1]; X } X polygons[I] = VCreatePolygon (vertices, pts, VAllocColor(str)); X } X X object = (VObject *) Vmalloc (sizeof(VObject)); X object->name = strdup (name); X object->numPolys = NumPolys; X object->polygon = polygons; X X free ((char *) tmpPts); X return ferror(f) ? (VObject *) 0 : object; X} *-*-END-of-./V/lib/VReadObject.c-*-* echo x - ./V/lib/VMatrixMult.c sed 's/^X//' >./V/lib/VMatrixMult.c <<'*-*-END-of-./V/lib/VMatrixMult.c-*-*' X#include "Vlib.h" X Xvoid VMatrixMult (Mt1, Mt2, R) XVMatrix *Mt1, *Mt2, *R; { X short I, J, K; X X for (I=0; I<4; ++I) X for (J=0; J<4; ++J) { X R->m[I][J] = 0.0; X for (K=0; K<4; ++K) X R->m[I][J] = R->m[I][J] + Mt1->m[K][J] * Mt2->m[I][K]; X } X} *-*-END-of-./V/lib/VMatrixMult.c-*-* echo x - ./V/lib/VTransform.c sed 's/^X//' >./V/lib/VTransform.c <<'*-*-END-of-./V/lib/VTransform.c-*-*' X#include "Vlib.h" X X/* X * VTransform: transform a point from one coordinate system to another. X */ X Xvoid VTransform (pt, mt, newPt) XVPoint *pt; XVMatrix *mt; XVPoint *newPt; { X X newPt->x = pt->x * mt->m[0][0] + pt->y * mt->m[0][1] X + pt->z * mt->m[0][2] + mt->m[0][3]; X X newPt->y = pt->x * mt->m[1][0] + pt->y * mt->m[1][1] X + pt->z * mt->m[1][2] + mt->m[1][3]; X X newPt->z = pt->x * mt->m[2][0] + pt->y * mt->m[2][1] X + pt->z * mt->m[2][2] + mt->m[2][3]; X} *-*-END-of-./V/lib/VTransform.c-*-* echo x - ./V/lib/VIdentMatrix.c sed 's/^X//' >./V/lib/VIdentMatrix.c <<'*-*-END-of-./V/lib/VIdentMatrix.c-*-*' X#include "Vlib.h" X Xvoid VIdentMatrix (Mtx) XVMatrix *Mtx; X{ X short I, J; X X for (I=0; I<4; ++I) X for (J=0; J<4; ++J) X if (I == J) X (*Mtx).m[I][J] = 1.0; X else X (*Mtx).m[I][J] = 0.0; X X} *-*-END-of-./V/lib/VIdentMatrix.c-*-* echo x - ./V/lib/VDisplayObjects.c sed 's/^X//' >./V/lib/VDisplayObjects.c <<'*-*-END-of-./V/lib/VDisplayObjects.c-*-*' X#include "Vlib.h" X Xvoid VDisplayObjects() { X X Point3 TmpPt; X int I, J; X XPoint xpt[MaxPts]; X X for (I=0; I<NumPolys; ++I) { X X for (J=0; J<Polygons[I].PolyVtces; ++J) { X Transform(&Points[Vertices[Polygons[I].Start + J]], &EyeSpace, &TmpPt); X MakeDisplayable(&TmpPt); X xpt[J].x = (int) TmpPt.X; X xpt[J].y = (int) TmpPt.Y; X } X/* xpt[J] = xpt[0]; X XDrawLines (dpy, win, gc, &xpt, J+1, CoordModeOrigin); */ X XFillPolygon (dpy, win, curGC, &xpt, J, Nonconvex, CoordModeOrigin); X } X X} *-*-END-of-./V/lib/VDisplayObjects.c-*-* echo x - ./V/lib/VRotate.c sed 's/^X//' >./V/lib/VRotate.c <<'*-*-END-of-./V/lib/VRotate.c-*-*' X#include "Vlib.h" X#include <math.h> X XVMatrix *VRotate (Mt1, operation, angle) XVMatrix * Mt1; Xint operation; Xdouble angle; { X X VMatrix m, s; X X VIdentMatrix (&m); X X switch (operation) { X case XRotation: X m.m[1][1] = m.m[2][2] = cos(angle); X m.m[2][1] = sin(angle); X m.m[1][2] = - m.m[2][1]; X break; X case YRotation: X m.m[0][0] = m.m[2][2] = cos(angle); X m.m[2][0] = sin(angle); X m.m[0][2] = - m.m[2][0]; X break; X case ZRotation: X m.m[0][0] = m.m[1][1] = cos(angle); X m.m[1][0] = sin(angle); X m.m[0][1] = - m.m[1][0]; X break; X } X X s = *Mt1; X X VMatrixMult (&s, &m, Mt1); X return Mt1; X} X XVMatrix *VTranslatePoint (Mt, loc) XVMatrix *Mt; XVPoint loc; { X X Mt->m[0][3] = Mt->m[0][3] + loc.x; X Mt->m[1][3] = Mt->m[1][3] + loc.y; X Mt->m[2][3] = Mt->m[2][3] + loc.z; X return Mt; X X} X XVMatrix *VTranslate (Mt, x, y ,z) XVMatrix *Mt; Xdouble x, y, z; { X X Mt->m[0][3] = Mt->m[0][3] + x; X Mt->m[1][3] = Mt->m[1][3] + y; X Mt->m[2][3] = Mt->m[2][3] + z; X return Mt; X} *-*-END-of-./V/lib/VRotate.c-*-* echo x - ./V/lib/VGetPlanes.c sed 's/^X//' >./V/lib/VGetPlanes.c <<'*-*-END-of-./V/lib/VGetPlanes.c-*-*' X#include "Vlib.h" X XVPolygon *VGetPlanes (poly) XVPolygon *poly; { X X VPoint tmp[64], *p; X int i, lasti; X X lasti = poly->numVtces - 1; X p = poly->vertex; X X for (i=0; i<poly->numVtces; ++i) { X tmp[i].x = p->y * poly->vertex[lasti].z - p->z * X poly->vertex[lasti].y; X tmp[i].y = p->z * poly->vertex[lasti].x - p->x * X poly->vertex[lasti].z; X tmp[i].z = p->x * poly->vertex[lasti].y - p->y * X poly->vertex[lasti].x; X lasti = i; X p++; X } X X for (i=0; i<poly->numVtces; ++i) X poly->vertex[i] = tmp[i]; X X return poly; X} *-*-END-of-./V/lib/VGetPlanes.c-*-* echo x - ./V/lib/VOpenViewport.c sed 's/^X//' >./V/lib/VOpenViewport.c <<'*-*-END-of-./V/lib/VOpenViewport.c-*-*' X#include "Vlib.h" X XViewport *VOpenViewport (dpy, screen, win, unit, dist, scale, width, height) XDisplay *dpy; Xint screen; XWindow *win; Xdouble unit; Xdouble dist; Xdouble scale; Xint width; Xint height; { X X Viewport *v; X VPoint clip[4]; X X/* X * Allocate space for the Viewport structure X */ X X v = (Viewport *) Vmalloc (sizeof(Viewport)); X X/* X * Calculate screen resolution in pixels per unit. X */ X X v->dist = dist; X v->units = unit; X X v->xres = ((((double) DisplayWidth(dpy,screen)) * unit * 1000.0) / X ((double) DisplayWidthMM(dpy,screen))); X v->yres = ((((double) DisplayHeight(dpy,screen)) * unit * 1000.0) / X ((double) DisplayHeightMM(dpy,screen))); X/* X * Use that info to set scaling factors. X */ X X v->Scale.x = v->xres * dist * scale; X v->Scale.y = v->yres * dist * scale; X v->Scale.z = 1.0; X X v->Middl.x = (double) width / 2.0; X v->Middl.y = (double) height / 2.0; X v->Middl.z = 0.0; X X/* X * Build the clipping planes for our view into the eye space. X */ X X clip[0].x = - width / v->xres / 2.0 / scale; X clip[0].y = - height / v->yres / 2.0 / scale; X clip[0].z = dist; X clip[1].x = - width / v->xres / 2.0 / scale; X clip[1].y = height / v->yres / 2.0 / scale; X clip[1].z = dist; X clip[2].x = width / v->xres / 2.0 / scale; X clip[2].y = height / v->yres / 2.0 / scale; X clip[2].z = dist; X clip[3].x = width / v->xres / 2.0 / scale; X clip[3].y = - height / v->yres / 2.0 / scale; X clip[3].z = dist; X X v->clipPoly = VCreatePolygon (4, clip); X VGetPlanes (v->clipPoly); X X/* X * Fill out the rest of the structure. X */ X X v->flags = VPPerspective | VPClip; X v->dpy = dpy; X v->screen = screen; X v->win = win; X VIdentMatrix (&v->eyeSpace); X v->set = 0; X X/* X * Is this a monochrome situation? X */ X X if (DisplayPlanes (dpy, screen) < 2) { X v->monoPixmap = XCreatePixmap (dpy, RootWindow(dpy, screen), width, height, 1); X v->flags |= VPMono; X } X X return v; X} *-*-END-of-./V/lib/VOpenViewport.c-*-* echo x - ./V/lib/VDrawString.c sed 's/^X//' >./V/lib/VDrawString.c <<'*-*-END-of-./V/lib/VDrawString.c-*-*' X#include "Vlib.h" X Xvoid VDrawString(v, win, gc, p, str, len) XViewport *v; XWindow *win; XGC gc; XVPoint *p; Xchar *str; Xint len; { X X VPoint TmpPt; X register int x, y; X X if (v->flags & VPPerspective) { X TmpPt.x = v->Middl.x + v->Scale.x * p->x / p->z; X TmpPt.y = v->Middl.y - v->Scale.y * p->y / p->z; X } X else { X TmpPt.x = v->Middl.x + v->Scale.x * p->x; X TmpPt.y = v->Middl.y - v->Scale.y * p->y; X } X X x = TmpPt.x + 0.5; X y = TmpPt.y + 0.5; X X XDrawString (v->dpy, win, gc, x, y, str, len); X X} *-*-END-of-./V/lib/VDrawString.c-*-* echo x - ./V/lib/VTransformPolygon.c sed 's/^X//' >./V/lib/VTransformPolygon.c <<'*-*-END-of-./V/lib/VTransformPolygon.c-*-*' X#include "Vlib.h" X XVPolygon *VTransformPolygon (poly, m) XVPolygon *poly; XVMatrix *m; { X X int i; X VPoint tmp; X X for (i=0; i<poly->numVtces; ++i) { X VTransform (&(poly->vertex[i]), m, &tmp); X poly->vertex[i] = tmp; X } X X return poly; X} *-*-END-of-./V/lib/VTransformPolygon.c-*-* echo x - ./V/lib/VCloseViewport.c sed 's/^X//' >./V/lib/VCloseViewport.c <<'*-*-END-of-./V/lib/VCloseViewport.c-*-*' X#include "Vlib.h" X Xvoid VCloseViewport (v) XViewport *v; { X X VDestroyPolygon (v->clipPoly); X free ((char *) v); X} *-*-END-of-./V/lib/VCloseViewport.c-*-* echo x - ./V/lib/VWriteObject.c sed 's/^X//' >./V/lib/VWriteObject.c <<'*-*-END-of-./V/lib/VWriteObject.c-*-*' X#include "Vlib.h" X#include <string.h> X Xint VWriteObject(f, obj) XFILE *f; XVObject *obj; { X X int i, j, k, points; X VPolygon **q; X VPoint *p; X X/* X * Total the number of vertices in all of the object's polygons X */ X X points = 0; X q = obj->polygon; X for (i=0; i<obj->numPolys; ++i) { X points += q[i]->numVtces; X } X X/* X * Print the header X */ X X fprintf (f, "%s\n%d %d\n", obj->name, points, obj->numPolys); X X/* X * Print the point list X */ X X k = 1; X q = obj->polygon; X for (i=0; i<obj->numPolys; ++i) { X for ((j=0, p=q[i]->vertex); j<q[i]->numVtces; (++p, ++j)) { X fprintf(f, "%d %g %g %g\n", k, p->x, p->y, p->z); X ++k; X } X } X X/* X * Print the polygon list X */ X X k = 1; X q = obj->polygon; X for (i=0; i<obj->numPolys; ++i) { X fprintf(f, "%s %d", q[i]->color->color_name, q[i]->numVtces); X for (j=0; j<q[i]->numVtces; ++j) X fprintf(f, " %d", k++); X fprintf (f, "\n"); X } X X return ferror(f) ? -1 : 0; X} *-*-END-of-./V/lib/VWriteObject.c-*-* echo x - ./V/lib/VFillPolygon.c sed 's/^X//' >./V/lib/VFillPolygon.c <<'*-*-END-of-./V/lib/VFillPolygon.c-*-*' X#include "Vlib.h" X X#define COLLAPSEUNUSEDPOINTS X Xvoid VFillPolygon(v, win, gc, poly) XViewport *v; XWindow *win; XGC gc; XVPolygon *poly; { X X VPoint TmpPt, *p; X XPoint xpt[VmaxVP], *lastpt; X int i, k; X Drawable d; X X d = (v->flags & VPMono) ? (Drawable) v->monoPixmap : (Drawable) win; X X if (poly == (VPolygon *) NULL) X return; X X k = 0; X lastpt = &xpt[0]; X for ((i=0, p=poly->vertex); i<poly->numVtces; (++i, ++p)) { X if (v->flags & VPPerspective) { X TmpPt.x = v->Middl.x + v->Scale.x * p->x / p->z; X TmpPt.y = v->Middl.y - v->Scale.y * p->y / p->z; X } X else { X TmpPt.x = v->Middl.x + v->Scale.x * p->x; X TmpPt.y = v->Middl.y - v->Scale.y * p->y; X } X X#ifdef COLLAPSEUNUSEDPOINTS X xpt[k].x = TmpPt.x + 0.5; X xpt[k].y = TmpPt.y + 0.5; X X if (k == 0 || !(xpt[k].x == lastpt->x && xpt[k].y == lastpt->y)) X lastpt = &xpt[k++]; X X#else X xpt[k].x = TmpPt.x + 0.5; X xpt[k].y = TmpPt.y + 0.5; X ++k; X#endif X X } X X if (k > 0) { X#ifdef COLLAPSEUNUSEDPOINTS X if (k == 1) X XDrawPoint (v->dpy, d, gc, xpt[0].x, xpt[0].y); X else if (k == 2) X XDrawLines (v->dpy, d, gc, xpt, 2, CoordModeOrigin); X else X#endif X XFillPolygon (v->dpy, d, gc, xpt, k, Nonconvex, CoordModeOrigin); X } X X} *-*-END-of-./V/lib/VFillPolygon.c-*-* echo x - ./V/lib/VMatrixInvert.c sed 's/^X//' >./V/lib/VMatrixInvert.c <<'*-*-END-of-./V/lib/VMatrixInvert.c-*-*' X#include "Vlib.h" X X#define mod(a) (a < 0 ? a + 3 : a % 3) X XVMatrix *VMatrixInvert(s, d) XVMatrix *s; XVMatrix *d; { X X register int i, j; X register double det; X X det = VMatrixDeterminant (s); X X for (i=0; i<4; ++i) X for (j=0; j<4; ++j) X d->m[j][i] =(s->m[mod(j+1)][mod(i+1)] * X s->m[mod(j+2)][mod(i+2)] - X s->m[mod(j-1)][mod(i+1)] * X s->m[mod(j-2)][mod(i+2)] ) / det; X X return d; X} *-*-END-of-./V/lib/VMatrixInvert.c-*-* echo x - ./V/lib/VMatrixDeterminant.c sed 's/^X//' >./V/lib/VMatrixDeterminant.c <<'*-*-END-of-./V/lib/VMatrixDeterminant.c-*-*' X#include "Vlib.h" X Xdouble VMatrixDeterminant(m) XVMatrix *m; { X X double det; X X det = m->m[0][0] * m->m[1][1] * m->m[2][2] * m->m[3][3] + X m->m[1][0] * m->m[2][1] * m->m[3][2] * m->m[0][3] + X m->m[2][0] * m->m[3][1] * m->m[0][2] * m->m[1][3] + X m->m[3][0] * m->m[0][1] * m->m[1][2] * m->m[2][3] - X m->m[0][3] * m->m[1][2] * m->m[2][1] * m->m[3][0] - X m->m[1][3] * m->m[2][2] * m->m[3][1] * m->m[0][0] - X m->m[2][3] * m->m[3][2] * m->m[0][1] * m->m[1][0] - X m->m[3][3] * m->m[0][2] * m->m[1][1] * m->m[2][0]; X X return det; X} *-*-END-of-./V/lib/VMatrixDeterminant.c-*-* echo x - ./V/lib/VBindColors.c sed 's/^X//' >./V/lib/VBindColors.c <<'*-*-END-of-./V/lib/VBindColors.c-*-*' X#include "Vlib.h" X#include <math.h> X Xint pmap (vec, n) Xint *vec; Xint n; { X X static int itbl[] = {1, 2, 4, 8}; X register int i, r=0; X X for (i=0; i<4; ++i) X if (itbl[i] & n) X r += vec[i]; X return r; X} X Xint VBindColors (v, background) XViewport *v; Xchar * background; { X X register int i, j, k, n, c; X static int parseComplete = 0; X unsigned int pixel; X VColor *p; X Display *dpy; X XColor colorSet[MAXCOLORS]; X unsigned long planemask[PLANES*2]; X unsigned long pixels[1]; X X X if (v->flags & VPMono) X return 0; X X n = PLANES; X c = (int) (pow(2.0, (double) n) + 0.01); X dpy = v->dpy; X X v->cmap = DefaultColormap(dpy, DefaultScreen(dpy)); X X if (XAllocColorCells (dpy, v->cmap, False, planemask, n*2, pixels, 1) == 0) { X fprintf (stderr, "Cannot allocate color cells\n"); X return -1; X } X X/* X * Parse background color X */ X X if (/*parseComplete == 0*/ 1) { X X if (XParseColor(dpy, v->cmap, background, &colorSet[0]) == 0) { X fprintf (stderr, "Can't parse color %s\n", background); X return -1; X } X X/* X * Parse each color defined in the V Color List X */ X X for ((i=0, p=VColorList); p != (VColor *) 0; i++) { X if (i > c) { X fprintf (stderr, "Too many colors selected.\n"); X return -1; X } X if (XParseColor (dpy, v->cmap, p->color_name, &colorSet[i+1]) == 0) { X fprintf (stderr, "Can't parse color %s\n", p->color_name); X return -1; X } X p->xcolor = colorSet[i+1]; X p->index = i+1; X p = p->next; X } X X parseComplete = 1; X } X X v->colors = i+1; X X#ifdef DEBUG X fprintf (stderr, "%d colors defined in the V color list.\n", i); X#endif X X/* X * PAY ATTENTION! X * X * We will now create a two lists of XColors. Each will expose a particular X * drawing buffer (there are two drawing buffers created here). X * A drawing is exposed by passing one of these lists to the XSetColors X * procedure. X * We create a list by iterating through each possible combination of X * pixel values, based on the values returned in pixel and planemask. X * The pixel value is determined using a function called pmap. Each pixel X * value is assigned the appropriate XColor. X */ X X k = 0; X for (i=0; i<v->colors; ++i) { X pixel = v->aPixel[i] = pmap(&planemask[0], i) | pixels[0]; X for (j=0; j<v->colors; ++j) { X v->aColor[k] = colorSet[i]; X v->aColor[k++].pixel = pixel | pmap (&planemask[n], j); X } X } X X v->aMask = pmap(&planemask[0], (c-1)) | pixels[0]; X X k = 0; X for (i=0; i<v->colors; ++i) { X pixel = v->bPixel[i] = pmap(&planemask[n], i) | pixels[0]; X for (j=0; j<v->colors; ++j) { X v->bColor[k] = colorSet[i]; X v->bColor[k++].pixel = pixel | pmap(&planemask[0], j); X } X } X X v->bMask = pmap(&planemask[n], (c-1)) | pixels[0]; X X return 0; X} *-*-END-of-./V/lib/VBindColors.c-*-* echo x - ./V/lib/VExposeBuffer.c sed 's/^X//' >./V/lib/VExposeBuffer.c <<'*-*-END-of-./V/lib/VExposeBuffer.c-*-*' X#include "Vlib.h" X Xvoid VExposeBuffer (v, gc) XViewport *v; XGC gc; { X X VColor *p; X unsigned long *q; X X/* X * this is one area where more-than-one window per display gets hairy -- this call X * really exposes the drawings buffered in all windows associated with a given display. X * the calling sequence needs to be changed to reflect this. X */ X X if (v->flags & VPMono) { X XCopyArea (v->dpy, v->monoPixmap, v->win, gc, X 0, 0, v->width, v->height, 0, 0); X XSetForeground (v->dpy, gc, WhitePixel(v->dpy, v->screen)); X XFillRectangle (v->dpy, v->monoPixmap, gc, 0, 0, v->width, v->height); X XSetForeground (v->dpy, gc, BlackPixel(v->dpy, v->screen)); X return; X } X X if (v->set == 0) { X v->set = 1; X XStoreColors (v->dpy, v->cmap, v->aColor, v->colors*v->colors); X v->pixel = &(v->bPixel[0]); X XSetPlaneMask (v->dpy, gc, v->bMask); X v->mask = v->bMask; X /* X for ((p=VColorList, q = &(v->bPixel[1])); p != (VColor *) 0; ++q) { X p->xcolor.pixel = *q; X p = p->next; X } X */ X } X else { X v->set = 0; X XStoreColors (v->dpy, v->cmap, v->bColor, v->colors*v->colors); X v->pixel = &(v->aPixel[0]); X XSetPlaneMask (v->dpy, gc, v->aMask); X v->mask = v->aMask; X /* X for ((p=VColorList, q = &(v->aPixel[1])); p != (VColor *) 0; ++q) { X p->xcolor.pixel = *q; X p = p->next; X } X */ X } X X/* XSync (v->dpy, False); */ X XFlush (v->dpy); X} *-*-END-of-./V/lib/VExposeBuffer.c-*-* echo x - ./V/lib/VAllocColor.c sed 's/^X//' >./V/lib/VAllocColor.c <<'*-*-END-of-./V/lib/VAllocColor.c-*-*' X#include "Vlib.h" X#include <string.h> X XVColor *VAllocColor (name) Xchar *name; { X X VColor *p=VColorList, *prev=0, **q; X X/* X * Search for this color among those already allocated. X */ X X while (p != (VColor *) 0) { X if (strcmp(p->color_name, name) == 0) { X return p; X } X prev = p; X p = p->next; X } X X/* X * The color was not in the list; allocate a new list element. X */ X X if (prev == (VColor *)0) X q = &VColorList; X else X q = &(prev->next); X X *q = (VColor *) Vmalloc (sizeof(VColor)); X (*q)->color_name = strdup (name); X (*q)->index = -1; X (*q)->next = 0; X X return *q; X} *-*-END-of-./V/lib/VAllocColor.c-*-* echo x - ./V/lib/VResizeViewport.c sed 's/^X//' >./V/lib/VResizeViewport.c <<'*-*-END-of-./V/lib/VResizeViewport.c-*-*' X#include "Vlib.h" X Xvoid VResizeViewport (v, unit, dist, scale, width, height) XViewport *v; Xdouble unit; Xdouble dist; Xdouble scale; Xint width; Xint height; { X X VPoint clip[4]; X X/* X * Allocate a new monochrome bitmap to buffer the displayed image. X */ X X if (v->flags & VPMono) { X XFreePixmap (v->dpy, v->monoPixmap); X v->monoPixmap = XCreatePixmap (v->dpy, X RootWindow(v->dpy, v->screen), v->width, v->height, 1); X } X X/* X * Calculate screen resolution in pixels per unit. X */ X X v->dist = dist; X v->units = unit; X X/* X * Use that info to set scaling factors. X */ X X v->Scale.x = v->xres * dist * scale; X v->Scale.y = v->yres * dist * scale; X v->Scale.z = 1.0; X X v->Middl.x = (double) width / 2.0; X v->Middl.y = (double) height / 2.0; X v->Middl.z = 0.0; X X/* X * Build the clipping planes for our view into the eye space. X */ X X clip[0].x = - width / v->xres / 2.0 / scale; X clip[0].y = - height / v->yres / 2.0 / scale; X clip[0].z = dist; X clip[1].x = - width / v->xres / 2.0 / scale; X clip[1].y = height / v->yres / 2.0 / scale; X clip[1].z = dist; X clip[2].x = width / v->xres / 2.0 / scale; X clip[2].y = height / v->yres / 2.0 / scale; X clip[2].z = dist; X clip[3].x = width / v->xres / 2.0 / scale; X clip[3].y = - height / v->yres / 2.0 / scale; X clip[3].z = dist; X X v->clipPoly = VCreatePolygon (4, clip); X VGetPlanes (v->clipPoly); X} *-*-END-of-./V/lib/VResizeViewport.c-*-* echo x - ./V/test sed 's/^X//' >./V/test <<'*-*-END-of-./V/test-*-*' *-*-END-of-./V/test-*-* echo x - ./V/test/app.c sed 's/^X//' >./V/test/app.c <<'*-*-END-of-./V/test/app.c-*-*' X#include "../lib/Vlib.h" X#include <X11/Xutil.h> X#include <math.h> X X#define VIEW2 X Xextern Display *dpy; Xextern Window win; Xextern GC curGC; Xextern XSizeHints xsh; Xextern int mono; X XVPolygon *poly[1024]; X Xvoid placeObject (obj, loc, roll, pitch, yaw, poly, cnt) XVObject *obj; XVPoint loc; Xdouble roll; Xdouble pitch; Xdouble yaw; XVPolygon **poly; Xint *cnt; { X X int i, j, k; X VPoint *q, tmp; X VMatrix mtx; X X j = *cnt; X X VIdentMatrix (&mtx); X if (roll != 0.0) X VRotate (&mtx, XRotation, roll); X if (pitch != 0.0) X VRotate (&mtx, YRotation, pitch); X if (yaw != 0.0) X VRotate (&mtx, ZRotation, yaw); X VTranslatePoint (&mtx, loc); X X for (i=0; i<obj->numPolys; ++i) { X X if (poly[j] != (VPolygon *) NULL) X VDestroyPolygon (poly[j]); X X poly[j] = VCopyPolygon(obj->polygon[i]); X for ((k=0, q=poly[j]->vertex); k<poly[j]->numVtces; (++k, ++q)) { X VTransform(q, &mtx, &tmp); X *q = tmp; X } X ++j; X } X X *cnt = j; X} X Xapp(background) Xchar *background; { X X int i, cnt, black; X unsigned int j, curPixel = 0; X char *str, YD[32]; X FILE *file; X VObject *obj, *ftr, *mig; X VPoint viewPt, centerInt, up, ftrLoc, ftrLoc2, ftrLoc3, migLoc1, migLoc2; X Viewport *v; X double dist, p, migV, v1, a, migRoll; X double updateRate = 5.0; X X str = "fullrwy"; X X if ((file = fopen(str, "r")) == (FILE *) NULL) { X perror ("Cannot open object file"); X exit (1); X } X X if ((obj = VReadObject(file)) == (VObject *) NULL) { X fprintf (stderr, "Error reading the object definition.\n"); X exit (1); X } X X fclose (file); X X str = "f16"; X X if ((file = fopen(str, "r")) == (FILE *) NULL) { X perror ("Cannot open object file"); X exit (1); X } X X if ((ftr = VReadObject(file)) == (VObject *) NULL) { X fprintf (stderr, "Error reading the object definition.\n"); X exit (1); X } X X fclose (file); X X X str = "mig23"; X X if ((file = fopen(str, "r")) == (FILE *) NULL) { X perror ("Cannot open object file"); X exit (1); X } X X if ((mig = VReadObject(file)) == (VObject *) NULL) { X fprintf (stderr, "Error reading the object definition.\n"); X exit (1); X } X X fclose (file); X X v = VOpenViewport (dpy, 0, win, 12 * 25.4 / 1000.0, 1.5, 1.0, xsh.width, X xsh.height); X X if (VBindColors (v, background) < 0) { X fprintf (stderr, "Error in binding colors.\n"); X exit (1); X } X VExposeBuffer (v, curGC); X X X ftrLoc.x = 80.0; X ftrLoc.y = -110.0; X ftrLoc.z = -7.0; X X ftrLoc2.x = 475.0; X ftrLoc2.y = 3.7; X ftrLoc2.z = -7.0; X X migLoc1.z = -310.0; X migLoc2.z = -320.0; X migV = 370.0 / 3600.0 * 5280.0 / updateRate; /* mig speed in fps */ X migV = migV / (2500.0 * 3.14 * 2.0); /* mig speed in rad/update */ X migRoll = 28.0 * 3.14 / 180.0; X a = 90.0 * 3.14 / 180.0; X X v1 = 130.0 / 3600.0 * 5280.0 / updateRate; X X centerInt.x = 80.0; X centerInt.y = -90.0; X centerInt.z = -6.0; X X dist = -10000.0; p = 0; X X while (1) { X X ftrLoc3.x = dist+150.0; X ftrLoc3.y = -15.0; X ftrLoc3.z = (dist+150.0) * 50.0 / 1000.0 - 40.0; X if (ftrLoc3.z > -13.0) X ftrLoc3.z = -13.0; X viewPt.x = dist; X viewPt.y = 15.0; X viewPt.z = dist * 50.0 / 1000.0 - 50.0; X if (viewPt.z > -13.0) X viewPt.z = -13.0; X up = viewPt; X up.z = up.z - 1.0; X if (viewPt.z < -14.0) X up.y = up.y + 0.1 * sin(p); X p = p + 0.03; X dist = dist + v1; X if (dist > 10000.0) X exit (1); X X migLoc1.x = 0.0 + 2200.0 * cos (a); X migLoc1.y = -800.0 + 2200.0 * sin (a); X migLoc2.x = 0.0 + 2225.0 * cos (a-0.04); X migLoc2.y = -800.0 + 2225.0 * sin (a-0.04); X a = a + migV; X X/* X * Now create a vector containing all polygons from the objects. X */ X X for (i=0; i<obj->numPolys; ++i) { X if (poly[i] != (VPolygon *) NULL) X VDestroyPolygon(poly[i]); X poly[i] = VCopyPolygon(obj->polygon[i]); X } X cnt = obj->numPolys; X#ifndef VIEW3 X placeObject (ftr, ftrLoc, 0.0, 0.0, 90.0*3.14/180.0, &poly[0], &cnt); X#endif X placeObject (ftr, ftrLoc2, 0.0, 0.0, -3.0*3.14/180.0, &poly[0], &cnt); X placeObject (ftr, ftrLoc3, 0.0, -11.0*3.14/180.0, 0.0, &poly[0], &cnt); X#ifndef VIEW1 X placeObject (ftr, viewPt, 0.0, -11.0*3.14/180.0, 0.0, &poly[0], &cnt); X#endif X placeObject (mig, migLoc1, migRoll, 0.0, a+90.0*3.14/180.0, &poly[0], &cnt); X#ifndef VIEW2 X placeObject (mig, migLoc2, migRoll, 0.0, a+90.0*3.14/180.0, &poly[0], &cnt); X#endif X X/* X * Calculate eye space information based on our current viewpoint. X */ X X#ifdef VIEW1 X VGetEyeSpace (v, viewPt, centerInt, up); X#endif X#ifdef VIEW2 X up = migLoc2; X up.z = up.z - 1.0; X VGetEyeSpace (v, migLoc2, viewPt, up); X#endif X#ifdef VIEW3 X up = ftrLoc; X up.z = up.z - 1.0; X VGetEyeSpace (v, ftrLoc, viewPt, up); X#endif X X black = BlackPixel(dpy, 0); X X X/* X * First clip, then draw each polygon. X */ X X for (i=0; i<cnt; ++i) { X X if (mono) X XSetForeground (dpy, curGC, black); X X VTransformPolygon (poly[i], &(v->eyeSpace)); X poly[i] = VClipPolygon(poly[i], v->clipPoly); X if (poly[i]) { X if (mono == 0 && curPixel != (j=v->pixel[poly[i]->color->index])) { X XSetForeground (dpy, curGC, j); X curPixel = j; X } X if (mono) X VDrawPolygon (v, win, curGC, poly[i]); X else X VFillPolygon (v, win, curGC, poly[i]); X } X X } X X VExposeBuffer (v, curGC); X X/* X * Erase the un-displayed planes. X */ X X if (mono == 0) { X curPixel = *(v->pixel); X XSetForeground (dpy, curGC, curPixel); X XFillRectangle (dpy, win, curGC, 0, 0, xsh.width, xsh.height); X } X X } X X} *-*-END-of-./V/test/app.c-*-* echo x - ./V/test/animate.c sed 's/^X//' >./V/test/animate.c <<'*-*-END-of-./V/test/animate.c-*-*' X#include <stdio.h> X#include <X11/Xlib.h> X#include <X11/Xutil.h> X Xstatic char *id = "V library animation test -- Riley Rainey"; X X#define STRING "Double Buffered Animation" X#define BORDER 1 X#define FONT "fixed" X#define ARG_FONT "font" X#define ARG_BORDER_COLOR "borderColor" X#define ARG_BACKGROUND "background" X#define ARG_BORDER "borderWidth" X#define ARG_GEOMETRY "geometry" X#define DEFAULT_BACKGROUND "#29350B" X#define DEFAULT_BORDER "black" X X#define SW_BORDER 1 X#define SW_BG 3 X#define SW_GEOM 4 X Xstruct { X char *sw; X int value; X } switches[] = { X "-bw", SW_BORDER, X "-bg", SW_BG, X "-geometry", SW_GEOM, X NULL, 0}, *swp; X Xchar *background = NULL, *filename; Xint borderWidth = 1; Xint mono; X X X/* X * This structure forms the WM_HINTS property of the window, X * letting the window manager know how to handle this window. X * See Section 9.1 of the Xlib manual. X */ XXWMHints xwmh = { X (InputHint|StateHint), /* flags */ X False, /* input */ X NormalState, /* initial_state */ X 0, /* icon pixmap */ X 0, /* icon window */ X 0, 0, /* icon location */ X 0, /* icon mask */ X 0, /* Window group */ X}; X XDisplay *dpy; /* X server connection */ XWindow win; /* Window ID */ XGC gc; /* GC to draw with */ XXGCValues gcv; XXSizeHints xsh; /* Size hints for window manager */ XColormap cmap; X Xstatic unsigned long planemask [6]; /* plane masks from XAllocColorCells */ Xstatic unsigned long pixels [16]; /* pixel values from XAllocColorCells */ XGC curGC; X Xmain(argc,argv) X int argc; X char **argv; X{ X char *fontName; /* Name of font for string */ X XFontStruct *fontstruct; /* Font descriptor */ X unsigned long ftw, fth, pad;/* Font size parameters */ X unsigned long bg, bd; /* Pixel values */ X unsigned long bw; /* Border width */ X char *tempstr; /* Temporary string */ X XColor color; /* Temporary color */ X XEvent event; /* Event received */ X char *geomSpec; /* Window geometry string */ X XSetWindowAttributes xswa; /* Temporary Set Window Attribute struct */ X char **c; X int i; X X/* X * Parse command line X */ X X for (c= &argv[1]; *c != (char *) NULL; ++c) X if (**c == '-') { X for (swp= &switches[0]; swp->value != 0; ++swp) X if (strcmp (swp->sw, *c) == 0) { X switch (swp->value) { X case SW_GEOM: X geomSpec = *(++c); X break; X case SW_BG: X background = *(++c); X break; X case SW_BORDER: X borderWidth = atoi (*(++c)); X break; X } X break; X } X if (swp->value == 0) { X fprintf (stderr, "%s: invalid switch %s", argv[0], *c); X exit (1); X } X } X else X filename = *c; X X /* X * Open the display using the $DISPLAY environment variable to locate X * the X server. See Section 2.1. X */ X if ((dpy = XOpenDisplay(NULL)) == NULL) { X fprintf(stderr, "%s: can't open %s\n", argv[0], XDisplayName(NULL)); X exit(1); X } X X mono = (DisplayPlanes(dpy, 0) < 2) ? 1 : 0; X X /* X * Load the font to use. See Sections 10.2 & 6.5.1 X */ X if ((fontName = XGetDefault(dpy, argv[0], ARG_FONT)) == NULL) { X fontName = FONT; X } X if ((fontstruct = XLoadQueryFont(dpy, fontName)) == NULL) { X fprintf(stderr, "%s: display %s doesn't know font %s\n", X argv[0], DisplayString(dpy), fontName); X exit(1); X } X fth = fontstruct->max_bounds.ascent + fontstruct->max_bounds.descent; X ftw = fontstruct->max_bounds.width; X X /* X * Select colors for the border, the window background, and the X * foreground. We use the default colormap to allocate the colors in. X * See Sections 2.2.1, 5.1.2, & 10.4. X */ X X cmap = DefaultColormap(dpy, DefaultScreen(dpy)); X X if ((tempstr = XGetDefault(dpy, argv[0], ARG_BORDER_COLOR)) == NULL) X tempstr = DEFAULT_BORDER; X if (XParseColor(dpy, cmap, tempstr, &color) == 0) { X fprintf (stderr, "Can't get border color %s\n", tempstr); X exit (1); X } X bd = color.pixel; X X/* X * Allocate Color Planes and one extra cell for the border color. X */ X X if (mono == 0) X if (XAllocColorCells (dpy, cmap, False, planemask, 0, pixels, 1) == 0) { X fprintf (stderr, "Cannot allocate color cells\n"); X exit (1); X } X bg = WhitePixel (dpy, 0); X X/* X * Store border color X */ X X if (mono) X bd = BlackPixel (dpy, 0); X else { X bd = color.pixel = pixels [0]; X XStoreColor (dpy, cmap, &color); X } X X/* X * Background Color (pixels [0] defines this). X */ X X if (background == NULL) X background = XGetDefault (dpy, argv[0], ARG_BACKGROUND); X if (background == NULL) X background = DEFAULT_BACKGROUND; X X /* X * Set the border width of the window, and the gap between the text X * and the edge of the window, "pad". X */ X pad = BORDER; X if ((tempstr = XGetDefault(dpy, argv[0], ARG_BORDER)) == NULL) X bw = 1; X else X bw = atoi(tempstr); X X /* X * Deal with providing the window with an initial position & size. X * Fill out the XSizeHints struct to inform the window manager. See X * Sections 9.1.6 & 10.3. X */ X if (geomSpec == NULL) X geomSpec = XGetDefault(dpy, argv[0], ARG_GEOMETRY); X X if (geomSpec == NULL) { X /* X * The defaults database doesn't contain a specification of the X * initial size & position - fit the window to the text and locate X * it in the center of the screen. X */ X xsh.flags = (PPosition | PSize); X xsh.height = 800; X xsh.width = 1000; X xsh.x = (DisplayWidth(dpy, DefaultScreen(dpy)) - xsh.width) / 2; X xsh.y = (DisplayHeight(dpy, DefaultScreen(dpy)) - xsh.height) / 2; X } X else { X int bitmask; X X bzero(&xsh, sizeof(xsh)); X bitmask = XGeometry(dpy, DefaultScreen(dpy), geomSpec, geomSpec, X bw, ftw, fth, pad, pad, &(xsh.x), &(xsh.y), X &(xsh.width), &(xsh.height)); X if (bitmask & (XValue | YValue)) { X xsh.flags |= USPosition; X } X if (bitmask & (WidthValue | HeightValue)) { X xsh.flags |= USSize; X } X } X X /* X * Create the Window with the information in the XSizeHints, the X * border width, and the border & background pixels. See Section 3.3. X */ X win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), X xsh.x, xsh.y, xsh.width, xsh.height, X bw, bd, bg); X X /* X * Set the standard properties for the window managers. See Section X * 9.1. X */ X XSetStandardProperties(dpy, win, STRING, STRING, None, argv, argc, &xsh); X XSetWMHints(dpy, win, &xwmh); X X /* X * Ensure that the window's colormap field points to the default X * colormap, so that the window manager knows the correct colormap to X * use for the window. See Section 3.2.9. Also, set the window's Bit X * Gravity to reduce Expose events. X */ X xswa.colormap = DefaultColormap(dpy, DefaultScreen(dpy)); X xswa.bit_gravity = NorthWestGravity; X XChangeWindowAttributes(dpy, win, (CWColormap | CWBitGravity), &xswa); X X /* X * Create the GC for drawing the picture. X */ X gcv.font = fontstruct->fid; X curGC = XCreateGC(dpy, win, GCFont, &gcv); X X /* X * Specify the event types we're interested in - only Exposures. See X * Sections 8.5 & 8.4.5.1 X */ X XSelectInput(dpy, win, ExposureMask); X X /* X * Map the window to make it visible. See Section 3.5. X */ X XMapWindow(dpy, win); X X app(background); X X exit(1); X} X *-*-END-of-./V/test/animate.c-*-* echo x - ./V/test/rwy sed 's/^X//' >./V/test/rwy <<'*-*-END-of-./V/test/rwy-*-*' XRunway X280 69 X1 0.000000 -75.000000 0.000000 X2 12000.000000 -75.000000 0.000000 X3 12000.000000 75.000000 0.000000 X4 0.000000 75.000000 0.000000 X5 0.000000 -75.000000 0.000000 X6 12000.000000 -75.000000 0.000000 X7 12000.000000 -70.000000 0.000000 X8 0.000000 -70.000000 0.000000 X9 0.000000 75.000000 0.000000 X10 12000.000000 75.000000 0.000000 X11 12000.000000 70.000000 0.000000 X12 0.000000 70.000000 0.000000 X13 1000.000000 -66.000000 0.000000 X14 1125.000000 -66.000000 0.000000 X15 1125.000000 -36.000000 0.000000 X16 1000.000000 -36.000000 0.000000 X17 1000.000000 66.000000 0.000000 X18 1125.000000 66.000000 0.000000 X19 1125.000000 36.000000 0.000000 X20 1000.000000 36.000000 0.000000 X21 11000.000000 -66.000000 0.000000 X22 10875.000000 -66.000000 0.000000 X23 10875.000000 -36.000000 0.000000 X24 11000.000000 -36.000000 0.000000 X25 11000.000000 66.000000 0.000000 X26 10875.000000 66.000000 0.000000 X27 10875.000000 36.000000 0.000000 X28 11000.000000 36.000000 0.000000 X29 4.000000 -66.000000 0.000000 X30 129.000000 -66.000000 0.000000 X31 129.000000 -54.888889 0.000000 X32 4.000000 -54.888889 0.000000 X33 4.000000 -50.888889 0.000000 X34 129.000000 -50.888889 0.000000 X35 129.000000 -39.777779 0.000000 X36 4.000000 -39.777779 0.000000 X37 4.000000 -35.777779 0.000000 X38 129.000000 -35.777779 0.000000 X39 129.000000 -24.666666 0.000000 X40 4.000000 -24.666666 0.000000 X41 4.000000 -20.666666 0.000000 X42 129.000000 -20.666666 0.000000 X43 129.000000 -9.555555 0.000000 X44 4.000000 -9.555555 0.000000 X45 4.000000 9.555555 0.000000 X46 129.000000 9.555555 0.000000 X47 129.000000 20.666666 0.000000 X48 4.000000 20.666666 0.000000 X49 4.000000 24.666666 0.000000 X50 129.000000 24.666666 0.000000 X51 129.000000 35.777779 0.000000 X52 4.000000 35.777779 0.000000 X53 4.000000 39.777779 0.000000 X54 129.000000 39.777779 0.000000 X55 129.000000 50.888889 0.000000 X56 4.000000 50.888889 0.000000 X57 4.000000 54.888889 0.000000 X58 129.000000 54.888889 0.000000 X59 129.000000 66.000000 0.000000 X60 4.000000 66.000000 0.000000 X61 11996.000000 -66.000000 0.000000 X62 11871.000000 -66.000000 0.000000 X63 11871.000000 -54.888889 0.000000 X64 11996.000000 -54.888889 0.000000 X65 11996.000000 -50.888889 0.000000 X66 11871.000000 -50.888889 0.000000 X67 11871.000000 -39.777779 0.000000 X68 11996.000000 -39.777779 0.000000 X69 11996.000000 -35.777779 0.000000 X70 11871.000000 -35.777779 0.000000 X71 11871.000000 -24.666666 0.000000 X72 11996.000000 -24.666666 0.000000 X73 11996.000000 -20.666666 0.000000 X74 11871.000000 -20.666666 0.000000 X75 11871.000000 -9.555555 0.000000 X76 11996.000000 -9.555555 0.000000 X77 11996.000000 9.555555 0.000000 X78 11871.000000 9.555555 0.000000 X79 11871.000000 20.666666 0.000000 X80 11996.000000 20.666666 0.000000 X81 11996.000000 24.666666 0.000000 X82 11871.000000 24.666666 0.000000 X83 11871.000000 35.777779 0.000000 X84 11996.000000 35.777779 0.000000 X85 11996.000000 39.777779 0.000000 X86 11871.000000 39.777779 0.000000 X87 11871.000000 50.888889 0.000000 X88 11996.000000 50.888889 0.000000 X89 11996.000000 54.888889 0.000000 X90 11871.000000 54.888889 0.000000 X91 11871.000000 66.000000 0.000000 X92 11996.000000 66.000000 0.000000 X93 258.000000 -2.500000 0.000000 X94 383.000000 -2.500000 0.000000 X95 383.000000 2.500000 0.000000 X96 258.000000 2.500000 0.000000 X97 508.000000 -2.500000 0.000000 X98 633.000000 -2.500000 0.000000 X99 633.000000 2.500000 0.000000 X100 508.000000 2.500000 0.000000 X101 758.000000 -2.500000 0.000000 X102 883.000000 -2.500000 0.000000 X103 883.000000 2.500000 0.000000 X104 758.000000 2.500000 0.000000 X105 1008.000000 -2.500000 0.000000 X106 1133.000000 -2.500000 0.000000 X107 1133.000000 2.500000 0.000000 X108 1008.000000 2.500000 0.000000 X109 1258.000000 -2.500000 0.000000 X110 1383.000000 -2.500000 0.000000 X111 1383.000000 2.500000 0.000000 X112 1258.000000 2.500000 0.000000 X113 1508.000000 -2.500000 0.000000 X114 1633.000000 -2.500000 0.000000 X115 1633.000000 2.500000 0.000000 X116 1508.000000 2.500000 0.000000 X117 1758.000000 -2.500000 0.000000 X118 1883.000000 -2.500000 0.000000 X119 1883.000000 2.500000 0.000000 X120 1758.000000 2.500000 0.000000 X121 2008.000000 -2.500000 0.000000 X122 2133.000000 -2.500000 0.000000 X123 2133.000000 2.500000 0.000000 X124 2008.000000 2.500000 0.000000 X125 2258.000000 -2.500000 0.000000 X126 2383.000000 -2.500000 0.000000 X127 2383.000000 2.500000 0.000000 X128 2258.000000 2.500000 0.000000 X129 2508.000000 -2.500000 0.000000 X130 2633.000000 -2.500000 0.000000 X131 2633.000000 2.500000 0.000000 X132 2508.000000 2.500000 0.000000 X133 2758.000000 -2.500000 0.000000 X134 2883.000000 -2.500000 0.000000 X135 2883.000000 2.500000 0.000000 X136 2758.000000 2.500000 0.000000 X137 3008.000000 -2.500000 0.000000 X138 3133.000000 -2.500000 0.000000 X139 3133.000000 2.500000 0.000000 X140 3008.000000 2.500000 0.000000 X141 3258.000000 -2.500000 0.000000 X142 3383.000000 -2.500000 0.000000 X143 3383.000000 2.500000 0.000000 X144 3258.000000 2.500000 0.000000 X145 3508.000000 -2.500000 0.000000 X146 3633.000000 -2.500000 0.000000 X147 3633.000000 2.500000 0.000000 X148 3508.000000 2.500000 0.000000 X149 3758.000000 -2.500000 0.000000 X150 3883.000000 -2.500000 0.000000 X151 3883.000000 2.500000 0.000000 X152 3758.000000 2.500000 0.000000 X153 4008.000000 -2.500000 0.000000 X154 4133.000000 -2.500000 0.000000 X155 4133.000000 2.500000 0.000000 X156 4008.000000 2.500000 0.000000 X157 4258.000000 -2.500000 0.000000 X158 4383.000000 -2.500000 0.000000 X159 4383.000000 2.500000 0.000000 X160 4258.000000 2.500000 0.000000 X161 4508.000000 -2.500000 0.000000 X162 4633.000000 -2.500000 0.000000 X163 4633.000000 2.500000 0.000000 X164 4508.000000 2.500000 0.000000 X165 4758.000000 -2.500000 0.000000 X166 4883.000000 -2.500000 0.000000 X167 4883.000000 2.500000 0.000000 X168 4758.000000 2.500000 0.000000 X169 5008.000000 -2.500000 0.000000 X170 5133.000000 -2.500000 0.000000 X171 5133.000000 2.500000 0.000000 X172 5008.000000 2.500000 0.000000 X173 5258.000000 -2.500000 0.000000 X174 5383.000000 -2.500000 0.000000 X175 5383.000000 2.500000 0.000000 X176 5258.000000 2.500000 0.000000 X177 5508.000000 -2.500000 0.000000 X178 5633.000000 -2.500000 0.000000 X179 5633.000000 2.500000 0.000000 X180 5508.000000 2.500000 0.000000 X181 5758.000000 -2.500000 0.000000 X182 5883.000000 -2.500000 0.000000 X183 5883.000000 2.500000 0.000000 X184 5758.000000 2.500000 0.000000 X185 6008.000000 -2.500000 0.000000 X186 6133.000000 -2.500000 0.000000 X187 6133.000000 2.500000 0.000000 X188 6008.000000 2.500000 0.000000 X189 6258.000000 -2.500000 0.000000 X190 6383.000000 -2.500000 0.000000 X191 6383.000000 2.500000 0.000000 X192 6258.000000 2.500000 0.000000 X193 6508.000000 -2.500000 0.000000 X194 6633.000000 -2.500000 0.000000 X195 6633.000000 2.500000 0.000000 X196 6508.000000 2.500000 0.000000 X197 6758.000000 -2.500000 0.000000 X198 6883.000000 -2.500000 0.000000 X199 6883.000000 2.500000 0.000000 X200 6758.000000 2.500000 0.000000 X201 7008.000000 -2.500000 0.000000 X202 7133.000000 -2.500000 0.000000 X203 7133.000000 2.500000 0.000000 X204 7008.000000 2.500000 0.000000 X205 7258.000000 -2.500000 0.000000 X206 7383.000000 -2.500000 0.000000 X207 7383.000000 2.500000 0.000000 X208 7258.000000 2.500000 0.000000 X209 7508.000000 -2.500000 0.000000 X210 7633.000000 -2.500000 0.000000 X211 7633.000000 2.500000 0.000000 X212 7508.000000 2.500000 0.000000 X213 7758.000000 -2.500000 0.000000 X214 7883.000000 -2.500000 0.000000 X215 7883.000000 2.500000 0.000000 X216 7758.000000 2.500000 0.000000 X217 8008.000000 -2.500000 0.000000 X218 8133.000000 -2.500000 0.000000 X219 8133.000000 2.500000 0.000000 X220 8008.000000 2.500000 0.000000 X221 8258.000000 -2.500000 0.000000 X222 8383.000000 -2.500000 0.000000 X223 8383.000000 2.500000 0.000000 X224 8258.000000 2.500000 0.000000 X225 8508.000000 -2.500000 0.000000 X226 8633.000000 -2.500000 0.000000 X227 8633.000000 2.500000 0.000000 X228 8508.000000 2.500000 0.000000 X229 8758.000000 -2.500000 0.000000 X230 8883.000000 -2.500000 0.000000 X231 8883.000000 2.500000 0.000000 X232 8758.000000 2.500000 0.000000 X233 9008.000000 -2.500000 0.000000 X234 9133.000000 -2.500000 0.000000 X235 9133.000000 2.500000 0.000000 X236 9008.000000 2.500000 0.000000 X237 9258.000000 -2.500000 0.000000 X238 9383.000000 -2.500000 0.000000 X239 9383.000000 2.500000 0.000000 X240 9258.000000 2.500000 0.000000 X241 9508.000000 -2.500000 0.000000 X242 9633.000000 -2.500000 0.000000 X243 9633.000000 2.500000 0.000000 X244 9508.000000 2.500000 0.000000 X245 9758.000000 -2.500000 0.000000 X246 9883.000000 -2.500000 0.000000 X247 9883.000000 2.500000 0.000000 X248 9758.000000 2.500000 0.000000 X249 10008.000000 -2.500000 0.000000 X250 10133.000000 -2.500000 0.000000 X251 10133.000000 2.500000 0.000000 X252 10008.000000 2.500000 0.000000 X253 10258.000000 -2.500000 0.000000 X254 10383.000000 -2.500000 0.000000 X255 10383.000000 2.500000 0.000000 X256 10258.000000 2.500000 0.000000 X257 10508.000000 -2.500000 0.000000 X258 10633.000000 -2.500000 0.000000 X259 10633.000000 2.500000 0.000000 X260 10508.000000 2.500000 0.000000 X261 10758.000000 -2.500000 0.000000 X262 10883.000000 -2.500000 0.000000 X263 10883.000000 2.500000 0.000000 X264 10758.000000 2.500000 0.000000 X265 11008.000000 -2.500000 0.000000 X266 11133.000000 -2.500000 0.000000 X267 11133.000000 2.500000 0.000000 X268 11008.000000 2.500000 0.000000 X269 11258.000000 -2.500000 0.000000 X270 11383.000000 -2.500000 0.000000 X271 11383.000000 2.500000 0.000000 X272 11258.000000 2.500000 0.000000 X273 11508.000000 -2.500000 0.000000 X274 11633.000000 -2.500000 0.000000 X275 11633.000000 2.500000 0.000000 X276 11508.000000 2.500000 0.000000 X277 11758.000000 -2.500000 0.000000 X278 11883.000000 -2.500000 0.000000 X279 11883.000000 2.500000 0.000000 X280 11758.000000 2.500000 0.000000 Xwhite 4 5 6 7 8 Xwhite 4 9 10 11 12 Xwhite 4 13 14 15 16 Xwhite 4 17 18 19 20 Xwhite 4 21 22 23 24 Xwhite 4 25 26 27 28 Xwhite 4 29 30 31 32 Xwhite 4 33 34 35 36 Xwhite 4 37 38 39 40 Xwhite 4 41 42 43 44 Xwhite 4 45 46 47 48 Xwhite 4 49 50 51 52 Xwhite 4 53 54 55 56 Xwhite 4 57 58 59 60 Xwhite 4 61 62 63 64 Xwhite 4 65 66 67 68 Xwhite 4 69 70 71 72 Xwhite 4 73 74 75 76 Xwhite 4 77 78 79 80 Xwhite 4 81 82 83 84 Xwhite 4 85 86 87 88 Xwhite 4 89 90 91 92 Xwhite 4 93 94 95 96 Xwhite 4 97 98 99 100 Xwhite 4 101 102 103 104 Xwhite 4 105 106 107 108 Xwhite 4 109 110 111 112 Xwhite 4 113 114 115 116 Xwhite 4 117 118 119 120 Xwhite 4 121 122 123 124 Xwhite 4 125 126 127 128 Xwhite 4 129 130 131 132 Xwhite 4 133 134 135 136 Xwhite 4 137 138 139 140 Xwhite 4 141 142 143 144 Xwhite 4 145 146 147 148 Xwhite 4 149 150 151 152 Xwhite 4 153 154 155 156 Xwhite 4 157 158 159 160 Xwhite 4 161 162 163 164 Xwhite 4 165 166 167 168 Xwhite 4 169 170 171 172 Xwhite 4 173 174 175 176 Xwhite 4 177 178 179 180 Xwhite 4 181 182 183 184 Xwhite 4 185 186 187 188 Xwhite 4 189 190 191 192 Xwhite 4 193 194 195 196 Xwhite 4 197 198 199 200 Xwhite 4 201 202 203 204 Xwhite 4 205 206 207 208 Xwhite 4 209 210 211 212 Xwhite 4 213 214 215 216 Xwhite 4 217 218 219 220 Xwhite 4 221 222 223 224 Xwhite 4 225 226 227 228 Xwhite 4 229 230 231 232 Xwhite 4 233 234 235 236 Xwhite 4 237 238 239 240 Xwhite 4 241 242 243 244 Xwhite 4 245 246 247 248 Xwhite 4 249 250 251 252 Xwhite 4 253 254 255 256 Xwhite 4 257 258 259 260 Xwhite 4 261 262 263 264 Xwhite 4 265 266 267 268 Xwhite 4 269 270 271 272 Xwhite 4 273 274 275 276 Xwhite 4 277 278 279 280 *-*-END-of-./V/test/rwy-*-* -- Riley Rainey Internet: riley@mips.com MIPS Computer Systems Phone: +1 214 770-7979 Dallas, Texas dan ---------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com Opinions expressed reflect those of the author only.