home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume28 / rayshade / patch04 (.txt) < prev    next >
LaTeX Document  |  1992-02-10  |  46KB  |  1,269 lines

  1. Newsgroups: comp.sources.misc
  2. From: Craig Kolb <rayshade-request@cs.princeton.edu>
  3. Subject:  v28i030:  rayshade - A raytracing package for UNIX, Patch04
  4. Message-ID: <1992Feb10.162026.5810@sparky.imd.sterling.com>
  5. X-Md4-Signature: c0a893b6c041148a9801edd1aa2c3b24
  6. Date: Mon, 10 Feb 1992 16:20:26 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8. Submitted-by: Craig Kolb <rayshade-request@cs.princeton.edu>
  9. Posting-number: Volume 28, Issue 30
  10. Archive-name: rayshade/patch04
  11. Environment: UNIX
  12. Patch-To: rayshade: Volume 21, Issue 3-22
  13. System: rayshade version 4.0
  14. Patch #: 4
  15. Priority: HIGH
  16. Subject: patch #3, continued
  17. Date: Mon Feb  3 13:23:58 EST 1992
  18. From: Rayshade Construction Co. <rayshade-request@cs.princeton.edu>
  19. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your rayshade source
  20.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  21.     If you don't have the patch program, apply the following by hand,
  22.     or get patch (version 2.0, latest patchlevel).
  23.     After patching:
  24.         *** DO NOTHING--INSTALL ALL PATCHES UP THROUGH #5 FIRST ***
  25.     If patch indicates that patchlevel is the wrong version, you may need
  26.     to apply one or more previous patches, or the patch may already
  27.     have been applied.  See the patchlevel.h file to find out what has or
  28.     has not been applied.  In any event, don't continue with the patch.
  29.     If you are missing previous patches they can be obtained through
  30.     anonymous ftp from weedeater.math.yale.edu (130.132.23.17) in
  31.     pub/rayshade.4.0/patches.
  32. Index: patchlevel.h
  33. Prereq: 3
  34. < #define PATCHLEVEL 3
  35. > #define PATCHLEVEL 4
  36. Index: Doc/Guide/options.tex
  37. *** old/Doc/Guide/options.tex    Mon Feb  3 12:50:02 1992
  38. --- new/Doc/Guide/options.tex    Fri Jan 17 10:29:14 1992
  39. ***************
  40. *** 1,12 ****
  41.   \chapter{Options}
  42. ! This appendix describes the command-line arguments accepted by {\em rayshade}.
  43.   These options override defaults
  44.   as well as any values or flags given in the input file,
  45.   and are thus useful for generating test and other unusual, ``non-standard''
  46.   renderings.
  47. ! The general form of a \rayshade command line is:
  48.   \begin{quote}
  49.   {\tt rayshade} [{\em Options}] [{\em filename}]
  50.   \end{quote}
  51. --- 1,12 ----
  52.   \chapter{Options}
  53. ! This appendix describes the command-line arguments accepted by {\rayshade}.
  54.   These options override defaults
  55.   as well as any values or flags given in the input file,
  56.   and are thus useful for generating test and other unusual, ``non-standard''
  57.   renderings.
  58. ! The general form of a {\rayshade} command line is:
  59.   \begin{quote}
  60.   {\tt rayshade} [{\em Options}] [{\em filename}]
  61.   \end{quote}
  62. ***************
  63. *** 20,26 ****
  64.   Command-line options fall into two broad categories: those that set
  65.   numerical or other values and thus must be followed by further arguments,
  66. ! and those that simply turn features on and off.  {\em Rayshade}'s
  67.   convention is to denote the value-setting arguments using capital letters,
  68.   and feature-toggling arguments using lower-case letters.
  69. --- 20,26 ----
  70.   Command-line options fall into two broad categories: those that set
  71.   numerical or other values and thus must be followed by further arguments,
  72. ! and those that simply turn features on and off.  {\Rayshade}'s
  73.   convention is to denote the value-setting arguments using capital letters,
  74.   and feature-toggling arguments using lower-case letters.
  75. ***************
  76. *** 46,52 ****
  77.       Continue an interrupted rendering.
  78.   \end{defkey}
  79.   When given, this option indicates that the image file being written
  80. ! to contains a partially-completed image.  \Rayshade will read the
  81.   image to determine the scanline from which to continue the rendering.
  82.   This option is only available with the Utah Raster Toolkit.
  83.   The {\tt -O} option must also be used.
  84. --- 46,52 ----
  85.       Continue an interrupted rendering.
  86.   \end{defkey}
  87.   When given, this option indicates that the image file being written
  88. ! to contains a partially-completed image.  {\Rayshade} will read the
  89.   image to determine the scanline from which to continue the rendering.
  90.   This option is only available with the Utah Raster Toolkit.
  91.   The {\tt -O} option must also be used.
  92. ***************
  93. *** 74,79 ****
  94. --- 74,87 ----
  95.   \end{defkey}
  96.   Overrides the value given using the {\tt report} keyword.
  97. + \begin{defkey}{-f}{}
  98. +     Flip all computed polygon (and triangle) normals.
  99. + \end{defkey}
  100. + This option should be used when rendering polygons defined
  101. + by vertices given in {\em clockwise}
  102. + order, rather than counter-clockwise order as
  103. + expected by {\rayshade}.
  104.   \begin{defkey}{-G}{{\em gamma}}
  105.       Use given gamma correction exponent writing writing
  106.       color information to the image file.
  107. ***************
  108. *** 91,100 ****
  109.   \end{defkey}
  110.   \begin{defkey}{-j}{}
  111. !     Use jittered sampling to perform antialiasing.
  112.   \end{defkey}
  113. - This option overrides the {\tt adaptive} keyword, if present,
  114. - in the input file.
  115.   \begin{defkey}{-l}{}
  116.       Render the left stereo pair image.
  117. --- 99,107 ----
  118.   \end{defkey}
  119.   \begin{defkey}{-j}{}
  120. !     Toggle the use of jittered sampling to perform antialiasing.
  121. !     If disabled, a fixed sampling pattern is used.
  122.   \end{defkey}
  123.   \begin{defkey}{-l}{}
  124.       Render the left stereo pair image.
  125. ***************
  126. *** 129,144 ****
  127.       Toggle the effect of object opacity on shadows.
  128.   \end{defkey}
  129.   This option is equivalent to specifying {\tt shadowtransp}
  130. ! in the input file.  By default, \rayshade traces shadow
  131.   rays through non-opaque objects.
  132. ! \begin{defkey}{-P}{}
  133.       Specify the options that should be passed to the C
  134.       preprocessor.
  135.   \end{defkey}
  136.   The C preprocessor, if available, is applied to all of the input
  137.   passed to {\em rayshade}.
  138.   \begin{defkey}{-p}{}
  139.       Perform preview-quality rendering.
  140.   \end{defkey}
  141. --- 136,151 ----
  142.       Toggle the effect of object opacity on shadows.
  143.   \end{defkey}
  144.   This option is equivalent to specifying {\tt shadowtransp}
  145. ! in the input file.  By default, {\rayshade} traces shadow
  146.   rays through non-opaque objects.
  147. ! \begin{defkey}{-P}{{\em cpp-arguments}}
  148.       Specify the options that should be passed to the C
  149.       preprocessor.
  150.   \end{defkey}
  151.   The C preprocessor, if available, is applied to all of the input
  152.   passed to {\em rayshade}.
  153.   \begin{defkey}{-p}{}
  154.       Perform preview-quality rendering.
  155.   \end{defkey}
  156. ***************
  157. *** 168,174 ****
  158.   \begin{defkey}{-s}{}
  159.       Disable caching of  shadowing information.
  160.   \end{defkey}
  161. ! It should not be necessary to ever use this option.
  162.   \begin{defkey}{-T}{{\em r g b}}
  163.       Set the contrast threshold in the three
  164. --- 175,181 ----
  165.   \begin{defkey}{-s}{}
  166.       Disable caching of  shadowing information.
  167.   \end{defkey}
  168. ! It should never be necessary to use this option.
  169.   \begin{defkey}{-T}{{\em r g b}}
  170.       Set the contrast threshold in the three
  171. ***************
  172. *** 177,182 ****
  173. --- 184,197 ----
  174.   This option overrides any value given through the use of
  175.   the {\em contrast} keyword.
  176. + \begin{defkey}{-u}{}
  177. +     Toggle the use of the C preprocessor.
  178. + \end{defkey}
  179. + {\Rayshade} usually feeds its input through a
  180. + C preprocessor if one is available on your system.
  181. + If this option is given, unadulterated input files will
  182. + be used.
  183.   \begin{defkey}{-V}{{\em    filename}}
  184.       Write verbose output to the named file.
  185.   \end{defkey}
  186. ***************
  187. *** 190,198 ****
  188.   selected and the objects defined to be included in the
  189.   report file.
  190. ! \begin{defkey}{-W}{{\em minx miny maxx maxy}}
  191. !     Render the specified subwindow.  The parameters
  192. !     should fall between zero and one.
  193.   \end{defkey}
  194.   This option is provided to facilitate changing and/or examining a
  195.   small portion of an image without having to re-render the entire
  196. --- 205,219 ----
  197.   selected and the objects defined to be included in the
  198.   report file.
  199. ! \begin{defkey}{-W}{{\em minx maxx miny maxy}}
  200. !     Render the specified window.
  201. ! \end{defkey}
  202. ! The window must be properly contained within the screen.  This
  203. ! option overrides any window specified using the {\em window} keyword
  204. ! in the input file.
  205. ! \begin{defkey}{-X}{{\em left right bottom top}}
  206. !     Crop the rendering window using the given normalized values.
  207.   \end{defkey}
  208.   This option is provided to facilitate changing and/or examining a
  209.   small portion of an image without having to re-render the entire
  210. Index: etc/rsconvert/yacc.y
  211. Prereq: 4.0.1.1
  212. *** old/etc/rsconvert/yacc.y    Mon Feb  3 12:49:50 1992
  213. --- new/etc/rsconvert/yacc.y    Mon Feb  3 09:11:58 1992
  214. ***************
  215. *** 11,23 ****
  216.   /*                                        */
  217.   /* There is no warranty or other guarantee of fitness of this software       */
  218.   /* for any purpose.  It is provided solely "as is".               */
  219. ! /* $Id: yacc.y,v 4.0.1.1 91/09/28 20:44:09 cek Exp Locker: cek $ */
  220.   #include <stdio.h>
  221.   #include "libcommon/common.h"
  222. ! /*#define NEWLINE()    WriteString("\n")*/
  223. ! #define NEWLINE()    printf("\n")
  224.   #define LIST    0
  225.   #define GRID    1
  226.   char yyfilename[BUFSIZ];
  227. --- 11,23 ----
  228.   /*                                        */
  229.   /* There is no warranty or other guarantee of fitness of this software       */
  230.   /* for any purpose.  It is provided solely "as is".               */
  231. ! /* $Id: yacc.y,v 4.0.1.2 91/11/26 21:13:36 cek Exp cek $ */
  232.   #include <stdio.h>
  233.   #include "libcommon/common.h"
  234. ! #define NEWLINE()    WriteNewline()
  235. ! /*#define NEWLINE()    printf("\n")*/
  236.   #define LIST    0
  237.   #define GRID    1
  238.   char yyfilename[BUFSIZ];
  239. ***************
  240. *** 31,42 ****
  241.       Vector v;
  242.   %token <d> tFLOAT
  243. ! %token <c> tSTRING
  244.   %token <i> tINT
  245.   %type <d> Fnumber sFnumber
  246.   %type <col> sColor
  247.   %type <v> sVector
  248. ! %token tADAPTIVE tAPERTURE 
  249.   %token tBACKGROUND tBLOTCH tBOX tBUMP tCONE tCYL tDIRECTIONAL
  250.   %token tENDDEF tEXTENDED tEYEP tFBM tFBMBUMP tFOCALDIST tFOG tFOV tGLOSS tGRID
  251.   %token tHEIGHTFIELD tJITTERED tLIGHT tLIST tLOOKP tMARBLE tMAXDEPTH tMIST
  252. --- 31,42 ----
  253.       Vector v;
  254.   %token <d> tFLOAT
  255. ! %token <c> tSTRING tHASHTHING
  256.   %token <i> tINT
  257.   %type <d> Fnumber sFnumber
  258.   %type <col> sColor
  259.   %type <v> sVector
  260. ! %token tADAPTIVE tAPERTURE
  261.   %token tBACKGROUND tBLOTCH tBOX tBUMP tCONE tCYL tDIRECTIONAL
  262.   %token tENDDEF tEXTENDED tEYEP tFBM tFBMBUMP tFOCALDIST tFOG tFOV tGLOSS tGRID
  263.   %token tHEIGHTFIELD tJITTERED tLIGHT tLIST tLOOKP tMARBLE tMAXDEPTH tMIST
  264. ***************
  265. *** 73,80 ****
  266. --- 73,87 ----
  267.           | Object
  268.           | Fog
  269.           | Mist
  270. +         | Hashthing
  271.           | ENDFILE        /* For backward compatibility */
  272.           ;
  273. + Hashthing    : tHASHTHING
  274. +         {
  275. +             WriteVerbatim("\n#");
  276. +             WriteVerbatim($1);
  277. +             WriteNewline();
  278. +         };
  279.   List        : LIST
  280.           {
  281.               NEWLINE();
  282. ***************
  283. *** 156,162 ****
  284.           {
  285.               NEWLINE();
  286.           }
  287. !         | FBM Fnumber Fnumber Fnumber Fnumber Int Fnumber tSTRING
  288.           {
  289.               NEWLINE();
  290.           }
  291. --- 163,169 ----
  292.           {
  293.               NEWLINE();
  294.           }
  295. !         | FBM Fnumber Fnumber Fnumber Fnumber Int Fnumber String
  296.           {
  297.               NEWLINE();
  298.           }
  299. ***************
  300. *** 401,406 ****
  301. --- 408,414 ----
  302.                   WriteFloat($10);
  303.                   WriteString("1 1 1");
  304.                   WriteFloat($11);
  305. +                 WriteNewline();
  306.               }
  307.           }
  308.           ;
  309. ***************
  310. *** 434,444 ****
  311. --- 442,466 ----
  312.           ;
  313.   Cylinder    : CYL String sVector sVector sFnumber
  314.           {
  315. +             Vector tmp;
  316.               /* Radius now goes first */
  317.               WriteFloat($5);
  318.               WriteVector(&$3);
  319.               WriteVector(&$4);
  320.               NEWLINE();
  321. +             WriteString("#ifdef ENDCAPS\n");
  322. +                 VecSub($3, $4, &tmp);
  323. +                 WriteVerbatim("disc ");
  324. +                 WriteFloat($5);    /* radius */
  325. +                 WriteVector(&$3); /* pos */
  326. +                 WriteVector(&tmp);
  327. +                 WriteVerbatim("\ndisc ");
  328. +                 VecScale(-1, tmp, &tmp);
  329. +                 WriteFloat($5);    /* radius */
  330. +                 WriteVector(&$4); /* pos */
  331. +                 WriteVector(&tmp);
  332. +             WriteString("\n#endif\n");
  333.           }
  334.           ;
  335.   Sphere        : SPHERE String Fnumber Vector
  336. ***************
  337. *** 495,502 ****
  338.               NEWLINE();
  339.           }
  340.           ;
  341. ! Fog        : FOG Fnumber Color
  342.           {
  343.               NEWLINE();
  344.           }
  345.           ;
  346. --- 517,526 ----
  347.               NEWLINE();
  348.           }
  349.           ;
  350. ! Fog        : FOG sFnumber sColor
  351.           {
  352. +             WriteColor(&$3);
  353. +             WriteFloat($2); WriteFloat($2); WriteFloat($2);
  354.               NEWLINE();
  355.           }
  356.           ;
  357. ***************
  358. *** 542,548 ****
  359.   FBM        : tFBM        { WriteString("fbm"); }
  360.   FBMBUMP        : tFBMBUMP    { WriteString("fbmbump"); }
  361.   FOCALDIST    : tFOCALDIST    { WriteString("focaldist"); }
  362. ! FOG        : tFOG        { WriteString("fog"); }
  363.   FOV        : tFOV        { WriteString("fov"); }
  364.   GLOSS        : tGLOSS    { WriteString("gloss"); }
  365.   GRID        : tGRID    tINT tINT tINT    { SetTypeGrid($2,$3,$4); }
  366. --- 566,572 ----
  367.   FBM        : tFBM        { WriteString("fbm"); }
  368.   FBMBUMP        : tFBMBUMP    { WriteString("fbmbump"); }
  369.   FOCALDIST    : tFOCALDIST    { WriteString("focaldist"); }
  370. ! FOG        : tFOG        { WriteString("atmosphere fog"); }
  371.   FOV        : tFOV        { WriteString("fov"); }
  372.   GLOSS        : tGLOSS    { WriteString("gloss"); }
  373.   GRID        : tGRID    tINT tINT tINT    { SetTypeGrid($2,$3,$4); }
  374. ***************
  375. *** 553,559 ****
  376.   LOOKP        : tLOOKP    { WriteString("lookp"); }
  377.   MARBLE        : tMARBLE    { WriteString("marble"); }
  378.   MAXDEPTH    : tMAXDEPTH    { WriteString("maxdepth"); }
  379. ! MIST        : tMIST        { WriteString("mist"); }
  380.   OBJECT        : tOBJECT    { WriteString("object"); }
  381.   OUTFILE        : tOUTFILE    { WriteString("outfile"); }
  382.   PLANE        : tPLANE    { WriteString("plane"); }
  383. --- 577,583 ----
  384.   LOOKP        : tLOOKP    { WriteString("lookp"); }
  385.   MARBLE        : tMARBLE    { WriteString("marble"); }
  386.   MAXDEPTH    : tMAXDEPTH    { WriteString("maxdepth"); }
  387. ! MIST        : tMIST        { WriteString("atmosphere mist"); }
  388.   OBJECT        : tOBJECT    { WriteString("object"); }
  389.   OUTFILE        : tOUTFILE    { WriteString("outfile"); }
  390.   PLANE        : tPLANE    { WriteString("plane"); }
  391. Index: libshade/yacc.y
  392. Prereq: 4.0.1.2
  393. *** old/libshade/yacc.y    Mon Feb  3 12:49:51 1992
  394. --- new/libshade/yacc.y    Fri Jan 17 10:30:13 1992
  395. ***************
  396. *** 11,17 ****
  397.   /*                                        */
  398.   /* There is no warranty or other guarantee of fitness of this software       */
  399.   /* for any purpose.  It is provided solely "as is".               */
  400. ! /* $Id: yacc.y,v 4.0.1.2 91/10/08 20:40:35 cek Exp Locker: cek $ */
  401.   #include "rayshade.h"
  402. --- 11,17 ----
  403.   /*                                        */
  404.   /* There is no warranty or other guarantee of fitness of this software       */
  405.   /* for any purpose.  It is provided solely "as is".               */
  406. ! /* $Id: yacc.y,v 4.0.1.4 92/01/10 16:29:55 cek Exp Locker: cek $ */
  407.   #include "rayshade.h"
  408. ***************
  409. *** 514,519 ****
  410. --- 514,520 ----
  411.                   AnimExpr AnimExpr AnimExpr
  412.                   AnimExpr AnimExpr AnimExpr
  413.           {
  414. +             $$ = TransXformCreate();
  415.               TransXformSetX0($$, $2);
  416.               TransXformSetY0($$, $3);
  417.               TransXformSetZ0($$, $4);
  418. ***************
  419. *** 648,653 ****
  420. --- 649,659 ----
  421.                   Options.window[HIGH][X] = $3;
  422.                   Options.window[LOW][Y] = $4;
  423.                   Options.window[HIGH][Y] = $5;
  424. +                 /*
  425. +                  * We must let ViewingSetup know
  426. +                  * that a window has been defined.
  427. +                  */
  428. +                 Options.window_set = TRUE;
  429.               }
  430.           }
  431.           ;
  432. ***************
  433. *** 1002,1007 ****
  434. --- 1008,1015 ----
  435.               Defstack = GeomStackPop(Defstack);
  436.               /* Pop current surface */
  437.               CurSurf = SurfPop(CurSurf);
  438. +             /* Make current default surf aggregate's default */
  439. +             $$->surf = CurSurf->surf;
  440.           }
  441.           ;
  442.   AggregateDef    : AggregateCreate Aggdefs tEND
  443. Index: rayview/glmethods.c
  444. Prereq: 4.0.1.2
  445. *** old/rayview/glmethods.c    Mon Feb  3 12:49:50 1992
  446. --- new/rayview/glmethods.c    Fri Jan 17 10:30:33 1992
  447. ***************
  448. *** 14,22 ****
  449.    * There is no warranty or other guarantee of fitness of this software
  450.    * for any purpose.  It is provided solely "as is".
  451. !  * $Id: glmethods.c,v 4.0.1.2 91/10/10 22:45:27 cek Exp $
  452.    * $Log:    glmethods.c,v $
  453.    * Revision 4.0.1.2  91/10/10  22:45:27  cek
  454.    * patch1: Added spotlight support.
  455.    * 
  456. --- 14,29 ----
  457.    * There is no warranty or other guarantee of fitness of this software
  458.    * for any purpose.  It is provided solely "as is".
  459. !  * $Id: glmethods.c,v 4.0.1.4 92/01/10 17:17:39 cek Exp Locker: cek $
  460.    * $Log:    glmethods.c,v $
  461. +  * Revision 4.0.1.4  92/01/10  17:17:39  cek
  462. +  * patch3: Added heightfield support.
  463. +  * 
  464. +  * Revision 4.0.1.3  91/12/13  11:43:11  cek
  465. +  * patch3: Spot direction and spread now set correctly.
  466. +  * patch3: Set GLC_OLDPOLYGON to 0 on sgi machines to fix VGX weirdness.
  467. +  * 
  468.    * Revision 4.0.1.2  91/10/10  22:45:27  cek
  469.    * patch1: Added spotlight support.
  470.    * 
  471. ***************
  472. *** 40,45 ****
  473. --- 47,53 ----
  474.   #include "libobj/csg.h"
  475.   #include "libobj/cylinder.h"
  476.   #include "libobj/disc.h"
  477. + #include "libobj/hf.h"
  478.   #include "libobj/grid.h"
  479.   #include "libobj/instance.h"
  480.   #include "libobj/list.h"
  481. ***************
  482. *** 117,123 ****
  483.       CylinderMethodRegister(GLCylinderDraw);
  484.       DiscMethodRegister(GLDiscDraw);
  485.       GridMethodRegister(GLGridDraw);
  486. !     /*HfMethodRegister(GLHfDraw);*/
  487.       InstanceMethodRegister(GLInstanceDraw);
  488.       ListMethodRegister(GLListDraw);
  489.       PlaneMethodRegister(GLPlaneDraw);
  490. --- 125,133 ----
  491.       CylinderMethodRegister(GLCylinderDraw);
  492.       DiscMethodRegister(GLDiscDraw);
  493.       GridMethodRegister(GLGridDraw);
  494. ! #ifdef sgi
  495. !     HfMethodRegister(GLHfDraw);
  496. ! #endif
  497.       InstanceMethodRegister(GLInstanceDraw);
  498.       ListMethodRegister(GLListDraw);
  499.       PlaneMethodRegister(GLPlaneDraw);
  500. ***************
  501. *** 186,191 ****
  502. --- 196,202 ----
  503.       ScreenDrawInit();
  504.       ObjectInit();
  505.       LightDrawInit();
  506.       /*
  507.        * Push the default surface.
  508.        */
  509. ***************
  510. *** 203,208 ****
  511. --- 214,224 ----
  512.   #endif
  513.       prefsize(Screen.xsize, Screen.ysize);
  514.       winopen("rayview");
  515. + #ifdef sgi
  516. +     glcompat(GLC_OLDPOLYGON, 0);
  517. + #endif
  518.       RGBmode();
  519.       mmode(MVIEWING);
  520. ***************
  521. *** 214,226 ****
  522.       gconfig();
  523.       blendfunction(BF_SA, BF_MSA);
  524.       /*
  525.        * Initialize viewing matrix.
  526.        */
  527.       GLViewingInit();
  528. -     zbuffer(TRUE);
  529.       BackPack = (unsigned char)(255*Screen.background.r) |
  530.           ((unsigned char)(255*Screen.background.g) << 8) |
  531.           ((unsigned char)(255*Screen.background.b) << 16);
  532. --- 230,242 ----
  533.       gconfig();
  534.       blendfunction(BF_SA, BF_MSA);
  535. +     zbuffer(TRUE);
  536.       /*
  537.        * Initialize viewing matrix.
  538.        */
  539.       GLViewingInit();
  540.       BackPack = (unsigned char)(255*Screen.background.r) |
  541.           ((unsigned char)(255*Screen.background.g) << 8) |
  542.           ((unsigned char)(255*Screen.background.b) << 16);
  543. ***************
  544. *** 564,570 ****
  545.   static void
  546. ! GLHfDraw(){}
  547.   static void
  548.   GLInstanceDraw(inst)
  549. --- 580,653 ----
  550.   static void
  551. ! GLHfDraw(hf)
  552. ! Hf *hf;
  553. !     int x, y;
  554. !     float n[3], v[3], del, del2, del4, dz1, delz, za, zb, zc;
  555. !     float bot, top, left, right, len;
  556. !     del = 1. / (hf->size - 1);
  557. !     del2 = del*del;
  558. !     del4 = del2*del2;
  559. !     bot = 0.;
  560. !     top = del;
  561. !     for (y = 0; y < hf->size -1; y++) {
  562. !         za = hf->data[y+1][0];
  563. !         zb = hf->data[y][0];
  564. !         left = 0;
  565. !         right = del;
  566. !         for (x = 1; x < hf->size; x++) {
  567. !             /*
  568. !              * A +-+ C
  569. !              *   |/
  570. !              * B +
  571. !              */
  572. !             zc = hf->data[y+1][x];
  573. !             dz1 = za - zb;
  574. !             delz = za - zc;
  575. !             len = sqrt(del2*delz*delz + del2*dz1*dz1 + del4);
  576. !             bgnpolygon();
  577. !             n[0] = del*delz/len;
  578. !             n[1] = -del*dz1/len;
  579. !             n[2] = del2/len;
  580. !             n3f(n);
  581. !             v[0] = left; v[1] = top; v[2] = za; v3f(v);
  582. !             v[1] = bot; v[2] = zb; v3f(v);
  583. !             v[0] = right; v[1] = top; v[2] = zc; v3f(v);
  584. !             endpolygon();
  585. !             /*
  586. !              *   B +
  587. !              *    /|
  588. !              * A +-+ C
  589. !              */
  590. !             za = zb; zb = zc; zc = hf->data[y][x];
  591. !             dz1 = zc - za;
  592. !             delz = zc - zb;
  593. !             len = sqrt(del2*dz1*dz1 + del2*delz*delz + del4);
  594. !             n[0] = -del*dz1/len;
  595. !             n[1] = del*delz/len;
  596. !             n[2] = del2/len;
  597. !             bgnpolygon();
  598. !             n3f(n);
  599. !             v[0] = left; v[1] = bot; v[2] = za; v3f(v);
  600. !             v[0] = right; v[2] = zc; v3f(v);
  601. !             v[1] = top; v[2] = zb; v3f(v);
  602. !             endpolygon();
  603. !             left = right;
  604. !             right += del;
  605. !             za = zb;
  606. !             zb = zc;
  607. !         }
  608. !         bot = top;
  609. !         top += del;
  610.   static void
  611.   GLInstanceDraw(inst)
  612. ***************
  613. *** 762,774 ****
  614.       lpos[1] = spot->pos.y;
  615.       lpos[2] = spot->pos.z;
  616.       lpos[3] = 1.;
  617. !     spotdir[0] = spot->pos.x - spot->dir.x;
  618. !     spotdir[1] = spot->pos.y - spot->dir.y;
  619. !     spotdir[2] = spot->pos.z - spot->dir.z;
  620.       *spotexp = spot->coef;
  621. !     *spotspread = spot->falloff;
  622.       lmdef(DEFLIGHT, curlight++, sizeof(lightprops) / sizeof(float),
  623.               lightprops);
  624.       *spotspread = 180.;
  625.       *spotexp = 1.;
  626. --- 845,858 ----
  627.       lpos[1] = spot->pos.y;
  628.       lpos[2] = spot->pos.z;
  629.       lpos[3] = 1.;
  630. !     spotdir[0] = spot->dir.x;
  631. !     spotdir[1] = spot->dir.y;
  632. !     spotdir[2] = spot->dir.z;
  633.       *spotexp = spot->coef;
  634. !     *spotspread = 180 * acos(spot->falloff) / PI;
  635.       lmdef(DEFLIGHT, curlight++, sizeof(lightprops) / sizeof(float),
  636.               lightprops);
  637. +     /* fix up spot defs so other source methods needn't reset them. */
  638.       *spotspread = 180.;
  639.       *spotexp = 1.;
  640. Index: README
  641. *** old/README    Mon Feb  3 12:49:52 1992
  642. --- new/README    Fri Jan 17 10:29:21 1992
  643. ***************
  644. *** 35,41 ****
  645.   conversion utility, rsconvert.  See Doc/Changes for a list of some of
  646.   the more important changes.
  647. ! Rayshade v4.0 Beta has been tested on several different UNIX-based computers,
  648.   including: SGI 4D, IBM RS6000, Sun Sparcstation 1, Sun 3, DECstation,
  649.   Apollo DN10000, NeXT.  If your machine has a C compiler, enough memory
  650.   (at least 2Mb), and runs something resembling UNIX, rayshade should be fairly
  651. --- 35,41 ----
  652.   conversion utility, rsconvert.  See Doc/Changes for a list of some of
  653.   the more important changes.
  654. ! Rayshade v4.0 has been tested on many different UNIX-based computers,
  655.   including: SGI 4D, IBM RS6000, Sun Sparcstation 1, Sun 3, DECstation,
  656.   Apollo DN10000, NeXT.  If your machine has a C compiler, enough memory
  657.   (at least 2Mb), and runs something resembling UNIX, rayshade should be fairly
  658. ***************
  659. *** 54,60 ****
  660.   Normally, rayshade makes use of the Utah Raster toolkit.  You are
  661.   strongly encouraged to get a copy of the toolkit, as it provides a
  662. ! host of useful tools for image manipulation and a library for reading/reading
  663.   the toolkit's "RLE" format image files.  "blurb.urt" is the "blurb" file from
  664.   the latest distribution of the toolkit.  Also of interest is the
  665.   "fbm" library, available from nl.cs.cmu.edu:/usr/mlm/ftp/fbm.tar.Z, which
  666. --- 54,60 ----
  667.   Normally, rayshade makes use of the Utah Raster toolkit.  You are
  668.   strongly encouraged to get a copy of the toolkit, as it provides a
  669. ! host of useful tools for image manipulation and a library for reading/writing
  670.   the toolkit's "RLE" format image files.  "blurb.urt" is the "blurb" file from
  671.   the latest distribution of the toolkit.  Also of interest is the
  672.   "fbm" library, available from nl.cs.cmu.edu:/usr/mlm/ftp/fbm.tar.Z, which
  673. ***************
  674. *** 140,147 ****
  675.   William Bouma, Allen Braunsdorf, Jeff Butterworth, Nick Carriero,
  676.   Nancy Everson, Tom Friedel, Robert Funchess, David Gelernter, Mike Gigante,
  677.   Ed Herderick, John Knuston, Raphael Manfredi, Lee Moore, Dietmar Saupe,
  678. ! Brian Wyvill, and everybody else for their bugfixes, suggestions, input files,
  679. ! encouragement, and other feedback.
  680.   Thanks also to Mark Podlipec for providing the blob and torus objects.
  681. --- 140,147 ----
  682.   William Bouma, Allen Braunsdorf, Jeff Butterworth, Nick Carriero,
  683.   Nancy Everson, Tom Friedel, Robert Funchess, David Gelernter, Mike Gigante,
  684.   Ed Herderick, John Knuston, Raphael Manfredi, Lee Moore, Dietmar Saupe,
  685. ! Iain Sinclair, Brian Wyvill, and everybody else for their bugfixes,
  686. ! suggestions, input files, encouragement, and other feedback.
  687.   Thanks also to Mark Podlipec for providing the blob and torus objects.
  688. ***************
  689. *** 149,155 ****
  690.   His code, and a host of other useful routines, can be found in
  691.   "Graphics Gems", edited by Andrew Glassner.
  692. ! Thanks to Benoit Mandelbrot for his support and inspiration.
  693.   If you find any bugs, make any useful extensions, have a nice input file,
  694.   port rayshade to a new environment, or need assistance understanding a
  695. --- 149,155 ----
  696.   His code, and a host of other useful routines, can be found in
  697.   "Graphics Gems", edited by Andrew Glassner.
  698. ! Thanks to Benoit Mandelbrot for the support he provided this project.
  699.   If you find any bugs, make any useful extensions, have a nice input file,
  700.   port rayshade to a new environment, or need assistance understanding a
  701. ***************
  702. *** 162,169 ****
  703.   Craig Kolb
  704.   Rod Bogart
  705. ! 9 October 1991
  706. ! rayshade@weedeater.math.yale.edu
  707.   Craig Kolb 
  708.   Computer Science Department
  709. --- 162,169 ----
  710.   Craig Kolb
  711.   Rod Bogart
  712. ! 10 January 1992
  713. ! rayshade-request@cs.yale.edu
  714.   Craig Kolb 
  715.   Computer Science Department
  716. Index: raypaint/README
  717. *** old/raypaint/README    Mon Feb  3 12:42:23 1992
  718. --- new/raypaint/README    Fri Jan 17 10:30:23 1992
  719. ***************
  720. *** 17,26 ****
  721.   The middle mouse button may be used to sweep out a rectangular region to
  722.   which raypaint should restrict its refinement:  Press and hold the middle
  723. ! mouse button while pointing at one corner of the region on interest,
  724.   drag the cursor to the opposite corner and release the mouse button.
  725.   Note that no rectangle will be drawn.  Refinement will continue inside
  726. ! of the indicated region, using whatever sampling
  727.   When every pixel has been sampled, an image file is written.
  728. --- 17,26 ----
  729.   The middle mouse button may be used to sweep out a rectangular region to
  730.   which raypaint should restrict its refinement:  Press and hold the middle
  731. ! mouse button while pointing at one corner of the region of interest,
  732.   drag the cursor to the opposite corner and release the mouse button.
  733.   Note that no rectangle will be drawn.  Refinement will continue inside
  734. ! of the indicated region.
  735.   When every pixel has been sampled, an image file is written.
  736. Index: etc/rsconvert/lex.l
  737. Prereq: 4.0
  738. *** old/etc/rsconvert/lex.l    Mon Feb  3 12:42:44 1992
  739. --- new/etc/rsconvert/lex.l    Fri Jan 17 10:29:21 1992
  740. ***************
  741. *** 10,16 ****
  742.   /*                                        */
  743.   /* There is no warranty or other guarantee of fitness of this software       */
  744.   /* for any purpose.  It is provided solely "as is".               */
  745. ! /* $Id: lex.l,v 4.0 91/07/17 14:29:16 kolb Exp Locker: kolb $ */
  746.   #include "config.h"
  747.   #include <stdio.h>
  748. --- 10,16 ----
  749.   /*                                        */
  750.   /* There is no warranty or other guarantee of fitness of this software       */
  751.   /* for any purpose.  It is provided solely "as is".               */
  752. ! /* $Id: lex.l,v 4.0.1.1 91/11/26 21:12:29 cek Exp Locker: cek $ */
  753.   #include "config.h"
  754.   #include <stdio.h>
  755. ***************
  756. *** 29,37 ****
  757.   string    ({alpha}|"/")({alpha}|{digit}|{special}|"/")*
  758.   %p 3000
  759. ! [\t\n]            {WriteVerbatim(yytext);};
  760.   " "            {};
  761. ! ^#            {handlehash();}
  762.   "/*"            {skipcomments();}
  763.   adaptive        {return(tADAPTIVE);}
  764.   aperture        {return(tAPERTURE);}
  765. --- 29,38 ----
  766.   string    ({alpha}|"/")({alpha}|{digit}|{special}|"/")*
  767.   %p 3000
  768. ! [\t]            {WriteVerbatim(yytext);};
  769. ! "\n"            {};
  770.   " "            {};
  771. ! ^#            {return handlehash();}
  772.   "/*"            {skipcomments();}
  773.   adaptive        {return(tADAPTIVE);}
  774.   aperture        {return(tAPERTURE);}
  775. ***************
  776. *** 111,116 ****
  777. --- 112,118 ----
  778.           WriteChar(c);
  779.           if ((c = input()) == '/') {
  780.               WriteChar(c);
  781. +             WriteNewline();
  782.               return;
  783.           }
  784.           unput(c);
  785. ***************
  786. *** 127,133 ****
  787.   handlehash()
  788.       char buf[BUFSIZ];
  789. !     int i;
  790.       extern int yylineno;
  791.       extern char yyfilename[];
  792. --- 129,135 ----
  793.   handlehash()
  794.       char buf[BUFSIZ];
  795. !     int i, linenumber;
  796.       extern int yylineno;
  797.       extern char yyfilename[];
  798. ***************
  799. *** 139,162 ****
  800.       unput(buf[i]);        /* To make sure consecutive # lines work. */
  801.       buf[i] = (char)NULL;    /* Replace newline with NULL. */
  802. !     /*
  803. !      * Check to see if it's #include or
  804. !      * #define.
  805. !      * If so just spit out the line.
  806. !      */
  807. !     if (strncmp("include", buf, 7) == 0 || strncmp("define", buf, 6) == 0) {
  808. !         WriteVerbatim("#");
  809. !         WriteVerbatim(buf);
  810. !         return;
  811.       /*
  812. !      * Complain if the line was not of the form #n "filename"
  813.        */
  814. !     if ((i = sscanf(buf, "%d \"%[^\"]s\"", &yylineno, yyfilename)) == 0) {
  815. !         yyerror("Unknown '#' control.");
  816. !         exit(1);
  817. !     if (i == 1) {
  818.   #ifdef SYSV
  819.           if (strchr(buf, '"') != (char *)0) {
  820.   #else
  821. --- 141,153 ----
  822.       unput(buf[i]);        /* To make sure consecutive # lines work. */
  823.       buf[i] = (char)NULL;    /* Replace newline with NULL. */
  824. !     yylval.c = strsave(buf);
  825.       /*
  826. !      * Set file/line if the line was of the form #n "filename"
  827.        */
  828. !     if ((i = sscanf(buf, "%d \"%[^\"]s\"", &linenumber, buf)) != 0) {
  829. !         yylineno = linenumber;
  830.   #ifdef SYSV
  831.           if (strchr(buf, '"') != (char *)0) {
  832.   #else
  833. ***************
  834. *** 166,171 ****
  835.                * Filename was "", which means stdin.
  836.                */
  837.               strcpy(yyfilename, "stdin");
  838. !         }
  839. --- 157,164 ----
  840.                * Filename was "", which means stdin.
  841.                */
  842.               strcpy(yyfilename, "stdin");
  843. !         } else
  844. !             strcpy(yyfilename, buf);
  845. +     return tHASHTHING;
  846. Index: libshade/lex.l
  847. Prereq: 4.0.1.2
  848. *** old/libshade/lex.l    Mon Feb  3 12:49:59 1992
  849. --- new/libshade/lex.l    Fri Jan 17 10:30:08 1992
  850. ***************
  851. *** 11,17 ****
  852.   /* There is no warranty or other guarantee of fitness of this software       */
  853.   /* for any purpose.  It is provided solely "as is".               */
  854.   /*                                       */
  855. ! /* $Id: lex.l,v 4.0.1.2 91/10/08 20:25:59 cek Exp Locker: cek $ */
  856.   #include "config.h"
  857.   #include "rayshade.h"
  858. --- 11,17 ----
  859.   /* There is no warranty or other guarantee of fitness of this software       */
  860.   /* for any purpose.  It is provided solely "as is".               */
  861.   /*                                       */
  862. ! /* $Id: lex.l,v 4.0.1.3 92/01/14 18:28:38 cek Exp Locker: cek $ */
  863.   #include "config.h"
  864.   #include "rayshade.h"
  865. ***************
  866. *** 201,217 ****
  867.       /*
  868.        * Complain if the line was not of the form #n "filename"
  869.        */
  870. !     if ((i = sscanf(buf, "%d \"%[^\"]s\"", &yylineno, yyfilename)) == 0) {
  871. !         RLerror(RL_PANIC, "Unknown '#' control (%s).",buf);
  872.           exit(1);
  873. !     if (i == 1) {
  874. !         if (index(buf, '"') != (char *)NULL) {
  875. !             /*
  876. !              * Filename was "", which means stdin.
  877. !              */
  878. !             (void)strcpy(yyfilename, "stdin");
  879. !         }
  880.       yylineno--;  /* The newline we unput will increment yylineno */
  881. --- 201,216 ----
  882.       /*
  883.        * Complain if the line was not of the form #n "filename"
  884.        */
  885. !     if ((i = sscanf(buf,"%d \"%[^\"]s\"", &yylineno, yyfilename)) == 0 &&
  886. !         (i = sscanf(buf," line %d \"%[^\"]s\"",&yylineno,yyfilename))==0) {
  887. !         RLerror(RL_PANIC, "Unknown '#' control (%s).\n",buf);
  888.           exit(1);
  889. !     if (i == 1 && (index(buf,'"') != (char *)NULL)) {
  890. !         /*
  891. !          * Filename was given as ""
  892. !          */
  893. !         (void)strcpy(yyfilename, "stdin");
  894.       yylineno--;  /* The newline we unput will increment yylineno */
  895. Index: Doc/Guide/animate.tex
  896. *** old/Doc/Guide/animate.tex    Mon Feb  3 12:49:57 1992
  897. --- new/Doc/Guide/animate.tex    Fri Jan 17 10:29:12 1992
  898. ***************
  899. *** 1,6 ****
  900.   \chapter{Animation}
  901. ! \Rayshade provides basic animation animation support by
  902.   allowing time-varying
  903.   transformations to be associated with primitives and aggregate objects.
  904.   Commands are provided for controlling the amount of time between each
  905. --- 1,6 ----
  906.   \chapter{Animation}
  907. ! {\Rayshade}\ provides basic animation animation support by
  908.   allowing time-varying
  909.   transformations to be associated with primitives and aggregate objects.
  910.   Commands are provided for controlling the amount of time between each
  911. ***************
  912. *** 7,15 ****
  913.   frame, the speed of the camera shutter, and the total number of frames
  914.   to be rendered.
  915. ! By default, rayshade renders a single frame, with the shutter open for
  916.   an instant (0 units of time, in fact).  The shutter speed in no way
  917. ! changes the light-gathering properties of the camera, i.e. frames
  918.   rendered using
  919.   a longer exposure will not appear brighter than those with a shorter
  920.   exposure.  The only change will be in the potential amount of movement
  921. --- 7,15 ----
  922.   frame, the speed of the camera shutter, and the total number of frames
  923.   to be rendered.
  924. ! By default, {\rayshade} renders a single frame, with the shutter open for
  925.   an instant (0 units of time, in fact).  The shutter speed in no way
  926. ! changes the light-gathering properties of the camera, i.e., frames
  927.   rendered using
  928.   a longer exposure will not appear brighter than those with a shorter
  929.   exposure.  The only change will be in the potential amount of movement
  930. ***************
  931. *** 16,22 ****
  932.   that the
  933.   frame ``sees'' during the time that the shutter is open.
  934. ! Each ray cast by \rayshade samples a particular moment in time.
  935.   The time value assigned to a ray
  936.   ranges from the starting time of the current frame to the starting
  937.   time plus the amount of time the shutter is open.  When
  938. --- 16,22 ----
  939.   that the
  940.   frame ``sees'' during the time that the shutter is open.
  941. ! Each ray cast by {\rayshade} samples a particular moment in time.
  942.   The time value assigned to a ray
  943.   ranges from the starting time of the current frame to the starting
  944.   time plus the amount of time the shutter is open.  When
  945. ***************
  946. *** 27,33 ****
  947.   computations are performed.
  948.   The starting time of the current frame is computed using the
  949. ! lenth of each frame
  950.   the current frame number, and the starting time of the first frame.
  951.   \begin{defkey}{shutter}{{\em t}}
  952. --- 27,33 ----
  953.   computations are performed.
  954.   The starting time of the current frame is computed using the
  955. ! length of each frame
  956.   the current frame number, and the starting time of the first frame.
  957.   \begin{defkey}{shutter}{{\em t}}
  958. ***************
  959. *** 73,79 ****
  960.   The second animated variable, {\tt frame}, is equal to the current
  961.   frame number.  Unlike the {\tt time} variable, {\tt frame} takes on
  962.   a single value for the duration of each frame.  Thus, transforms
  963. ! animated through the use of the {\tt time} variable will not exhibit
  964.   motion blurring.
  965.   Also supported is the {\tt linear} function.  This function uses
  966. --- 73,79 ----
  967.   The second animated variable, {\tt frame}, is equal to the current
  968.   frame number.  Unlike the {\tt time} variable, {\tt frame} takes on
  969.   a single value for the duration of each frame.  Thus, transforms
  970. ! animated through the use of the {\tt frame} variable will not exhibit
  971.   motion blurring.
  972.   Also supported is the {\tt linear} function.  This function uses
  973. ***************
  974. *** 81,87 ****
  975.   \begin{defkey}{linear}{{\tt (} {\em Stime, Sval, Etime, Eval} {\tt )}}
  976.       Linearly interpolate between {\em Sval} at time
  977. !     {\em Stime} and {\em Etime} at time {\em Eval}.
  978.       If the current time is less than {\em Stime}, the function
  979.       returns {\em Sval}.  If the current time is greater than
  980.       {\em Etime}, {\em Eval} is returned.
  981. --- 81,87 ----
  982.   \begin{defkey}{linear}{{\tt (} {\em Stime, Sval, Etime, Eval} {\tt )}}
  983.       Linearly interpolate between {\em Sval} at time
  984. !     {\em Stime} and {\em Eval} at time {\em Etime}.
  985.       If the current time is less than {\em Stime}, the function
  986.       returns {\em Sval}.  If the current time is greater than
  987.       {\em Etime}, {\em Eval} is returned.
  988. ***************
  989. *** 99,102 ****
  990.   \end{verbatim}
  991.   Further examples of animation may be found in the Examples directory
  992. ! of the \rayshade distribution.
  993. --- 99,102 ----
  994.   \end{verbatim}
  995.   Further examples of animation may be found in the Examples directory
  996. ! of the {\rayshade} distribution.
  997. Index: Doc/Guide/intro.tex
  998. *** old/Doc/Guide/intro.tex    Mon Feb  3 12:42:31 1992
  999. --- new/Doc/Guide/intro.tex    Fri Jan 17 10:29:12 1992
  1000. ***************
  1001. *** 1,7 ****
  1002.   \chapter{Introduction}
  1003.   \pagenumbering{arabic}
  1004. ! This document describes \rayshade in enough detail to enable
  1005.   the technical-minded to
  1006.   sit down and render some images.  In its current form,
  1007.   it is truly a draft, and even then
  1008. --- 1,7 ----
  1009.   \chapter{Introduction}
  1010.   \pagenumbering{arabic}
  1011. ! This document describes {\rayshade} in enough detail to enable
  1012.   the technical-minded to
  1013.   sit down and render some images.  In its current form,
  1014.   it is truly a draft, and even then
  1015. ***************
  1016. *** 10,34 ****
  1017.   This document does not provide any kind of thorough introduction
  1018.   to the basics of computer graphics or ray tracing.
  1019.   There are many other excellent sources for this kind of information.
  1020. ! The technical and coding details of \rayshade and
  1021.   its libraries will be documented elsewhere.
  1022.   \section{Getting Started}
  1023. ! The best way to learn how to use \rayshade is to dive right in and
  1024.   start making pictures.  Study the example
  1025. ! input files that are packaged with {\em rayshade}.  Run them through
  1026. ! rayshade to see what the images they produce look like.
  1027.   Change the input files; move the camera,
  1028.   change the field of view, modify surface properties, and see what differences
  1029.   your changes make, all the while referring to the appropriate portions
  1030.   of this document.  Browse through the individual chapters
  1031. ! to see what \rayshade can and cannot do.  The \rayshade quick reference
  1032.   guide may also help you sort out syntactical nasties.
  1033.   Throughout this text, the {\tt typewriter} type style is used to indicate
  1034.   keywords and other items that should be passed
  1035. ! directly {\em rayshade}.  Where appropriate,
  1036.   items in an {\em italic\/} style indicate
  1037.   places where you should provide an appropriate number or string.
  1038. --- 10,34 ----
  1039.   This document does not provide any kind of thorough introduction
  1040.   to the basics of computer graphics or ray tracing.
  1041.   There are many other excellent sources for this kind of information.
  1042. ! The technical and coding details of {\rayshade} and
  1043.   its libraries will be documented elsewhere.
  1044.   \section{Getting Started}
  1045. ! The best way to learn how to use {\rayshade} is to dive right in and
  1046.   start making pictures.  Study the example
  1047. ! input files that are packaged with {\rayshade}.  Run them through
  1048. ! {\rayshade} to see what the images they produce look like.
  1049.   Change the input files; move the camera,
  1050.   change the field of view, modify surface properties, and see what differences
  1051.   your changes make, all the while referring to the appropriate portions
  1052.   of this document.  Browse through the individual chapters
  1053. ! to see what {\rayshade} can and cannot do.  The {\rayshade} quick reference
  1054.   guide may also help you sort out syntactical nasties.
  1055.   Throughout this text, the {\tt typewriter} type style is used to indicate
  1056.   keywords and other items that should be passed
  1057. ! directly to {\rayshade}.  Where appropriate,
  1058.   items in an {\em italic\/} style indicate
  1059.   places where you should provide an appropriate number or string.
  1060. ***************
  1061. *** 43,53 ****
  1062.   \section{A Simple Example}
  1063. ! Because \rayshade provides a default camera description, surface properties,
  1064.   and a default light
  1065.   source, it is easy to construct short input files that allow you to
  1066.   experiment with objects, textures, and transformations.
  1067. ! If you haven't already run \rayshade on one of the example input files,
  1068.   you might want to try producing an image using the following input:
  1069.   \begin{verbatim}
  1070. --- 43,53 ----
  1071.   \section{A Simple Example}
  1072. ! Because {\rayshade} provides a default camera description, surface properties,
  1073.   and a default light
  1074.   source, it is easy to construct short input files that allow you to
  1075.   experiment with objects, textures, and transformations.
  1076. ! If you haven't already run {\rayshade} on one of the example input files,
  1077.   you might want to try producing an image using the following input:
  1078.   \begin{verbatim}
  1079. ***************
  1080. *** 54,60 ****
  1081.      sphere 2 0 0 0
  1082.   \end{verbatim}
  1083. ! If you are running \rayshade on a UNIX\footnote{UNIX is a trademark
  1084.   of AT\&T Bell Laboratories}-like machine, the command:
  1085.   \begin{verbatim}
  1086.     echo "sphere 2 0 0 0" | rayshade > sphere.rle
  1087. --- 54,60 ----
  1088.      sphere 2 0 0 0
  1089.   \end{verbatim}
  1090. ! If you are running {\rayshade} on a UNIX\footnote{UNIX is a trademark
  1091.   of AT\&T Bell Laboratories}-like machine, the command:
  1092.   \begin{verbatim}
  1093.     echo "sphere 2 0 0 0" | rayshade > sphere.rle
  1094. Index: libray/libsurf/surfshade.c
  1095. Prereq: 4.0
  1096. *** old/libray/libsurf/surfshade.c    Mon Feb  3 12:42:45 1992
  1097. --- new/libray/libsurf/surfshade.c    Fri Jan 17 10:29:47 1992
  1098. ***************
  1099. *** 13,21 ****
  1100.    * There is no warranty or other guarantee of fitness of this software
  1101.    * for any purpose.  It is provided solely "as is".
  1102. !  * $Id: surfshade.c,v 4.0 91/07/17 14:41:15 kolb Exp Locker: kolb $
  1103.    * $Log:    surfshade.c,v $
  1104.    * Revision 4.0  91/07/17  14:41:15  kolb
  1105.    * Initial version.
  1106.    * 
  1107. --- 13,28 ----
  1108.    * There is no warranty or other guarantee of fitness of this software
  1109.    * for any purpose.  It is provided solely "as is".
  1110. !  * $Id: surfshade.c,v 4.0.1.2 92/01/10 14:08:28 cek Exp Locker: cek $
  1111.    * $Log:    surfshade.c,v $
  1112. +  * Revision 4.0.1.2  92/01/10  14:08:28  cek
  1113. +  * patch3: Fixed additional composition problems.
  1114. +  * 
  1115. +  * Revision 4.0.1.1  91/12/13  11:54:51  cek
  1116. +  * patch3: Fixed ordering of world/model xform composition.
  1117. +  * patch3: Geometric normal now transformed correctly.
  1118. +  * 
  1119.    * Revision 4.0  91/07/17  14:41:15  kolb
  1120.    * Initial version.
  1121.    * 
  1122. ***************
  1123. *** 67,72 ****
  1124. --- 74,80 ----
  1125.        */
  1126.       for (i = 0, hp = hitlist->data; i < hitlist->nodes -1; hp++, i++) {
  1127.           obj = hp->obj;
  1128. +         texturing = texturing || obj->texture;
  1129.           if (hp->dotrans) {
  1130.               /*
  1131.                * Here we're actually computing prim2world.
  1132. ***************
  1133. *** 73,87 ****
  1134.                * When finished, we invert it.
  1135.                */
  1136.               if (transforming) {
  1137. !                 TransCompose(&hp->trans, &world2model,
  1138.                       &world2model);
  1139.               } else {
  1140.                   TransCopy(&hp->trans, &world2model);
  1141.               }
  1142. -             transforming = TRUE;
  1143.           }
  1144. -         if (obj->texture)
  1145. -             texturing = TRUE;
  1146.       /*
  1147. --- 81,93 ----
  1148.                * When finished, we invert it.
  1149.                */
  1150.               if (transforming) {
  1151. !                 TransCompose(&world2model, &hp->trans,
  1152.                       &world2model);
  1153.               } else {
  1154.                   TransCopy(&hp->trans, &world2model);
  1155. +                 transforming = TRUE;
  1156.               }
  1157.           }
  1158.       /*
  1159. ***************
  1160. *** 150,156 ****
  1161.       TransInit(&prim2model);
  1162.       rtmp = hitlist->data[0].ray;
  1163.       /*
  1164. !      * Walk down hitlist.
  1165.        */
  1166.       for (hp = hitlist->data, i = 0; i < hitlist->nodes -1; i++, hp++) {
  1167.           obj = hp->obj;
  1168. --- 156,166 ----
  1169.       TransInit(&prim2model);
  1170.       rtmp = hitlist->data[0].ray;
  1171.       /*
  1172. !      * Walk down hitlist (from primitive up to World object),
  1173. !      * transforming hit point and shading normal and applying textures.
  1174. !      * Note that the texturing routines want gnorm in object space,
  1175. !      * so we don't transform the geometric normal until texturing
  1176. !      * is complete.
  1177.        */
  1178.       for (hp = hitlist->data, i = 0; i < hitlist->nodes -1; i++, hp++) {
  1179.           obj = hp->obj;
  1180. ***************
  1181. *** 161,169 ****
  1182.                    * Compose prim<-->model and world<-->model
  1183.                    * with current transformation.
  1184.                    */
  1185. !                 TransCompose(&hp->trans, &prim2model,
  1186.                       &prim2model);
  1187. !                 TransCompose(&hp->trans, &world2model,
  1188.                       &world2model);
  1189.                   /*
  1190.                    * Transform point and ray to model space.
  1191. --- 171,179 ----
  1192.                    * Compose prim<-->model and world<-->model
  1193.                    * with current transformation.
  1194.                    */
  1195. !                 TransCompose(&prim2model, &hp->trans,
  1196.                       &prim2model);
  1197. !                 TransCompose(&world2model, &hp->trans,
  1198.                       &world2model);
  1199.                   /*
  1200.                    * Transform point and ray to model space.
  1201. ***************
  1202. *** 179,183 ****
  1203. --- 189,195 ----
  1204.               TextApply(obj->texture, prim, &rtmp, pos, norm,
  1205.                   gnorm, surf, &prim2model, &world2model);
  1206. +     /* Transform geometric normal from object to world space. */
  1207. +     NormalTransform(gnorm, &world2model.trans);
  1208.       return entering;
  1209. Index: Doc/Guide/texture.tex
  1210. *** old/Doc/Guide/texture.tex    Mon Feb  3 12:50:02 1992
  1211. --- new/Doc/Guide/texture.tex    Fri Jan 17 10:29:15 1992
  1212. ***************
  1213. *** 45,50 ****
  1214. --- 45,52 ----
  1215.   The returned normalized vector is weighted by {\em scale}
  1216.   and the result is added to the normal vector at the point of intersection.
  1217.   \end{defkey}
  1218. + Using an image texture applied to the ``bump'' component offers a more
  1219. + direct way to control the modification of surface normals (see below).
  1220.   \begin{defkey}{checker}{$<${\em Surface}$>$}
  1221.   Applies a 3D checkerboard texture.  Every point that falls within an
  1222. ***************
  1223. *** 144,150 ****
  1224.       of {\em bump} controls the extent to which the bump appears
  1225.       to be displaced from the rest of the surface.  If negative,
  1226.       the stripe will appear to
  1227. !     sink into the surface; if negative, it will appear to stand
  1228.       out of the surface.
  1229.   \end{defkey}
  1230.   Mapping functions are described below.
  1231. --- 146,152 ----
  1232.       of {\em bump} controls the extent to which the bump appears
  1233.       to be displaced from the rest of the surface.  If negative,
  1234.       the stripe will appear to
  1235. !     sink into the surface; if positive, it will appear to stand
  1236.       out of the surface.
  1237.   \end{defkey}
  1238.   Mapping functions are described below.
  1239. ***************
  1240. *** 157,163 ****
  1241.   \section {Image Texturing}
  1242. ! {\em Rayshade} also supports an {\tt image} texture.  This texture
  1243.   allows you to use images to modify the characteristics of a surface.  You
  1244.   can use three-channel images to modify the any or all of
  1245.   the ambient, diffuse, and specular colors of a surface.
  1246. --- 159,165 ----
  1247.   \section {Image Texturing}
  1248. ! {\Rayshade} also supports an {\tt image} texture.  This texture
  1249.   allows you to use images to modify the characteristics of a surface.  You
  1250.   can use three-channel images to modify the any or all of
  1251.   the ambient, diffuse, and specular colors of a surface.
  1252. ***************
  1253. *** 222,228 ****
  1254.       should be repeated along the $v$ axis.  If either value is zero,
  1255.       the image is repeated infinitely along the appropriate axis.
  1256.   \end{defkey}
  1257. ! Tiling is usually only a concern when linear mapping is being used,
  1258.   though it may also be used if image textures are being scaled.  By default
  1259.   {\em un} and {\em vn} are both zero.
  1260. --- 224,230 ----
  1261.       should be repeated along the $v$ axis.  If either value is zero,
  1262.       the image is repeated infinitely along the appropriate axis.
  1263.   \end{defkey}
  1264. ! Tiling is usually only a concern when planar mapping is being used,
  1265.   though it may also be used if image textures are being scaled.  By default
  1266.   {\em un} and {\em vn} are both zero.
  1267. *** End of Patch 4 ***
  1268. exit 0 # Just in case...
  1269.