home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume20 / pexdraw / part10 < prev    next >
Encoding:
Text File  |  1993-06-07  |  61.6 KB  |  2,077 lines

  1. Newsgroups: comp.sources.x
  2. From: jch@okimicro.oki.com (Jan Hardenbergh)
  3. Subject: v20i020:  pexdraw - A PEX drawing program, Part10/14
  4. Message-ID: <1993Jun8.150218.19247@sparky.imd.sterling.com>
  5. X-Md4-Signature: 7d08faebcaf1664665a5294de6acea41
  6. Sender: chris@sparky.imd.sterling.com (Chris Olson)
  7. Organization: Sterling Software
  8. Date: Tue, 8 Jun 1993 15:02:18 GMT
  9. Approved: chris@sparky.imd.sterling.com
  10.  
  11. Submitted-by: jch@okimicro.oki.com (Jan Hardenbergh)
  12. Posting-number: Volume 20, Issue 20
  13. Archive-name: pexdraw/part10
  14. Environment: X11R5, PEX
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then feed it
  18. # into a shell via "sh file" or similar.  To overwrite existing files,
  19. # type "sh file -c".
  20. # Contents:  pexdrawc.2 pexdrawu.3
  21. # Wrapped by chris@sparky on Tue Jun  8 09:46:34 1993
  22. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  23. echo If this archive is complete, you will see the following message:
  24. echo '          "shar: End of archive 10 (of 14)."'
  25. if test -f 'pexdrawc.2' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'pexdrawc.2'\"
  27. else
  28.   echo shar: Extracting \"'pexdrawc.2'\" \(29508 characters\)
  29.   sed "s/^X//" >'pexdrawc.2' <<'END_OF_FILE'
  30. X  } else if (OCData->oc_type  == PEXOCTriangleStrip ) {
  31. X    nPoints = OCData->data.TriangleStrip.count;
  32. X    p = OCData->data.TriangleStrip.vertices.no_data;
  33. X  } else if (OCData->oc_type  == PEXOCNURBCurve ) {
  34. X    if (OCData->data.NURBCurve.rationality == PEXRational) {
  35. X      int i;
  36. X      double w;
  37. X      for (i = 0; i < OCData->data.NURBCurve.count; i++ ) {
  38. X    w = 1.0 / OCData->data.NURBCurve.points.point_4d[i].w;
  39. X    OCData->data.NURBCurve.points.point[i].x = 
  40. X      OCData->data.NURBCurve.points.point_4d[i].x * w;
  41. X    OCData->data.NURBCurve.points.point[i].y = 
  42. X      OCData->data.NURBCurve.points.point_4d[i].y * w;
  43. X    OCData->data.NURBCurve.points.point[i].z = 
  44. X      OCData->data.NURBCurve.points.point_4d[i].z * w;
  45. X      }
  46. X    }
  47. X
  48. X    nPoints = OCData->data.NURBCurve.count;
  49. X    p = OCData->data.NURBCurve.points.point;
  50. X  } else if (OCData->oc_type  == PEXOCText ) {
  51. X
  52. X    PEXSetElementPtr( theDisplay, theSelectedStrux, PEXBeginning,  5 );
  53. X
  54. X    if (GetTextRect(OCData, theSelectedStrux, theSelectedElement-1, &p)) {
  55. X      nPoints = 4;
  56. X    } else {
  57. X      nPoints = 1;
  58. X      p = &OCData->data.EncodedText.origin;
  59. X    }
  60. X  } else {
  61. X    printf("imagine a Motif alarm! selecting unknown element type %d\n",
  62. X       OCData->oc_type );
  63. X    PEXFreeOCData(count, OCData);
  64. X    free(eData);
  65. X    return (1);
  66. X  }
  67. X
  68. X/* do not need this now.
  69. X   if (!(PEXFetchElements( theDisplay, theSelectedStrux,
  70. X               PEXBeginning, MATRIX_ELEM,
  71. X               PEXBeginning, MATRIX_ELEM, theFF,
  72. X               &count, &length, &edata ))) { return; }
  73. X
  74. X  matrixOC = PEXDecodeOCs( theFF, count, length, eData );
  75. X  XFree((char *)eData);
  76. X
  77. X  theMCMatrix.strux = theSelectedStrux;
  78. X  theMCMatrix.seqNo = ++theMCSeqNo;
  79. X  bcopy( theMCMatrix.matrix, 
  80. X    matrixOC->data.SetLocalTransform.transform, sizeof(PEXMatrix));
  81. X*/
  82. X  nGot = theRenderProcs.MapMCToX(&theMCMatrix, nPoints, p, points );
  83. X
  84. X  PEXFreeOCData(count, OCData);
  85. X  PEXFreeOCData(count, matrixOC);
  86. X  free(eData);
  87. X
  88. X  if (nGot != nPoints) return (error);
  89. X
  90. X  *nPoints_return = nPoints;
  91. X  return (0);
  92. X}
  93. X
  94. X/*************************************************************************
  95. X * InsertMClipCmd - take two points and create a positiion & vector, that
  96. X * defines a model clipping plane.
  97. X * Wow is me, the UI for this should really be thought out more. For now,
  98. X * We will put:
  99. X *  - marker color
  100. X *  - line - When selected.
  101. X *  - marker
  102. X *  - model clip indicator
  103. X *  - model clip volume
  104. X */
  105. Xvoid InsertMClipCmd( points, select )
  106. X     PEXCoord *points;
  107. X     int select;
  108. X{
  109. X  PEXStructure strux;
  110. X  int error, e;
  111. X  PEXHalfSpace halfSpace;
  112. X
  113. X  if ( theSelectedElement != -1 ) {
  114. X    strux = theSelectedStrux;
  115. X  } else if (theNewStrux != 0) {
  116. X    strux = theNewStrux;
  117. X  }
  118. X
  119. X  if ( theSelectedElement != -1 ) {
  120. X    ClearSelection();
  121. X  }
  122. X
  123. X  halfSpace.point = points[0];
  124. X  halfSpace.vector.x = points[1].x - points[0].x;
  125. X  halfSpace.vector.y = points[1].y - points[0].y;
  126. X  halfSpace.vector.z = points[1].z - points[0].z;
  127. X
  128. X  PEXNormalizeVectors(1, &halfSpace.vector, &halfSpace.vector);
  129. X
  130. X  points[1].x = points[0].x + halfSpace.vector.x;
  131. X  points[1].y = points[0].y + halfSpace.vector.y;
  132. X  points[1].z = points[0].z + halfSpace.vector.z;
  133. X
  134. X  PEXSetElementPtr( theDisplay, strux, PEXBeginning, FACE_CULL_ELEM );
  135. X  PEXNoop(theDisplay, strux, PEXOCStore); /* where color usuall goes */
  136. X  PEXSetMarkerColorIndex( theDisplay, strux, PEXOCStore, 7);
  137. X  PEXMarkers(theDisplay, strux, PEXOCStore, 2, points);
  138. X  if (select) PEXPolyline(theDisplay, strux, PEXOCStore, 2, points);
  139. X
  140. X  PEXSetModelClipFlag( theDisplay, strux, PEXOCStore, PEXClip );
  141. X  PEXSetModelClipVolume( theDisplay, strux, PEXOCStore,
  142. X               PEXModelClipIntersection, 1, &halfSpace );
  143. X
  144. X  if (select) {
  145. X    theSelectedStrux = strux;
  146. X    theSelectedElement = FACE_CULL_ELEM + 2;
  147. X  }
  148. X}
  149. X
  150. X/*************************************************************************
  151. X * DumpStrux
  152. X *
  153. X * In: strux   - structure to dump
  154. X *     element - is -1 do whole structure, else just that one
  155. X *     pretty  - use pretty formatting, dump into Motif window???
  156. X */
  157. Xvoid
  158. XDumpStrux( strux, element, pretty )
  159. X     long strux;
  160. X     long element;
  161. X     int pretty;
  162. X{
  163. X  char *eData, *eStuff;
  164. X  PEXOCData *ocd, *OCData;
  165. X  int i, start;
  166. X  unsigned long count, length;
  167. X
  168. X  if (element != -1) {
  169. X    if (!(PEXFetchElements( theDisplay, strux,
  170. X                 PEXBeginning, element, PEXBeginning, element, 
  171. X                 theFF, &count, &length, &eData  ))) { return; }
  172. X    start = element;
  173. X  } else {
  174. X    if (!(PEXFetchElements( theDisplay, strux,
  175. X                 PEXBeginning, 1, PEXEnd, 0, theFF,
  176. X                 &count, &length, &eData ))) { return; }
  177. X    start = 1;
  178. X  }
  179. X
  180. X  if (eData) printf("fetch!\n");
  181. X
  182. X  OCData = PEXDecodeOCs( theFF, count, length, eData );
  183. X  for (i = 0, ocd = OCData; i < count; i++, start++) {
  184. X    printf("%d element is type %d - first 12 bytes %x, %x, %x\n", start,
  185. X       ocd->oc_type, ocd->data.FillAreaSet.shape_hint, 
  186. X       ocd->data.FillAreaSet.ignore_edges,
  187. X       ocd->data.FillAreaSet.contour_hint );
  188. X
  189. X    ocd++;
  190. X  }
  191. X  PEXFreeOCData(count, OCData);
  192. X
  193. X  XFree(eData);
  194. X}
  195. X
  196. X/*************************************************************************
  197. X * PrintElement - dump out the element contents in hex.
  198. X */
  199. X/*
  200. Xvoid
  201. XPrintElement( long struxID, long element, long ocType, long eSize,
  202. X          char *elem_data )
  203. X{
  204. X  long i, *p;
  205. X}
  206. X*/
  207. X /*************************************************************************
  208. X * ResizeWindow
  209. X *
  210. X * uses rubber sheet. The alternative would be porthole.
  211. X *
  212. X * It changes the Workstation Window (NPC) to the aspect ratio of the window.
  213. X * It changes the Workstation Viewport (DC) to the size of the window.
  214. X *
  215. X * To do porthole, the Workstation Window would move around NPC. The
  216. X * Workstation Viewport would still be the whole window.
  217. X *
  218. X * Watch out for X Window, View Window and Workstation Window confusion.
  219. X */
  220. Xvoid ResizeWindow( w, width, height)
  221. X     Window w;
  222. X     int width;
  223. X     int height;
  224. X{
  225. X   float d, minx, maxx, miny, maxy;
  226. X   PEXNPCSubVolume  volume;
  227. X   PEXViewport  viewport; 
  228. X   
  229. X   theRenderProcs.ReconfigureWindow( w, width, height );
  230. X
  231. X   if (width > height) {
  232. X      minx = theWindowCenterX - theWindowSize;
  233. X      maxx = theWindowCenterX + theWindowSize;
  234. X      d = (float)(height)/(float)(width);
  235. X      miny = theWindowCenterY - theWindowSize*(d);
  236. X      maxy = theWindowCenterY + theWindowSize*(d);
  237. X   }
  238. X   else {
  239. X      miny = theWindowCenterY - theWindowSize;
  240. X      maxy = theWindowCenterY + theWindowSize;
  241. X      d = (float)(width)/(float)(height);
  242. X      minx = theWindowCenterX - theWindowSize*(d);
  243. X      maxx = theWindowCenterX + theWindowSize*(d);
  244. X   }
  245. X
  246. X   viewport.min.x = 0.0;
  247. X   viewport.max.x = width;
  248. X   viewport.min.y = 0.0;
  249. X   viewport.max.y = height;
  250. X   viewport.min.z = 0.0;
  251. X   viewport.max.z = 1.0;
  252. X   viewport.use_drawable = 1; 
  253. X    
  254. X   volume.min.x = (float)minx;
  255. X   volume.max.x = (float)maxx;
  256. X   volume.min.y = (float)miny;
  257. X   volume.max.y = (float)maxy;
  258. X   volume.min.z = 0.0;
  259. X   volume.max.z = 1.0;
  260. X
  261. X   theRenderProcs.SetNPCToDC( &volume, &viewport );
  262. X}
  263. X
  264. X/*************************************************************************
  265. X * InitLights - random init of two lights.
  266. X */
  267. XInitLights()
  268. X{
  269. X  PEXLightEntry            light;
  270. X
  271. X  light.type = PEXLightAmbient;
  272. X  light.color.type = PEXColorTypeRGB;
  273. X  light.color.value.rgb.red   =  AmbientColor[0];
  274. X  light.color.value.rgb.green =  AmbientColor[1];
  275. X  light.color.value.rgb.blue  =  AmbientColor[2];
  276. X  PEXSetTableEntries(theDisplay,theLightLUT,1,1,PEXLUTLight,(char *)&light);
  277. X
  278. X  light.type = PEXLightWCVector;
  279. X  light.color.type = PEXColorTypeRGB;
  280. X  light.color.value.rgb.red   =  LightColor[0];
  281. X  light.color.value.rgb.green =  LightColor[1];
  282. X  light.color.value.rgb.blue  =  LightColor[2];
  283. X  light.direction.x = LightVector[0];
  284. X  light.direction.y = LightVector[1];
  285. X  light.direction.z = LightVector[2];
  286. X  PEXSetTableEntries(theDisplay,theLightLUT,2,1,PEXLUTLight,(char *)&light);
  287. X
  288. X  /* set up light state info for structure elements */
  289. X  theLightsOn[0] = 1;
  290. X  theLightsOn[1] = 2;
  291. X  theLightsOnCount = 2;
  292. X  theLightsOffCount = 0;
  293. X}
  294. X
  295. X/*************************************************************************
  296. X * StartSpinning - install oneSpin as a Motif "work proc"
  297. X *
  298. X * set up the Global theSpinInfo to allow oneSpin to incrementally spin
  299. X * theNewStrux. This is installed as a Motif work proc and gets called
  300. X * whenever the XtMainLoop has nothing better to do.
  301. X *
  302. X * SEE ALSO, StopSpinning().  This sets theSpinInfo.stop which gets returned
  303. X * by oneSpin each time it is called.  A non-zero value mean that the work
  304. X * proc is done.
  305. X */
  306. Xint
  307. XStartSpinning(sid)
  308. X     PEXStructure sid;
  309. X{
  310. X  SpinInfo *si;
  311. X  int i;
  312. X
  313. X  if (GetSpinInfo(sid)) return (0); /* it's going, don't bother */
  314. X
  315. X  si = (SpinInfo *)malloc(sizeof(SpinInfo));
  316. X
  317. X  si->strux = sid;
  318. X  /*
  319. X   * If I weren't such a wimp I'd get the matrix and decompose it so we start
  320. X   * from the right place, tick, tick...
  321. X   */
  322. X  si->point.x = 0.0;
  323. X  si->point.y = 0.0;
  324. X  si->point.z = 0.0;
  325. X  si->offset.x = 0;
  326. X  si->offset.y = 0;
  327. X  si->offset.z = 0;
  328. X  si->scale.x = 1.0;
  329. X  si->scale.y = 1.0;
  330. X  si->scale.z = 1.0;
  331. X  si->x_ang = 0.0;
  332. X  si->y_ang = 0.0;
  333. X  si->z_ang = 0.0;
  334. X  si->delta_x = ((float)(theSpinList.count+1))/10.0;
  335. X  si->delta_y = (float)0.1;
  336. X  si->delta_z = 0.0;
  337. X
  338. X  si->wk_id = theRenderObj;
  339. X  si->dpy = theDisplay;
  340. X  si->stop = 0;
  341. X  si->next = theSpinList.listHead;
  342. X  theSpinList.count++;
  343. X  theSpinList.listHead = si;
  344. X
  345. X  if (theSpinList.count == 1)
  346. X  AddWorkProc(manageSpin,(char *)si);
  347. X
  348. X  return (1); /* we started something spinning */
  349. X}
  350. X
  351. XSpinInfo *
  352. XGetSpinInfo(sid)
  353. X     PEXStructure sid;
  354. X{
  355. X  SpinInfo *si;
  356. X  int i;
  357. X
  358. X  if (theSpinList.count == 0) theSpinList.listHead = (SpinInfo *)0; /* mem leak */
  359. X  /*
  360. X   * first check to make sure we are not spinning this strux already
  361. X   */
  362. X  si = theSpinList.listHead;
  363. X  for (i=0; i < theSpinList.count; i++) { /* what me trust linked lists? */
  364. X    if (si == (SpinInfo *)0) {
  365. X      printf("imagine there's no heaven, -John Lennon\n");
  366. X      /* oh, just let it crash */
  367. X    }
  368. X    if (si->strux == sid) return (si);
  369. X    si = si->next;
  370. X  }
  371. X  return ((SpinInfo *)0);
  372. X}
  373. X
  374. X/*************************************************************************
  375. X * oneSpin - Motif "work proc" for spinning a structure
  376. X *
  377. X * there is a bug in Xt that prevents multiple work procs from getting
  378. X * time. So this one WorkProc manages all of the spins.
  379. X * If Xt could round robin the workProcs, then oneSpin would be the
  380. X * work proc.
  381. X */
  382. Xint manageSpin(client_data)
  383. X     char *client_data;
  384. X{
  385. X  SpinInfo *si;
  386. X  int error;
  387. X  int stop = 1;
  388. X  int i;
  389. X  
  390. X  /*
  391. X   * walk through list, call oneSpin for each.
  392. X   */
  393. X  si = theSpinList.listHead;
  394. X  for (i=0; i < theSpinList.count; i++) { /* what me trust linked lists? */
  395. X    if (si == (SpinInfo *)0) {
  396. X      printf("imagine there's no heaven, -John Lennon\n");
  397. X      /* oh, just let it crash */
  398. X    }
  399. X    if (!oneSpin((char *)si)) stop = 0;
  400. X    si = si->next;
  401. X  }
  402. X  theRenderProcs.ReDraw();
  403. X
  404. X  XSync(theDisplay, 0); /* perhaps save the first display? */
  405. X
  406. X  return (stop);
  407. X}
  408. X
  409. X/*************************************************************************
  410. X * oneSpin - Motif "work proc" for spinning a structure
  411. X */
  412. Xint oneSpin(client_data)
  413. X     char *client_data;
  414. X{
  415. X  SpinInfo *si;
  416. X  int error;
  417. X
  418. X  si = (SpinInfo *)client_data;
  419. X
  420. X  if (si->stop) return (si->stop);
  421. X/*
  422. X * go to replace mode because we just want to bang that matrix a bunch of
  423. X * times. err... well in this case, just once.
  424. X */
  425. X  PEXSetEditingMode(theDisplay, si->strux, PEXStructureReplace );
  426. X  PEXSetElementPtr( theDisplay, si->strux, PEXBeginning,  MATRIX_ELEM );
  427. X
  428. X  si->x_ang += si->delta_x;
  429. X  si->y_ang += si->delta_y;
  430. X  si->z_ang += si->delta_z;
  431. X
  432. X  theMCMatrix.seqNo = ++theMCSeqNo;
  433. X  PEXBuildTransform(&si->point, &si->offset,
  434. X    si->x_ang, si->y_ang, si->z_ang, &si->scale, 
  435. X    theMCMatrix.matrix);
  436. X
  437. X  PEXSetLocalTransform(theDisplay, si->strux, PEXOCStoreSingle, PEXReplace, 
  438. X               theMCMatrix.matrix);
  439. X  PEXSetEditingMode(theDisplay, si->strux, PEXStructureInsert );
  440. X
  441. X  return (si->stop);
  442. X}
  443. X/*************************************************************************
  444. X * StopSpinning(sidToStop)
  445. X *
  446. X * When Is Making Possible: to free the spin memory.
  447. X */
  448. Xint
  449. XStopSpinning(sid)
  450. X     PEXStructure sid;
  451. X{
  452. X  SpinInfo *si, *presi;
  453. X  int i;
  454. X
  455. X  si = theSpinList.listHead;
  456. X  if (sid == (PEXStructure)-1) {
  457. X    for (i=0; i < theSpinList.count; i++) { /* what me trust linked lists? */
  458. X      si->stop = 1;
  459. X      si = si->next;
  460. X    }
  461. X    theSpinList.count = 0;
  462. X    return (2);
  463. X  }
  464. X  /*
  465. X   * first check to make sure we are not spinning this strux already
  466. X   */
  467. X  presi = (SpinInfo *)0;
  468. X  si = theSpinList.listHead;
  469. X  for (i=0; i < theSpinList.count; i++) { /* what me trust linked lists? */
  470. X    if (si == (SpinInfo *)0) {
  471. X      printf("imagine there's no heaven, -John Lennon\n");
  472. X      /* oh, just let it crash */
  473. X    }
  474. X    if (si->strux == sid) {
  475. X      si->stop = 1;
  476. X      if (presi == (SpinInfo *)0) {
  477. X    theSpinList.listHead = si->next;
  478. X      } else {
  479. X    presi->next = si->next;
  480. X    return (1);
  481. X      }
  482. X      theSpinList.count--;
  483. X    }
  484. X    si = si->next;
  485. X  }
  486. X  return (0); /* nothing started */
  487. X}
  488. X/*************************************************************************
  489. X * ReadArchiveFile
  490. X *
  491. X * Find all of the root structures - first find all structres and weed out
  492. X *  those that are instanced by others.
  493. X * Read the whole archive, should do this be reading networks of posters, but..
  494. X * Post all of the poster candidates.
  495. X */
  496. Xint ReadArchiveFile(filename)
  497. X  char *filename;
  498. X{
  499. X  char *command;
  500. X  int len1;
  501. X  XID newStrux;
  502. X  int enough = 200;
  503. X  
  504. X  len1 = strlen(filename);
  505. X  command = (char *)malloc(len1+enough);
  506. X  if (!command)   {printf("can't malloc %s\n",filename); return (-1);}
  507. X  strcat(command,filename);
  508. X  
  509. X  newStrux = InitStrux();
  510. X  XSync(theDisplay, 0);
  511. X
  512. X  strcat(&command[len1]," -display ");
  513. X  len1 += strlen(" -display ");
  514. X  strcat(&command[len1],DisplayString(theDisplay));
  515. X  len1 += strlen(DisplayString(theDisplay));
  516. X  strcat(&command[len1]," -strux ");
  517. X  len1 += strlen(" -strux ");
  518. X  sprintf(&command[len1],"%d\n",newStrux);
  519. X  printf(" system >%s< \n",command);
  520. X  system(command);
  521. X  free(command);
  522. X}
  523. X
  524. X/*************************************************************************
  525. X *  WriteArchiveFile
  526. X */
  527. Xint WriteArchiveFile(filename)
  528. X     char *filename;
  529. X{
  530. X  int arid;
  531. X
  532. X  printf("closed archive file %s\n", filename);
  533. X}
  534. X
  535. X
  536. X/*************************************************************************
  537. X * SolidToggleCmd - ideally this should inquire the state, if solid
  538. X * make hollow, if hollow make solid and return the state so the menu
  539. X * can give the user feedback about the state.
  540. X */
  541. Xint 
  542. XInteriorStyleCmd(style)
  543. X     int style;
  544. X{
  545. X  long strux;
  546. X
  547. X  if ( theSelectedElement != -1 ) {
  548. X    strux =  theSelectedStrux;
  549. X  } else {
  550. X    if (theNewStrux == 0) theNewStrux = InitStrux();
  551. X    strux =  theNewStrux;
  552. X  }
  553. X
  554. X  PEXSetEditingMode(theDisplay, strux, PEXStructureReplace );
  555. X  PEXSetElementPtr( theDisplay, strux, PEXBeginning,  INT_STYLE_ELEM );
  556. X  PEXSetInteriorStyle(theDisplay, strux, PEXOCStoreSingle, style);
  557. X  PEXSetEditingMode(theDisplay, strux, PEXStructureInsert );
  558. X
  559. X  return (0);
  560. X}
  561. X
  562. Xint SurfaceInterpCmd( method)
  563. X     int method;
  564. X{
  565. X  long strux;
  566. X
  567. X  if ( theSelectedElement != -1 ) {
  568. X    strux =  theSelectedStrux;
  569. X  } else {
  570. X    if (theNewStrux == 0) theNewStrux = InitStrux();
  571. X    strux =  theNewStrux;
  572. X  }
  573. X
  574. X  PEXSetEditingMode(theDisplay, strux, PEXStructureReplace );
  575. X  PEXSetElementPtr( theDisplay, strux, PEXBeginning, INT_SHAD_ELEM );
  576. X  PEXSetSurfaceInterpMethod(theDisplay, strux, PEXOCStoreSingle, method );
  577. X  PEXSetEditingMode(theDisplay, strux, PEXStructureInsert );
  578. X
  579. X  return (0);
  580. X}
  581. X
  582. X/*************************************************************************
  583. X *
  584. X */
  585. Xint FacetCullingCmd( mode)
  586. X     int mode;
  587. X{
  588. X  long strux;
  589. X  PEXElementInfo *eInfo;
  590. X  unsigned long count;
  591. X
  592. X  if ( theSelectedElement != -1 ) {
  593. X    strux =  theSelectedStrux;
  594. X  } else {
  595. X    if (theNewStrux == 0) theNewStrux = InitStrux();
  596. X    strux =  theNewStrux;
  597. X  }
  598. X
  599. X  PEXSetEditingMode(theDisplay, strux, PEXStructureReplace );
  600. X  PEXSetElementPtr( theDisplay, strux, PEXBeginning, FACE_CULL_ELEM);
  601. X/*
  602. X * check to make sure there is a facet culling OC here, if not insert.
  603. X */
  604. X  if(PEXGetElementInfo(theDisplay, strux, PEXBeginning, FACE_CULL_ELEM,
  605. X            PEXBeginning, FACE_CULL_ELEM, theFF, &count, &eInfo )){
  606. X    if ((count != 1) || (eInfo->type != PEXOCFacetCullingMode)) {
  607. X      PEXSetEditingMode(theDisplay, strux, PEXStructureInsert );
  608. X      PEXSetElementPtr( theDisplay, strux, PEXCurrent, -1);
  609. X      if (theSelectedElement != -1 ) theSelectedElement++;
  610. X    }
  611. X  } else { printf("PEXGetStructureInfo failed\n");}
  612. X
  613. X  PEXSetFacetCullingMode(theDisplay, strux, PEXOCStoreSingle, mode );
  614. X  PEXSetEditingMode(theDisplay, strux, PEXStructureInsert );
  615. X
  616. X  return (0);
  617. X}
  618. X
  619. Xint ReflectionAttributesCmd(reflAttrs)
  620. X     PEXReflectionAttributes *reflAttrs;
  621. X{
  622. X  long strux;
  623. X
  624. X  if ( theSelectedElement != -1 ) {
  625. X    strux =  theSelectedStrux;
  626. X  } else {
  627. X    if (theNewStrux == 0) theNewStrux = InitStrux();
  628. X    strux =  theNewStrux;
  629. X  }
  630. X
  631. X  PEXSetEditingMode(theDisplay, strux, PEXStructureReplace );
  632. X  PEXSetElementPtr( theDisplay, strux, PEXBeginning, REFL_ATTRS_ELEM );
  633. X  PEXSetReflectionAttributes(theDisplay, strux, PEXOCStoreSingle, reflAttrs );
  634. X  PEXSetEditingMode(theDisplay, strux, PEXStructureInsert );
  635. X
  636. X  return (0);
  637. X}
  638. X
  639. Xvoid
  640. XDumpStruxCmd(pretty)
  641. X     int pretty;
  642. X{
  643. X    if ( theSelectedElement != -1 ) {
  644. X      DumpStrux(theSelectedStrux, -1, pretty ); 
  645. X    } else if (theNewStrux != 0){
  646. X      DumpStrux(theNewStrux, -1, pretty ); 
  647. X    }
  648. X  }
  649. X
  650. X/*************************************************************************
  651. X * From posting by Alan Paeth
  652. X *
  653. XPlatonic Solids (regular and quasi-regular, Kepler-Poinset star solids omitted)
  654. X
  655. XThe orientations minimize the number of distinct coordinates, thereby revealing
  656. Xboth symmetry groups and embedding (eg, tetrahedron in cube in dodecahedron).
  657. XConsequently, the latter is depicted resting on an edge (Z taken as up/down).
  658. X
  659. XSOLID         VERTEX COORDINATES
  660. X-----------      -------------------
  661. XTetrahedron      (  1,  1,  1), (  1, -1, -1), ( -1,  1, -1), ( -1, -1,  1)
  662. XCube             (+-1,+-1,+-1)
  663. XOctahedron       (+-1,  0,  0), (  0,+-1,  0), (  0,  0,+-1)
  664. XCubeoctahedron   (  0,+-1,+-1), (+-1,  0,+-1), (+-1,+-1,  0)
  665. XIcosahedron      (  0,+-p,+-1), (+-1,  0,+-p), (+-p,+-1,  0)
  666. XDodecahedron     (  0,+-i,+-p), (+-p,  0,+-i), (+-i,+-p,  0), (+-1,+-1,+-1)
  667. XIcosidodecahedron(+-2,  0,  0), (  0,+-2,  0), (  0,  0,+-2), ...
  668. X                 (+-p,+-i,+-1), (+-1,+-p,+-i), (+-i,+-1,+-p)
  669. X
  670. Xwith golden mean: p = (sqrt(5)+1)/2; i = (sqrt(5)-1)/2 = 1/p = p-1
  671. X------------------------------------------------------------------------------
  672. X
  673. X   /Alan Paeth
  674. X   Computer Graphics Laboratory
  675. X   University of Waterloo
  676. X
  677. XWhy am I doing this split tristrip, when I should be writing!!!
  678. X
  679. Xwhile (i<n) {
  680. X t1[j] = v[i], n1[j] = vn[i]
  681. X t1[j+1] = (v[i]+v[i+1])/2, n[j+1] = vn[i]+vn[i+1]/2 Normalize
  682. X t1[j+2] = (v[i]+v[i+2])/2, n[j+2] = vn[i]+vn[i+2]/2 Normalize
  683. X t1[j+3] = (v[i+1]+v[i+2])/2, n[j+3] = vn[i+1]+vn[i+2]/2 Normalize
  684. X
  685. X if length is odd and i = n-2 then skip this.
  686. X
  687. X t2[j] = t1[j+1], n2[j] = n[j+1]
  688. X t2[j+1] = v[i+1], n2[j+1] = vn[i+1]
  689. X t2[j+2] = t1[j+3]
  690. X t2[j+3] = (v[i+1]+v[i+3])/2, n2[j+3] = vn[i+1]+vn[i+3]/2 Normalize
  691. X
  692. X j += 4;
  693. X i += 2;
  694. X }
  695. X
  696. X*/
  697. X
  698. Xstatic int cohCount = 0;
  699. Xstatic PEXCoord cohVertex[] = { {0,1,1},{1,1,0},{1,0,1},{1,0,-1},{1,-1,0},
  700. X {0,-1,-1},{0,-1,1},{-1,-1,0},{-1,0,1},{-1,0,-1},{-1,1,0},{0,1,-1},
  701. X {0,1,1},{1,1,0}, /* duplicate */ {1,1,0},{0,1,-1}, {1,0,-1}, 
  702. X {-1,0,-1}, {0,-1,-1}, {-1,-1,0},{-1,-1,0}, /*duplicate, web, duplicate */
  703. X {-1,1,0},{-1,1,0},{0,1,1},{-1,0,1},{1,0,1},{0,-1,1},{1,-1,0}};
  704. X
  705. X#define R3I .577
  706. X
  707. X/* this is sort of interesting, but let's use the utility */
  708. X#ifdef NOT_DEF
  709. Xstatic PEXVector cohNormals[] = { {R3I,R3I,R3I},{1,0,0},{1,0,0},{R3I,-R3I,-R3I},{0,-1,0},
  710. X {0,-1,0},{-R3I,-R3I,R3I},{-1,0,0},{-1,0,0},{-R3I,R3I,-R3I},{0,1,0},{0,1,0},
  711. X {R3I,R3I,-R3I},{R3I,R3I,-R3I}, /* duplicate now 14,15 */ {0,0,-1},{0,0,-1}, {-R3I,-R3I,-R3I}, 
  712. X {-R3I,-R3I,-R3I}, {-R3I,-R3I,-R3I}, {-R3I,-R3I,-R3I},{-R3I,R3I,R3I}, /*duplicate, web, duplicate */
  713. X {-R3I,R3I,R3I},{0,0,1},{0,0,1},{0,0,1},{0,0,1}};
  714. X#endif
  715. X
  716. X#define COH_VERTS 28
  717. X
  718. Xlong
  719. XCubeoctahedron(offset, radius)
  720. X     PEXCoord *offset;
  721. X     double radius;
  722. X{
  723. X  PEXVertexNormal        vertex_data[COH_VERTS];
  724. X  PEXVertexNormal        *nv1, *nv2;
  725. X  PEXCoord p[2];
  726. X  float sq2;
  727. X  int i, j;
  728. X  long strux;
  729. X  PEXArrayOfFacetData facetNormals;
  730. X  PEXVector *fn1, *fn2;
  731. X  PEXArrayOfVertex too;  /* should be able to cast these somehow, too late */
  732. X  PEXVector cohNormals[COH_VERTS];
  733. X
  734. X  strux = InitStrux();
  735. X
  736. X  PEXSetLineColorIndex( theDisplay, strux, PEXOCStore, 2);
  737. X  
  738. X  p[0].x = 0; p[0].y = 0; p[0].z = 0;
  739. X  p[1].x = offset->x*radius;
  740. X  p[1].y = offset->y*radius;
  741. X  p[1].z = offset->z*radius;
  742. X  PEXPolyline(theDisplay, strux, PEXOCStore, 2, p );
  743. X
  744. X/*
  745. X * if we are passing though an odd pass insert a NURB sphere.
  746. X */
  747. X
  748. X  if (cohCount++ & 0x1) {
  749. X    too.normal = vertex_data;    
  750. X
  751. X/* this is now done in the pipeline context.
  752. X *   PEXSetSurfaceApprox(theDisplay, strux, PEXOCStore, 
  753. X *            PEXApproxConstantBetweenKnots, 2.0, 2.0 );
  754. X */
  755. X    PEXSetSurfaceColorIndex( theDisplay, strux, PEXOCStore, 5 );
  756. X    InsertNURBSphere( theDisplay, strux );
  757. X
  758. X  } else {
  759. X
  760. X    /*
  761. X     * generate the cubo
  762. X     */
  763. X    sq2 = sqrt((double)2.0) / 2.0;
  764. X    
  765. X    for (i = 0; i < COH_VERTS; i++ ) {
  766. X      vertex_data[i].point.x = offset->x + radius*cohVertex[i].x;
  767. X      vertex_data[i].point.y = offset->y + radius*cohVertex[i].y;
  768. X      vertex_data[i].point.z = offset->z + radius*cohVertex[i].z;
  769. X      vertex_data[i].normal.x = sq2*cohVertex[i].x;
  770. X      vertex_data[i].normal.y = sq2*cohVertex[i].y;
  771. X      vertex_data[i].normal.z = sq2*cohVertex[i].z;
  772. X    }
  773. X#define NO_DOUBLE 1
  774. X
  775. X#ifdef NO_DOUBLE
  776. X
  777. X    PEXSetSurfaceColorIndex( theDisplay, strux, PEXOCStore, 4 );
  778. X    too.normal = vertex_data;
  779. X    facetNormals.normal = cohNormals;
  780. X    PEXGeoNormTriangleStrip( PEXGANormal, PEXGANormal,
  781. X             PEXColorTypeRGB, facetNormals, 28, too);
  782. X
  783. X    for (i = 0; i < COH_VERTS-2; i++ ) {
  784. X      cohNormals[i].x = -cohNormals[i].x;
  785. X      cohNormals[i].y = -cohNormals[i].y;
  786. X      cohNormals[i].z = -cohNormals[i].z;
  787. X    }
  788. X
  789. X    PEXTriangleStrip( theDisplay, strux, PEXOCStore, PEXGANormal, PEXGANormal,
  790. X             PEXColorTypeRGB, facetNormals, 28, too);
  791. X
  792. X#else
  793. X
  794. X/*
  795. X * double the tristrip
  796. X */
  797. X
  798. X    nv1 = (PEXVertexNormal *)malloc(COH_VERTS*4*sizeof(PEXVertexNormal));
  799. X      if (!nv1) {printf("nv1\n"); exit(1);}
  800. X    nv2 = nv1+2*COH_VERTS;
  801. X
  802. X    fn1 = (PEXVector *)malloc(COH_VERTS*4*sizeof(PEXVector));
  803. X      if (!fn1) {printf("nv1\n"); exit(1);}
  804. X    fn2 = fn1+2*COH_VERTS;
  805. X
  806. X
  807. X    i = 0; j = 0;
  808. X
  809. X#define AVERAGE(a,b,c) {a.x=(b.x+c.x)/2;a.y=(b.y+c.y)/2;a.z=(b.z+c.z)/2;}
  810. X
  811. X    while (i < COH_VERTS) {
  812. X
  813. X      nv1[j].point = vertex_data[i].point;
  814. X      nv1[j].normal = vertex_data[i].normal;
  815. X
  816. X      fn1[j] = cohNormals[i];
  817. X      fn1[j+1] = cohNormals[i];
  818. X      fn1[j+2] = cohNormals[i];
  819. X      fn1[j+3] = cohNormals[i+1];
  820. X
  821. X      AVERAGE(nv1[j+1].point, vertex_data[i].point, vertex_data[i+1].point);
  822. X      AVERAGE(nv1[j+1].normal, vertex_data[i].normal, vertex_data[i+1].normal);
  823. X      PEXNormalizeVectors(1, &nv1[j+1].normal, &nv1[j+1].normal);
  824. X
  825. X      AVERAGE(nv1[j+2].point, vertex_data[i].point, vertex_data[i+2].point);
  826. X      AVERAGE(nv1[j+2].normal, vertex_data[i].normal, vertex_data[i+2].normal);
  827. X      PEXNormalizeVectors(1, &nv1[j+2].normal, &nv1[j+2].normal);
  828. X
  829. X      AVERAGE(nv1[j+3].point, vertex_data[i+1].point, vertex_data[i+2].point);
  830. X      AVERAGE(nv1[j+3].normal,vertex_data[i+1].normal,vertex_data[i+2].normal);
  831. X      PEXNormalizeVectors(1, &nv1[j+3].normal, &nv1[j+3].normal);
  832. X
  833. X      /*  if length is odd and i = n-2 then skip this. */
  834. X
  835. X      nv2[j] = nv1[j+1];
  836. X
  837. X      nv2[j+1].point = vertex_data[i+1].point;
  838. X      nv2[j+1].normal = vertex_data[i+1].normal;
  839. X
  840. X      nv2[j+2] = nv1[j+3];
  841. X
  842. X      AVERAGE(nv2[j+3].point, vertex_data[i+1].point, vertex_data[i+3].point);
  843. X      AVERAGE(nv2[j+3].normal,vertex_data[i+1].normal,vertex_data[i+3].normal);
  844. X      PEXNormalizeVectors(1, &nv2[j+3].normal, &nv2[j+3].normal);
  845. X
  846. X      fn2[j] = cohNormals[i];
  847. X      fn2[j+1] = cohNormals[i+1];
  848. X      fn2[j+2] = cohNormals[i+1];
  849. X      fn2[j+3] = cohNormals[i+1];
  850. X
  851. X      j += 4;
  852. X      i += 2;
  853. X    }
  854. X    PEXSetSurfaceColorIndex( theDisplay, strux, PEXOCStore, 4 );
  855. X    too.normal = nv1;
  856. X    facetNormals.normal = fn1;
  857. X    PEXTriangleStrip( theDisplay, strux, PEXOCStore, PEXGANormal, PEXGANormal,
  858. X             PEXColorTypeRGB, facetNormals, 54, too);
  859. X
  860. X    PEXSetSurfaceColorIndex( theDisplay, strux, PEXOCStore, 4 );
  861. X    too.normal = nv2;
  862. X    facetNormals.normal = fn2;
  863. X    PEXTriangleStrip( theDisplay, strux, PEXOCStore, PEXGANormal, PEXGANormal,
  864. X             PEXColorTypeRGB, facetNormals, 54, too);
  865. X
  866. X    free(nv1);
  867. X    free(fn1);
  868. X#endif
  869. X  }
  870. X
  871. X  theRenderProcs.Post( strux );
  872. X
  873. X  return (strux);
  874. X}
  875. X/*************************************************************************
  876. X *
  877. X */
  878. Xint GetTextRect(OCData, strux, offset, rect )
  879. X     PEXOCData *OCData;
  880. X     XID strux;
  881. X     int offset;
  882. X     PEXCoord **rect;
  883. X{
  884. X  PEXTextExtent *extent;
  885. X  TextAttributes *tAttrs;
  886. X  PEXListOfEncodedText listOfEncodedText;
  887. X
  888. X/* GetTextAttributes - really needs to be a renderer function?
  889. X * No, the structure inquiry should happen in application code, getting
  890. X * the default should be from the renderer.
  891. X                      tAttrs->index, tAttrs->path,
  892. X                      tAttrs->expansion, tAttrs->spacing,
  893. X                      tAttrs->height, 
  894. X                      tAttrs->halign, tAttrs->valign, 
  895. X */
  896. X
  897. X listOfEncodedText.count = OCData->data.EncodedText.count;
  898. X listOfEncodedText.encoded_text = OCData->data.EncodedText.encoded_text;
  899. X
  900. X  XSync(theDisplay, 0);
  901. X
  902. X  extent = PEXQueryEncodedTextExtents( theDisplay, theFontLUT,
  903. X                      (unsigned int)1, PEXPathRight,
  904. X                      1.0, 0.0, 0.08, 
  905. X                      PEXVAlignNormal, PEXHAlignNormal,
  906. X                      1, &listOfEncodedText );
  907. X
  908. X  textRect[0].x = OCData->data.EncodedText.origin.x + extent->lower_left.x;
  909. X  textRect[0].y = OCData->data.EncodedText.origin.y + extent->lower_left.y;
  910. X  textRect[2].x = textRect[0].x + extent->upper_right.x;
  911. X  textRect[2].y = textRect[0].y + extent->upper_right.y;
  912. X
  913. X  textRect[1].x = textRect[2].x;
  914. X  textRect[1].y = textRect[0].y;
  915. X  textRect[3].x = textRect[0].x;
  916. X  textRect[3].y = textRect[2].y;
  917. X
  918. X  textRect[3].z = textRect[2].z = textRect[1].z = textRect[0].z = 
  919. X    OCData->data.EncodedText.origin.z;
  920. X
  921. X  *rect = textRect;
  922. X  return (1);
  923. X}
  924. X
  925. X/*************************************************************************
  926. X *
  927. X */
  928. X
  929. XInsertNURBSphere(dpy,struxid)
  930. X     Display *dpy;
  931. X     XID struxid;
  932. X{
  933. X  float uKnots[8]; /* 3 + 5 = 8 <> order + points = number of knots */
  934. X  float vKnots[12]; /* 3 + 9 = 12 */
  935. X  PEXCoord uPoints[5];
  936. X  PEXCoord vPoints[9];
  937. X  PEXCoord4D points[45];
  938. X  float uWeights[5];
  939. X  float vWeights[9];
  940. X  PEXArrayOfCoord parr;
  941. X  int i,j;
  942. X
  943. X#define SET_POINT(p,a,b,c) {(p)->x=(a);(p)->y=(b);(p)->z=(c);}
  944. X
  945. X  SET_POINT(&uPoints[0], 0, 0, -0.5); uWeights[0] = 1;
  946. X  SET_POINT(&uPoints[1], 0.5, 0, -0.5); uWeights[1] = 0.707107;
  947. X  SET_POINT(&uPoints[2], 0.5, 0, 0);  uWeights[2] = 1;
  948. X  SET_POINT(&uPoints[3], 0.5, 0, 0.5);  uWeights[3] = 0.707107;
  949. X  SET_POINT(&uPoints[4], 0, 0, 0.5);  uWeights[4] = 1;
  950. X
  951. X  uKnots[0]=0; uKnots[1]=0; uKnots[2]=0;
  952. X  uKnots[3]=1; uKnots[4]=1;
  953. X  uKnots[5]=2; uKnots[6]=2; uKnots[7]=2;
  954. X
  955. X  SET_POINT(&vPoints[0], 0, 1, 0);   vWeights[0] = 1;        
  956. X  SET_POINT(&vPoints[1], 1, 1, 0);   vWeights[1] = 0.707107; 
  957. X  SET_POINT(&vPoints[2], 1, 0, 0);   vWeights[2] = 1;        
  958. X  SET_POINT(&vPoints[3], 1, -1, 0);  vWeights[3] = 0.707107; 
  959. X  SET_POINT(&vPoints[4], 0, -1, 0);  vWeights[4] = 1;        
  960. X  SET_POINT(&vPoints[5], -1, -1, 0); vWeights[5] = 0.707107; 
  961. X  SET_POINT(&vPoints[6], -1, 0, 0);  vWeights[6] = 1;        
  962. X  SET_POINT(&vPoints[7], -1, 1, 0);  vWeights[7] = 0.707107; 
  963. X  SET_POINT(&vPoints[8], 0, 1, 0);   vWeights[8] = 1;        
  964. X
  965. X  vKnots[0]=0; vKnots[1]=0; vKnots[2]=0;
  966. X  vKnots[3]=1; vKnots[4]=1;
  967. X  vKnots[5]=2; vKnots[6]=2;
  968. X  vKnots[7]=3; vKnots[8]=3;
  969. X  vKnots[9]=4; vKnots[10]=4; vKnots[11]=4;
  970. X
  971. X  for (i = 0; i < 9; i++ ) { /* for each v point */
  972. X    for (j = 0; j < 5; j++ ) { /* for each u point */
  973. X      points[i*5+j].w = uWeights[j] * vWeights[i];
  974. X      SET_POINT(&points[i*5+j], uPoints[j].x*vPoints[i].x * points[i*5+j].w,
  975. X        uPoints[j].x*vPoints[i].y  * points[i*5+j].w,
  976. X        uPoints[j].z * points[i*5+j].w);
  977. X    }
  978. X  }
  979. X  parr.point_4d = points;
  980. X  PEXNURBSurface(dpy,struxid,PEXOCStore, PEXRational, 3, 3,
  981. X         uKnots, vKnots, 
  982. X         5, 9, parr, 0, 0 );
  983. X}
  984. X
  985. X/*************************************************************************
  986. X *
  987. X */
  988. X
  989. XInsertNURBSurface(dpy,struxid, rational)
  990. X     Display *dpy;
  991. X     XID struxid;
  992. X     int rational;
  993. X{
  994. X  float uKnots[6]; /* 3 + 5 = 8 <> order + points = number of knots */
  995. X  float vKnots[8]; /* 3 + 9 = 12 */
  996. X  PEXCoord p3[12];
  997. X  PEXCoord4D p4[12];
  998. X  PEXArrayOfCoord parr;
  999. X  int i;
  1000. X
  1001. X  uKnots[0]=0; uKnots[1]=0; uKnots[2]=0;
  1002. X  uKnots[3]=1; uKnots[4]=1; uKnots[5]=1;
  1003. X
  1004. X  vKnots[0]=0; vKnots[1]=0; vKnots[2]=0; vKnots[3]=0;
  1005. X  vKnots[4]=1; vKnots[5]=1; vKnots[6]=1; vKnots[7]=1;
  1006. X
  1007. X  SET_POINT(&p3[0], 0.0, 0.5, 0.0);
  1008. X  SET_POINT(&p3[1], 0.0, 0.6, 0.5);
  1009. X  SET_POINT(&p3[2], 0.0, 0.5, 1.0);
  1010. X  SET_POINT(&p3[3], 0.3, 0.5, 0.0);
  1011. X  SET_POINT(&p3[4], 0.3, 1.0, 0.5);
  1012. X  SET_POINT(&p3[5], 0.3, 0.5, 1.0);
  1013. X  SET_POINT(&p3[6], 0.6, 0.4, 0.0);
  1014. X  SET_POINT(&p3[7], 0.6, 0.5, 0.5);
  1015. X  SET_POINT(&p3[8], 0.6, 0.4, 1.0);
  1016. X  SET_POINT(&p3[9], 0.9, 0.5, 0.0);
  1017. X  SET_POINT(&p3[10], 0.9, 0.3, 0.5);
  1018. X  SET_POINT(&p3[11], 0.9, 0.2, 1.0);
  1019. X
  1020. X  if (rational == PEXRational) {
  1021. X    PEXCoord   *pp3;
  1022. X    PEXCoord4D *pp4;
  1023. X    float w;
  1024. X
  1025. X    w = 0.5;
  1026. X
  1027. X    for (i=0, pp4 = p4, pp3 = p3; i < 12;  i++, pp4++, pp3++ ) {
  1028. X    pp4->x = pp3->x * w;
  1029. X    pp4->y = pp3->y * w;
  1030. END_OF_FILE
  1031.   if test 29508 -ne `wc -c <'pexdrawc.2'`; then
  1032.     echo shar: \"'pexdrawc.2'\" unpacked with wrong size!
  1033.   fi
  1034.   # end of 'pexdrawc.2'
  1035. fi
  1036. if test -f 'pexdrawu.3' -a "${1}" != "-c" ; then 
  1037.   echo shar: Will not clobber existing file \"'pexdrawu.3'\"
  1038. else
  1039.   echo shar: Extracting \"'pexdrawu.3'\" \(28828 characters\)
  1040.   sed "s/^X//" >'pexdrawu.3' <<'END_OF_FILE'
  1041. X            };
  1042. X        };
  1043. Xobject
  1044. X    light_type_directional : XmToggleButton {
  1045. X        arguments {
  1046. X            XmNlabelString = "Directional";
  1047. X            };
  1048. X        callbacks {
  1049. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_type_directional);
  1050. X            };
  1051. X        };
  1052. Xobject
  1053. X    light_type_positional : XmToggleButton {
  1054. X        arguments {
  1055. X            XmNlabelString = "Positional";
  1056. X            };
  1057. X        callbacks {
  1058. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_type_positional);
  1059. X            };
  1060. X        };
  1061. Xobject
  1062. X    light_type_spot : XmToggleButton {
  1063. X        arguments {
  1064. X            XmNlabelString = "Spot";
  1065. X            };
  1066. X        callbacks {
  1067. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_type_spot);
  1068. X            };
  1069. X       };
  1070. X
  1071. X!*************************************************************** light pos *
  1072. X
  1073. Xobject
  1074. X    light_pos_sep : XmSeparator {
  1075. X    arguments {
  1076. X        XmNleftAttachment =  XmATTACH_FORM;
  1077. X        XmNrightAttachment =  XmATTACH_FORM;
  1078. X        XmNtopAttachment = XmATTACH_WIDGET;
  1079. X        XmNtopWidget = XmRadioBox light_type_box;
  1080. X    };
  1081. X    };
  1082. X
  1083. X
  1084. Xobject
  1085. X    light_pos_label : XmLabel {
  1086. X        arguments {
  1087. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1088. X        XmNtopWidget = XmSeparator light_pos_sep;
  1089. X        XmNrightAttachment = XmATTACH_FORM ;
  1090. X        XmNleftAttachment = XmATTACH_FORM ;
  1091. X            XmNlabelString = "Light Position";
  1092. X            };
  1093. X        };
  1094. X
  1095. Xobject
  1096. X    light_pos_x : XmTextField {
  1097. X        arguments {
  1098. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1099. X        XmNtopWidget = XmSeparator light_pos_sep;
  1100. X        XmNleftAttachment = XmATTACH_WIDGET;
  1101. X        XmNleftWidget = XmLabel light_pos_label;
  1102. X            XmNwidth = 30;
  1103. X            XmNmaxLength = 3;
  1104. X            XmNvalue = "0";
  1105. X            };
  1106. X        callbacks {
  1107. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_light_pos_x);
  1108. X            };
  1109. X        };
  1110. X
  1111. Xobject
  1112. X    light_pos_y : XmTextField {
  1113. X        arguments {
  1114. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1115. X        XmNtopWidget = XmSeparator light_pos_sep;
  1116. X        XmNleftAttachment = XmATTACH_WIDGET;
  1117. X        XmNleftWidget = XmTextField light_pos_x;
  1118. X            XmNwidth = 30;
  1119. X            XmNmaxLength = 3;
  1120. X            XmNvalue = "1";
  1121. X            };
  1122. X        callbacks {
  1123. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_light_pos_y);
  1124. X            };
  1125. X        };
  1126. X
  1127. Xobject
  1128. X    light_pos_z : XmTextField {
  1129. X        arguments {
  1130. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1131. X        XmNtopWidget = XmSeparator light_pos_sep;
  1132. X        XmNleftAttachment = XmATTACH_WIDGET;
  1133. X        XmNleftWidget = XmTextField light_pos_y;
  1134. X            XmNwidth = 30;
  1135. X            XmNmaxLength = 3;
  1136. X            XmNvalue = "0";
  1137. X            };
  1138. X        callbacks {
  1139. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_light_pos_z);
  1140. X            };
  1141. X        };
  1142. X
  1143. X!****************************** light color ********************************
  1144. X
  1145. Xobject
  1146. X    light_color_sep : XmSeparator {
  1147. X    arguments {
  1148. X        XmNleftAttachment =  XmATTACH_FORM;
  1149. X        XmNrightAttachment =  XmATTACH_FORM;
  1150. X        XmNtopAttachment = XmATTACH_WIDGET;
  1151. X        XmNtopWidget = XmTextField light_pos_z;
  1152. X    };
  1153. X    };
  1154. X
  1155. Xobject
  1156. X    light_color_label : XmLabel {
  1157. X        arguments {
  1158. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1159. X        XmNtopWidget = XmSeparator light_color_sep;
  1160. X        XmNleftAttachment = XmATTACH_FORM ;
  1161. X            XmNlabelString = "Light Color - red, green, blue";
  1162. X            };
  1163. X        };
  1164. X
  1165. Xobject
  1166. X    light_color_red : XmTextField {
  1167. X        arguments {
  1168. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1169. X        XmNtopWidget = XmSeparator light_color_sep;
  1170. X        XmNleftAttachment = XmATTACH_WIDGET;
  1171. X        XmNleftWidget = XmLabel light_color_label;
  1172. X            XmNwidth = 30;
  1173. X            XmNmaxLength = 3;
  1174. X            XmNvalue = "-1";
  1175. X            };
  1176. X        callbacks {
  1177. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_light_color_red);
  1178. X            };
  1179. X        };
  1180. X
  1181. Xobject
  1182. X    light_color_green : XmTextField {
  1183. X        arguments {
  1184. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1185. X        XmNtopWidget = XmSeparator light_color_sep;
  1186. X        XmNleftAttachment = XmATTACH_WIDGET;
  1187. X        XmNleftWidget = XmTextField light_color_red;
  1188. X            XmNwidth = 30;
  1189. X            XmNmaxLength = 3;
  1190. X            XmNvalue = "1";
  1191. X            };
  1192. X        callbacks {
  1193. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_light_color_green);
  1194. X            };
  1195. X        };
  1196. X
  1197. Xobject
  1198. X    light_color_blue : XmTextField {
  1199. X        arguments {
  1200. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1201. X        XmNtopWidget = XmSeparator light_color_sep;
  1202. X        XmNleftAttachment = XmATTACH_WIDGET;
  1203. X        XmNleftWidget = XmTextField light_color_green;
  1204. X            XmNwidth = 30;
  1205. X            XmNmaxLength = 3;
  1206. X            XmNvalue = "-1";
  1207. X            };
  1208. X        callbacks {
  1209. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_light_color_blue);
  1210. X            };
  1211. X        };
  1212. X
  1213. X!****************************** light direction *************
  1214. X
  1215. Xobject
  1216. X    light_direction_sep : XmSeparator {
  1217. X    arguments {
  1218. X        XmNleftAttachment =  XmATTACH_FORM;
  1219. X        XmNrightAttachment =  XmATTACH_FORM;
  1220. X        XmNtopAttachment = XmATTACH_WIDGET;
  1221. X        XmNtopWidget = XmTextField light_color_blue;
  1222. X    };
  1223. X    };
  1224. X
  1225. X
  1226. Xobject
  1227. X    light_direction_label : XmLabel {
  1228. X        arguments {
  1229. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1230. X        XmNtopWidget = XmSeparator light_direction_sep;
  1231. X        XmNleftAttachment = XmATTACH_FORM ;
  1232. X            XmNlabelString = "View Direction, Back & Front";
  1233. X            };
  1234. X        };
  1235. X
  1236. Xobject
  1237. X    light_direction_x : XmTextField {
  1238. X        arguments {
  1239. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1240. X        XmNtopWidget = XmSeparator light_direction_sep;
  1241. X        XmNleftAttachment = XmATTACH_WIDGET;
  1242. X        XmNleftWidget = XmLabel light_direction_label;
  1243. X            XmNwidth = 30;
  1244. X            XmNmaxLength = 3;
  1245. X            XmNvalue = "0";
  1246. X            };
  1247. X        callbacks {
  1248. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_light_direction_x);
  1249. X            };
  1250. X        };
  1251. X
  1252. Xobject
  1253. X    light_direction_y : XmTextField {
  1254. X        arguments {
  1255. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1256. X        XmNtopWidget = XmSeparator light_direction_sep;
  1257. X        XmNleftAttachment = XmATTACH_WIDGET;
  1258. X        XmNleftWidget = XmTextField light_direction_x;
  1259. X            XmNwidth = 30;
  1260. X            XmNmaxLength = 3;
  1261. X            XmNvalue = "0";
  1262. X            };
  1263. X        callbacks {
  1264. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_light_direction_y);
  1265. X            };
  1266. X        };
  1267. X
  1268. Xobject
  1269. X    light_direction_z : XmTextField {
  1270. X        arguments {
  1271. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1272. X        XmNtopWidget = XmSeparator light_direction_sep;
  1273. X        XmNleftAttachment = XmATTACH_WIDGET;
  1274. X        XmNleftWidget = XmTextField light_direction_y;
  1275. X            XmNwidth = 30;
  1276. X            XmNmaxLength = 3;
  1277. X            XmNvalue = "-1";
  1278. X            };
  1279. X        callbacks {
  1280. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_light_direction_z);
  1281. X            };
  1282. X        };
  1283. X
  1284. X
  1285. X!****************************** light attenuation coefficients *************
  1286. X
  1287. Xobject
  1288. X    light_coeff_sep : XmSeparator {
  1289. X    arguments {
  1290. X        XmNleftAttachment =  XmATTACH_FORM;
  1291. X        XmNrightAttachment =  XmATTACH_FORM;
  1292. X        XmNtopAttachment = XmATTACH_WIDGET;
  1293. X        XmNtopWidget = XmTextField light_direction_z;
  1294. X    };
  1295. X    };
  1296. X
  1297. X
  1298. Xobject
  1299. X    light_coeff_label : XmLabel {
  1300. X        arguments {
  1301. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1302. X        XmNtopWidget = XmSeparator light_coeff_sep;
  1303. X        XmNleftAttachment = XmATTACH_FORM ;
  1304. X            XmNlabelString = "Light Attenuation Coeffients, Const & Dist";
  1305. X            };
  1306. X        };
  1307. X
  1308. Xobject
  1309. X    light_coeff_const : XmTextField {
  1310. X        arguments {
  1311. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1312. X        XmNtopWidget = XmSeparator light_coeff_sep;
  1313. X        XmNleftAttachment = XmATTACH_WIDGET;
  1314. X        XmNleftWidget = XmLabel light_coeff_label;
  1315. X            XmNwidth = 30;
  1316. X            XmNmaxLength = 5;
  1317. X            XmNvalue = "0";
  1318. X            };
  1319. X        callbacks {
  1320. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_light_coeff_const);
  1321. X            };
  1322. X        };
  1323. X
  1324. Xobject
  1325. X    light_coeff_dist : XmTextField {
  1326. X        arguments {
  1327. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1328. X        XmNtopWidget = XmSeparator light_coeff_sep;
  1329. X        XmNleftAttachment = XmATTACH_WIDGET;
  1330. X        XmNleftWidget = XmTextField light_coeff_const;
  1331. X            XmNwidth = 30;
  1332. X            XmNmaxLength = 5;
  1333. X            XmNvalue = "0";
  1334. X            };
  1335. X        callbacks {
  1336. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_light_coeff_dist);
  1337. X            };
  1338. X        };
  1339. X
  1340. X!****************************** light concentration exponent *************
  1341. X
  1342. Xobject
  1343. X    light_conc_exp_sep : XmSeparator {
  1344. X    arguments {
  1345. X        XmNleftAttachment =  XmATTACH_FORM;
  1346. X        XmNrightAttachment =  XmATTACH_FORM;
  1347. X        XmNtopAttachment = XmATTACH_WIDGET;
  1348. X        XmNtopWidget = XmTextField light_direction_z;
  1349. X    };
  1350. X    };
  1351. X
  1352. X
  1353. Xobject
  1354. X    light_conc_exp_label : XmLabel {
  1355. X        arguments {
  1356. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1357. X        XmNtopWidget = XmSeparator light_conc_exp_sep;
  1358. X        XmNleftAttachment = XmATTACH_FORM ;
  1359. X            XmNlabelString = "Concentration Exponent";
  1360. X            };
  1361. X        };
  1362. X
  1363. Xobject
  1364. X    light_conc_exp : XmTextField {
  1365. X        arguments {
  1366. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1367. X        XmNtopWidget = XmSeparator light_conc_exp_sep;
  1368. X        XmNleftAttachment = XmATTACH_WIDGET;
  1369. X        XmNleftWidget = XmLabel light_conc_exp_label;
  1370. X            XmNwidth = 30;
  1371. X            XmNmaxLength = 5;
  1372. X            XmNvalue = "0";
  1373. X            };
  1374. X        callbacks {
  1375. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_light_conc_exp);
  1376. X            };
  1377. X        };
  1378. X
  1379. X
  1380. X!****************************** light spread angle *************
  1381. X
  1382. Xobject
  1383. X    light_spread_angle_sep : XmSeparator {
  1384. X    arguments {
  1385. X        XmNleftAttachment =  XmATTACH_FORM;
  1386. X        XmNrightAttachment =  XmATTACH_FORM;
  1387. X        XmNtopAttachment = XmATTACH_WIDGET;
  1388. X        XmNtopWidget = XmTextField light_conc_exp;
  1389. X    };
  1390. X    };
  1391. X
  1392. X
  1393. Xobject
  1394. X    light_spread_angle_label : XmLabel {
  1395. X        arguments {
  1396. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1397. X        XmNtopWidget = XmSeparator light_spread_angle_sep;
  1398. X        XmNleftAttachment = XmATTACH_FORM ;
  1399. X            XmNlabelString = "Spread Angle";
  1400. X            };
  1401. X        };
  1402. X
  1403. Xobject
  1404. X    light_spread_angle : XmTextField {
  1405. X        arguments {
  1406. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1407. X        XmNtopWidget = XmSeparator light_spread_angle_sep;
  1408. X        XmNleftAttachment = XmATTACH_WIDGET;
  1409. X        XmNleftWidget = XmLabel light_spread_angle_label;
  1410. X            XmNwidth = 30;
  1411. X            XmNmaxLength = 5;
  1412. X            XmNvalue = "0";
  1413. X            };
  1414. X        callbacks {
  1415. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_light_spread_angle);
  1416. X            };
  1417. X        };
  1418. X
  1419. X
  1420. X!*****************************  Bottom Buttons ******************************
  1421. X
  1422. Xobject
  1423. X    light_button_box : XmRowColumn {
  1424. X        arguments {
  1425. X            XmNorientation = XmHORIZONTAL;
  1426. X        XmNleftAttachment =  XmATTACH_FORM;
  1427. X        XmNrightAttachment =  XmATTACH_FORM;
  1428. X        XmNbottomAttachment =  XmATTACH_FORM;
  1429. X            XmNborderWidth = 2;
  1430. X            XmNentryBorder = 3;
  1431. X            };
  1432. X        controls {                                                  
  1433. X            XmPushButton     light_apply_button;
  1434. X            XmPushButton     light_dismiss_button;
  1435. X            XmPushButton     light_can_button;
  1436. X            };
  1437. X        };
  1438. X
  1439. Xobject
  1440. X    light_apply_button : XmPushButton widget { ! The menu positions the buttons
  1441. X        arguments {                     !  automatically.
  1442. X            XmNlabelString = "apply";
  1443. X            XmNforeground = yellow;
  1444. X            XmNbackground = red;
  1445. X            XmNhighlightColor = magenta;
  1446. X            XmNborderColor = green;
  1447. X        XmNaccelerator = "Ctrl <key>a";
  1448. X        XmNacceleratorText = " ^a";
  1449. X            };
  1450. X        callbacks {
  1451. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_apply_light);
  1452. X            XmNactivateCallback = procedure proc_pexdraw_activate (k_apply_light);
  1453. X        };
  1454. X    };
  1455. X
  1456. Xobject
  1457. X    light_can_button : XmPushButton widget {                       
  1458. X        arguments {
  1459. X            XmNlabelString = "reset";
  1460. X            XmNforeground = yellow;
  1461. X            XmNbackground = red;
  1462. X            XmNhighlightColor = magenta;
  1463. X            XmNborderColor = green;
  1464. X            };
  1465. X        callbacks {
  1466. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_reset_light);
  1467. X            XmNactivateCallback = procedure proc_pexdraw_activate (k_reset_light);
  1468. X        };
  1469. X    };
  1470. X
  1471. Xobject
  1472. X    light_dismiss_button : XmPushButton widget {
  1473. X        arguments {
  1474. X            XmNlabelString = "dismiss";
  1475. X            XmNforeground = yellow;
  1476. X            XmNbackground = red;
  1477. X            XmNhighlightColor = magenta;
  1478. X            XmNborderColor = green;
  1479. X        };
  1480. X        callbacks {
  1481. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_dismiss_light);
  1482. X            XmNactivateCallback = procedure proc_pexdraw_activate (k_dismiss_light);
  1483. X        };
  1484. X    };
  1485. X
  1486. X!************************************************************************
  1487. X! end of Lights Form
  1488. X!************************************************************************
  1489. X
  1490. X
  1491. X!************************************************************************
  1492. X! The File Form
  1493. X!************************************************************************
  1494. X
  1495. Xobject
  1496. X    file_dialog : XmFormDialog {
  1497. X        arguments {
  1498. X            XmNdialogTitle = "File Selection";
  1499. X            XmNdialogStyle = XmDIALOG_MODELESS;
  1500. X        XmNheight = 400;
  1501. X        XmNwidth = 360;
  1502. X            XmNbackground = lightblue;
  1503. X        };
  1504. X        controls {
  1505. X            XmFileSelectionBox file_selector;
  1506. X    };
  1507. X
  1508. X        callbacks {
  1509. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_file);
  1510. X        };
  1511. X      };
  1512. X
  1513. Xobject
  1514. X    file_selector : XmFileSelectionBox {
  1515. X        arguments {
  1516. X             XmNbackground = lightblue;    
  1517. X        };
  1518. X        callbacks {
  1519. X             XmNokCallback = procedure proc_pexdraw_file();
  1520. X             XmNcancelCallback = procedure proc_pexdraw_file();
  1521. X             XmNhelpCallback = procedure proc_pexdraw_activate(k_file_help);
  1522. X            };        
  1523. X    };    
  1524. X
  1525. X
  1526. X!************************************************************************
  1527. X! The Surface Form
  1528. X!************************************************************************
  1529. X
  1530. Xobject
  1531. X    surface_dialog : XmFormDialog {
  1532. X        arguments {
  1533. X            XmNdialogTitle = "PEX Surface Options";
  1534. X            XmNdialogStyle = XmDIALOG_MODELESS;
  1535. X        XmNheight = 500;
  1536. X        XmNwidth = 360;
  1537. X!        XmNmwmDecorations = 30;
  1538. X            XmNbackground = lightblue;
  1539. X        };
  1540. X        controls {
  1541. X        XmSeparator    surface_style_sep;
  1542. X            XmLabel     surface_style_label;
  1543. X            XmRadioBox     surface_style_box;
  1544. X        XmSeparator    surface_shade_sep;
  1545. X        XmLabel    surface_shade_label;
  1546. X        XmRadioBox    surface_shade_box;
  1547. X        XmSeparator    surface_refl_sep;
  1548. X        XmLabel    surface_refl_label;
  1549. X        XmSeparator    surface_ambient_sep;
  1550. X        XmLabel    surface_ambient_label;
  1551. X        XmScale    surface_refl_ambient;
  1552. X        XmLabel    surface_diffuse_label;
  1553. X        XmScale    surface_refl_diffuse;
  1554. X        XmLabel    surface_specular_label;
  1555. X        XmScale    surface_refl_specular;
  1556. X        XmSeparator    surface_specular_sep;
  1557. X        XmLabel    surface_specular_dummy;
  1558. X        XmLabel    surface_specexp_label;
  1559. X        XmScale    surface_refl_specexp;
  1560. X        XmLabel    surface_transparency_label;
  1561. X        XmScale    surface_refl_transparency;
  1562. X            XmRowColumn surface_button_box;
  1563. X        XmSeparator    surface_cull_sep;
  1564. X        XmLabel    surface_cull_label;
  1565. X        XmRadioBox    surface_cull_box;
  1566. X            };
  1567. X
  1568. X        callbacks {
  1569. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_surface);
  1570. X            };
  1571. X    };
  1572. X
  1573. X!****************************** Surface Style
  1574. Xobject
  1575. X    surface_style_sep : XmSeparator {
  1576. X    arguments {
  1577. X        XmNleftAttachment =  XmATTACH_FORM;
  1578. X        XmNrightAttachment =  XmATTACH_FORM;
  1579. X        XmNtopAttachment = XmATTACH_FORM;
  1580. X    };
  1581. X    };
  1582. X
  1583. Xobject
  1584. X    surface_style_label : XmLabel {
  1585. X        arguments {
  1586. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1587. X        XmNtopWidget = XmSeparator surface_style_sep;
  1588. X        XmNleftAttachment = XmATTACH_FORM ;
  1589. X        XmNrightAttachment = XmATTACH_FORM ;
  1590. X            XmNlabelString = "Surface Style";
  1591. X            };
  1592. X        };
  1593. X
  1594. Xobject
  1595. X    surface_style_box : XmRadioBox {
  1596. X        arguments {
  1597. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1598. X        XmNtopWidget = XmLabel surface_style_label;
  1599. X        XmNleftAttachment = XmATTACH_FORM ;
  1600. X        XmNrightAttachment = XmATTACH_FORM ;
  1601. X            XmNorientation = XmHORIZONTAL;
  1602. X            XmNborderWidth = 1;
  1603. X            };
  1604. X        controls {
  1605. X            XmToggleButton   surface_edit1;
  1606. X            XmToggleButton   surface_edit2;
  1607. X            XmToggleButton   surface_edit3;
  1608. X            };
  1609. X        };
  1610. X
  1611. X
  1612. Xobject
  1613. X    surface_edit1 : XmToggleButton {
  1614. X        arguments {  XmNlabelString = "Hollow"; 
  1615. X            XmNset = on;   ! A radio box requires one toggle to be set.
  1616. X      };
  1617. X        callbacks {
  1618. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_sstyle_hollow);
  1619. X            };
  1620. X
  1621. X        };
  1622. Xobject
  1623. X    surface_edit2 : XmToggleButton {
  1624. X        arguments {
  1625. X            XmNlabelString = "Solid";
  1626. X            };
  1627. X        callbacks {
  1628. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_sstyle_solid);
  1629. X            };
  1630. X        };
  1631. Xobject
  1632. X    surface_edit3 : XmToggleButton {
  1633. X        arguments {
  1634. X            XmNlabelString = "Empty";
  1635. X            };
  1636. X        callbacks {
  1637. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_sstyle_empty);
  1638. X            };
  1639. X        };
  1640. X
  1641. X!****************************** surface shade Radio ********************
  1642. Xobject
  1643. X    surface_shade_sep : XmSeparator {
  1644. X    arguments {
  1645. X        XmNleftAttachment =  XmATTACH_FORM;
  1646. X        XmNrightAttachment =  XmATTACH_FORM;
  1647. X        XmNtopAttachment = XmATTACH_WIDGET;
  1648. X        XmNtopWidget = XmRadioBox surface_style_box;
  1649. X    };
  1650. X    };
  1651. X
  1652. Xobject
  1653. X    surface_shade_label : XmLabel {
  1654. X        arguments {
  1655. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1656. X        XmNtopWidget = XmSeparator surface_shade_sep;
  1657. X        XmNleftAttachment = XmATTACH_FORM ;
  1658. X        XmNrightAttachment = XmATTACH_FORM;
  1659. X            XmNlabelString = "Shading / Interpolation Method";
  1660. X            };
  1661. X        };
  1662. X
  1663. Xobject
  1664. X    surface_shade_box : XmRadioBox {
  1665. X        arguments {
  1666. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1667. X        XmNtopWidget = XmLabel surface_shade_label;
  1668. X        XmNleftAttachment = XmATTACH_FORM;
  1669. X        XmNrightAttachment = XmATTACH_FORM;
  1670. X            XmNorientation = XmHORIZONTAL;
  1671. X            XmNborderWidth = 1;
  1672. X            };
  1673. X        controls {
  1674. X            XmToggleButton   surface_shade_flat;
  1675. X            XmToggleButton   surface_shade_gouraud;
  1676. X            XmToggleButton   surface_shade_dot;
  1677. X            XmToggleButton   surface_shade_phong;
  1678. X            };
  1679. X        };
  1680. X
  1681. Xobject
  1682. X    surface_shade_flat : XmToggleButton {
  1683. X        arguments {
  1684. X            XmNlabelString = "Flat";
  1685. X            XmNset = on;   ! A radio box requires one toggle to be set.
  1686. X            };
  1687. X        callbacks {
  1688. X            MrmNcreateCallback = procedure proc_pexdraw_create(k_sshade_flat);
  1689. X            };
  1690. X        };
  1691. Xobject
  1692. X    surface_shade_gouraud : XmToggleButton {
  1693. X        arguments {
  1694. X            XmNlabelString = "Gouraud";
  1695. X            };
  1696. X        callbacks {
  1697. X            MrmNcreateCallback = procedure proc_pexdraw_create(k_sshade_gouraud);
  1698. X            };
  1699. X        };
  1700. Xobject
  1701. X    surface_shade_dot : XmToggleButton {
  1702. X        arguments {
  1703. X            XmNlabelString = "Dot";
  1704. X            };
  1705. X        callbacks {
  1706. X            MrmNcreateCallback = procedure proc_pexdraw_create(k_sshade_dot);
  1707. X            };
  1708. X        };
  1709. Xobject
  1710. X    surface_shade_phong : XmToggleButton {
  1711. X        arguments {
  1712. X            XmNlabelString = "Phong";
  1713. X            };
  1714. X        callbacks {
  1715. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_sshade_phong);
  1716. X            };
  1717. X       };
  1718. X
  1719. X!*************************************************************** surface refl *
  1720. X
  1721. Xobject
  1722. X    surface_refl_sep : XmSeparator {
  1723. X    arguments {
  1724. X        XmNleftAttachment =  XmATTACH_FORM;
  1725. X        XmNrightAttachment =  XmATTACH_FORM;
  1726. X        XmNtopAttachment = XmATTACH_WIDGET;
  1727. X        XmNtopWidget = XmRadioBox surface_shade_box;
  1728. X    };
  1729. X    };
  1730. X
  1731. X
  1732. Xobject
  1733. X    surface_refl_label : XmLabel {
  1734. X        arguments {
  1735. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1736. X        XmNtopWidget = XmSeparator surface_refl_sep;
  1737. X        XmNrightAttachment = XmATTACH_FORM ;
  1738. X        XmNleftAttachment = XmATTACH_FORM ;
  1739. X            XmNlabelString = "Surface Reflections Attributes";
  1740. X            };
  1741. X        };
  1742. X
  1743. Xobject
  1744. X    surface_ambient_sep : XmSeparator {
  1745. X    arguments {
  1746. X        XmNleftAttachment =  XmATTACH_FORM;
  1747. X        XmNrightAttachment =  XmATTACH_FORM;
  1748. X        XmNtopAttachment = XmATTACH_WIDGET;
  1749. X        XmNtopWidget = XmLabel surface_refl_label;
  1750. X    };
  1751. X    };
  1752. X
  1753. Xobject
  1754. X    surface_ambient_label : XmLabel {
  1755. X        arguments {
  1756. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1757. X        XmNtopWidget = XmSeparator surface_ambient_sep;
  1758. X        XmNleftAttachment = XmATTACH_FORM ;
  1759. X            XmNlabelString = "Ambient Reflection";
  1760. X            };
  1761. X        };
  1762. X
  1763. Xobject
  1764. X    surface_refl_ambient : XmScale {
  1765. X        arguments {
  1766. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1767. X        XmNtopWidget = XmLabel surface_ambient_label;
  1768. X        XmNleftAttachment = XmATTACH_FORM;
  1769. X        XmNrightAttachment =  XmATTACH_FORM;
  1770. X            XmNorientation = XmHORIZONTAL;
  1771. X        XmNminimum = 000;
  1772. X        XmNmaximum = 100;
  1773. X            XmNvalue = 30;
  1774. X            XmNshowValue = on;
  1775. X        XmNdecimalPoints = 2;
  1776. X            };
  1777. X        callbacks {
  1778. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_surface_refl_ambient);
  1779. X            };
  1780. X        };
  1781. X
  1782. X
  1783. Xobject
  1784. X    surface_diffuse_label : XmLabel {
  1785. X        arguments {
  1786. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1787. X        XmNtopWidget = XmScale surface_refl_ambient;
  1788. X        XmNleftAttachment = XmATTACH_FORM ;
  1789. X            XmNlabelString = "Diffuse Reflection";
  1790. X            };
  1791. X        };
  1792. X
  1793. Xobject
  1794. X    surface_refl_diffuse : XmScale {
  1795. X        arguments {
  1796. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1797. X        XmNtopWidget = XmLabel surface_diffuse_label;
  1798. X        XmNleftAttachment = XmATTACH_FORM;
  1799. X        XmNrightAttachment =  XmATTACH_FORM;
  1800. X            XmNorientation = XmHORIZONTAL;
  1801. X        XmNminimum = 000;
  1802. X        XmNmaximum = 100;
  1803. X            XmNvalue = 30;
  1804. X            XmNshowValue = on;
  1805. X        XmNdecimalPoints = 2;
  1806. X            };
  1807. X        callbacks {
  1808. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_surface_refl_diffuse);
  1809. X            };
  1810. X        };
  1811. X
  1812. Xobject
  1813. X    surface_specular_label : XmLabel {
  1814. X        arguments {
  1815. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1816. X        XmNtopWidget = XmScale surface_refl_diffuse;
  1817. X        XmNleftAttachment = XmATTACH_FORM ;
  1818. X            XmNlabelString = "Specular Reflection";
  1819. X            };
  1820. X        };
  1821. X
  1822. Xobject
  1823. X    surface_refl_specular : XmScale {
  1824. X        arguments {
  1825. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1826. X        XmNtopWidget = XmLabel surface_specular_label;
  1827. X        XmNleftAttachment = XmATTACH_FORM;
  1828. X        XmNrightAttachment =  XmATTACH_FORM;
  1829. X            XmNorientation = XmHORIZONTAL;
  1830. X        XmNminimum = 000;
  1831. X        XmNmaximum = 100;
  1832. X            XmNvalue = 30;
  1833. X            XmNshowValue = on;
  1834. X        XmNdecimalPoints = 2;
  1835. X            };
  1836. X        callbacks {
  1837. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_surface_refl_specular);
  1838. X            };
  1839. X        };
  1840. X
  1841. X
  1842. Xobject
  1843. X    surface_specular_sep : XmSeparator {
  1844. X    arguments {
  1845. X        XmNleftAttachment =  XmATTACH_FORM;
  1846. X        XmNrightAttachment =  XmATTACH_FORM;
  1847. X        XmNtopAttachment = XmATTACH_WIDGET;
  1848. X        XmNtopWidget = XmScale surface_refl_specular;
  1849. X    };
  1850. X    };
  1851. X
  1852. X
  1853. Xobject
  1854. X    surface_specular_dummy : XmLabel {
  1855. X        arguments {
  1856. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1857. X        XmNtopWidget = XmSeparator surface_specular_sep;
  1858. X        XmNleftAttachment = XmATTACH_FORM ;
  1859. X            XmNlabelString = "Specular Color is white...come and change it";
  1860. X            };
  1861. X        };
  1862. X
  1863. X
  1864. Xobject
  1865. X    surface_specexp_label : XmLabel {
  1866. X        arguments {
  1867. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1868. X        XmNtopWidget = XmLabel surface_specular_dummy;
  1869. X        XmNleftAttachment = XmATTACH_FORM ;
  1870. X            XmNlabelString = "Specular Exponent";
  1871. X            };
  1872. X        };
  1873. X
  1874. Xobject
  1875. X    surface_refl_specexp : XmScale {
  1876. X        arguments {
  1877. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1878. X        XmNtopWidget = XmLabel surface_specexp_label;
  1879. X        XmNleftAttachment = XmATTACH_FORM;
  1880. X        XmNrightAttachment =  XmATTACH_FORM;
  1881. X            XmNorientation = XmHORIZONTAL;
  1882. X        XmNminimum = 00;
  1883. X        XmNmaximum = 2000;
  1884. X            XmNvalue = 500;
  1885. X            XmNshowValue = on;
  1886. X        XmNdecimalPoints = 1;
  1887. X            };
  1888. X        callbacks {
  1889. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_surface_refl_specexp);
  1890. X            };
  1891. X        };
  1892. X
  1893. Xobject
  1894. X    surface_transparency_label : XmLabel {
  1895. X        arguments {
  1896. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1897. X        XmNtopWidget = XmScale surface_refl_specexp;
  1898. X        XmNleftAttachment = XmATTACH_FORM ;
  1899. X            XmNlabelString = "Transparency";
  1900. X            };
  1901. X        };
  1902. X
  1903. Xobject
  1904. X    surface_refl_transparency : XmScale {
  1905. X        arguments {
  1906. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1907. X        XmNtopWidget = XmLabel surface_transparency_label;
  1908. X        XmNleftAttachment = XmATTACH_FORM;
  1909. X        XmNrightAttachment =  XmATTACH_FORM;
  1910. X            XmNorientation = XmHORIZONTAL;
  1911. X        XmNminimum = 0;
  1912. X        XmNmaximum = 100;
  1913. X            XmNvalue = 0;
  1914. X            XmNshowValue = on;
  1915. X        XmNdecimalPoints = 2;
  1916. X            };
  1917. X        callbacks {
  1918. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_surface_refl_transparency);
  1919. X            };
  1920. X        };
  1921. X
  1922. X!****************************** Surface Cull
  1923. Xobject
  1924. X    surface_cull_sep : XmSeparator {
  1925. X    arguments {
  1926. X        XmNleftAttachment =  XmATTACH_FORM;
  1927. X        XmNrightAttachment =  XmATTACH_FORM;
  1928. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1929. X        XmNtopWidget = XmScale surface_refl_transparency;
  1930. X    };
  1931. X    };
  1932. X
  1933. Xobject
  1934. X    surface_cull_label : XmLabel {
  1935. X        arguments {
  1936. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1937. X        XmNtopWidget = XmSeparator surface_cull_sep;
  1938. X        XmNleftAttachment = XmATTACH_FORM ;
  1939. X        XmNrightAttachment = XmATTACH_FORM ;
  1940. X            XmNlabelString = "Surface Cull";
  1941. X            };
  1942. X        };
  1943. X
  1944. Xobject
  1945. X    surface_cull_box : XmRadioBox {
  1946. X        arguments {
  1947. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1948. X        XmNtopWidget = XmLabel surface_cull_label;
  1949. X        XmNleftAttachment = XmATTACH_FORM ;
  1950. X        XmNrightAttachment = XmATTACH_FORM ;
  1951. X            XmNorientation = XmHORIZONTAL;
  1952. X            XmNborderWidth = 1;
  1953. X            };
  1954. X        controls {
  1955. X            XmToggleButton   surface_cull_none;
  1956. X            XmToggleButton   surface_cull_back;
  1957. X            XmToggleButton   surface_cull_front;
  1958. X            };
  1959. X        };
  1960. X
  1961. X
  1962. Xobject
  1963. X    surface_cull_none : XmToggleButton {
  1964. X        arguments {  XmNlabelString = "Neither"; 
  1965. X            XmNset = on;   ! A radio box requires one toggle to be set.
  1966. X      };
  1967. X        callbacks {
  1968. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_cull_none);
  1969. X            };
  1970. X
  1971. X        };
  1972. Xobject
  1973. X    surface_cull_back : XmToggleButton {
  1974. X        arguments {
  1975. X            XmNlabelString = "Back Faces";
  1976. X            };
  1977. X        callbacks {
  1978. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_cull_back);
  1979. X            };
  1980. X        };
  1981. Xobject
  1982. X    surface_cull_front : XmToggleButton {
  1983. X        arguments {
  1984. X            XmNlabelString = "Front Faces";
  1985. X            };
  1986. X        callbacks {
  1987. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_cull_front);
  1988. X            };
  1989. X        };
  1990. X
  1991. X
  1992. X!*****************************  Bottom Buttons ******************************
  1993. X
  1994. Xobject
  1995. X    surface_button_box : XmRowColumn {
  1996. X        arguments {
  1997. X            XmNorientation = XmHORIZONTAL;
  1998. X        XmNleftAttachment =  XmATTACH_FORM;
  1999. X        XmNrightAttachment =  XmATTACH_FORM;
  2000. X        XmNbottomAttachment =  XmATTACH_FORM;
  2001. X            XmNborderWidth = 2;
  2002. X            XmNentryBorder = 3;
  2003. X            };
  2004. X        controls {                                                  
  2005. X            XmPushButton     surface_apply_button;
  2006. X            XmPushButton     surface_dismiss_button;
  2007. X            XmPushButton     surface_can_button;
  2008. X            };
  2009. X        };
  2010. X
  2011. Xobject
  2012. X    surface_apply_button : XmPushButton widget { ! The menu positions the buttons
  2013. X        arguments {                     !  automatically.
  2014. X            XmNlabelString = "apply";
  2015. X            XmNforeground = yellow;
  2016. X            XmNbackground = red;
  2017. X            XmNhighlightColor = magenta;
  2018. X            XmNborderColor = green;
  2019. X        XmNaccelerator = "Ctrl <key>a";
  2020. X        XmNacceleratorText = " ^a";
  2021. X            };
  2022. X        callbacks {
  2023. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_apply_surface);
  2024. X            XmNactivateCallback = procedure proc_pexdraw_activate (k_apply_surface);
  2025. X        };
  2026. X    };
  2027. X
  2028. Xobject
  2029. X    surface_can_button : XmPushButton widget {                       
  2030. X        arguments {
  2031. X            XmNlabelString = "fetch";
  2032. X            XmNforeground = yellow;
  2033. X            XmNbackground = red;
  2034. X            XmNhighlightColor = magenta;
  2035. X            XmNborderColor = green;
  2036. X            };
  2037. X        callbacks {
  2038. X            XmNactivateCallback = procedure proc_pexdraw_activate (k_reset_surface);
  2039. X        };
  2040. X    };
  2041. END_OF_FILE
  2042.   if test 28828 -ne `wc -c <'pexdrawu.3'`; then
  2043.     echo shar: \"'pexdrawu.3'\" unpacked with wrong size!
  2044.   fi
  2045.   # end of 'pexdrawu.3'
  2046. fi
  2047. echo shar: End of archive 10 \(of 14\).
  2048. cp /dev/null ark10isdone
  2049. MISSING=""
  2050. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
  2051.     if test ! -f ark${I}isdone ; then
  2052.     MISSING="${MISSING} ${I}"
  2053.     fi
  2054. done
  2055. if test "${MISSING}" = "" ; then
  2056.     echo You have unpacked all 14 archives.
  2057.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2058.     echo "concatentating pexdraw.c ..."
  2059.     cat pexdrawc.? > pexdraw.c
  2060.     rm pexdrawc.?
  2061.     echo "concatentating pexdraw.uil ..."
  2062.     cat pexdrawu.? > pexdraw.uil
  2063.     rm pexdrawu.?
  2064.     echo "concatentating teapot.c ..."
  2065.     rm teapotc.?
  2066. else
  2067.     echo You still must unpack the following archives:
  2068.     echo "        " ${MISSING}
  2069. fi
  2070. exit 0
  2071. exit 0 # Just in case...
  2072. -- 
  2073.   // chris@IMD.Sterling.COM       | Send comp.sources.x submissions to:
  2074. \X/  Amiga - The only way to fly! |    sources-x@imd.sterling.com
  2075.  "It's intuitively obvious to the |
  2076.   most casual observer..."        | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
  2077.