|
|
1.1 ! root 1: .hw rect\%angle ! 2: .if n .po 5 ! 3: .de Po ! 4: .if t \&\f(CW\\$1\f1\\$2 ! 5: .if n \&\fI\\$1\f1\\$2 ! 6: .. ! 7: .de Ja ! 8: .ne 6 ! 9: .sp ! 10: .in 0 ! 11: .ft CW ! 12: .ps 12 ! 13: .br ! 14: .if t .BX \\$1 ! 15: .if n \\$1 ! 16: .ps 10 ! 17: .ft 1 ! 18: \h'4m'\\$2 ! 19: .in +3 ! 20: .sp ! 21: .ft CW ! 22: .. ! 23: .de Jb ! 24: .sp ! 25: .ft 1 ! 26: .. ! 27: .SH ! 28: A Library of Goo for the 5620 ! 29: .PP ! 30: In the following summaries, ! 31: all coordinates are screen or bitmap coordinates. ! 32: The library is ! 33: .Po /usr/jerq/lib/libjj.a ! 34: which can be accessed by including a ! 35: .Po -ljj ! 36: in your compilation. ! 37: .sp ! 38: .PP ! 39: .in 0 ! 40: .ft 1 ! 41: .Ja 3d "3d: scaled integer three dimensional geometry ! 42: .nf ! 43: #define ONE 16384 ! 44: #define XAXIS 0 ! 45: #define YAXIS 1 ! 46: #define ZAXIS 2 ! 47: typedef short fract; /* fixed point scaled by ONE */ ! 48: typedef fract matrix[4][4]; ! 49: typedef short coord[4]; ! 50: typedef struct point3 ! 51: { ! 52: fract x, y, z, w; ! 53: } Hcoord; ! 54: .fi ! 55: .Jb ! 56: These are the data structures for a 3 dimensional geometry package. ! 57: .Po Hcoord ! 58: are homogeneous coordinates. ! 59: Author (for all the 3d stuff): Tom Duff. ! 60: .Ja Clip "Clip: clipped jerq primitives ! 61: .nf ! 62: Clip(r) Rectangle r; ! 63: Cbitblt(sb, sr, db, dp, fc) Bitmap *sb, *db; Rectangle sr; Point dp; ! 64: Crectf(bp, r, fc) Bitmap *bp; Rectangle r; ! 65: Point Cstring(f, s, bp, p, fc) Font *f; char *s; Bitmap *bp; Point p; ! 66: Ctexture(bp, r, t, fc) Bitmap *bp; Rectangle r; Texture *t; ! 67: .fi ! 68: .Jb ! 69: .Po Clip ! 70: sets the clipping rectangle for the routines ! 71: .Po Cbitblt , ! 72: .Po Crectf , ! 73: .Po Cstring ! 74: and ! 75: .Po Ctexture . ! 76: These routines implicitly clip to the layer as well. ! 77: .Po Cstring ! 78: returns the same result as ! 79: .Po string , ! 80: that is, the result is not clipped. ! 81: Author: Andrew Hume. ! 82: .Ja NMenu "NMenu: extended menu ! 83: .nf ! 84: typedef struct NMitem ! 85: { ! 86: char *text; /* text in menu */ ! 87: char *help; /* optional help text */ ! 88: struct NMenu *next; /* cascade to */ ! 89: void (*dfn)(), (*bfn)(), (*hfn)(); ! 90: } NMitem; ! 91: typedef struct NMenu ! 92: { ! 93: NMitem *item; /* string array, ending with text=0 */ ! 94: NMitem *(*generator)(); /* used if item == 0 */ ! 95: /* and some other private data */ ! 96: } NMenu; ! 97: .fi ! 98: .Jb ! 99: A ! 100: .Po NMenu ! 101: is used by ! 102: .Po mhit ! 103: described below. ! 104: Null or missing values should be zero. ! 105: The help text should be less than 40 characters or so. ! 106: The generator function is called with an integer argument. ! 107: The end of the menu is indicated by a zero \f(CWtext\fP field. ! 108: The function ! 109: .Po dfn ! 110: is called just before the new menu is invoked. ! 111: The function ! 112: .Po bfn ! 113: is called just after this menu is finished. ! 114: The function ! 115: .Po hfn ! 116: is invoked just after the selection is made and before ! 117: .Po bfn . ! 118: All three functions are called with one argument, ! 119: a pointer to the ! 120: .Po NMitem ! 121: concerned. ! 122: .Po Mhit ! 123: returns a pointer to the NMitem that was selected or ! 124: .Po (NMitem *)0 . ! 125: The above definitions are available in ! 126: .Po /usr/jerq/include/menu.h . ! 127: .Ja confirm "confirm: confirm a decision ! 128: confirm(but) ! 129: .Jb ! 130: .Po confirm ! 131: waits for all buttons to be released, ! 132: changes the cursor to an icon indicating which button to push for an affirmative ! 133: reponse, ! 134: waits for a button push and returns the equality between the button push ! 135: and the argument ! 136: .Po but . ! 137: Author: Adrian Freed. ! 138: .Ja icos "icos, isin, isqrt: accurate scaled functions ! 139: .nf ! 140: fract icos(x) angle(x); ! 141: fract isin(x) angle x; ! 142: long isqrt(x) long x; ! 143: .fi ! 144: .Jb ! 145: .Po icos ! 146: and ! 147: .Po isin ! 148: return a scaled value of their (scaled) argument. ! 149: See ! 150: .Po 3d ! 151: above. ! 152: .Ja init3 "init3: initialise the 3d geometry world ! 153: init3(v, d, s) Bitmap *v; ! 154: .Jb ! 155: .Po init3 ! 156: initialises the matrix stack ! 157: (see ! 158: .Po push3 below). ! 159: .Po v ! 160: is the Bitmap for the image. ! 161: .Po d/s ! 162: is the distance to the screen whose half-width is 1. ! 163: .Ja kbdstr "kbdstr: enter a string from the keyboard ! 164: kbdstr(s) char *s; ! 165: .Jb ! 166: .Po kbdstr ! 167: displays the given text in a box 300 pixels long and allows the user to ! 168: type after the prompt. ! 169: The erase and kill characters are ! 170: .Po BS ! 171: and ! 172: .Po @ ! 173: respectively. ! 174: Author: Andrew Hume. ! 175: .Ja mhit "mhit: extended analog to menuhit ! 176: NMitem *mhit(m, but, 0) NMenu *m; ! 177: .Jb ! 178: .Po mhit ! 179: supports cascading menus with help. ! 180: Menus may be a static list of ! 181: .Po MNitem ! 182: or a generating function. ! 183: .Po mhit ! 184: may be called with a button argument of 2 or 3 only. ! 185: Button 1 causes the help message associated with the currently ! 186: highlighted entry to be displayed. ! 187: The menu items (and help messages) scroll. ! 188: Author: Andrew Hume. ! 189: .Ja polyture "polyture: texture a polygon ! 190: .nf ! 191: polyture(bp, pts, n, t, c) Bitmap *bp; Point *pts; Texture *t; Code c; ! 192: .fi ! 193: .Jb ! 194: .Po Polyture ! 195: textures with mode ! 196: .Po c ! 197: the polygon bounded by and including the ! 198: .Po n ! 199: vertices specified by ! 200: .Po pts . ! 201: The list should be closed, i.e. ! 202: .Po pts[0]==pts[n-1] . ! 203: Author: Andrew Hume. ! 204: .Ja push3 "push3, pop3: manipulate the 3d matrix stack ! 205: .nf ! 206: push3() ! 207: pop() ! 208: .fi ! 209: .Jb ! 210: .Po push3 ! 211: pushes a copy of the top of the matrix stack onto the matrix stack. ! 212: .Po pop3 ! 213: throws away the top of the matrix stack. ! 214: .Ja rot3 "rot3, rosc3: rotate a matrix ! 215: .nf ! 216: rot3(theta, axis) angle theta; ! 217: rotsc3(s, c, axis) short s, c; ! 218: .fi ! 219: .Jb ! 220: These routines rotate the top of the matrix stack about the specified axis. ! 221: .Po rot3(theta,\ axis) ! 222: is identical to ! 223: .Po rotsc3(isin(theta),\ icos(theta),\ axis) . ! 224: .Ja todo "3d stuff to be done ! 225: .nf ! 226: Hcoord hcoord(x,y,z,w) fract x, y, z, w; ! 227: scale3(p) Hcoord p; ! 228: tran3(p) Hcoord p; ! 229: ident(m) matrix m; ! 230: xform3(m) matrix m; ! 231: long dot(a, b) Hcoord a, b; ! 232: Hcoord unitize(x) Hcoord(x); ! 233: Hcoord cross(a, b) Hcoord a, b; ! 234: look3(e, l, u) Hcoord e, l, u; ! 235: move3(p) Hcoord p; ! 236: line3(p) Hcoord p; ! 237: .fi ! 238: .Jb ! 239: These have yet to be documented.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.