#! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'Doc/Changes' <<'END_OF_FILE' XMajor changes since 3.0 X----------------------- XAddition of CSG. "union", "intersect" and "difference" types. X XAnimation support. Multi-frame image files, use of expressions, animated Xtransformations, new keywords, including: shutter, frames, framelength, Xdefine, starttime. "linear" function, "time" and "frame" variables. X XAggregate syntax changed. Rather than "define .... defend" with Xthe aggregate type buried inbetween, syntax is "type ... end", where type Xis one of: grid, list, union, intersect, difference. Object naming Xis now accomplished by preceding one of the above with the "name" keyword Xfollowed by the name to assign to the aggregate. X XTorus, blob primitives added, courtesy of Mark Podlipec and Jochen Schwarze. XBuggy superquadric primitive removed. X XSurface definition syntax and binding changed. Surface definition is now keyword- Xbased. Note that the specular color of a surface is used to modify the color of Xreflected rays in 4.0. When converting 3.0 scripts to 4.0, the specular component Xand/or reflectivity may need to be modified. X XImproved antialiasing. Rather than using an adaptive scheme or nonadaptive X"distributed" ray tracing, an adaptive jittered algorithm is used. X XAdditional textures and light source types. X XVastly improved performance when using many texturing functions. X XMany minor and not-so-minor bugfixes. END_OF_FILE if test 1361 -ne `wc -c <'Doc/Changes'`; then echo shar: \"'Doc/Changes'\" unpacked with wrong size! fi # end of 'Doc/Changes' fi if test -f 'Doc/Guide/transform.tex' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Doc/Guide/transform.tex'\" else echo shar: Extracting \"'Doc/Guide/transform.tex'\" \(1496 characters\) sed "s/^X//" >'Doc/Guide/transform.tex' <<'END_OF_FILE' X\chapter {Transformations} X X{\Rayshade} supports the application of linear transformations to objects Xand textures. If more than one transformation is specified, the Xtotal resulting transformation is computed and applied. X X\begin{defkey}{translate}{\evec{delta}} XTranslate (move) by {\em delta}. X\end{defkey} X X\begin{defkey}{rotate}{\evec{axis} $\theta$} XRotate counter-clockwise about the given axis by $\theta$ degrees. X\end{defkey} X X\begin{defkey}{scale}{\evec{v}} XScale by {\em v}. X\end{defkey} XAll three scaling components must be non-zero, else degenerate matrices Xwill result. X X\begin{defkey}{transform}{\evec{row1} \evec{row2} \evec{row3} [\evec{delta}]} XApply the given 3-by-3 transformation matrix. If given, {\em delta} Xspecifies a translation vector. X\end{defkey} X XTransformations should Xbe specified in the order in which they are to be applied Ximmediately following the item to Xbe transformed. For example: X X\begin{verbatim} X /* X * Ellipsoid, rotated cube X */ X sphere 1. 0 0 0 scale 2. 1. 1. translate 0 0 -2.5 X box 0 0 0 .5 .5 .5 X rotate 0 0 1 45 rotate 1 0 0 45 translate 0 0 2.5 X\end{verbatim} X XTransformations may also be applied to textures: X X\begin{verbatim} X plane 0 0 -4 0 0 1 X texture checker red scale 2 2 2 rotate 0 0 1 45 X\end{verbatim} X XNote that transformation parameters may be specified using Xanimated expressions, causing the transformations themselves Xto be animated. See Appendix B for further details. END_OF_FILE if test 1496 -ne `wc -c <'Doc/Guide/transform.tex'`; then echo shar: \"'Doc/Guide/transform.tex'\" unpacked with wrong size! fi # end of 'Doc/Guide/transform.tex' fi if test -f 'Doc/TODO' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Doc/TODO'\" else echo shar: Extracting \"'Doc/TODO'\" \(1258 characters\) sed "s/^X//" >'Doc/TODO' <<'END_OF_FILE' X--------- XTODO List X--------- X XIf World object has only one subobject, and the World Xis neither textured nor transformed (can't do this anyway), Xthen make that object the World object. In theory we could Xdo this (collapsing) throughout the modeling tree. X X> 2 objects in CSG objects X XCreate nasty, rigorous test scenes, more examples in general. X XAnimated lights & camera. X XCubic interpolation functions. X XAnimated primitive/texture/surface/etc parameters. X XThere should be a windowing command that takes pixel locations Xas well as one that takes normalized coordinates. X XPut Linda code back in place. X XUser-selectable primitives/aggregates/lights/textures at compile time? X XTechnical Documentation X XMake heightfields be stored in fixed-point, and take care of byte-ordering Xproblems so that height fields are transportable from machine to machine. X XIs Bayes' theorem-based polygon intersection method better? X XAdaptive gridding. X XBetter antialiasing. X XAdd an option to perform sorting during ray/List intersection tests so Xobjects are tested approximately in order. X XExpr compressor program: Spits out .ray file with just floats. X XOptimize blur for non-jitter case (don't exapnd bboxes, etc). X XAnimated scales and translations can modify matrix directly. END_OF_FILE if test 1258 -ne `wc -c <'Doc/TODO'`; then echo shar: \"'Doc/TODO'\" unpacked with wrong size! fi # end of 'Doc/TODO' fi if test -f 'Examples/boxball.ray' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Examples/boxball.ray'\" else echo shar: Extracting \"'Examples/boxball.ray'\" \(1380 characters\) sed "s/^X//" >'Examples/boxball.ray' <<'END_OF_FILE' X/* X * White diffuse sphere with wooden box-shaped regions removed. X * Rod Bogart 11/90 X */ Xeyep 4 3 5 Xfov 15 Xlight 1 directional 1 0.5 2 Xsample 1 /* Increase this value for less noisy image */ Xreport verbose Xscreen 320 256 X Xplane 0. 0. -5. 0. 0. 1 texture marble scale 2 2 1 X Xdifference X sphere 0.65 0 0 0 X grid 3 3 3 X applysurf ambient .2 .05 .05 X diffuse .8 .1 .05 X specular .05 .05 .05 X specpow 20 X X box 0.3 0.3 -0.7 0.7 0.7 -0.3 X box -0.2 0.3 -0.7 0.2 0.7 -0.3 X box -0.7 0.3 -0.7 -0.3 0.7 -0.3 X X box 0.3 0.3 -0.2 0.7 0.7 0.2 X box -0.2 0.3 -0.2 0.2 0.7 0.2 X box -0.7 0.3 -0.2 -0.3 0.7 0.2 X X box 0.3 0.3 0.3 0.7 0.7 0.7 X box -0.2 0.3 0.3 0.2 0.7 0.7 X box -0.7 0.3 0.3 -0.3 0.7 0.7 X X box 0.3 -0.2 -0.7 0.7 0.2 -0.3 X box -0.2 -0.2 -0.7 0.2 0.2 -0.3 X box -0.7 -0.2 -0.7 -0.3 0.2 -0.3 X X box 0.3 -0.2 -0.2 0.7 0.2 0.2 X box -0.2 -0.2 -0.2 0.2 0.2 0.2 X box -0.7 -0.2 -0.2 -0.3 0.2 0.2 X X box 0.3 -0.2 0.3 0.7 0.2 0.7 X box -0.2 -0.2 0.3 0.2 0.2 0.7 X box -0.7 -0.2 0.3 -0.3 0.2 0.7 X X box 0.3 -0.7 -0.7 0.7 -0.3 -0.3 X box -0.2 -0.7 -0.7 0.2 -0.3 -0.3 X box -0.7 -0.7 -0.7 -0.3 -0.3 -0.3 X X box 0.3 -0.7 -0.2 0.7 -0.3 0.2 X box -0.2 -0.7 -0.2 0.2 -0.3 0.2 X box -0.7 -0.7 -0.2 -0.3 -0.3 0.2 X X box 0.3 -0.7 0.3 0.7 -0.3 0.7 X box -0.2 -0.7 0.3 0.2 -0.3 0.7 X box -0.7 -0.7 0.3 -0.3 -0.3 0.7 X end texture wood scale 3 1 1 Xend END_OF_FILE if test 1380 -ne `wc -c <'Examples/boxball.ray'`; then echo shar: \"'Examples/boxball.ray'\" unpacked with wrong size! fi # end of 'Examples/boxball.ray' fi if test -f 'Reconfigure' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Reconfigure'\" else echo shar: Extracting \"'Reconfigure'\" \(1482 characters\) sed "s/^X//" >'Reconfigure' <<'END_OF_FILE' X#!/bin/sh X# X# Reconfigure X# Extract .SH files using values in config.sh X# X# Useful in environments in which the source tree X# is used to build executables for more than one kind of machine. X# After running Configure on a particular machine, copy the X# resulting config.sh to, for example, config.sh.SPARC. X# When you have to recompile for some reason, running X# "Reconfigure config.sh.SPARC" should produce the correct Makefiles X# and the like. X# X# If you need to run "make depend" for a machine other than the one X# that the Configure script was last run for, you will need to remake X# the "mkdep" script by removing it, copying the appropriate X# config.sh.MACHINE file to config.sh, and running "Configure -d". X# X Xcase "$1" in X'') X configfile="./config.sh" X ;; X*) X if test -f "$1" ; then X configfile="$1" X else X echo "$1 does not exist." X exit X fi Xesac X Xecho "Reconfiguring using $configfile." X. $configfile X Xecho " " Xecho "Doing variable substitutions on .SH files..." Xset x `awk '{print $1}' 'libray/libcommon/color.h' <<'END_OF_FILE' X/* X * color.h X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: color.h,v 4.0.1.1 91/09/29 15:32:09 cek Exp Locker: cek $ X * X * $Log: color.h,v $ X * Revision 4.0.1.1 91/09/29 15:32:09 cek X * patch1: Fixed #endif typo. X * X * Revision 4.0 91/07/17 14:30:08 kolb X * Initial version. X * X */ X#ifndef COLOR_H X#define COLOR_H X/* X * Color X */ Xtypedef struct Color { X Float r, g, b; /* Red, green, blue. */ X} Color; X X#define ColorScale(s,c,a) (a)->r = (s)*(c).r, \ X (a)->g = (s)*(c).g, \ X (a)->b = (s)*(c).b X X#define ColorAddScaled(x, s, y, c) (c)->r = (x).r + (s)*(y).r, \ X (c)->g = (x).g + (s)*(y).g, \ X (c)->b = (x).b + (s)*(y).b X X#define ColorMultiply(x,y,a) (a)->r = (x).r*(y).r, \ X (a)->g = (x).g*(y).g, \ X (a)->b = (x).b*(y).b X X#define ColorAdd(x,y,a) (a)->r = (x).r+(y).r, \ X (a)->g = (x).g+(y).g, \ X (a)->b = (x).b+(y).b X#endif /* COLOR_H */ END_OF_FILE if test 1328 -ne `wc -c <'libray/libcommon/color.h'`; then echo shar: \"'libray/libcommon/color.h'\" unpacked with wrong size! fi # end of 'libray/libcommon/color.h' fi if test -f 'libray/libcommon/error.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libcommon/error.h'\" else echo shar: Extracting \"'libray/libcommon/error.h'\" \(1417 characters\) sed "s/^X//" >'libray/libcommon/error.h' <<'END_OF_FILE' X/* X * error.h X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: error.h,v 4.0 91/07/17 14:30:27 kolb Exp Locker: kolb $ X * X * $Log: error.h,v $ X * Revision 4.0 91/07/17 14:30:27 kolb X * Initial version. X * X */ X#ifndef ERROR_H X#define ERROR_H X/* X * Error severity codes, passed to user-provided RLerror() X * function which optionally prints and optionally exits. X * X * RL_ADVISE Message may safely be safely suppressed, though X * the resulting image may not be exactly what you expect. X * RL_WARN Message should probably be printed; image will most X * likely be affected. X * RL_ABORT Message should be printed -- couldn't perform a request. X * The resulting image will be affected. X * RL_PANIC Fatal error -- call to RLerror() must not return. X */ X#define RL_ADVISE 0 /* Advisory */ X#define RL_WARN 1 /* Warning */ X#define RL_ABORT 2 /* Aborted */ X#define RL_PANIC 3 /* Panic */ X Xextern void RLerror(); /* application-supplied reporting routine */ X#endif /* ERROR_H */ END_OF_FILE if test 1417 -ne `wc -c <'libray/libcommon/error.h'`; then echo shar: \"'libray/libcommon/error.h'\" unpacked with wrong size! fi # end of 'libray/libcommon/error.h' fi if test -f 'libray/libcommon/expr.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libcommon/expr.h'\" else echo shar: Extracting \"'libray/libcommon/expr.h'\" \(1552 characters\) sed "s/^X//" >'libray/libcommon/expr.h' <<'END_OF_FILE' X/* X * expr.h X * X * Copyright (C) 1989, 1991, Craig E. Kolb, Rod G. Bogart X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: expr.h,v 4.0 91/07/17 14:30:47 kolb Exp Locker: kolb $ X * X * $Log: expr.h,v $ X * Revision 4.0 91/07/17 14:30:47 kolb X * Initial version. X * X */ X#ifndef EXPR_H X#define EXPR_H X X#define FLOAT_EXPR 0 X#define BUILTIN_EXPR 1 X Xtypedef struct Expr { X short type, /* Expr type (float/builtin/time) */ X timevary, /* does the expr vary over time? */ X symtab, /* is the expr in the symtab? */ X nparams; /* # of params, if builtin */ X Float value, /* float val/last eval if timeexpr */ X timenow, /* time of last evaluation */ X (*function)(); X struct Expr **params; /* parameters, if a builtin */ X} Expr; X Xtypedef struct ExprAssoc { X Float *lhs; /* left-hand side */ X Expr *expr; /* right-hand side */ X struct ExprAssoc *next; /* Next in list */ X} ExprAssoc; X Xextern Float ExprEval(); X Xextern Expr *ExprResolve1(), *ExprResolve2(), *ExprResolve3(), X *ExprResolve4(), *ExprResolve5(), *ExprFloatCreate(); Xextern Expr *TimeExpr, *FrameExpr, *ExprReuseFloatCreate(); X Xextern ExprAssoc *AssocCreate(); X X#endif /* EXPR_H */ END_OF_FILE if test 1552 -ne `wc -c <'libray/libcommon/expr.h'`; then echo shar: \"'libray/libcommon/expr.h'\" unpacked with wrong size! fi # end of 'libray/libcommon/expr.h' fi if test -f 'libray/libcommon/rotate.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libcommon/rotate.h'\" else echo shar: Extracting \"'libray/libcommon/rotate.h'\" \(1244 characters\) sed "s/^X//" >'libray/libcommon/rotate.h' <<'END_OF_FILE' X/* X * rotate.h X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: rotate.h,v 4.0 91/07/17 14:31:26 kolb Exp Locker: kolb $ X * X * $Log: rotate.h,v $ X * Revision 4.0 91/07/17 14:31:26 kolb X * Initial version. X * X */ X#ifndef ROTATE_H X#define ROTATE_H X X#define TransRotateCreate() TransCreate((TransRef)RotateCreate(), RotateMethods()) X X#define TransRotateSetX(t, v) TransAssoc(t, &((Rotate *)t->tr)->x, v) X#define TransRotateSetY(t, v) TransAssoc(t, &((Rotate *)t->tr)->y, v) X#define TransRotateSetZ(t, v) TransAssoc(t, &((Rotate *)t->tr)->z, v) X#define TransRotateSetTheta(t, v) TransAssoc(t, &((Rotate *)t->tr)->theta, v) X Xtypedef struct { X Float x, y, z, theta; X} Rotate; X Xextern Rotate *RotateCreate(); Xextern TransMethods *RotateMethods(); Xextern void RotatePropagate(); X X#endif /* ROTATE_H */ END_OF_FILE if test 1244 -ne `wc -c <'libray/libcommon/rotate.h'`; then echo shar: \"'libray/libcommon/rotate.h'\" unpacked with wrong size! fi # end of 'libray/libcommon/rotate.h' fi if test -f 'libray/libcommon/sampling.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libcommon/sampling.h'\" else echo shar: Extracting \"'libray/libcommon/sampling.h'\" \(1485 characters\) sed "s/^X//" >'libray/libcommon/sampling.h' <<'END_OF_FILE' X/* X * sampling.h X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: sampling.h,v 4.0 91/07/17 14:32:01 kolb Exp Locker: kolb $ X * X * $Log: sampling.h,v $ X * Revision 4.0 91/07/17 14:32:01 kolb X * Initial version. X * X */ X#ifndef SAMPLING_H X#define SAMPLING_H X X/* X * # of subsamples to take within each of the totsamples slots when X * computing 'animated' bounding boxes. X */ X#define TIME_SUB_SAMPLES 10 X Xtypedef struct SampleInfo { X int totsamples, /* # of samples/pixel */ X sidesamples, /* sqrt(samples) */ X gaussian, /* gaussian filter? */ X framenum, /* current frame numer */ X timemagic; /* # of time samples per screen... */ X Float weight, /* 1. / totsamples */ X spacing, /* 1. / sidesamples */ X filterwidth, /* total width of filter */ X filterdelta, /* filterwidth * spacing */ X **filter, /* pixel filter, sidesamp by sidesamp */ X starttime, /* start time */ X shutter; /* length of time shutter is open */ X} SampleInfo; X Xextern SampleInfo Sampling; X Xextern void SamplingSetOptions(), UnitCirclePoint(); X X#endif /* SAMPLING */ END_OF_FILE if test 1485 -ne `wc -c <'libray/libcommon/sampling.h'`; then echo shar: \"'libray/libcommon/sampling.h'\" unpacked with wrong size! fi # end of 'libray/libcommon/sampling.h' fi if test -f 'libray/libcommon/translate.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libcommon/translate.h'\" else echo shar: Extracting \"'libray/libcommon/translate.h'\" \(1199 characters\) sed "s/^X//" >'libray/libcommon/translate.h' <<'END_OF_FILE' X/* X * translate.h X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: translate.h,v 4.0 91/07/17 14:32:49 kolb Exp Locker: kolb $ X * X * $Log: translate.h,v $ X * Revision 4.0 91/07/17 14:32:49 kolb X * Initial version. X * X */ X#ifndef TRANSLATE_H X#define TRANSLATE_H X X#define TransTranslateCreate() TransCreate((TransRef)TranslateCreate(), TranslateMethods()) X X#define TransTranslateSetX(t, v) TransAssoc(t, &((Translate *)t->tr)->x, v) X#define TransTranslateSetY(t, v) TransAssoc(t, &((Translate *)t->tr)->y, v) X#define TransTranslateSetZ(t, v) TransAssoc(t, &((Translate *)t->tr)->z, v) X Xtypedef Vector Translate; X Xextern Translate *TranslateCreate(); Xextern TransMethods *TranslateMethods(); Xextern void TranslatePropagate(); X X#endif /* TRANSLATE_H */ END_OF_FILE if test 1199 -ne `wc -c <'libray/libcommon/translate.h'`; then echo shar: \"'libray/libcommon/translate.h'\" unpacked with wrong size! fi # end of 'libray/libcommon/translate.h' fi if test -f 'libray/libimage/image.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libimage/image.h'\" else echo shar: Extracting \"'libray/libimage/image.h'\" \(1190 characters\) sed "s/^X//" >'libray/libimage/image.h' <<'END_OF_FILE' X/* X * image.h X * X * Copyright (C) 1989, 1991, Rod G. Bogart, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: image.h,v 4.0 91/07/17 14:33:39 kolb Exp Locker: kolb $ X * X * $Log: image.h,v $ X * Revision 4.0 91/07/17 14:33:39 kolb X * Initial version. X * X */ X#ifndef IMAGE_H X#define IMAGE_H X X/* X * Generic image object for texture map storage. X */ Xtypedef struct Image { X int width, height, /* Image size */ X chan, has_alpha, /* # of channels, has alpha info? */ X totalchan, /* # channels + any alpha channel */ X chansize; /* width * height */ X unsigned char *data; /* Image */ X char *filename; /* Filename (identifier) */ X struct Image *next; /* Next image in list. */ X} Image; X XImage *ImageCreate(), *ImageFind(), *ImageRead(); Xvoid ImageIndex(); X X#endif /* IMAGE_H */ END_OF_FILE if test 1190 -ne `wc -c <'libray/libimage/image.h'`; then echo shar: \"'libray/libimage/image.h'\" unpacked with wrong size! fi # end of 'libray/libimage/image.h' fi if test -f 'libray/libobj/bounds.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libobj/bounds.h'\" else echo shar: Extracting \"'libray/libobj/bounds.h'\" \(1348 characters\) sed "s/^X//" >'libray/libobj/bounds.h' <<'END_OF_FILE' X/* X * bounds.h X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: bounds.h,v 4.0 91/07/17 14:36:26 kolb Exp Locker: kolb $ X * X * $Log: bounds.h,v $ X * Revision 4.0 91/07/17 14:36:26 kolb X * Initial version. X * X */ X#ifndef BOUNDS_H X#define BOUNDS_H X X/* X * Used to make indices into bounding box arrays more readable. X */ X#define X 0 X#define Y 1 X#define Z 2 X#define LOW 0 X#define HIGH 1 X X/* X * If minimum X is greater than maximum, then X * is considered to be unbounded. X */ X X#define UNBOUNDED(o) ((o)->bounds[LOW][X] > (o)->bounds[HIGH][X]) X X/* X * Is the point p outside of the bounding box "b"? X */ X#define OutOfBounds(p,b) ((p)->x < b[0][0] || (p)->x > b[1][0] ||\ X (p)->y < b[0][1] || (p)->y > b[1][1] ||\ X (p)->z < b[0][2] || (p)->z > b[1][2]) X Xextern void BoundsCopy(), BoundsPrint(), X BoundsInit(), BoundsEnlarge(), X BoundsTransform(); X Xextern int BoundsIntersect(); X#endif /* BOUNDS_H */ END_OF_FILE if test 1348 -ne `wc -c <'libray/libobj/bounds.h'`; then echo shar: \"'libray/libobj/bounds.h'\" unpacked with wrong size! fi # end of 'libray/libobj/bounds.h' fi if test -f 'libray/libobj/csg.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libobj/csg.h'\" else echo shar: Extracting \"'libray/libobj/csg.h'\" \(1237 characters\) sed "s/^X//" >'libray/libobj/csg.h' <<'END_OF_FILE' X/* X * csg.h X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: csg.h,v 4.0 91/07/17 14:37:06 kolb Exp Locker: kolb $ X * X * $Log: csg.h,v $ X * Revision 4.0 91/07/17 14:37:06 kolb X * Initial version. X * X */ X#ifndef CSG_H X#define CSG_H X X#define GeomCsgCreate(t) GeomCreate((GeomRef)CsgCreate(t), CsgMethods()) X X/* X * CSG (Constructive Solid Geometry) X */ X#define CSG_UNION 0 X#define CSG_INTERSECT 1 X#define CSG_DIFFERENCE 2 X Xtypedef struct Csg { X char operator; /* Union, Intersect, or Difference */ X struct Geom *obj1, *obj2; X int (*intmeth)(); /* Intersection method. */ X Float bounds[2][3]; X} Csg; X Xextern char *CsgName(); Xextern Csg *CsgCreate(); Xextern int CsgIntersect(), CsgConvert(); Xextern void CsgBounds(); Xextern int FirstCsgGeom(); Xextern Methods *CsgMethods(); X X#endif /* CSG_H */ END_OF_FILE if test 1237 -ne `wc -c <'libray/libobj/csg.h'`; then echo shar: \"'libray/libobj/csg.h'\" unpacked with wrong size! fi # end of 'libray/libobj/csg.h' fi if test -f 'libray/libobj/instance.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libobj/instance.h'\" else echo shar: Extracting \"'libray/libobj/instance.h'\" \(1159 characters\) sed "s/^X//" >'libray/libobj/instance.h' <<'END_OF_FILE' X/* X * instance.h X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: instance.h,v 4.0 91/07/17 14:38:30 kolb Exp Locker: kolb $ X * X * $Log: instance.h,v $ X * Revision 4.0 91/07/17 14:38:30 kolb X * Initial version. X * X */ X#ifndef INSTANCE_H X#define INSTANCE_H X X#define GeomInstanceCreate(o) GeomCreate((GeomRef)InstanceCreate(o), \ X InstanceMethods()) X X/* X * Instance object X */ Xtypedef struct { X struct Geom *obj; /* Geom being instantiated */ X Float bounds[2][3]; /* Bounding box of object */ X} Instance; X Xextern char *InstanceName(); Xextern int InstanceIntersect(), InstanceConvert(); Xextern void InstanceBounds(); Xextern Instance *InstanceCreate(); Xextern Methods *InstanceMethods(); X X#endif /* INSTANCE_H */ END_OF_FILE if test 1159 -ne `wc -c <'libray/libobj/instance.h'`; then echo shar: \"'libray/libobj/instance.h'\" unpacked with wrong size! fi # end of 'libray/libobj/instance.h' fi if test -f 'libray/libobj/poly.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libobj/poly.h'\" else echo shar: Extracting \"'libray/libobj/poly.h'\" \(1275 characters\) sed "s/^X//" >'libray/libobj/poly.h' <<'END_OF_FILE' X/* X * poly.h X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: poly.h,v 4.0 91/07/17 14:39:04 kolb Exp Locker: kolb $ X * X * $Log: poly.h,v $ X * Revision 4.0 91/07/17 14:39:04 kolb X * Initial version. X * X */ X#ifndef POLY_H X#define POLY_H X X#define GeomPolygonCreate(r,p,f) GeomCreate((GeomRef)PolygonCreate(r,p,f), \ X PolygonMethods()) X X/* X * Polygon X */ Xtypedef struct { X Vector norm; /* Normal to polygon */ X Float d; /* Plane constant */ X char index; /* Which normal coord is "dominant"? */ X Vector *points; /* Array of vertices */ X int npoints; /* Number of vertices */ X} Polygon; X Xextern Polygon *PolygonCreate(); Xextern Methods *PolygonMethods(); Xextern int PolygonIntersect(), PolygonEnter(), PolygonNormal(); Xextern void PolygonBounds(), PolygonUV(), PolygonStats(); Xextern char *PolygonName(); X X#endif /* POLY_H */ END_OF_FILE if test 1275 -ne `wc -c <'libray/libobj/poly.h'`; then echo shar: \"'libray/libobj/poly.h'\" unpacked with wrong size! fi # end of 'libray/libobj/poly.h' fi if test -f 'libray/libobj/torus.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libobj/torus.h'\" else echo shar: Extracting \"'libray/libobj/torus.h'\" \(1216 characters\) sed "s/^X//" >'libray/libobj/torus.h' <<'END_OF_FILE' X/* X * torus.h X * X * Copyright (C) 1990, 1991, Mark Polipec, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: torus.h,v 4.0 91/07/17 14:39:31 kolb Exp Locker: kolb $ X * X * $Log: torus.h,v $ X * Revision 4.0 91/07/17 14:39:31 kolb X * Initial version. X * X */ X#ifndef TORUS_H X#define TORUS_H X X#define GeomTorusCreate(a,b,p,n) GeomCreate((GeomRef)TorusCreate(a,b,p,n), \ X TorusMethods()) X X/* X * Torus X */ Xtypedef struct { X Float a; /* tube radius */ X Float b; /* swept radius */ X Float aa, bb; /* squares of the above */ X Trans trans; /* general<-->canonical transform */ X} Torus; X Xextern Torus *TorusCreate(); Xextern int TorusIntersect(), TorusEnter(), TorusNormal(); Xextern void TorusBounds(), TorusUV(), TorusStats(); Xextern char *TorusName(); Xextern Methods *TorusMethods(); X X#endif /* TORUS_H */ END_OF_FILE if test 1216 -ne `wc -c <'libray/libobj/torus.h'`; then echo shar: \"'libray/libobj/torus.h'\" unpacked with wrong size! fi # end of 'libray/libobj/torus.h' fi if test -f 'libray/libsurf/atmosphere.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libsurf/atmosphere.h'\" else echo shar: Extracting \"'libray/libsurf/atmosphere.h'\" \(1227 characters\) sed "s/^X//" >'libray/libsurf/atmosphere.h' <<'END_OF_FILE' X/* X * atmosphere.h X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: atmosphere.h,v 4.0 91/07/17 14:40:06 kolb Exp Locker: kolb $ X * X * $Log: atmosphere.h,v $ X * Revision 4.0 91/07/17 14:40:06 kolb X * Initial version. X * X */ X#ifndef ATMOSPHERE_H X#define ATMOSPHERE_H X X#include "libcommon/common.h" X Xtypedef char * AtmosRef; X Xtypedef struct Medium { X Float index, /* Index of refraction */ X statten; /* specular transmission attenuation */ X struct Medium *next; X} Medium; X Xtypedef struct Atmosphere { X AtmosRef data; /* Effect info */ X void (*method)(); /* Atmosphere method */ X struct Atmosphere *next; /* Next effect */ X} Atmosphere; X Xextern Medium *MediumPush(); Xextern Atmosphere *AtmosCreate(), *AtmosphereCopy(); Xextern void Atmospherics(); X X#endif /* ATMOSPHERE_H */ END_OF_FILE if test 1227 -ne `wc -c <'libray/libsurf/atmosphere.h'`; then echo shar: \"'libray/libsurf/atmosphere.h'\" unpacked with wrong size! fi # end of 'libray/libsurf/atmosphere.h' fi if test -f 'libray/libtext/blotch.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libtext/blotch.c'\" else echo shar: Extracting \"'libray/libtext/blotch.c'\" \(1369 characters\) sed "s/^X//" >'libray/libtext/blotch.c' <<'END_OF_FILE' X/* X * blotch.c X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: blotch.c,v 4.0 91/07/17 14:41:31 kolb Exp Locker: kolb $ X * X * $Log: blotch.c,v $ X * Revision 4.0 91/07/17 14:41:31 kolb X * Initial version. X * X */ X#include "texture.h" X#include "blotch.h" X X/* X * Create and return a reference to a "blotch" texture. X */ XBlotch * XBlotchCreate(mix, surf) XFloat mix; XSurface *surf; X{ X Blotch *blotch; X X blotch = (Blotch *)Malloc(sizeof(Blotch)); X blotch->mix = mix; X blotch->surf = surf; X return blotch; X} X X/* X * Apply "blotch" texture. X */ X/*ARGSUSED*/ Xvoid XBlotchApply(blotch, prim, ray, pos, norm, gnorm, surf) XBlotch *blotch; XGeom *prim; XRay *ray; XVector *pos, *norm, *gnorm; XSurface *surf; X{ X Float val; X X /* X * "mix" represents the 'average' noise value at a point. X */ X val = Noise3(pos); X if (val > blotch->mix) { X val = (val - blotch->mix) / (1. - blotch->mix); X SurfaceBlend(surf, blotch->surf, 1. - val, val); X } X} END_OF_FILE if test 1369 -ne `wc -c <'libray/libtext/blotch.c'`; then echo shar: \"'libray/libtext/blotch.c'\" unpacked with wrong size! fi # end of 'libray/libtext/blotch.c' fi if test -f 'libray/libtext/bump.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libtext/bump.c'\" else echo shar: Extracting \"'libray/libtext/bump.c'\" \(1213 characters\) sed "s/^X//" >'libray/libtext/bump.c' <<'END_OF_FILE' X/* X * bump.c X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: bump.c,v 4.0 91/07/17 14:41:39 kolb Exp Locker: kolb $ X * X * $Log: bump.c,v $ X * Revision 4.0 91/07/17 14:41:39 kolb X * Initial version. X * X */ X#include "texture.h" X#include "bump.h" X X/* X * Create and return a reference to a "bump" texture. X */ XBump * XBumpCreate(size) XFloat size; X{ X Bump *bump; X X bump = (Bump *)Malloc(sizeof(Bump)); X bump->size = size; X return bump; X} X X/* X * Apply a "bump" texture. X */ Xvoid XBumpApply(bump, prim, ray, pos, norm, gnorm, surf) XBump *bump; XGeom *prim; XRay *ray; XVector *pos, *norm, *gnorm; XSurface *surf; X{ X Vector disp; X X DNoise3(pos, &disp); X norm->x += disp.x * bump->size; X norm->y += disp.y * bump->size; X norm->z += disp.z * bump->size; X (void)VecNormalize(norm); X} END_OF_FILE if test 1213 -ne `wc -c <'libray/libtext/bump.c'`; then echo shar: \"'libray/libtext/bump.c'\" unpacked with wrong size! fi # end of 'libray/libtext/bump.c' fi if test -f 'libray/libtext/checker.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libtext/checker.c'\" else echo shar: Extracting \"'libray/libtext/checker.c'\" \(1341 characters\) sed "s/^X//" >'libray/libtext/checker.c' <<'END_OF_FILE' X/* X * checker.c X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: checker.c,v 4.0 91/07/17 14:41:48 kolb Exp Locker: kolb $ X * X * $Log: checker.c,v $ X * Revision 4.0 91/07/17 14:41:48 kolb X * Initial version. X * X */ X#include "texture.h" X#include "checker.h" X X/* X * Create and return a reference to a "checker" texture. X */ XChecker * XCheckerCreate(surf) XSurface *surf; X{ X Checker *checker; X checker = (Checker *)Malloc(sizeof(checker)); X checker->surf = surf; X return checker; X} X X/* X * Apply a "checker" texture. X */ Xvoid XCheckerApply(checker, prim, ray, pos, norm, gnorm, surf) XChecker *checker; XGeom *prim; XRay *ray; XVector *pos, *norm, *gnorm; XSurface *surf; X{ X int xp, yp, zp; X X xp = pos->x > 0. ? pos->x : 1. - pos->x; X yp = pos->y > 0. ? pos->y : 1. - pos->y; X zp = pos->z > 0. ? pos->z : 1. - pos->z; X X if ((xp + yp + zp) % 2) X *surf = *checker->surf; X /* else surface stays the same. */ X} END_OF_FILE if test 1341 -ne `wc -c <'libray/libtext/checker.c'`; then echo shar: \"'libray/libtext/checker.c'\" unpacked with wrong size! fi # end of 'libray/libtext/checker.c' fi if test -f 'libray/libtext/fbmbump.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libtext/fbmbump.c'\" else echo shar: Extracting \"'libray/libtext/fbmbump.c'\" \(1284 characters\) sed "s/^X//" >'libray/libtext/fbmbump.c' <<'END_OF_FILE' X/* X * fbmbump.c X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: fbmbump.c,v 4.0 91/07/17 14:42:21 kolb Exp Locker: kolb $ X * X * $Log: fbmbump.c,v $ X * Revision 4.0 91/07/17 14:42:21 kolb X * Initial version. X * X */ X#include "texture.h" X#include "fbm.h" X#include "fbmbump.h" X XFBm * XFBmBumpCreate(offset, scale, h, lambda, octaves) XFloat offset, h, lambda, scale; Xint octaves; X{ X FBm *fbm; X fbm = FBmCreate(offset, scale, h, lambda, octaves, 0., (char *)NULL); X return fbm; X} X X/*ARGSUSED*/ Xvoid XFBmBumpApply(fbm, prim, ray, pos, norm, gnorm, surf) XFBm *fbm; XGeom *prim; XRay *ray; XVector *pos, *norm, *gnorm; XSurface *surf; X{ X Vector disp; X X VfBm(pos, fbm->omega, fbm->lambda, fbm->octaves, &disp); X norm->x += fbm->offset + disp.x * fbm->scale; X norm->y += fbm->offset + disp.y * fbm->scale; X norm->z += fbm->offset + disp.z * fbm->scale; X} END_OF_FILE if test 1284 -ne `wc -c <'libray/libtext/fbmbump.c'`; then echo shar: \"'libray/libtext/fbmbump.c'\" unpacked with wrong size! fi # end of 'libray/libtext/fbmbump.c' fi if test -f 'libray/libtext/gloss.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libtext/gloss.c'\" else echo shar: Extracting \"'libray/libtext/gloss.c'\" \(1477 characters\) sed "s/^X//" >'libray/libtext/gloss.c' <<'END_OF_FILE' X/* X * gloss.c X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: gloss.c,v 4.0 91/07/17 14:42:30 kolb Exp Locker: kolb $ X * X * $Log: gloss.c,v $ X * Revision 4.0 91/07/17 14:42:30 kolb X * Initial version. X * X */ X#include "texture.h" X#include "gloss.h" X XGloss * XGlossCreate(glossiness) XFloat glossiness; X{ X Gloss *gloss; X X gloss = (Gloss *)Malloc(sizeof(Gloss)); X gloss->glossy = 1. - glossiness; X return gloss; X} X Xvoid XGlossApply(gloss, prim, ray, pos, norm, gnorm, surf) XGloss *gloss; XGeom *prim; XRay *ray; XVector *pos, *norm, *gnorm; XSurface *surf; X{ X Vector uaxis, vaxis, point, norminc; X extern void UnitCirclePoint(); X X /* X * Find coordinate system with norm as the Z axis. X */ X VecCoordSys(norm, &uaxis, &vaxis); X /* X * Find point on unit circle based on sample #. X */ X UnitCirclePoint(&point, ray->sample); X /* X * Perturb normal appropriately. X */ X VecComb(gloss->glossy * point.x, uaxis, X gloss->glossy * point.y, vaxis, X &norminc); X VecAdd(*norm, norminc, norm); X /* X * Renormalize. X */ X (void)VecNormalize(norm); X} END_OF_FILE if test 1477 -ne `wc -c <'libray/libtext/gloss.c'`; then echo shar: \"'libray/libtext/gloss.c'\" unpacked with wrong size! fi # end of 'libray/libtext/gloss.c' fi if test -f 'libray/libtext/imagetext.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libtext/imagetext.h'\" else echo shar: Extracting \"'libray/libtext/imagetext.h'\" \(1222 characters\) sed "s/^X//" >'libray/libtext/imagetext.h' <<'END_OF_FILE' X/* X * imagetext.h X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: imagetext.h,v 4.0 91/07/17 14:42:47 kolb Exp Locker: kolb $ X * X * $Log: imagetext.h,v $ X * Revision 4.0 91/07/17 14:42:47 kolb X * Initial version. X * X */ X#ifndef IMAGETEXT_H X#define IMAGETEXT_H X X#define TextImageCreate(s) TextCreate((TextRef)ImageTextCreate(s), \ X ImageTextApply) X Xtypedef struct { X Image *image; /* image to use */ X Surface *surf; /* Alternative surface */ X int component, /* component to texture */ X smooth; /* interpolate pixel values? */ X Float lo, hi; /* high and low values in image */ X Float tileu, tilev; /* tiling control */ X Mapping *mapping; X} ImageText; X Xextern ImageText *ImageTextCreate(); Xextern void ImageTextApply(), ImageTextSetComponent(); X X#endif /* IMAGETEXT_H */ END_OF_FILE if test 1222 -ne `wc -c <'libray/libtext/imagetext.h'`; then echo shar: \"'libray/libtext/imagetext.h'\" unpacked with wrong size! fi # end of 'libray/libtext/imagetext.h' fi if test -f 'libray/libtext/mount.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libray/libtext/mount.c'\" else echo shar: Extracting \"'libray/libtext/mount.c'\" \(1523 characters\) sed "s/^X//" >'libray/libtext/mount.c' <<'END_OF_FILE' X/* X * mount.c X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: mount.c,v 4.0 91/07/17 14:43:17 kolb Exp Locker: kolb $ X * X * $Log: mount.c,v $ X * Revision 4.0 91/07/17 14:43:17 kolb X * Initial version. X * X */ X#include "texture.h" X#include "mount.h" X X/* X * Create and return a reference to a "mount" texture. X */ XMount * XMountCreate(cmap, turb, slope) Xchar *cmap; XFloat turb, slope; X{ X Mount *mount; X X mount = (Mount *)Malloc(sizeof(Mount)); X mount->turb = turb; X mount->slope = slope; X mount->cmap = ColormapRead(cmap); X return mount; X} X X/* X * Apply a "mount" texture. X */ Xvoid XMountApply(mount, prim, ray, pos, norm, gnorm, surf) XMount *mount; XGeom *prim; XRay *ray; XVector *pos, *norm, *gnorm; XSurface *surf; X{ X int index; X Float t; X Color c; X X t = Chaos(pos, 7); X index = (pos->z + mount->turb*t - mount->slope*(1.-norm->z))*256; X if (index < 0) X index = 0; X if (index > 255) X index = 255; X X ColorMultiply(surf->amb, mount->cmap[index], &surf->amb); X ColorMultiply(surf->diff, mount->cmap[index], &surf->diff); X ColorMultiply(surf->spec, mount->cmap[index], &surf->spec); X} END_OF_FILE if test 1523 -ne `wc -c <'libray/libtext/mount.c'`; then echo shar: \"'libray/libtext/mount.c'\" unpacked with wrong size! fi # end of 'libray/libtext/mount.c' fi if test -f 'libshade/builtin.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libshade/builtin.c'\" else echo shar: Extracting \"'libshade/builtin.c'\" \(1383 characters\) sed "s/^X//" >'libshade/builtin.c' <<'END_OF_FILE' X/* X * builtin.c X * X * Copyright (C) 1989, 1991, Craig E. Kolb, Rod G. Bogart X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: builtin.c,v 4.0 91/07/17 14:45:00 kolb Exp Locker: kolb $ X * X * $Log: builtin.c,v $ X * Revision 4.0 91/07/17 14:45:00 kolb X * Initial version. X * X */ X X#include "rayshade.h" X XFloat XSumExpr(a, b) XFloat a, b; X{ X return a + b; X} XFloat XDiffExpr(a, b) XFloat a, b; X{ X return a - b; X} X XFloat XMultExpr(a, b) XFloat a, b; X{ X return a * b; X} XFloat XDivideExpr(a, b) XFloat a, b; X{ X return a / b; X} X XFloat XModExpr(a, b) XFloat a, b; X{ X return (Float)((int)a % (int)b); X} X XFloat XNegateExpr(a) XFloat a; X{ X return -a; X} X XFloat XLinearTime(starttime, startval, endtime, endval) XFloat starttime, endtime, startval, endval; X{ X if (TimeExpr->value < starttime) X return startval; X if (TimeExpr->value > endtime) X return endval; X if (equal(endtime, starttime)) X return startval; X return startval + (endval - startval) * X (TimeExpr->value - starttime) / (endtime - starttime); X} END_OF_FILE if test 1383 -ne `wc -c <'libshade/builtin.c'`; then echo shar: \"'libshade/builtin.c'\" unpacked with wrong size! fi # end of 'libshade/builtin.c' fi if test -f 'libshade/stats.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libshade/stats.h'\" else echo shar: Extracting \"'libshade/stats.h'\" \(1395 characters\) sed "s/^X//" >'libshade/stats.h' <<'END_OF_FILE' X/* X * stats.h X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: stats.h,v 4.0 91/07/17 14:47:46 kolb Exp Locker: kolb $ X * X * $Log: stats.h,v $ X * Revision 4.0 91/07/17 14:47:46 kolb X * Initial version. X * X */ X#ifndef STATS_H X#define STATS_H X X/* X * Statistics X */ Xtypedef struct RSStats { X unsigned long EyeRays, /* # of eye rays spawned */ X ShadowRays, /* # of shadow rays spawned */ X ReflectRays, /* # of reflected rays */ X RefractRays, /* # of refracted rays */ X HitRays, /* # of rays that hit something. */ X BVTests, /* # of bounding volume tests. */ X SuperSampled, /* # of supersampled pixels. */ X ShadowHits, /* # of shadow ray hits */ X CacheHits, /* # of shadow cache hits */ X CacheMisses; /* # of shadow cache misses */ X Float Utime, /* User time */ X Stime; /* System time */ X FILE *fstats; /* Stats/info file pointer. */ X} RSStats; X Xextern RSStats Stats; Xextern void StatsPrint(), StatsAddRep(); X X#endif /* STATS_H */ END_OF_FILE if test 1395 -ne `wc -c <'libshade/stats.h'`; then echo shar: \"'libshade/stats.h'\" unpacked with wrong size! fi # end of 'libshade/stats.h' fi if test -f 'libshade/symtab.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libshade/symtab.h'\" else echo shar: Extracting \"'libshade/symtab.h'\" \(1180 characters\) sed "s/^X//" >'libshade/symtab.h' <<'END_OF_FILE' X/* X * symtab.h X * X * Copyright (C) 1989, 1991, Craig E. Kolb, Rod G. Bogart X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: symtab.h,v 4.0 91/07/17 14:48:12 kolb Exp Locker: kolb $ X * X * $Log: symtab.h,v $ X * Revision 4.0 91/07/17 14:48:12 kolb X * Initial version. X * X */ X X#ifndef SYMTAB_H X#define SYMTAB_H X Xtypedef Float (*FloatFuncPtr)(); X Xstruct SymtabPredefinedEntry { X char * name; X Float f; X FloatFuncPtr fp; X int type; X int timevary; X int params; X}; X Xtypedef union { X Float (*fp)(); X Expr *expr; X} SymtabValue; X Xtypedef struct SymtabEntry { X char *name; X SymtabValue value; X int type; X int timevary; X int params; X struct SymtabEntry *next; X} SymtabEntry; X Xextern Expr *ExprFloatSymtabFind(); Xextern SymtabEntry *SymtabFind(), *SymtabBuiltinFind(); X X#endif /* SYMTAB_H */ END_OF_FILE if test 1180 -ne `wc -c <'libshade/symtab.h'`; then echo shar: \"'libshade/symtab.h'\" unpacked with wrong size! fi # end of 'libshade/symtab.h' fi if test -f 'libshade/viewing.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'libshade/viewing.h'\" else echo shar: Extracting \"'libshade/viewing.h'\" \(1564 characters\) sed "s/^X//" >'libshade/viewing.h' <<'END_OF_FILE' X/* X * viewing.h X * X * Copyright (C) 1989, 1991, Craig E. Kolb X * All rights reserved. X * X * This software may be freely copied, modified, and redistributed X * provided that this copyright notice is preserved on all copies. X * X * You may not distribute this software, in whole or in part, as part of X * any commercial product without the express consent of the authors. X * X * There is no warranty or other guarantee of fitness of this software X * for any purpose. It is provided solely "as is". X * X * $Id: viewing.h,v 4.0 91/07/17 14:48:26 kolb Exp Locker: kolb $ X * X * $Log: viewing.h,v $ X * Revision 4.0 91/07/17 14:48:26 kolb X * Initial version. X * X */ X#ifndef VIEWING_H X#define VIEWING_H X X/* X * Screen X */ Xtypedef struct RSScreen { X int xres, yres, /* Resolution of entire screen */ X xsize, ysize, /* Resolution of window */ X minx, miny, maxx, maxy; /* Window to be rendered */ X Vector scrnx, scrny, /* Horizontal & vertical screen axes */ X scrni, scrnj, /* Normalized versions of the above */ X firstray; /* Direction from eye to screen UL */ X Color background; /* Background color */ X} RSScreen; X X/* X * Camera X */ Xtypedef struct { X Vector pos, /* Eye position */ X lookp, /* Look position */ X dir, /* Look direction */ X up; /* 'Up' vector */ X Float hfov, vfov, /* Horizontal/vertical field of view */ X lookdist, /* Eye pos/look pos distance */ X aperture, /* Aperture width (0 == pinhole) */ X focaldist; /* Distance from eye to focal plane */ X} RSCamera; X Xextern RSScreen Screen; Xextern RSCamera Camera; X X#endif /* VIEWING_H */ END_OF_FILE if test 1564 -ne `wc -c <'libshade/viewing.h'`; then echo shar: \"'libshade/viewing.h'\" unpacked with wrong size! fi # end of 'libshade/viewing.h' fi echo shar: End of archive 3 \(of 19\). cp /dev/null ark3isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 19 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0