home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume21 / rayshade / patch4 < prev    next >
Encoding:
Text File  |  1990-03-19  |  54.5 KB  |  1,803 lines

  1. System: rayshade version 3.0
  2. Patch #: 4
  3. Priority: LOW 
  4. Subject: Patch #4
  5.  
  6. Description:
  7.  
  8.     Was possible for heightfield code to dump core.
  9.  
  10.     Appending to "mtv" format images didn't work.
  11.  
  12.     Was possible for makcone() and makcyl() to attempt rotation about
  13.     a degenerate axis.
  14.  
  15.     Documentation was wrong and/or incomplete in a number of places.
  16.  
  17.     Pointers to colormaps were not initialized to NULL.
  18.  
  19.     Directions for compiling with -DNORLE weren't blatant enough.
  20.  
  21.     Added new gloss texture.
  22.  
  23.     The number of primitives in each object is reported in verbose mode.
  24.  
  25.     Attempting to render an empty scene now results in an error message.
  26.  
  27.     Typos in Linda-related code.
  28.  
  29.     Formatting problems with texture mapping tutorial.
  30.  
  31.     Linda code assumed shared memory.
  32.  
  33. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your rayshade source
  34.         directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  35.         If you don't have the patch program, apply the following by hand,
  36.         or get patch (version 2.0, latest patchlevel).
  37.  
  38.         After patching:
  39.                 make depend
  40.                 make
  41.  
  42.         If patch indicates that patchlevel is the wrong version, you may need
  43.         to apply one or more previous patches, or the patch may already
  44.         have been applied.  See the patchlevel.h file to find out what has or
  45.         has not been applied.  In any event, don't continue with the patch.
  46.  
  47.     Previous patches and other rayshade-related materials are available via
  48.     anonymous ftp from weedeater.math.yale.edu (130.132.23.17).
  49.  
  50. Index: src/patchlevel.h
  51. Prereq: 3
  52. 1c1
  53. < #define PATCHLEVEL 3
  54. --- 1,1 ----
  55. > #define PATCHLEVEL 4
  56.  
  57. Index: Changes
  58. *** Changes.old    Wed Mar  7 22:16:45 1990
  59. --- Changes    Wed Mar  7 22:16:45 1990
  60. ***************
  61. *** 1,7 ****
  62. --- 1,26 ----
  63. + Patch #4:
  64. + ---------
  65. + Added gloss texture.
  66. + The number of primitives in each object is reported in verbose mode.
  67. + Attempting to render an empty scene now results in an error message.
  68. + Fixed a number of typos in the documentation.
  69. + Fixed core-dumping bug in heightfield code.
  70. + Changes to makcyl() and makcone() to avoid rotating about degenerate axes.
  71. + Fixed thresholding bug in fBm texture.
  72. + Fixed bug with appending to "mtv" image files.
  73. + Fixed bug with the initialization of pointers to colormaps.
  74. + Updated Makefile.
  75. + Added SHAREDMEM compile-time switch for linda on shared memory machines.
  76. + Fixed a number of linda-related typos.
  77. + Fixed minor formatting problems in texture mapping tutorial.
  78.   Patch #2/3:
  79.   -----------
  80.   
  81.   Added depth of field code, courtesy of Rodney G. Bogart.
  82. + Removed handling of #include directives in input files.
  83. + Added handling of cpp-generated lines of the form '#n "filename"'.
  84. + Added new error and warning message routines.
  85.   Added -F option to allow selection of frequency of status reports.
  86.   Added reporting of total and split CPU times during verbose status reports.
  87.   Removed hard-coded constants in several of the textures.
  88.  
  89. Index: src/Makefile
  90. *** src/Makefile.old    Wed Mar  7 22:17:13 1990
  91. --- src/Makefile    Wed Mar  7 22:17:13 1990
  92. ***************
  93. *** 3,16 ****
  94.   #
  95.   # Craig Kolb
  96.   #
  97. ! # $Id: Makefile,v 3.0 89/10/27 02:05:45 craig Exp $
  98.   #
  99. ! # $Log:    Makefile,v $
  100. ! # Revision 3.0  89/10/27  02:05:45  craig
  101. ! # Baseline for first official release.
  102. ! # 
  103. ! # Location of Utah-raster library and include files, if appropriate.
  104. ! # If you are compiling with -DNORLE, leave these two undefined.
  105.   #
  106.   RLELIB = /usr/u/utah/lib/librle.a
  107.   RLEINC = /usr/u/utah/include
  108. --- 3,16 ----
  109.   #
  110.   # Craig Kolb
  111.   #
  112. ! # $Id: Makefile,v 3.0.1.1 90/03/07 21:38:06 craig Exp $
  113.   #
  114. ! # If you are using the Utah Raster Toolkit, you must set RLELIB and RLEINC
  115. ! # to be the name of the Utah Raster library and include file directory.
  116. ! #
  117. ! # If you are not using the Utah Raster Toolkit, you must compile using
  118. ! # -DNORLE (see below). In this case, you should comment out the next two
  119. ! # definitions.
  120.   #
  121.   RLELIB = /usr/u/utah/lib/librle.a
  122.   RLEINC = /usr/u/utah/include
  123. ***************
  124. *** 19,41 ****
  125.   #
  126.   #LCC = /homes/systems/carriero/linda/v2.2/bin/clc
  127.   #
  128. ! # Temporary file directory, bin direction, and executable name.
  129.   #
  130. - TMPDIR = /tmp
  131.   BINDIR = /usr/u/craig/bin
  132.   SHADENAME = rayshade
  133.   #
  134.   # Compiler flags.
  135.   #
  136. ! # GENERIC (BSD):    CFLAGS = -I$(RLEINC) -DTMPDIR=\"$(TMPDIR)\"
  137.   # SYSV:            add -DSYSV
  138.   #
  139.   # Multimax (shared memory):
  140. ! #            add -DMULTIMAX
  141.   # Linda:        add -DLINDA (and move raytrace.c to raytrace.cl)
  142.   #
  143.   # Long ago, rayshade was compiled on the Amiga using Aztec C and:
  144. ! #            CFLAGS = +fi +C +D +L -DTMPDIR="t:" -DAZTEC
  145.   # 
  146.   # If you are not using the Utah Raster toolkit, add -DNORLE
  147.   # If your compiler doesn't understand the void type, add -DNOVOID
  148. --- 19,40 ----
  149.   #
  150.   #LCC = /homes/systems/carriero/linda/v2.2/bin/clc
  151.   #
  152. ! # Bin directory and executable name.
  153.   #
  154.   BINDIR = /usr/u/craig/bin
  155.   SHADENAME = rayshade
  156.   #
  157.   # Compiler flags.
  158.   #
  159. ! # GENERIC (BSD):    CFLAGS = -I$(RLEINC)
  160.   # SYSV:            add -DSYSV
  161.   #
  162.   # Multimax (shared memory):
  163. ! #            add -DMULTIMAX -DSHAREDMEM
  164.   # Linda:        add -DLINDA (and move raytrace.c to raytrace.cl)
  165.   #
  166.   # Long ago, rayshade was compiled on the Amiga using Aztec C and:
  167. ! #            CFLAGS = +fi +C +D +L -DAZTEC
  168.   # 
  169.   # If you are not using the Utah Raster toolkit, add -DNORLE
  170.   # If your compiler doesn't understand the void type, add -DNOVOID
  171. ***************
  172. *** 45,51 ****
  173.   #
  174.   # Be sure to add any necessary floating-point hardware switches.
  175.   # 
  176. ! CFLAGS = -I$(RLEINC) -DTMPDIR=\"$(TMPDIR)\" -O -DSYSV
  177.   #
  178.   # Libraries:
  179.   # BSD:        LIBS = $(RLELIB) -lm
  180. --- 44,50 ----
  181.   #
  182.   # Be sure to add any necessary floating-point hardware switches.
  183.   # 
  184. ! CFLAGS = -I$(RLEINC) -O -DSYSV
  185.   #
  186.   # Libraries:
  187.   # BSD:        LIBS = $(RLELIB) -lm
  188. ***************
  189. *** 149,158 ****
  190.   setup.o: primobj.h
  191.   setup.o: funcdefs.h
  192.   input.o: input.c
  193. - input.o: constants.h
  194. - input.o: typedefs.h
  195. - input.o: datatypes.h
  196. - input.o: primobj.h
  197.   input_yacc.o: input_yacc.c
  198.   input_yacc.o: constants.h
  199.   input_yacc.o: typedefs.h
  200. --- 148,153 ----
  201. ***************
  202. *** 160,165 ****
  203. --- 155,161 ----
  204.   input_yacc.o: primobj.h
  205.   input_yacc.o: funcdefs.h
  206.   input_yacc.o: texture.h
  207. + input_yacc.o: atmosphere.h
  208.   input_lex.o: input_lex.c
  209.   input_lex.o: typedefs.h
  210.   input_lex.o: datatypes.h
  211. ***************
  212. *** 306,311 ****
  213. --- 302,308 ----
  214.   shade.o: datatypes.h
  215.   shade.o: primobj.h
  216.   shade.o: funcdefs.h
  217. + shade.o: atmosphere.h
  218.   atmosphere.o: atmosphere.c
  219.   atmosphere.o: typedefs.h
  220.   atmosphere.o: datatypes.h
  221. ***************
  222. *** 312,317 ****
  223. --- 309,315 ----
  224.   atmosphere.o: primobj.h
  225.   atmosphere.o: constants.h
  226.   atmosphere.o: funcdefs.h
  227. + atmosphere.o: atmosphere.h
  228.   light.o: light.c
  229.   light.o: typedefs.h
  230.   light.o: datatypes.h
  231.  
  232. Index: src/cone.c
  233. *** src/cone.c.old    Wed Mar  7 22:17:21 1990
  234. --- src/cone.c    Wed Mar  7 22:17:21 1990
  235. ***************
  236. *** 18,26 ****
  237.    * name of the person performing the modification, the date of modification,
  238.    * and the reason for such modification.
  239.    *
  240. !  * $Id: cone.c,v 3.0.1.2 89/12/06 16:33:44 craig Exp $
  241.    *
  242.    * $Log:    cone.c,v $
  243.    * Revision 3.0.1.2  89/12/06  16:33:44  craig
  244.    * patch2: Added calls to new error/warning routines.
  245.    * 
  246. --- 18,29 ----
  247.    * name of the person performing the modification, the date of modification,
  248.    * and the reason for such modification.
  249.    *
  250. !  * $Id: cone.c,v 3.0.1.3 90/02/12 13:20:58 craig Exp $
  251.    *
  252.    * $Log:    cone.c,v $
  253. +  * Revision 3.0.1.3  90/02/12  13:20:58  craig
  254. +  * patch4: Changes to avoid rotation about null axis.
  255. +  * 
  256.    * Revision 3.0.1.2  89/12/06  16:33:44  craig
  257.    * patch2: Added calls to new error/warning routines.
  258.    * 
  259. ***************
  260. *** 128,136 ****
  261.       /*
  262.        * Calculate rotation matrix to map from world space to cone space.
  263.        */
  264. !     tmp.x = axis.y;
  265. !     tmp.y = -axis.x;
  266. !     tmp.z = 0.;
  267.       RS_rotate(trans, &tmp, acos(axis.z));
  268.       RS_translate(trans, &base);
  269.       cone->tantheta *= cone->tantheta;
  270. --- 131,144 ----
  271.       /*
  272.        * Calculate rotation matrix to map from world space to cone space.
  273.        */
  274. !     if (abs(axis.z) == 1.) {
  275. !         tmp.x = 1;
  276. !         tmp.y = tmp.z = 0.;
  277. !     } else {
  278. !         tmp.x = axis.y;
  279. !         tmp.y = -axis.x;
  280. !         tmp.z = 0.;
  281. !     }
  282.       RS_rotate(trans, &tmp, acos(axis.z));
  283.       RS_translate(trans, &base);
  284.       cone->tantheta *= cone->tantheta;
  285.  
  286. Index: src/grid.c
  287. *** src/grid.c.old    Wed Mar  7 22:17:34 1990
  288. --- src/grid.c    Wed Mar  7 22:17:34 1990
  289. ***************
  290. *** 18,26 ****
  291.    * name of the person performing the modification, the date of modification,
  292.    * and the reason for such modification.
  293.    *
  294. !  * $Id: grid.c,v 3.0 89/10/27 02:05:50 craig Exp $
  295.    *
  296.    * $Log:    grid.c,v $
  297.    * Revision 3.0  89/10/27  02:05:50  craig
  298.    * Baseline for first official release.
  299.    * 
  300. --- 18,29 ----
  301.    * name of the person performing the modification, the date of modification,
  302.    * and the reason for such modification.
  303.    *
  304. !  * $Id: grid.c,v 3.0.1.1 90/02/12 13:16:36 craig Exp $
  305.    *
  306.    * $Log:    grid.c,v $
  307. +  * Revision 3.0.1.1  90/02/12  13:16:36  craig
  308. +  * patch4: Changed obj->counter to pointer when SHAREDMEM is defined.
  309. +  * 
  310.    * Revision 3.0  89/10/27  02:05:50  craig
  311.    * Baseline for first official release.
  312.    * 
  313. ***************
  314. *** 329,335 ****
  315.            * bounding box of the ray's extent in the voxel does
  316.            * not intersect the bounding box of the object, don't bother.
  317.            */
  318. ! #ifdef LINDA
  319.           if (*obj->counter >= counter ||
  320.   #else
  321.           if (obj->counter >= counter ||
  322. --- 332,338 ----
  323.            * bounding box of the ray's extent in the voxel does
  324.            * not intersect the bounding box of the object, don't bother.
  325.            */
  326. ! #ifdef SHAREDMEM
  327.           if (*obj->counter >= counter ||
  328.   #else
  329.           if (obj->counter >= counter ||
  330. ***************
  331. *** 341,347 ****
  332.               obj->bounds[LOW][Z] > hz ||
  333.               obj->bounds[HIGH][Z] < lz)
  334.               continue;
  335. ! #ifdef LINDA
  336.           *obj->counter = counter;
  337.   #else
  338.           obj->counter = counter;
  339. --- 344,350 ----
  340.               obj->bounds[LOW][Z] > hz ||
  341.               obj->bounds[HIGH][Z] < lz)
  342.               continue;
  343. ! #ifdef SHAREDMEM
  344.           *obj->counter = counter;
  345.   #else
  346.           obj->counter = counter;
  347.  
  348. Index: src/hf.c
  349. *** src/hf.c.old    Wed Mar  7 22:17:37 1990
  350. --- src/hf.c    Wed Mar  7 22:17:38 1990
  351. ***************
  352. *** 18,26 ****
  353.    * name of the person performing the modification, the date of modification,
  354.    * and the reason for such modification.
  355.    *
  356. !  * $Id: hf.c,v 3.0.1.2 89/12/06 16:33:23 craig Exp $
  357.    *
  358.    * $Log:    hf.c,v $
  359.    * Revision 3.0.1.2  89/12/06  16:33:23  craig
  360.    * patch2: Added calls to new error/warning routines.
  361.    * 
  362. --- 18,29 ----
  363.    * name of the person performing the modification, the date of modification,
  364.    * and the reason for such modification.
  365.    *
  366. !  * $Id: hf.c,v 3.0.1.3 90/02/12 13:30:14 craig Exp $
  367.    *
  368.    * $Log:    hf.c,v $
  369. +  * Revision 3.0.1.3  90/02/12  13:30:14  craig
  370. +  * patch4: Fixed bug involving computation of hf->lsize[i]
  371. +  * 
  372.    * Revision 3.0.1.2  89/12/06  16:33:23  craig
  373.    * patch2: Added calls to new error/warning routines.
  374.    * 
  375. ***************
  376. *** 180,186 ****
  377.       for (i = 1; i < hf->levels; i++) {
  378.           hf->spacing[i] = hf->spacing[i-1] * hf->iBestSize;
  379.           hf->lsize[i] = (int)hf->spacing[i];
  380. !         if (hf->lsize[i-1] % hf->BestSize != 0)
  381.               hf->lsize[i]++;
  382.           hf->boundsmax[i]=(float **)share_malloc(hf->lsize[i]*sizeof(float *));
  383.           hf->boundsmin[i]=(float **)share_malloc(hf->lsize[i]*sizeof(float *));
  384. --- 183,189 ----
  385.       for (i = 1; i < hf->levels; i++) {
  386.           hf->spacing[i] = hf->spacing[i-1] * hf->iBestSize;
  387.           hf->lsize[i] = (int)hf->spacing[i];
  388. !         if ((double)hf->lsize[i] != hf->spacing[i])
  389.               hf->lsize[i]++;
  390.           hf->boundsmax[i]=(float **)share_malloc(hf->lsize[i]*sizeof(float *));
  391.           hf->boundsmin[i]=(float **)share_malloc(hf->lsize[i]*sizeof(float *));
  392.  
  393. Index: src/input_lex.l
  394. *** src/input_lex.l.old    Wed Mar  7 22:17:43 1990
  395. --- src/input_lex.l    Wed Mar  7 22:17:43 1990
  396. ***************
  397. *** 13,19 ****
  398.   /* without supplying the source, or without informing the end-user that the */
  399.   /* source is available for no extra charge.                    */
  400.   /*                                        */
  401. ! /* $Id: input_lex.l,v 3.0.1.3 89/12/07 23:00:54 craig Exp $ */
  402.   %{
  403.   #include <stdio.h>
  404.   #ifdef SYSV
  405. --- 13,19 ----
  406.   /* without supplying the source, or without informing the end-user that the */
  407.   /* source is available for no extra charge.                    */
  408.   /*                                        */
  409. ! /* $Id: input_lex.l,v 3.0.1.4 90/03/07 21:26:29 craig Exp $ */
  410.   %{
  411.   #include <stdio.h>
  412.   #ifdef SYSV
  413. ***************
  414. *** 58,63 ****
  415. --- 58,64 ----
  416.   focaldist        {return(tFOCALDIST);}
  417.   fog            {return(tFOG);}
  418.   fov            {return(tFOV);}
  419. + gloss            {return(tGLOSS);}
  420.   grid            {return(tGRID);}
  421.   heightfield        {return(tHEIGHTFIELD);}
  422.   jittered        {return(tJITTERED);}
  423.  
  424. Index: src/input_yacc.y
  425. *** src/input_yacc.y.old    Wed Mar  7 22:17:48 1990
  426. --- src/input_yacc.y    Wed Mar  7 22:17:48 1990
  427. ***************
  428. *** 17,23 ****
  429.   /* name of the person performing the modification, the date of modification,*/
  430.   /* and the reason for such modification.                    */
  431.   /*                                        */
  432. ! /* $Id: input_yacc.y,v 3.0.1.6 89/12/07 22:55:53 craig Exp $ */
  433.   %{
  434.   #include <stdio.h>
  435.   #include "constants.h"
  436. --- 17,23 ----
  437.   /* name of the person performing the modification, the date of modification,*/
  438.   /* and the reason for such modification.                    */
  439.   /*                                        */
  440. ! /* $Id: input_yacc.y,v 3.0.1.8 90/03/07 21:26:42 craig Exp $ */
  441.   %{
  442.   #include <stdio.h>
  443.   #include "constants.h"
  444. ***************
  445. *** 63,69 ****
  446.   %token <c> tSTRING
  447.   %token tADAPTIVE tAPERTURE 
  448.   %token tBACKGROUND tBLOTCH tBOX tBUMP tCONE tCYL tDIRECTIONAL
  449. ! %token tENDDEF tEXTENDED tEYEP tFBM tFBMBUMP tFOCALDIST tFOG tFOV tGRID
  450.   %token tHEIGHTFIELD tJITTERED tLIGHT tLIST tLOOKP tMARBLE tMAXDEPTH tMIST
  451.   %token tOBJECT tOUTFILE
  452.   %token tPLANE tPOINT tPOLY tROTATE tSAMPLES
  453. --- 63,69 ----
  454.   %token <c> tSTRING
  455.   %token tADAPTIVE tAPERTURE 
  456.   %token tBACKGROUND tBLOTCH tBOX tBUMP tCONE tCYL tDIRECTIONAL
  457. ! %token tENDDEF tEXTENDED tEYEP tFBM tFBMBUMP tFOCALDIST tFOG tFOV tGLOSS tGRID
  458.   %token tHEIGHTFIELD tJITTERED tLIGHT tLIST tLOOKP tMARBLE tMAXDEPTH tMIST
  459.   %token tOBJECT tOUTFILE
  460.   %token tPLANE tPOINT tPOLY tROTATE tSAMPLES
  461. ***************
  462. *** 130,138 ****
  463.           ;
  464.   Primitive    : Prim Textures
  465.           {
  466. !             if (LastObj)
  467.                   /* User may have botched prim. def. */
  468.                   LastObj->texture = CurText;
  469.               CurText = (Texture *)0;
  470.               LastObj = (Object *)0;
  471.           }
  472. --- 130,143 ----
  473.           ;
  474.   Primitive    : Prim Textures
  475.           {
  476. !             if (LastObj) {
  477.                   /* User may have botched prim. def. */
  478.                   LastObj->texture = CurText;
  479. +                 if (CurObj->data)
  480. +                     CurObj->data->prims++;
  481. +                 else
  482. +                     World->prims++;
  483. +             }
  484.               CurText = (Texture *)0;
  485.               LastObj = (Object *)0;
  486.           }
  487. ***************
  488. *** 324,329 ****
  489. --- 329,338 ----
  490.           | tWOOD
  491.           {
  492.               $$ = NewWoodText();
  493. +         }
  494. +         | tGLOSS Fnumber
  495. +         {
  496. +             $$ = NewGlossText($2);
  497.           }
  498.           ;
  499.   Child        : Childdef Textures
  500.  
  501. Index: src/light.c
  502. *** src/light.c.old    Wed Mar  7 22:17:52 1990
  503. --- src/light.c    Wed Mar  7 22:17:52 1990
  504. ***************
  505. *** 18,26 ****
  506.    * name of the person performing the modification, the date of modification,
  507.    * and the reason for such modification.
  508.    *
  509. !  * $Id: light.c,v 3.0 89/10/27 16:17:22 craig Exp $
  510.    *
  511.    * $Log:    light.c,v $
  512.    * Revision 3.0  89/10/27  16:17:22  craig
  513.    * Baseline for first official release.
  514.    * 
  515. --- 18,29 ----
  516.    * name of the person performing the modification, the date of modification,
  517.    * and the reason for such modification.
  518.    *
  519. !  * $Id: light.c,v 3.0.1.1 90/03/07 21:28:21 craig Exp $
  520.    *
  521.    * $Log:    light.c,v $
  522. +  * Revision 3.0.1.1  90/03/07  21:28:21  craig
  523. +  * patch4: Removed LightCoordSys().
  524. +  * 
  525.    * Revision 3.0  89/10/27  16:17:22  craig
  526.    * Baseline for first official release.
  527.    * 
  528. ***************
  529. *** 58,98 ****
  530.            */
  531.           vecsub(lp->pos, *objpos, lray);
  532.           lightdist = normalize(lray);
  533. -     }
  534. - }
  535. - /*
  536. -  * Find a coordinate system perpendicular to the ray from
  537. -  * a point of intersection to the center of an extended light source.
  538. -  */
  539. - LightCoordSys(lp, pos, vector, xaxis, yaxis)
  540. - Light *lp;
  541. - Vector *pos, *vector, *xaxis, *yaxis;
  542. - {
  543. -     /*
  544. -      * Vector should *not* be normalized, xaxis & yaxis should be.
  545. -      */
  546. -     vector->x = lp->pos.x - pos->x;
  547. -     vector->y = lp->pos.y - pos->y;
  548. -     vector->z = lp->pos.z - pos->z;
  549. -     xaxis->x = vector->y;
  550. -     xaxis->y = -vector->x;
  551. -     xaxis->z = 0.;
  552. -     if (normalize(xaxis) == 0.) {
  553. -         xaxis->x = 0.;
  554. -         xaxis->y = -vector->z;
  555. -         xaxis->z = vector->y;
  556. -         if (normalize(xaxis) == 0.)
  557. -             fprintf(stderr,"LightCoordSys: Can't find X axis!\n");
  558. -         yaxis->x = (vector->y * vector->y) + (vector->z * vector->z);
  559. -         yaxis->y = -vector->x * vector->y;
  560. -         yaxis->z = -vector->x * vector->z;
  561. -         (void)normalize(yaxis);
  562. -     } else {
  563. -         yaxis->x = vector->x * vector->z;
  564. -         yaxis->y = vector->y * vector->z;
  565. -         yaxis->z = -(vector->x * vector->x) -(vector->y * vector->y);
  566. -         (void)normalize(yaxis);
  567.       }
  568.   }
  569.   
  570. --- 61,66 ----
  571.  
  572. Index: src/main.c
  573. *** src/main.c.old    Wed Mar  7 22:17:57 1990
  574. --- src/main.c    Wed Mar  7 22:17:58 1990
  575. ***************
  576. *** 1,5 ****
  577.   char rcsid[] =
  578. !     "$Id: main.c,v 3.0.1.2 89/12/07 22:54:39 craig Exp $";
  579.   /*
  580.    * main.c
  581.    *
  582. --- 1,5 ----
  583.   char rcsid[] =
  584. !     "$Id: main.c,v 3.0.1.3 90/03/07 21:33:09 craig Exp $";
  585.   /*
  586.    * main.c
  587.    *
  588. ***************
  589. *** 21,26 ****
  590. --- 21,30 ----
  591.    * and the reason for such modification.
  592.    *
  593.    * $Log:    main.c,v $
  594. +  * Revision 3.0.1.3  90/03/07  21:33:09  craig
  595. +  * patch4: Return value of times() is now checked.
  596. +  * patch4: Workers is externed iff LINDA is defined.
  597. +  * 
  598.    * Revision 3.0.1.2  89/12/07  22:54:39  craig
  599.    * patch2: Renamed utime and stime to avoid name clashes.
  600.    * 
  601. ***************
  602. *** 70,77 ****
  603.   char **argv;
  604.   {
  605.       unsigned long TotalRays;
  606. !     extern int Verbose, Cache, Workers, Jittered;
  607.       extern unsigned long CacheWorked, CacheFailed, ShadowHits;
  608.   
  609.       /*
  610.         * Initialize variables, etc.
  611. --- 74,84 ----
  612.   char **argv;
  613.   {
  614.       unsigned long TotalRays;
  615. !     extern int Verbose, Cache, Jittered;
  616.       extern unsigned long CacheWorked, CacheFailed, ShadowHits;
  617. + #ifdef LINDA
  618. +     extern int Workers;
  619. + #endif
  620.   
  621.       /*
  622.         * Initialize variables, etc.
  623. ***************
  624. *** 174,180 ****
  625.       struct tms time;
  626.       long times();
  627.   
  628. !     (void)times(&time);
  629.       *usertime = (double)time.tms_utime / (double)HZ;
  630.       *systime = (double)time.tms_stime / (double)HZ;
  631.   }
  632. --- 181,188 ----
  633.       struct tms time;
  634.       long times();
  635.   
  636. !     if (times(&time) < 0)
  637. !         RSwarning("Cannot get cpu time?!\n");
  638.       *usertime = (double)time.tms_utime / (double)HZ;
  639.       *systime = (double)time.tms_stime / (double)HZ;
  640.   }
  641.  
  642. Index: src/object.c
  643. *** src/object.c.old    Wed Mar  7 22:18:08 1990
  644. --- src/object.c    Wed Mar  7 22:18:08 1990
  645. ***************
  646. *** 18,26 ****
  647.    * name of the person performing the modification, the date of modification,
  648.    * and the reason for such modification.
  649.    *
  650. !  * $Id: object.c,v 3.0.1.1 89/12/06 16:33:20 craig Exp $
  651.    *
  652.    * $Log:    object.c,v $
  653.    * Revision 3.0.1.1  89/12/06  16:33:20  craig
  654.    * patch2: Added calls to new error/warning routines.
  655.    * 
  656. --- 18,29 ----
  657.    * name of the person performing the modification, the date of modification,
  658.    * and the reason for such modification.
  659.    *
  660. !  * $Id: object.c,v 3.0.1.2 90/02/12 13:18:44 craig Exp $
  661.    *
  662.    * $Log:    object.c,v $
  663. +  * Revision 3.0.1.2  90/02/12  13:18:44  craig
  664. +  * patch4: Changes to record number of primitives in each object.
  665. +  * 
  666.    * Revision 3.0.1.1  89/12/06  16:33:20  craig
  667.    * patch2: Added calls to new error/warning routines.
  668.    * 
  669. ***************
  670. *** 55,61 ****
  671.       new->type = type;
  672.       new->data = data;
  673.       new->trans = trans;
  674. ! #ifdef LINDA
  675.       /*
  676.        * If the counter is in shared memory, processes will
  677.        * be modifying it left-and-right.  So, we cheat and
  678. --- 58,65 ----
  679.       new->type = type;
  680.       new->data = data;
  681.       new->trans = trans;
  682. !     new->prims = 0;
  683. ! #ifdef SHAREDMEM
  684.       /*
  685.        * If the counter is in shared memory, processes will
  686.        * be modifying it left-and-right.  So, we cheat and
  687. ***************
  688. *** 141,149 ****
  689. --- 145,155 ----
  690.       if (parent == (Object *)0) {
  691.           newnode->next = (ObjList *)World->data;
  692.           World->data = (char *)newnode;
  693. +         World->prims += child->prims;
  694.       } else {
  695.           newnode->next = (ObjList *)parent->data;
  696.           parent->data = (char *)newnode;
  697. +         parent->prims += child->prims;
  698.       }
  699.       return newobj;
  700.   }
  701. ***************
  702. *** 182,187 ****
  703. --- 188,195 ----
  704.            */
  705.           fprintf(fstats,"Object \"%s\" extent:\n", obj->name);
  706.           print_bounds(obj->bounds);
  707. +         fprintf(fstats,"\t%ld primitive%c\n",obj->prims,
  708. +                 obj->prims == 1 ? ' ' : 's');
  709.       }
  710.   }
  711.   
  712.  
  713. Index: src/outputp.c
  714. *** src/outputp.c.old    Wed Mar  7 22:18:11 1990
  715. --- src/outputp.c    Wed Mar  7 22:18:12 1990
  716. ***************
  717. *** 18,26 ****
  718.    * name of the person performing the modification, the date of modification,
  719.    * and the reason for such modification.
  720.    *
  721. !  * $Id: outputp.c,v 3.0.1.1 89/12/06 16:33:17 craig Exp $
  722.    *
  723.    * $Log:    outputp.c,v $
  724.    * Revision 3.0.1.1  89/12/06  16:33:17  craig
  725.    * patch2: Added calls to new error/warning routines.
  726.    * 
  727. --- 18,29 ----
  728.    * name of the person performing the modification, the date of modification,
  729.    * and the reason for such modification.
  730.    *
  731. !  * $Id: outputp.c,v 3.0.1.2 90/02/12 16:09:05 craig Exp $
  732.    *
  733.    * $Log:    outputp.c,v $
  734. +  * Revision 3.0.1.2  90/02/12  16:09:05  craig
  735. +  * patch4: Fixed bug with duplicate headers in mtv files when Appending.
  736. +  * 
  737.    * Revision 3.0.1.1  89/12/06  16:33:17  craig
  738.    * patch2: Added calls to new error/warning routines.
  739.    * 
  740. ***************
  741. *** 150,156 ****
  742.       } else
  743.           imgfile = stdout;
  744.   
  745. !     fprintf(imgfile,"%d %d\n",Xres, Yres);
  746.       fflush(imgfile);
  747.   }
  748.   
  749. --- 153,161 ----
  750.       } else
  751.           imgfile = stdout;
  752.   
  753. !     if (!Appending)
  754. !         fprintf(imgfile,"%d %d\n",Xres, Yres);
  755.       fflush(imgfile);
  756.   }
  757.   
  758.  
  759. Index: src/ray_options.c
  760. *** src/ray_options.c.old    Wed Mar  7 22:18:20 1990
  761. --- src/ray_options.c    Wed Mar  7 22:18:21 1990
  762. ***************
  763. *** 18,26 ****
  764.    * name of the person performing the modification, the date of modification,
  765.    * and the reason for such modification.
  766.    *
  767. !  * $Id: ray_options.c,v 3.0.1.4 89/12/06 16:33:55 craig Exp $
  768.    *
  769.    * $Log:    ray_options.c,v $
  770.    * Revision 3.0.1.4  89/12/06  16:33:55  craig
  771.    * patch2: Added calls to new error/warning routines.
  772.    * 
  773. --- 18,29 ----
  774.    * name of the person performing the modification, the date of modification,
  775.    * and the reason for such modification.
  776.    *
  777. !  * $Id: ray_options.c,v 3.0.1.5 90/02/12 13:28:19 craig Exp $
  778.    *
  779.    * $Log:    ray_options.c,v $
  780. +  * Revision 3.0.1.5  90/02/12  13:28:19  craig
  781. +  * patch4: Fixed typo in 'W' option error message.
  782. +  * 
  783.    * Revision 3.0.1.4  89/12/06  16:33:55  craig
  784.    * patch2: Added calls to new error/warning routines.
  785.    * 
  786. ***************
  787. *** 190,196 ****
  788.               case 'W':
  789.                   Workers = atoi(argv[1]);
  790.                   if (Workers < 0 || Workers > 17) {
  791. !                     RSerror("%d workers?\n",workers);
  792.                   }
  793.                   argv++; argc--;
  794.                   break;
  795. --- 193,199 ----
  796.               case 'W':
  797.                   Workers = atoi(argv[1]);
  798.                   if (Workers < 0 || Workers > 17) {
  799. !                     RSerror("%d workers?\n",Workers);
  800.                   }
  801.                   argv++; argc--;
  802.                   break;
  803.  
  804. Index: src/raymath.c
  805. *** src/raymath.c.old    Wed Mar  7 22:18:22 1990
  806. --- src/raymath.c    Wed Mar  7 22:18:23 1990
  807. ***************
  808. *** 18,26 ****
  809.    * name of the person performing the modification, the date of modification,
  810.    * and the reason for such modification.
  811.    *
  812. !  * $Id: raymath.c,v 3.0 89/10/27 02:06:01 craig Exp $
  813.    *
  814.    * $Log:    raymath.c,v $
  815.    * Revision 3.0  89/10/27  02:06:01  craig
  816.    * Baseline for first official release.
  817.    * 
  818. --- 18,29 ----
  819.    * name of the person performing the modification, the date of modification,
  820.    * and the reason for such modification.
  821.    *
  822. !  * $Id: raymath.c,v 3.0.1.1 90/03/07 21:26:08 craig Exp $
  823.    *
  824.    * $Log:    raymath.c,v $
  825. +  * Revision 3.0.1.1  90/03/07  21:26:08  craig
  826. +  * patch4: Added VectCoordSys().
  827. +  * 
  828.    * Revision 3.0  89/10/27  02:06:01  craig
  829.    * Baseline for first official release.
  830.    * 
  831. ***************
  832. *** 99,104 ****
  833. --- 102,136 ----
  834.       k = kn * cos1 - sqrt(cos2);
  835.       veccomb(kn, I, k, N, dir);
  836.       return FALSE;
  837. + }
  838. + /*
  839. +  * Given a vector, find two additional vectors such that all three
  840. +  * are mutually perpendicular and xaxis X yaxis = vector.  The given
  841. +  * vector need not be normalized. xaxis and yaxis are normalized.
  842. +  */
  843. + VectCoordSys(vector, xaxis, yaxis)
  844. + Vector *vector, *xaxis, *yaxis;
  845. + {
  846. +     xaxis->x = vector->y;
  847. +     xaxis->y = -vector->x;
  848. +     xaxis->z = 0.;
  849. +     if (normalize(xaxis) == 0.) {
  850. +         xaxis->x = 0.;
  851. +         xaxis->y = -vector->z;
  852. +         xaxis->z = vector->y;
  853. +         if (normalize(xaxis) == 0.)
  854. +             RSwarning("LightCoordSys: Can't find X axis!\n");
  855. +         yaxis->x = (vector->y * vector->y) + (vector->z * vector->z);
  856. +         yaxis->y = -vector->x * vector->y;
  857. +         yaxis->z = -vector->x * vector->z;
  858. +         (void)normalize(yaxis);
  859. +     } else {
  860. +         yaxis->x = vector->x * vector->z;
  861. +         yaxis->y = vector->y * vector->z;
  862. +         yaxis->z = -(vector->x * vector->x) -(vector->y * vector->y);
  863. +         (void)normalize(yaxis);
  864. +     }
  865.   }
  866.   
  867.   #ifdef DUMB_CPP
  868.  
  869. Index: src/raytrace.c
  870. *** src/raytrace.c.old    Wed Mar  7 22:18:27 1990
  871. --- src/raytrace.c    Wed Mar  7 22:18:28 1990
  872. ***************
  873. *** 18,26 ****
  874.    * name of the person performing the modification, the date of modification,
  875.    * and the reason for such modification.
  876.    *
  877. !  * $Id: raytrace.c,v 3.0.1.5 89/12/07 22:55:25 craig Exp $
  878.    *
  879.    * $Log:    raytrace.c,v $
  880.    * Revision 3.0.1.5  89/12/07  22:55:25  craig
  881.    * patch2: Renamed utime and stime to avoid name clashes.
  882.    * 
  883. --- 18,29 ----
  884.    * name of the person performing the modification, the date of modification,
  885.    * and the reason for such modification.
  886.    *
  887. !  * $Id: raytrace.c,v 3.0.1.6 90/02/12 13:29:09 craig Exp $
  888.    *
  889.    * $Log:    raytrace.c,v $
  890. +  * Revision 3.0.1.6  90/02/12  13:29:09  craig
  891. +  * patch4: Changes to reflect new variable names in linda code.
  892. +  * 
  893.    * Revision 3.0.1.5  89/12/07  22:55:25  craig
  894.    * patch2: Renamed utime and stime to avoid name clashes.
  895.    * 
  896. ***************
  897. *** 102,108 ****
  898.   {
  899.   #ifdef LINDA
  900.       extern unsigned long primtests[], primhits[];
  901. !     extern double usertime, systime;
  902.       extern unsigned long EyeRays, ShadowRays, ReflectRays, RefractRays,
  903.               CacheWorked, CacheFailed, ShadowHits, SuperSampled,
  904.               BVTests, HitRays;
  905. --- 105,111 ----
  906.   {
  907.   #ifdef LINDA
  908.       extern unsigned long primtests[], primhits[];
  909. !     extern double Utime, Stime;
  910.       extern unsigned long EyeRays, ShadowRays, ReflectRays, RefractRays,
  911.               CacheWorked, CacheFailed, ShadowHits, SuperSampled,
  912.               BVTests, HitRays;
  913. ***************
  914. *** 153,160 ****
  915.               primhits[j] += hittmp[j];
  916.           }
  917.           in ("timing", ? utmp, ? stmp);
  918. !         usertime += utmp / (double)Workers;
  919. !         systime += stmp / (double)Workers;
  920.           in("worker", ? int);
  921.       }
  922.   #endif
  923. --- 156,163 ----
  924.               primhits[j] += hittmp[j];
  925.           }
  926.           in ("timing", ? utmp, ? stmp);
  927. !         Utime += utmp / (double)Workers;
  928. !         Stime += stmp / (double)Workers;
  929.           in("worker", ? int);
  930.       }
  931.   #endif
  932.  
  933. Index: src/setup.c
  934. *** src/setup.c.old    Wed Mar  7 22:18:31 1990
  935. --- src/setup.c    Wed Mar  7 22:18:31 1990
  936. ***************
  937. *** 18,26 ****
  938.    * name of the person performing the modification, the date of modification,
  939.    * and the reason for such modification.
  940.    *
  941. !  * $Id: setup.c,v 3.0.1.1 89/12/02 16:52:33 craig Exp $
  942.    *
  943.    * $Log:    setup.c,v $
  944.    * Revision 3.0.1.1  89/12/02  16:52:33  craig
  945.    * patch2: Added code to set default value for ReportFreq.
  946.    * 
  947. --- 18,30 ----
  948.    * name of the person performing the modification, the date of modification,
  949.    * and the reason for such modification.
  950.    *
  951. !  * $Id: setup.c,v 3.0.1.2 90/02/12 13:26:49 craig Exp $
  952.    *
  953.    * $Log:    setup.c,v $
  954. +  * Revision 3.0.1.2  90/02/12  13:26:49  craig
  955. +  * patch4: Added calls to new error/warning routines.
  956. +  * patch4: Attempting to render empty scene now results in an error message.
  957. +  * 
  958.    * Revision 3.0.1.1  89/12/02  16:52:33  craig
  959.    * patch2: Added code to set default value for ReportFreq.
  960.    * 
  961. ***************
  962. *** 56,63 ****
  963.        */
  964.       bytes = 1 << SHARED_BYTES;
  965.       if (share_malloc_init(bytes) == -1) {
  966. !         fprintf(stderr,"Cannot share_malloc %d bytes.\n",bytes);
  967. !         exit(10);
  968.       } else
  969.           fprintf(stderr,"Malloced %d bytes of shared memory.\n",
  970.                   bytes);
  971. --- 60,66 ----
  972.        */
  973.       bytes = 1 << SHARED_BYTES;
  974.       if (share_malloc_init(bytes) == -1) {
  975. !         RSerror("Cannot share_malloc %d bytes.\n",bytes);
  976.       } else
  977.           fprintf(stderr,"Malloced %d bytes of shared memory.\n",
  978.                   bytes);
  979. ***************
  980. *** 102,107 ****
  981. --- 105,111 ----
  982.   cleanup()
  983.   {
  984.       int i;
  985. +     extern Object *World;
  986.       extern int nlight, maxlevel;
  987.       extern int Xres, Yres, StartLine, Jittered, JitSamples, pixel_div;
  988.       extern double RedContrast, GreenContrast, BlueContrast, TreeCutoff;
  989. ***************
  990. *** 110,115 ****
  991. --- 114,125 ----
  992.       extern FILE *fstats;
  993.   
  994.       /*
  995. +      * Complain if there are no primitives to be rendered.
  996. +      */
  997. +     if (World->prims == 0) {
  998. +         RSerror("Nothing to be rendered.\n");
  999. +     }
  1000. +     /*
  1001.        * Because we want the user to be able to override the input file
  1002.        * through the command line, we have to initialize some variables to
  1003.        * bogus values so that when the file is being parsed, it is
  1004. ***************
  1005. *** 144,156 ****
  1006.           JitSamples = DEFLIGHTSAMPLES;
  1007.   
  1008.       if (Jittered && JitSamples > 5) {
  1009. !         fprintf(stderr,"Sorry, %d rays/pixel not supported.\n",
  1010.                           JitSamples*JitSamples);
  1011. -         exit(2);
  1012.       }
  1013.       if (!Jittered && JitSamples < 3) {
  1014. !         fprintf(stderr,"Samples (-S) value must be at least 3.\n");
  1015. !         exit(2);
  1016.       }
  1017.   
  1018.       if (TreeCutoff == UNSET)
  1019. --- 154,164 ----
  1020.           JitSamples = DEFLIGHTSAMPLES;
  1021.   
  1022.       if (Jittered && JitSamples > 5) {
  1023. !         RSerror("Sorry, %d rays/pixel not supported.\n",
  1024.                           JitSamples*JitSamples);
  1025.       }
  1026.       if (!Jittered && JitSamples < 3) {
  1027. !         RSerror("Samples (-S) value must be at least 3.\n");
  1028.       }
  1029.   
  1030.       if (TreeCutoff == UNSET)
  1031.  
  1032. Index: src/shade.c
  1033. *** src/shade.c.old    Wed Mar  7 22:18:33 1990
  1034. --- src/shade.c    Wed Mar  7 22:18:34 1990
  1035. ***************
  1036. *** 18,26 ****
  1037.    * name of the person performing the modification, the date of modification,
  1038.    * and the reason for such modification.
  1039.    *
  1040. !  * $Id: shade.c,v 3.0.1.1 89/11/16 20:34:42 craig Exp Locker: craig $
  1041.    *
  1042.    * $Log:    shade.c,v $
  1043.    * Revision 3.0.1.1  89/11/16  20:34:42  craig
  1044.    * patch1: Atmospheric effects are now applied to background rays.
  1045.    * 
  1046. --- 18,29 ----
  1047.    * name of the person performing the modification, the date of modification,
  1048.    * and the reason for such modification.
  1049.    *
  1050. !  * $Id: shade.c,v 3.0.1.2 90/03/07 21:31:21 craig Exp $
  1051.    *
  1052.    * $Log:    shade.c,v $
  1053. +  * Revision 3.0.1.2  90/03/07  21:31:21  craig
  1054. +  * patch4: Replaced call to LightCoordSys() with call to VectCoordSys().
  1055. +  * 
  1056.    * Revision 3.0.1.1  89/11/16  20:34:42  craig
  1057.    * patch1: Atmospheric effects are now applied to background rays.
  1058.    * 
  1059. ***************
  1060. *** 229,236 ****
  1061.        * whose normal is defined by the vector from the center
  1062.        * of the light source to the point of intersection and
  1063.        * which passes through the center of the light source.
  1064. !      */
  1065. !     LightCoordSys(lp, pos, &toLight, &Uaxis, &Vaxis);
  1066.       jit = 2. * lp->radius * SampleSpacing;
  1067.   
  1068.       if (Jittered) {
  1069. --- 232,241 ----
  1070.        * whose normal is defined by the vector from the center
  1071.        * of the light source to the point of intersection and
  1072.        * which passes through the center of the light source.
  1073. !       */
  1074. !     vecsub(lp->pos, *pos, &toLight);
  1075. !     VectCoordSys(&toLight, &Uaxis, &Vaxis);
  1076.       jit = 2. * lp->radius * SampleSpacing;
  1077.   
  1078.       if (Jittered) {
  1079.  
  1080. Index: src/texture.h
  1081. *** src/texture.h.old    Wed Mar  7 22:18:47 1990
  1082. --- src/texture.h    Wed Mar  7 22:18:48 1990
  1083. ***************
  1084. *** 18,26 ****
  1085.    * name of the person performing the modification, the date of modification,
  1086.    * and the reason for such modification.
  1087.    *
  1088. !  * $Id: texture.h,v 3.0 89/10/27 02:06:06 craig Exp $
  1089.    *
  1090.    * $Log:    texture.h,v $
  1091.    * Revision 3.0  89/10/27  02:06:06  craig
  1092.    * Baseline for first official release.
  1093.    * 
  1094. --- 18,29 ----
  1095.    * name of the person performing the modification, the date of modification,
  1096.    * and the reason for such modification.
  1097.    *
  1098. !  * $Id: texture.h,v 3.0.1.1 90/03/07 21:27:15 craig Exp $
  1099.    *
  1100.    * $Log:    texture.h,v $
  1101. +  * Revision 3.0.1.1  90/03/07  21:27:15  craig
  1102. +  * patch4: Added support for gloss texture.
  1103. +  * 
  1104.    * Revision 3.0  89/10/27  02:06:06  craig
  1105.    * Baseline for first official release.
  1106.    * 
  1107. ***************
  1108. *** 33,44 ****
  1109.   #define FBM        4    /* fBm texture */
  1110.   #define FBMBUMP        5    /* fBm bump map */
  1111.   #define WOOD        6
  1112.   
  1113.   Texture *NewCheckText(), *NewBlotchText(), *NewBumpText(), *NewMarbleText();
  1114.   Texture *NewfBmText(), *NewfBmBumpText();
  1115. ! Texture *NewWoodText();
  1116.   /*
  1117.    * Texturing routines.
  1118.    */
  1119.   int    CheckerText(), BlotchText(), BumpText(), MarbleText(), fBmText();
  1120. ! int    fBmBumpText(), WoodText();
  1121. --- 36,48 ----
  1122.   #define FBM        4    /* fBm texture */
  1123.   #define FBMBUMP        5    /* fBm bump map */
  1124.   #define WOOD        6
  1125. + #define GLOSS        7
  1126.   
  1127.   Texture *NewCheckText(), *NewBlotchText(), *NewBumpText(), *NewMarbleText();
  1128.   Texture *NewfBmText(), *NewfBmBumpText();
  1129. ! Texture *NewWoodText(), *NewGlossText();
  1130.   /*
  1131.    * Texturing routines.
  1132.    */
  1133.   int    CheckerText(), BlotchText(), BumpText(), MarbleText(), fBmText();
  1134. ! int    fBmBumpText(), WoodText(), GlossText();
  1135.  
  1136. Index: doc/texture.ms
  1137. *** doc/texture.ms.old    Wed Mar  7 22:17:10 1990
  1138. --- doc/texture.ms    Wed Mar  7 22:17:10 1990
  1139. ***************
  1140. *** 2,10 ****
  1141.   .\" Brief tutorial on adding textures to rayshade.
  1142.   .\" Craig Kolb 10/89
  1143.   .\"
  1144. ! .\" $Id: texture.ms,v 3.0.1.1 89/11/27 18:49:26 craig Exp $
  1145.   .\"
  1146.   .\" $Log:    texture.ms,v $
  1147.   .\" Revision 3.0.1.1  89/11/27  18:49:26  craig
  1148.   .\" patch2: Example texture now uses colormap to scale ambient & diffuse
  1149.   .\" patch2: components of surface color.
  1150. --- 2,13 ----
  1151.   .\" Brief tutorial on adding textures to rayshade.
  1152.   .\" Craig Kolb 10/89
  1153.   .\"
  1154. ! .\" $Id: texture.ms,v 3.0.1.2 90/02/12 12:44:41 craig Exp $
  1155.   .\"
  1156.   .\" $Log:    texture.ms,v $
  1157. + .\" Revision 3.0.1.2  90/02/12  12:44:41  craig
  1158. + .\" patch4: Fixed minor formatting problems.
  1159. + .\" 
  1160.   .\" Revision 3.0.1.1  89/11/27  18:49:26  craig
  1161.   .\" patch2: Example texture now uses colormap to scale ambient & diffuse
  1162.   .\" patch2: components of surface color.
  1163. ***************
  1164. *** 70,76 ****
  1165.   .LP
  1166.   Adding new textures to rayshade involves modifying at least
  1167.   four source files:
  1168. ! .NH texture.h
  1169.   texture.h
  1170.   .LP
  1171.   A numerical type is given to the texture.  The routines to
  1172. --- 73,79 ----
  1173.   .LP
  1174.   Adding new textures to rayshade involves modifying at least
  1175.   four source files:
  1176. ! .NH
  1177.   texture.h
  1178.   .LP
  1179.   A numerical type is given to the texture.  The routines to
  1180.  
  1181. Index: src/typedefs.h
  1182. *** src/typedefs.h.old    Wed Mar  7 22:18:52 1990
  1183. --- src/typedefs.h    Wed Mar  7 22:18:52 1990
  1184. ***************
  1185. *** 18,26 ****
  1186.    * name of the person performing the modification, the date of modification,
  1187.    * and the reason for such modification.
  1188.    *
  1189. !  * $Id: typedefs.h,v 3.0 89/10/27 02:06:07 craig Exp $
  1190.    *
  1191.    * $Log:    typedefs.h,v $
  1192.    * Revision 3.0  89/10/27  02:06:07  craig
  1193.    * Baseline for first official release.
  1194.    * 
  1195. --- 18,30 ----
  1196.    * name of the person performing the modification, the date of modification,
  1197.    * and the reason for such modification.
  1198.    *
  1199. !  * $Id: typedefs.h,v 3.0.1.1 90/02/12 13:22:35 craig Exp $
  1200.    *
  1201.    * $Log:    typedefs.h,v $
  1202. +  * Revision 3.0.1.1  90/02/12  13:22:35  craig
  1203. +  * patch4: Added prims field to Object structure.
  1204. +  * patch4: Object->counter is a pointer when SHAREDMEM is defined.
  1205. +  * 
  1206.    * Revision 3.0  89/10/27  02:06:07  craig
  1207.    * Baseline for first official release.
  1208.    * 
  1209. ***************
  1210. *** 49,55 ****
  1211.       char *data;        /* Pointer to list/grid/primitive */
  1212.       Trans *trans;        /* Transformation information */
  1213.       double bounds[2][3];    /* Bounding box */
  1214. ! #ifdef LINDA
  1215.       unsigned long *counter;
  1216.   #else
  1217.       unsigned long counter;        /* # of last grid checked against */
  1218. --- 53,60 ----
  1219.       char *data;        /* Pointer to list/grid/primitive */
  1220.       Trans *trans;        /* Transformation information */
  1221.       double bounds[2][3];    /* Bounding box */
  1222. !     unsigned long prims;    /* # of primitives, including sub-objects */
  1223. ! #ifdef SHAREDMEM
  1224.       unsigned long *counter;
  1225.   #else
  1226.       unsigned long counter;        /* # of last grid checked against */
  1227.  
  1228. Index: src/voxels.c
  1229. *** src/voxels.c.old    Wed Mar  7 22:18:58 1990
  1230. --- src/voxels.c    Wed Mar  7 22:18:58 1990
  1231. ***************
  1232. *** 18,26 ****
  1233.    * name of the person performing the modification, the date of modification,
  1234.    * and the reason for such modification.
  1235.    *
  1236. !  * $Id: voxels.c,v 3.0.1.1 89/12/06 16:33:29 craig Exp $
  1237.    *
  1238.    * $Log:    voxels.c,v $
  1239.    * Revision 3.0.1.1  89/12/06  16:33:29  craig
  1240.    * patch2: Added calls to new error/warning routines.
  1241.    * 
  1242. --- 18,29 ----
  1243.    * name of the person performing the modification, the date of modification,
  1244.    * and the reason for such modification.
  1245.    *
  1246. !  * $Id: voxels.c,v 3.0.1.2 90/02/12 13:19:50 craig Exp $
  1247.    *
  1248.    * $Log:    voxels.c,v $
  1249. +  * Revision 3.0.1.2  90/02/12  13:19:50  craig
  1250. +  * patch4: Added reporting of total number of primitives.
  1251. +  * 
  1252.    * Revision 3.0.1.1  89/12/06  16:33:29  craig
  1253.    * patch2: Added calls to new error/warning routines.
  1254.    * 
  1255. ***************
  1256. *** 51,56 ****
  1257. --- 54,61 ----
  1258.       if (Verbose) {
  1259.           fprintf(fstats,"World extent:\n");
  1260.           print_bounds(World->bounds);
  1261. +         fprintf(fstats,"\t%ld primitive%c\n",World->prims,
  1262. +                 World->prims == 1 ? ' ' : 's');
  1263.       }
  1264.   }
  1265.   
  1266.  
  1267. Index: src/cylinder.c
  1268. *** src/cylinder.c.old    Thu Mar  8 18:41:52 1990
  1269. --- src/cylinder.c    Thu Mar  8 18:42:01 1990
  1270. ***************
  1271. *** 18,26 ****
  1272.    * name of the person performing the modification, the date of modification,
  1273.    * and the reason for such modification.
  1274.    *
  1275. !  * $Id: cylinder.c,v 3.0.1.2 89/12/06 16:33:41 craig Exp $
  1276.    *
  1277.    * $Log:    cylinder.c,v $
  1278.    * Revision 3.0.1.2  89/12/06  16:33:41  craig
  1279.    * patch2: Added calls to new error/warning routines.
  1280.    * 
  1281. --- 18,32 ----
  1282.    * name of the person performing the modification, the date of modification,
  1283.    * and the reason for such modification.
  1284.    *
  1285. !  * $Id: cylinder.c,v 3.0.1.4 90/03/07 22:43:04 craig Exp $
  1286.    *
  1287.    * $Log:    cylinder.c,v $
  1288. +  * Revision 3.0.1.4  90/03/07  22:43:04  craig
  1289. +  * patch4: Fixed typo in previous fix.
  1290. +  * 
  1291. +  * Revision 3.0.1.3  90/02/12  13:27:30  craig
  1292. +  * patch4: Changes to avoid rotation about null axis.
  1293. +  * 
  1294.    * Revision 3.0.1.2  89/12/06  16:33:41  craig
  1295.    * patch2: Added calls to new error/warning routines.
  1296.    * 
  1297. ***************
  1298. *** 79,87 ****
  1299.       /*
  1300.        * Define matrix to transform from axis-aligned to desired cylinder.
  1301.        */
  1302. !     dir.x = axis.y;
  1303. !     dir.y = -axis.x;
  1304. !     dir.z = 0.;
  1305.       RS_rotate(trans, &dir, acos(axis.z));
  1306.       RS_translate(trans, cent);
  1307.   
  1308. --- 85,98 ----
  1309.       /*
  1310.        * Define matrix to transform from axis-aligned to desired cylinder.
  1311.        */
  1312. !     if (abs(axis.z) == 1.) {
  1313. !         dir.x = 1.;
  1314. !         dir.y = dir.z = 0.;
  1315. !     } else {
  1316. !         dir.x = axis.y;
  1317. !         dir.y = -axis.x;
  1318. !         dir.z = 0.;
  1319. !     }
  1320.       RS_rotate(trans, &dir, acos(axis.z));
  1321.       RS_translate(trans, cent);
  1322.   
  1323.  
  1324. Index: Examples/pool.ray
  1325. *** Examples/pool.ray.old    Thu Mar  8 18:31:24 1990
  1326. --- Examples/pool.ray    Thu Mar  8 18:31:24 1990
  1327. ***************
  1328. *** 9,14 ****
  1329. --- 9,21 ----
  1330.    * To speed rendering, use -P or -S options.
  1331.    *
  1332.    * C. Kolb 2/88
  1333. +  *
  1334. +  * $Id: pool.ray,v 3.0.1.1 90/03/08 18:24:39 craig Exp $
  1335. +  *
  1336. +  * $Log:    pool.ray,v $
  1337. +  * Revision 3.0.1.1  90/03/08  18:24:39  craig
  1338. +  * patch4: Modified transformation of wood & marble textures.
  1339. +  * 
  1340.    */
  1341.   up 0.0 0.0 1.
  1342.   fov 45
  1343. ***************
  1344. *** 70,79 ****
  1345.       sphere s9 1.5 -6.0    -31.392305    1.5
  1346.   
  1347.       box s4 0. 0. -1. 30. 57. 1.
  1348. !     box s15 30. 0. 0. 3. 54. 1.5 texture wood scale 5. 5. 5.
  1349. !     box s15 -30. 0. 0. 3. 54. 1.5 texture wood scale 5. 5. 5.
  1350. !     box s15 0. 57. 0. 33. 3. 1.5 texture wood scale 5. 5. 5.
  1351. !     box s15 0. -57. 0. 33. 3. 1.5 texture wood scale 5. 5. 5.
  1352.       sphere s16 1.5 0. 0. 0. translate 0. 21. 1.5
  1353.       box mirror 10. -144. 30. 21.3333 .1 20.    /* was 40. -144 30. */
  1354.       /*
  1355. --- 77,86 ----
  1356.       sphere s9 1.5 -6.0    -31.392305    1.5
  1357.   
  1358.       box s4 0. 0. -1. 30. 57. 1.
  1359. !     box s15 30. 0. 0. 3. 54. 1.5 texture wood scale 15. 10. 15.
  1360. !     box s15 -30. 0. 0. 3. 54. 1.5 texture wood scale 15. 10. 15.
  1361. !     box s15 0. 57. 0. 33. 3. 1.5 texture wood scale 10. 15. 15.
  1362. !     box s15 0. -57. 0. 33. 3. 1.5 texture wood scale 10. 15. 15.
  1363.       sphere s16 1.5 0. 0. 0. translate 0. 21. 1.5
  1364.       box mirror 10. -144. 30. 21.3333 .1 20.    /* was 40. -144 30. */
  1365.       /*
  1366. ***************
  1367. *** 87,93 ****
  1368.        * Floor
  1369.        */
  1370.       plane floor   0.     0.    1.    0.       0. -30.
  1371. !         texture marble scale 4. 4. 4. translate 0. 0. -4.376 
  1372.           texture checker blacktile scale 12.3 12.3 12.3
  1373.       /*
  1374.        * Ceiling
  1375. --- 94,101 ----
  1376.        * Floor
  1377.        */
  1378.       plane floor   0.     0.    1.    0.       0. -30.
  1379. !         texture marble scale 6. 6. 6. rotate 1 0 0 90
  1380. !                 translate 0. 0. -4.376 
  1381.           texture checker blacktile scale 12.3 12.3 12.3
  1382.       /*
  1383.        * Ceiling
  1384.  
  1385. Index: doc/rayshade.1
  1386. *** doc/rayshade.1.old    Thu Mar  8 18:39:55 1990
  1387. --- doc/rayshade.1    Thu Mar  8 18:40:06 1990
  1388. ***************
  1389. *** 1,8 ****
  1390.   .\" Manual page for rayshade, 'troff -man' format.
  1391.   .\"
  1392. ! .\" $Id: rayshade.1,v 3.0.1.11 89/12/06 17:21:39 craig Exp $
  1393.   .\"
  1394.   .\" $Log:    rayshade.1,v $
  1395.   .\" Revision 3.0.1.11  89/12/06  17:21:39  craig
  1396.   .\" patch2: Added suggestion to use cpp.
  1397.   .\" 
  1398. --- 1,19 ----
  1399.   .\" Manual page for rayshade, 'troff -man' format.
  1400.   .\"
  1401. ! .\" $Id: rayshade.1,v 3.0.1.14 90/03/08 18:20:10 craig Exp $
  1402.   .\"
  1403.   .\" $Log:    rayshade.1,v $
  1404. + .\" Revision 3.0.1.14  90/03/08  18:20:10  craig
  1405. + .\" patch4: More typos...
  1406. + .\" 
  1407. + .\" Revision 3.0.1.13  90/03/07  22:15:15  craig
  1408. + .\" patch4: Documented gloss texture.
  1409. + .\" patch4: Better documentation of heightfields.
  1410. + .\" patch4: General cleanup.
  1411. + .\" 
  1412. + .\" Revision 3.0.1.12  90/02/12  13:10:13  craig
  1413. + .\" patch4: Fixed errors in fbm and fbmbump documentation.
  1414. + .\" 
  1415.   .\" Revision 3.0.1.11  89/12/06  17:21:39  craig
  1416.   .\" patch2: Added suggestion to use cpp.
  1417.   .\" 
  1418. ***************
  1419. *** 129,135 ****
  1420.   .SH OVERVIEW
  1421.   .PP
  1422.   .I Rayshade
  1423. ! is an ray tracer capable of rendering images composed
  1424.   of a large number of primitive objects.
  1425.   .I Rayshade
  1426.   reads a series of lines supplied on the standard input or contained
  1427. --- 140,146 ----
  1428.   .SH OVERVIEW
  1429.   .PP
  1430.   .I Rayshade
  1431. ! is a ray tracing program capable of rendering images composed
  1432.   of a large number of primitive objects.
  1433.   .I Rayshade
  1434.   reads a series of lines supplied on the standard input or contained
  1435. ***************
  1436. *** 280,286 ****
  1437.   .PP
  1438.   Three types of light sources are supported:  point, extended (area), and
  1439.   directional.
  1440. ! Point sources are specified by a location in world-space
  1441.   and produce shadows with sharp edges.  Extended sources are specified
  1442.   by a location and a radius.  They produce shadows with "fuzzy" edges
  1443.   (penumbrae), but increase ray tracing time considerably.  Directional
  1444. --- 291,297 ----
  1445.   .PP
  1446.   Three types of light sources are supported:  point, extended (area), and
  1447.   directional.
  1448. ! Point sources are specified by a location in world space
  1449.   and produce shadows with sharp edges.  Extended sources are specified
  1450.   by a location and a radius.  They produce shadows with "fuzzy" edges
  1451.   (penumbrae), but increase ray tracing time considerably.  Directional
  1452. ***************
  1453. *** 327,334 ****
  1454.   .SH SURFACES
  1455.   .PP
  1456.   Every primitive object has a surface associated with it.  The surface specifies 
  1457. ! the color, reflectivity, and transparency of an object, and may be
  1458. ! defined anywhere in the input file as long as it is defined before it
  1459.   is used.
  1460.   Surfaces are
  1461.   defined once, and may be associated with any number of primitive objects.
  1462. --- 338,345 ----
  1463.   .SH SURFACES
  1464.   .PP
  1465.   Every primitive object has a surface associated with it.  The surface specifies 
  1466. ! the color, reflectivity, and transparency of an object.  A surface may be
  1467. ! defined anywhere in the input file, provided it is defined before it
  1468.   is used.
  1469.   Surfaces are
  1470.   defined once, and may be associated with any number of primitive objects.
  1471. ***************
  1472. *** 470,480 ****
  1473.   Defines a Phong-shaded triangle.  Here, the first three floating-point numbers
  1474.   specify the first vertex, the second three specify the
  1475.   normal at that vertex, and so on.  Again, vertices should be
  1476. ! specified in counter-clockwise order.
  1477. ! Currently, all three vertex/normal pairs
  1478. ! are stored for every triangle (as opposed to storing pointers to these
  1479. ! vectors, which would reduce storage space in cases where more than one
  1480. ! triangle shared a vertex).
  1481.   .TP
  1482.   \fBpoly \fIsurface x1 y1 z1 x2 y2 z2 x3 y3 z3 \fR[\fIx4 y4 z4 ...\fR]
  1483.   Creates a polygon with the specified vertices.  The vertices should be given in
  1484. --- 481,487 ----
  1485.   Defines a Phong-shaded triangle.  Here, the first three floating-point numbers
  1486.   specify the first vertex, the second three specify the
  1487.   normal at that vertex, and so on.  Again, vertices should be
  1488. ! specified in counter-clockwise order. Vertex normals need not be normalized.
  1489.   .TP
  1490.   \fBpoly \fIsurface x1 y1 z1 x2 y2 z2 x3 y3 z3 \fR[\fIx4 y4 z4 ...\fR]
  1491.   Creates a polygon with the specified vertices.  The vertices should be given in
  1492. ***************
  1493. *** 503,517 ****
  1494.   .I top_radius.
  1495.   .TP
  1496.   \fBheightfield \fIsurface filename\fR
  1497. ! Reads height field data from \fIfilename\fR and creates a height square
  1498. ! height field of unit size centered at (0.5, 0.5).  The binary data in
  1499. ! \fIfilename\fR
  1500. ! is stored as an initial integer giving the square root of number of data
  1501. ! points in the file, followed by altitude (Z) values stored as floating-point
  1502. ! numbers.  The height field is rendered as a surface tessellated by triangles.
  1503. ! Non-square height fields may be rendered by setting vertex heights to
  1504.   less than or equal to -1000.  Triangles which have any vertex less than
  1505. ! or equal in altitude to this value are not rendered.
  1506.   .TP
  1507.   \fBbox \fIsurface xcenter ycenter zcenter xsize ysize zsize\fR
  1508.   Creates a box centered at (
  1509. --- 510,532 ----
  1510.   .I top_radius.
  1511.   .TP
  1512.   \fBheightfield \fIsurface filename\fR
  1513. ! Reads height field data from \fIfilename\fR and creates a square
  1514. ! height field of unit size centered at (0.5, 0.5).  The height field is
  1515. ! rendered as a surface tessellated by right isoscoles triangles.  The binary
  1516. ! data in the heightfield file is stored as an initial
  1517. ! 32-bit integer giving the square root of number of data
  1518. ! points in the file, termed the size of the height field.  The size is
  1519. ! followed by altitude (Z) values stored as 32-bit
  1520. ! floating point values.  The 0th value in the file specifies the Z coordinate
  1521. ! of the lower-left corner of the height field (0, 0).  The next 
  1522. ! specifies the Z coordinate for (1/(size-1), 0).  The last specifies the
  1523. ! coordinate for (1., 1.).  In short, value number \fIi\fR
  1524. ! in the heightfield file specifies the Z coordinate for the point
  1525. ! ( (i % size) / (size -1), (i / size) / (size -1) ).
  1526. ! Non-square height fields may be rendered by specifying altitude values
  1527.   less than or equal to -1000.  Triangles which have any vertex less than
  1528. ! or equal in altitude to this value are not rendered.  Be warned that the
  1529. ! heightfield file is machine-dependent, as it is stored in binary format.
  1530.   .TP
  1531.   \fBbox \fIsurface xcenter ycenter zcenter xsize ysize zsize\fR
  1532.   Creates a box centered at (
  1533. ***************
  1534. *** 696,712 ****
  1535.   Versions of Perlin's Noise() and DNoise()
  1536.   functions are used to generate values for
  1537.   most of the interesting textures.
  1538. ! Currently, there are seven textures available:
  1539.   .TP
  1540.   \fBbump\fI scale\fR
  1541. ! applies a random bump map to the surface being textured.  The point of
  1542.   intersection is passed to DNoise().  The returned normalized vector is
  1543.   weighted by
  1544.   .I scale
  1545.   and added to the normal vector at the point of intersection.
  1546.   .TP
  1547. ! \fBchecker\fI size surface\fR
  1548. ! applies a (3D) checkerboard texture to the object being textured.  Every
  1549.   point that falls within an "even" cube will be shaded using the characteristics
  1550.   of the named surface.  Every point that falls within an "odd" cube will
  1551.   retain its usual surface characteristics.  Be warned that strange effects
  1552. --- 711,727 ----
  1553.   Versions of Perlin's Noise() and DNoise()
  1554.   functions are used to generate values for
  1555.   most of the interesting textures.
  1556. ! There are eight available textures:
  1557.   .TP
  1558.   \fBbump\fI scale\fR
  1559. ! Applies a random bump map to the surface being textured.  The point of
  1560.   intersection is passed to DNoise().  The returned normalized vector is
  1561.   weighted by
  1562.   .I scale
  1563.   and added to the normal vector at the point of intersection.
  1564.   .TP
  1565. ! \fBchecker\fI surface\fR
  1566. ! Applies a (3D) checkerboard texture to the object being textured.  Every
  1567.   point that falls within an "even" cube will be shaded using the characteristics
  1568.   of the named surface.  Every point that falls within an "odd" cube will
  1569.   retain its usual surface characteristics.  Be warned that strange effects
  1570. ***************
  1571. *** 721,727 ****
  1572.   of 0 results in a roughly 50-50 mix of the two surfaces.
  1573.   Higher values result in greater instances of the 'default' surface type.
  1574.   .TP
  1575. ! \fBfbm \fIscale offset H lambda octaves thresh\fR [\fIcolormap\fR]
  1576.   This texture generates a sample of discretized fractional Brownian motion (fBm)
  1577.   and uses it to modify the diffuse and ambient components of an object's color.
  1578.   If no \fIcolormap\fR is named, the sample
  1579. --- 736,742 ----
  1580.   of 0 results in a roughly 50-50 mix of the two surfaces.
  1581.   Higher values result in greater instances of the 'default' surface type.
  1582.   .TP
  1583. ! \fBfbm \fIoffset scale H lambda octaves thresh\fR [\fIcolormap\fR]
  1584.   This texture generates a sample of discretized fractional Brownian motion (fBm)
  1585.   and uses it to modify the diffuse and ambient components of an object's color.
  1586.   If no \fIcolormap\fR is named, the sample
  1587. ***************
  1588. *** 741,752 ****
  1589.   works well), and \fIthresh\fR is used to specify a lower bound on the
  1590.   output of fBm function.  Any value lower than \fIthresh\fR is set to zero.
  1591.   .TP
  1592. ! \fBfbmbump \fIscale offset H lambda octaves thresh\fR
  1593.   This texture is similar to the \fBfbm\fR texture.  Rather modifying the
  1594.   color of a surface, \fBfbmbump\fR acts as a bump map.
  1595.   .TP
  1596.   \fBmarble\fR [\fIcolormap\fR]
  1597. ! This texture gives a surface a marble-like appearance.  If the name of a
  1598.   \fIcolormap\fR file is given, the marble will be colored using the RGB values
  1599.   in the colormap.  If no colormap name is given, the diffuse and ambient
  1600.   components of
  1601. --- 756,778 ----
  1602.   works well), and \fIthresh\fR is used to specify a lower bound on the
  1603.   output of fBm function.  Any value lower than \fIthresh\fR is set to zero.
  1604.   .TP
  1605. ! \fBfbmbump \fIoffset scale H lambda octaves\fR
  1606.   This texture is similar to the \fBfbm\fR texture.  Rather modifying the
  1607.   color of a surface, \fBfbmbump\fR acts as a bump map.
  1608.   .TP
  1609. + \fBgloss \fIglossiness\fR
  1610. + This texture gives reflective surfaces a glossy appearance. A glossy
  1611. + object's surface normal is perturbed such that it 'samples' a cone of
  1612. + unit height with radius 1. - \fIglossiness\fR.  Thus, a value of 1 results
  1613. + in perfect mirror-like reflections, while a value of 0 results in extremely
  1614. + fuzzy reflections.  For best results, jittered sampling should be
  1615. + used when rendering scenes containing glossy objects.
  1616. + .TP
  1617.   \fBmarble\fR [\fIcolormap\fR]
  1618. ! This texture gives a surface a marble-like appearance.  The texture
  1619. ! is implemented as roughly parallel alternating veins of marble, each
  1620. ! of which is separated by 1/7 of a unit and runs perpendicular to the Z axis.
  1621. ! If the name of a
  1622.   \fIcolormap\fR file is given, the marble will be colored using the RGB values
  1623.   in the colormap.  If no colormap name is given, the diffuse and ambient
  1624.   components of
  1625. ***************
  1626. *** 755,761 ****
  1627.   .TP
  1628.   \fBwood\fR
  1629.   .br
  1630. ! This texture gives a wood-like appearance to a surface.
  1631.   .PP
  1632.   A colormap is an ASCII file
  1633.   256 lines in length, each line containing three space-separated integers
  1634. --- 781,790 ----
  1635.   .TP
  1636.   \fBwood\fR
  1637.   .br
  1638. ! This texture gives a wood-like appearance to a surface.  The feature size
  1639. ! of the texture is approximately 1/100th of a unit, making it often necessary
  1640. ! to scale the texture in order to achieve the desired
  1641. ! appearance.
  1642.   .PP
  1643.   A colormap is an ASCII file
  1644.   256 lines in length, each line containing three space-separated integers
  1645. ***************
  1646. *** 868,874 ****
  1647.   skipped,  \fIsamples\fR must be at least 3 if adaptive supersampling is
  1648.   being used.
  1649.   .PP
  1650. ! Not that the meaning of the \fB-S\fR option (and the \fBsamples\fR
  1651.   command) is different depending upon
  1652.   whether or not jittered
  1653.   sampling is being used.
  1654. --- 897,903 ----
  1655.   skipped,  \fIsamples\fR must be at least 3 if adaptive supersampling is
  1656.   being used.
  1657.   .PP
  1658. ! Note that the meaning of the \fB-S\fR option (and the \fBsamples\fR
  1659.   command) is different depending upon
  1660.   whether or not jittered
  1661.   sampling is being used.
  1662.  
  1663. Index: src/texture.c
  1664. *** src/texture.c.old    Thu Mar  8 18:38:25 1990
  1665. --- src/texture.c    Thu Mar  8 18:39:00 1990
  1666. ***************
  1667. *** 18,26 ****
  1668.    * name of the person performing the modification, the date of modification,
  1669.    * and the reason for such modification.
  1670.    *
  1671. !  * $Id: texture.c,v 3.0.1.2 89/12/06 16:33:50 craig Exp $
  1672.    *
  1673.    * $Log:    texture.c,v $
  1674.    * Revision 3.0.1.2  89/12/06  16:33:50  craig
  1675.    * patch2: Added calls to new error/warning routines.
  1676.    * 
  1677. --- 18,31 ----
  1678.    * name of the person performing the modification, the date of modification,
  1679.    * and the reason for such modification.
  1680.    *
  1681. !  * $Id: texture.c,v 3.0.1.3 90/03/07 21:30:22 craig Exp $
  1682.    *
  1683.    * $Log:    texture.c,v $
  1684. +  * Revision 3.0.1.3  90/03/07  21:30:22  craig
  1685. +  * patch4: Fixed thresholding bug in fBmText().
  1686. +  * patch4: Colormap is now set to NULL in new_texture().
  1687. +  * patch4: Added gloss texture.
  1688. +  * 
  1689.    * Revision 3.0.1.2  89/12/06  16:33:50  craig
  1690.    * patch2: Added calls to new error/warning routines.
  1691.    * 
  1692. ***************
  1693. *** 44,50 ****
  1694.    */
  1695.   int (*textures[])() =
  1696.       {CheckerText, BlotchText, BumpText, MarbleText, fBmText, fBmBumpText,
  1697. !      WoodText};
  1698.   extern double Chaos(), Marble(), fBm(), Noise();
  1699.   Color    *read_colormap();
  1700.   
  1701. --- 49,55 ----
  1702.    */
  1703.   int (*textures[])() =
  1704.       {CheckerText, BlotchText, BumpText, MarbleText, fBmText, fBmBumpText,
  1705. !      WoodText, GlossText};
  1706.   extern double Chaos(), Marble(), fBm(), Noise();
  1707.   Color    *read_colormap();
  1708.   
  1709. ***************
  1710. *** 62,67 ****
  1711. --- 67,73 ----
  1712.       new->surf1 = (Surface *)NULL;
  1713.       new->next = (Texture *)NULL;
  1714.       new->trans = (Trans *)NULL;
  1715. +     new->colormap = (Color *)NULL;
  1716.       return new;
  1717.   }
  1718.   
  1719. ***************
  1720. *** 242,247 ****
  1721. --- 248,267 ----
  1722.       return text;
  1723.   }
  1724.   
  1725. + Texture *
  1726. + NewGlossText(gloss)
  1727. + double gloss;
  1728. + {
  1729. +     Texture *text;
  1730. +     text = new_texture(GLOSS);
  1731. +     /*
  1732. +      * Radius of base of cone to be sampled is 1 - glossiness.
  1733. +      */
  1734. +     text->size = 1. - gloss;
  1735. +     return text;
  1736. + }
  1737.   /*
  1738.    * Apply "blotch" texture.
  1739.    */
  1740. ***************
  1741. *** 272,278 ****
  1742.   
  1743.       val = fBm(pos, text->args[0], text->args[1], (int)text->size);
  1744.       if (val < text->args[4])
  1745. !         val = 0.;
  1746.       else
  1747.           val = text->args[3] + text->args[2] * (val - text->args[4]);
  1748.       if (text->colormap) {
  1749. --- 292,298 ----
  1750.   
  1751.       val = fBm(pos, text->args[0], text->args[1], (int)text->size);
  1752.       if (val < text->args[4])
  1753. !         val = text->args[3];
  1754.       else
  1755.           val = text->args[3] + text->args[2] * (val - text->args[4]);
  1756.       if (text->colormap) {
  1757. ***************
  1758. *** 363,368 ****
  1759. --- 383,416 ----
  1760.           ScaleColor(val, surf->amb, &surf->amb);
  1761.           ScaleColor(val, surf->diff, &surf->diff);
  1762.       }
  1763. + }
  1764. + GlossText(text, pos, norm, surf)
  1765. + Texture *text;
  1766. + Vector *pos, *norm;
  1767. + Surface *surf;
  1768. + {
  1769. +     Vector uaxis, vaxis, point, norminc;
  1770. +     /*
  1771. +      * Find coordinate system with norm as the Z axis.
  1772. +      */
  1773. +     VectCoordSys(norm, &uaxis, &vaxis);
  1774. +     /*
  1775. +      * Find point on unit circle.
  1776. +      */
  1777. +     unit_circle_point(&point);
  1778. +     /*
  1779. +      * Perturb normal appropriately.
  1780. +      */
  1781. +     veccomb(text->size * point.x, uaxis,
  1782. +         text->size * point.y, vaxis,
  1783. +         &norminc);
  1784. +     vecadd(*norm, norminc, norm);
  1785. +     /*
  1786. +      * Renormalize.
  1787. +      */
  1788. +     (void)normalize(norm);
  1789.   }
  1790.   
  1791.   Color *
  1792.  
  1793.  
  1794.