home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / raytrace / radiance / simplerd.lha / simplerad / FinalFTP / WalkT / walkv.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-22  |  6.7 KB  |  157 lines

  1. /**********************************************************************/
  2. /* walkv.c :                                                          */
  3. /*                                                                    */
  4. /* Global variables for program                                       */
  5. /*                                                                    */
  6. /* Copyright (C) 1992, Bernard Kwok                                   */
  7. /* All rights reserved.                                               */
  8. /* Revision 1.0                                                       */
  9. /* May, 1992                                                          */
  10. /**********************************************************************/
  11. #include <stdio.h>
  12. #include <fmclient.h>
  13. #include <math.h>
  14. #include <gl/gl.h>
  15. #include <gl/device.h>
  16. #define IRIS4D 1
  17. #include "geo.h"
  18. #include "walk.h"
  19. #include "vcr.h"
  20.  
  21. SystemAttrib System = { /* Default options for system.      */
  22.   1.34,                 /* Default x/y aspect ratio         */
  23.   1024,                 /* Default x screeen size           */
  24.   LARGEZ,               /* Default z max                    */
  25.   FALSE, FALSE, FALSE,  /* Do not use prefered window size  */
  26.                         /* nor position                     */
  27.   TRUE, TRUE, FALSE,    /* Use double, zbuffer, no Abuffer  */
  28.   FALSE,                /* No panel                         */
  29.   FALSE,                /* No graphics initialized          */
  30.   FALSE,                /* Not using VCR                    */
  31.   0,                    /* No VCR mode                      */
  32.   FALSE,                /* No gamma                         */
  33.   FALSE                 /* Using full screen                */
  34.   };
  35.   
  36. OptionType Option = {   /* Default options (user)           */
  37.   NODEBUG,              /* Not debugging                    */
  38.   STILL,                /* Not moving                       */
  39.   NOLOG,                /* Not logging session              */
  40.   1.0,                  /* No zoomfactor                    */
  41.   GOURAUD,              /* Gouraud shade polygons           */
  42.   SHADE_QUAD,           /* Default shade quadralaterals     */
  43.   FALSE,                /* No BW shading                    */
  44.   ".",                  /* default directory of input scene */
  45.   TRUE,                 /* default draw xyz axis            */
  46.   1.0                   /* default no RGB scaling           */
  47.   };
  48.  
  49. /**********************************************************************/
  50. /* Movement structures */
  51. /**********************************************************************/
  52. Matrix objmat = {       /* Current object transformation matrix */
  53.   {1.0, 0.0, 0.0, 0.0},
  54.   {0.0, 1.0, 0.0, 0.0},
  55.   {0.0, 0.0, 1.0, 0.0},
  56.   {0.0, 0.0, 0.0, 1.0},
  57. };
  58.  
  59. Matrix viewmat = {       /* Current viewer transformation matrix */
  60.   {1.0, 0.0, 0.0, 0.0},
  61.   {0.0, 1.0, 0.0, 0.0},
  62.   {0.0, 0.0, 1.0, 0.0},
  63.   {0.0, 0.0, 0.0, 1.0},
  64. };
  65.  
  66. Matrix Identity = {     /* Identity matrix */
  67.     {1.0, 0.0, 0.0, 0.0},
  68.     {0.0, 1.0, 0.0, 0.0},
  69.     {0.0, 0.0, 1.0, 0.0},
  70.     {0.0, 0.0, 0.0, 1.0},
  71. };
  72.  
  73. int moves_logged = 0;   /* Current number of movements logged */
  74. FILE *movefile;         /* File of Movements (camera movement)        */
  75. char *movefilename;     /* Filename of "movement" file                */
  76.  
  77. Movement *Autoview;     /* Set of movements to run automatically      */
  78. Movement *Mtail;        /* Current last movement                      */
  79. AbsMovement Viewer;     /* Absolute movement of the viewer            */
  80. RelMovement view;       /* Relative movement tracking info            */
  81. MouseMovement Mouse;    /* Mouse movement tracking info               */
  82.  
  83. /**********************************************************************/
  84. /* Input scene stuff                                                  */
  85. /**********************************************************************/
  86. FILE *scenefile;        /* File containing input scene/environment    */
  87. /* Object *scene; */    /* Input scene                                */
  88.  
  89. /**********************************************************************/
  90. /* A-buffer structures (not used) */
  91. /**********************************************************************/
  92. int KernelId = -1;
  93. char **Kernels = 0;
  94. int NumKernels = 0;
  95. char *KernelFile = 0;
  96.  
  97. /**********************************************************************/
  98. /* Window structures                                                  */
  99. /**********************************************************************/
  100. char *ProgName = "walk";              /* program name                 */
  101.  
  102. char *WindowName = "R-Walk";   /* Main window label                   */
  103. long WindWid;                  /* Main window id                      */  
  104. long WindXorigin, WindYorigin; /* Main window origin (x,y)            */
  105. long WindXsize, WindYsize;     /* Main window size (x,y)              */
  106.   
  107. long PanelWid;                 /* Panel window id                     */
  108.  
  109. long HelpWid;                  /* Help window id                      */
  110. char *HelpCmd = 0;
  111. long Menu = -1;                /* Main menu */
  112.  
  113. /**********************************************************************/
  114. /* Font stuff for panels, menus                                       */
  115. /**********************************************************************/
  116. fmfonthandle FontScreen, FontScreen5, FontScreen8, FontScreen10;
  117. fmfontinfo FontScreenInfo, FontScreen5Info, FontScreen8Info, FontScreen10Info;
  118.  
  119. /**********************************************************************/
  120. /* Copy a relative viewer movement */
  121. /**********************************************************************/
  122. void CopyViewChg(oview, nview)
  123.      RelMovement *oview, *nview;
  124. {  
  125.   oview->rot[0] = nview->rot[0];
  126.   oview->rot[1] = nview->rot[1]; 
  127.   oview->rot[2] = nview->rot[2]; 
  128.   oview->transl[0] = nview->transl[0]; 
  129.   oview->transl[1] = nview->transl[1]; 
  130.   oview->transl[2] = nview->transl[2]; 
  131. }
  132.  
  133. /**********************************************************************/
  134. /* Copy a viewer position */
  135. /**********************************************************************/
  136. void CopyViewer(viewer,nviewer)
  137.      AbsMovement *viewer, *nviewer;
  138.      
  139. {
  140.   viewer->lookFrom.x = nviewer->lookFrom.x;
  141.   viewer->lookFrom.y = nviewer->lookFrom.y ; 
  142.   viewer->lookFrom.z = nviewer->lookFrom.z ; 
  143.   viewer->lookAt.x =   nviewer->lookAt.x ; 
  144.   viewer->lookAt.y =   nviewer->lookAt.y ; 
  145.   viewer->lookAt.z =   nviewer->lookAt.z ; 
  146.   viewer->lookUp.x =   nviewer->lookUp.x ; 
  147.   viewer->lookUp.y =   nviewer->lookUp.y ; 
  148.   viewer->lookUp.z =   nviewer->lookUp.z ; 
  149.   viewer->xRes =       nviewer->xRes; 
  150.   viewer->yRes =       nviewer->yRes;
  151.   viewer->fovx =       nviewer->fovx; 
  152.   viewer->fovy =       nviewer->fovy; 
  153.   viewer->near =       nviewer->near ; 
  154.   viewer->far =        nviewer->far ;
  155.   viewer->bank =       nviewer->bank ; 
  156. }
  157.