home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-07-21 | 54.4 KB | 2,350 lines |
- Newsgroups: comp.sources.misc
- From: Rayshade Construction Co. <rayshade@weedeater.math.YALE.EDU>
- Subject: v21i009: rayshade - A raytracing package for UNIX, Part06/19
- Message-ID: <1991Jul20.043456.11477@sparky.IMD.Sterling.COM>
- X-Md4-Signature: 9460758b6d1b7446ee76a8e036ff510a
- Date: Sat, 20 Jul 1991 04:34:56 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: Rayshade Construction Co. <rayshade@weedeater.math.YALE.EDU>
- Posting-number: Volume 21, Issue 9
- Archive-name: rayshade/part06
- Environment: UNIX, !16BIT
-
- #! /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 <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 6 (of 19)."
- # Contents: Doc/Guide/intro.tex Examples/planet.map
- # libray/liblight/extended.c libray/libobj/hf.h libray/libobj/list.c
- # libray/libobj/plane.c libray/libsurf/fogdeck.c
- # libray/libtext/cloud.c libray/libtext/stripe.c
- # libshade/Makefile.SH libshade/surfdef.c raypaint/Makefile.SH
- # raypaint/glgraphics.c raypaint/main.c rayshade/Makefile.SH
- # rayview/Makefile.SH
- # Wrapped by kolb@woody on Wed Jul 17 17:56:45 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'Doc/Guide/intro.tex' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Doc/Guide/intro.tex'\"
- else
- echo shar: Extracting \"'Doc/Guide/intro.tex'\" \(2585 characters\)
- sed "s/^X//" >'Doc/Guide/intro.tex' <<'END_OF_FILE'
- X\chapter{Introduction}
- X\pagenumbering{arabic}
- X
- XThis document describes \rayshade in enough detail to enable
- Xthe technical-minded to
- Xsit down and render some images. In its current form,
- Xit is truly a draft, and even then
- Xmore of a reference manual than a proper user's guide.
- X
- XThis document does not provide any kind of thorough introduction
- Xto the basics of computer graphics or ray tracing.
- XThere are many other excellent sources for this kind of information.
- XThe technical and coding details of \rayshade and
- Xits libraries will be documented elsewhere.
- X
- X\section{Getting Started}
- X
- XThe best way to learn how to use \rayshade is to dive right in and
- Xstart making pictures. Study the example
- Xinput files that are packaged with {\em rayshade}. Run them through
- Xrayshade to see what the images they produce look like.
- XChange the input files; move the camera,
- Xchange the field of view, modify surface properties, and see what differences
- Xyour changes make, all the while referring to the appropriate portions
- Xof this document. Browse through the individual chapters
- Xto see what \rayshade can and cannot do. The \rayshade quick reference
- Xguide may also help you sort out syntactical nasties.
- X
- XThroughout this text, the {\tt typewriter} type style is used to indicate
- Xkeywords and other items that should be passed
- Xdirectly {\em rayshade}. Where appropriate,
- Xitems in an {\em italic\/} style indicate
- Xplaces where you should provide an appropriate number or string.
- X
- XVectors, which consist of three numerical values, are indicated by
- Xan arrow over a name written in italic type style, e.g., \evec{vector}.
- XItems enclosed between {\tt [} and {\tt ]} characters indicate
- Xthat specifying those items is optional.
- XComplex constructions that are
- Xdescribed elsewhere in the text, such as surface or object specification,
- Xare denoted by enclosing descriptive text between
- X{\tt $<$} and {\tt $>$} characters.
- X
- X\section{A Simple Example}
- X
- XBecause \rayshade provides a default camera description, surface properties,
- Xand a default light
- Xsource, it is easy to construct short input files that allow you to
- Xexperiment with objects, textures, and transformations.
- XIf you haven't already run \rayshade on one of the example input files,
- Xyou might want to try producing an image using the following input:
- X
- X\begin{verbatim}
- X sphere 2 0 0 0
- X\end{verbatim}
- X
- XIf you are running \rayshade on a UNIX\footnote{UNIX is a trademark
- Xof AT\&T Bell Laboratories}-like machine, the command:
- X\begin{verbatim}
- X echo "sphere 2 0 0 0" | rayshade > sphere.rle
- X\end{verbatim}
- Xshould produce an image of a sphere.
- END_OF_FILE
- if test 2585 -ne `wc -c <'Doc/Guide/intro.tex'`; then
- echo shar: \"'Doc/Guide/intro.tex'\" unpacked with wrong size!
- fi
- # end of 'Doc/Guide/intro.tex'
- fi
- if test -f 'Examples/planet.map' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Examples/planet.map'\"
- else
- echo shar: Extracting \"'Examples/planet.map'\" \(2551 characters\)
- sed "s/^X//" >'Examples/planet.map' <<'END_OF_FILE'
- X40 128 200
- X40 128 200
- X41 129 201
- X42 130 202
- X43 131 202
- X44 132 203
- X45 133 204
- X46 134 204
- X47 135 205
- X48 136 206
- X48 136 206
- X49 137 207
- X50 138 208
- X51 139 209
- X52 140 209
- X53 141 210
- X54 142 211
- X55 143 211
- X56 144 212
- X57 145 213
- X57 145 213
- X58 146 214
- X59 147 215
- X60 148 216
- X61 149 216
- X62 150 217
- X63 151 218
- X64 152 218
- X65 153 219
- X66 154 220
- X66 154 220
- X67 155 221
- X68 156 222
- X69 157 222
- X70 158 223
- X71 159 224
- X72 160 225
- X73 161 225
- X74 162 226
- X75 163 227
- X75 163 227
- X76 164 228
- X77 165 229
- X78 166 229
- X79 167 230
- X80 168 231
- X81 169 232
- X82 170 232
- X83 171 233
- X84 172 234
- X84 172 234
- X85 173 235
- X86 174 236
- X87 175 236
- X88 176 237
- X89 177 238
- X90 178 238
- X91 179 239
- X92 180 240
- X93 181 241
- X93 181 241
- X94 182 242
- X95 183 243
- X96 184 243
- X97 185 244
- X98 186 245
- X99 187 245
- X100 188 246
- X101 189 247
- X102 190 248
- X102 190 248
- X103 191 249
- X104 192 250
- X105 193 250
- X106 194 251
- X107 195 252
- X108 196 252
- X109 197 253
- X110 198 254
- X111 199 255
- X244 211 1
- X240 211 1
- X237 211 1
- X234 211 1
- X231 211 1
- X228 211 1
- X224 211 1
- X221 211 1
- X218 211 1
- X215 211 1
- X212 211 1
- X209 211 1
- X205 211 1
- X202 211 1
- X199 211 1
- X196 211 1
- X193 211 1
- X190 211 1
- X186 211 1
- X183 211 1
- X180 211 1
- X177 211 1
- X174 211 1
- X171 211 1
- X132 208 1
- X129 206 1
- X125 204 1
- X122 201 1
- X119 199 1
- X115 197 1
- X112 194 1
- X108 192 1
- X105 190 1
- X102 187 1
- X98 185 1
- X95 183 1
- X91 180 1
- X88 178 1
- X84 176 1
- X81 173 1
- X78 171 1
- X74 169 1
- X71 166 1
- X67 164 1
- X64 162 1
- X61 159 1
- X57 157 1
- X54 155 1
- X50 152 1
- X47 150 1
- X44 148 1
- X40 145 1
- X37 143 1
- X33 141 1
- X30 138 1
- X27 136 1
- X23 134 1
- X20 131 1
- X16 129 1
- X13 127 1
- X10 124 1
- X6 122 1
- X3 120 1
- X0 118 1
- X3 116 1
- X6 115 1
- X9 113 1
- X12 112 1
- X15 110 1
- X18 109 1
- X21 107 1
- X25 106 1
- X28 104 1
- X31 103 1
- X34 101 1
- X37 100 1
- X40 98 1
- X43 97 1
- X46 96 1
- X50 94 1
- X53 93 1
- X56 91 1
- X59 90 1
- X62 88 1
- X65 87 1
- X68 85 1
- X71 84 1
- X75 82 1
- X78 81 1
- X81 79 1
- X84 78 1
- X87 77 1
- X90 75 1
- X93 74 1
- X96 72 1
- X100 71 1
- X103 69 1
- X106 68 1
- X109 66 1
- X112 65 1
- X115 63 1
- X118 62 1
- X122 61 1
- X121 61 1
- X120 61 1
- X118 60 1
- X117 60 1
- X115 59 1
- X114 59 1
- X113 59 1
- X111 58 1
- X110 58 1
- X109 58 1
- X111 59 1
- X114 60 1
- X116 62 1
- X119 63 1
- X121 65 1
- X124 66 1
- X126 68 1
- X129 69 1
- X131 71 1
- X134 72 1
- X136 74 1
- X139 75 1
- X141 77 1
- X144 78 1
- X147 80 1
- X149 81 1
- X152 83 1
- X154 84 1
- X157 86 1
- X159 87 1
- X162 89 1
- X164 90 1
- X167 92 1
- X169 93 1
- X172 95 1
- X174 96 1
- X177 98 1
- X180 99 1
- X182 101 1
- X185 102 1
- X187 104 1
- X190 105 1
- X192 107 1
- X195 108 1
- X197 110 1
- X200 111 1
- X202 113 1
- X205 114 1
- X207 116 1
- X210 117 1
- X213 119 2
- X210 120 9
- X208 122 16
- X205 124 23
- X203 126 30
- X200 128 37
- X198 129 44
- X195 131 51
- X193 133 59
- X190 135 66
- X188 137 73
- X186 138 80
- X183 140 87
- X181 142 94
- X178 144 101
- X176 146 109
- X173 148 116
- X254 255 255
- X254 255 254
- X254 255 254
- X254 255 253
- X254 255 253
- X254 255 253
- END_OF_FILE
- if test 2551 -ne `wc -c <'Examples/planet.map'`; then
- echo shar: \"'Examples/planet.map'\" unpacked with wrong size!
- fi
- # end of 'Examples/planet.map'
- fi
- if test -f 'libray/liblight/extended.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libray/liblight/extended.c'\"
- else
- echo shar: Extracting \"'libray/liblight/extended.c'\" \(2819 characters\)
- sed "s/^X//" >'libray/liblight/extended.c' <<'END_OF_FILE'
- X/*
- X * extended.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: extended.c,v 4.0 91/07/17 14:34:03 kolb Exp Locker: kolb $
- X *
- X * $Log: extended.c,v $
- X * Revision 4.0 91/07/17 14:34:03 kolb
- X * Initial version.
- X *
- X */
- X#include "light.h"
- X#include "libcommon/sampling.h"
- X#include "extended.h"
- X
- Xstatic LightMethods *iExtendedMethods = NULL;
- X
- XExtended *
- XExtendedCreate(r, pos)
- XFloat r;
- XVector *pos;
- X{
- X Extended *e;
- X
- X e = (Extended *)share_malloc(sizeof(Extended));
- X e->pos = *pos;
- X e->radius = r;
- X
- X return e;
- X}
- X
- XLightMethods *
- XExtendedMethods()
- X{
- X if (iExtendedMethods == (LightMethods *)NULL) {
- X iExtendedMethods = LightMethodsCreate();
- X iExtendedMethods->intens = ExtendedIntens;
- X iExtendedMethods->dir = ExtendedDirection;
- X }
- X return iExtendedMethods;
- X}
- X
- X/*
- X * Compute intensity ('color') of extended light source 'lp' from 'pos'.
- X */
- Xstatic int
- XExtendedIntens(lp, lcolor, cache, ray, dist, noshadow, color)
- XExtended *lp;
- XColor *lcolor, *color;
- XShadowCache *cache;
- XRay *ray;
- XFloat dist;
- Xint noshadow;
- X{
- X int uSample, vSample, islit;
- X Float jit, vbase, ubase, vpos, upos, lightdist;
- X Color newcol;
- X Ray newray;
- X Vector Uaxis, Vaxis, ldir;
- X
- X if (noshadow) {
- X *color = *lcolor;
- X return TRUE;
- X }
- X
- X newray = *ray;
- X /*
- X * Determinte two orthoganal vectors that lay in the plane
- X * whose normal is defined by the vector from the center
- X * of the light source to the point of intersection and
- X * passes through the center of the light source.
- X */
- X VecSub(lp->pos, ray->pos, &ldir);
- X VecCoordSys(&ldir, &Uaxis, &Vaxis);
- X
- X jit = 2. * lp->radius * Sampling.spacing;
- X
- X /*
- X * Sample a single point, determined by SampleNumber,
- X * on the extended source.
- X */
- X vpos = -lp->radius + (ray->sample % Sampling.sidesamples)*jit;
- X upos = -lp->radius + (ray->sample / Sampling.sidesamples)*jit;
- X vpos += nrand() * jit;
- X upos += nrand() * jit;
- X VecComb(upos, Uaxis, vpos, Vaxis, &newray.dir);
- X VecAdd(ldir, newray.dir, &newray.dir);
- X lightdist = VecNormalize(&newray.dir);
- X
- X return !Shadowed(color, lcolor, cache, &newray,
- X lightdist, noshadow);
- X}
- X
- Xvoid
- XExtendedDirection(lp, pos, dir, dist)
- XExtended *lp;
- XVector *pos, *dir;
- XFloat *dist;
- X{
- X /*
- X * Calculate dir from position to center of
- X * light source.
- X */
- X VecSub(lp->pos, *pos, dir);
- X *dist = VecNormalize(dir);
- X}
- X
- XExtendedMethodRegister(meth)
- XUserMethodType meth;
- X{
- X if (iExtendedMethods)
- X iExtendedMethods->user = meth;
- X}
- END_OF_FILE
- if test 2819 -ne `wc -c <'libray/liblight/extended.c'`; then
- echo shar: \"'libray/liblight/extended.c'\" unpacked with wrong size!
- fi
- # end of 'libray/liblight/extended.c'
- fi
- if test -f 'libray/libobj/hf.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libray/libobj/hf.h'\"
- else
- echo shar: Extracting \"'libray/libobj/hf.h'\" \(2626 characters\)
- sed "s/^X//" >'libray/libobj/hf.h' <<'END_OF_FILE'
- X/*
- X * hf.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: hf.h,v 4.0 91/07/17 14:38:19 kolb Exp Locker: kolb $
- X *
- X * $Log: hf.h,v $
- X * Revision 4.0 91/07/17 14:38:19 kolb
- X * Initial version.
- X *
- X */
- X#ifndef HF_H
- X#define HF_H
- X
- X#define GeomHfCreate(f) GeomCreate((GeomRef)HfCreate(f), HfMethods())
- X
- X/*
- X * Any height values <= Hf_UNSET is not considered to be part of the
- X * height field. Any trianges containing such a vertex will not be
- X * rendered. This allows one to render non-square height fields.
- X */
- X#define HF_UNSET (-1000.)
- X/*
- X * Number of datapoints in a single cell. If you've got loads of memory,
- X * decrease this number. The 'optimal' number is quite system-dependent,
- X * but something around 20 seems to work well. For systems without much
- X * memory, this constant should be greater than or equal to the largest
- X * height field which will be rendered, thus making the algorithm
- X * non-hierarchical.
- X */
- X#define BESTSIZE 16
- X/*
- X * Size of triangle cache.
- X */
- X#define CACHESIZE 6
- X/*
- X * Used to differentiate between the two triangles used to represent a cell:
- X * a------d
- X * |\ |
- X * | \TRI2| TRI2 == c-->d-->a-->c
- X * | \ |
- X * | \ |
- X * | \ |
- X * |TRI1 \| TRI1 == c-->a-->b-->c
- X * b------c
- X */
- X#define TRI1 1
- X#define TRI2 2
- X
- Xtypedef struct hfTri {
- X Vector v1, v2, v3, norm;
- X Float d;
- X char type;
- X struct hfTri *next, *prev;
- X} hfTri;
- X
- Xtypedef struct {
- X int len;
- X hfTri *head, *tail;
- X} TriQueue;
- X
- Xtypedef struct {
- X float **data; /* Altitude points */
- X float minz, maxz;
- X int size, *lsize; /* # of points/side */
- X int BestSize; /* "best" division size */
- X float iBestSize; /* inverse of above (for faster computation) */
- X int levels; /* log base BestSize of size */
- X float ***boundsmax; /* high data values at various resolutions. */
- X float ***boundsmin;
- X float *spacing;
- X hfTri hittri, **q; /* hit triangle and triangle cache */
- X int qtail, qsize; /* end and length of cache */
- X Float boundbox[2][3]; /* bounding box of Hf */
- X} Hf;
- X
- Xextern Hf *HfCreate();
- Xextern int HfIntersect(), HfEnter(), HfNormal();
- Xextern void HfBounds(), HfUV(), HfStats();
- Xextern char *HfName();
- Xextern Methods *HfMethods();
- X
- X#endif /* HF_H */
- END_OF_FILE
- if test 2626 -ne `wc -c <'libray/libobj/hf.h'`; then
- echo shar: \"'libray/libobj/hf.h'\" unpacked with wrong size!
- fi
- # end of 'libray/libobj/hf.h'
- fi
- if test -f 'libray/libobj/list.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libray/libobj/list.c'\"
- else
- echo shar: Extracting \"'libray/libobj/list.c'\" \(3113 characters\)
- sed "s/^X//" >'libray/libobj/list.c' <<'END_OF_FILE'
- X/*
- X * list.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: list.c,v 4.0 91/07/17 14:38:42 kolb Exp Locker: kolb $
- X *
- X * $Log: list.c,v $
- X * Revision 4.0 91/07/17 14:38:42 kolb
- X * Initial version.
- X *
- X */
- X#include "geom.h"
- X#include "list.h"
- X
- Xstatic Methods *iListMethods = NULL;
- Xstatic char listName[] = "list";
- X
- XList *
- XListCreate()
- X{
- X return (List *)share_calloc(1, sizeof(List));
- X}
- X
- Xchar *
- XListName()
- X{
- X return listName;
- X}
- X
- X/*
- X * Take a list whose DATA field points to a linked list of objects and
- X * turn it into a List.
- X */
- Xint
- XListConvert(list, objlist)
- XList *list;
- XGeom *objlist;
- X{
- X int num;
- X
- X /*
- X * Find the unbounded objects on the list as well as the
- X * bounding box of the list.
- X */
- X list->list = objlist;
- X for (num = 0; objlist; objlist = objlist->next)
- X num += objlist->prims;
- X return num;
- X}
- X
- X/*
- X * Intersect ray & list of objects.
- X */
- Xint
- XListIntersect(list, ray, hitlist, mindist, maxdist)
- XList *list;
- XRay *ray;
- XHitList *hitlist;
- XFloat mindist, *maxdist;
- X{
- X Geom *objlist;
- X Vector vtmp;
- X Float s;
- X int hit;
- X
- X hit = FALSE;
- X /*
- X * Intersect with unbounded objects.
- X */
- X for (objlist = list->unbounded; objlist ; objlist = objlist->next) {
- X if (intersect(objlist, ray, hitlist, mindist, maxdist))
- X hit = TRUE;
- X }
- X
- X /*
- X * Check for intersection with bounding box.
- X */
- X s = *maxdist; /* So maxdist won't be reset. */
- X VecAddScaled(ray->pos, mindist, ray->dir, &vtmp);
- X if (OutOfBounds(&vtmp, list->bounds) &&
- X !BoundsIntersect(ray, list->bounds, mindist, &s))
- X /*
- X * Ray never hit list.
- X */
- X return hit;
- X /*
- X * Else the ray enters list-space before it hits an
- X * unbounded object. Intersect with objects on list.
- X */
- X for (objlist = list->list; objlist ; objlist = objlist->next) {
- X if (intersect(objlist, ray, hitlist, mindist, maxdist))
- X hit = TRUE;
- X }
- X
- X return hit;
- X}
- X
- XMethods *
- XListMethods()
- X{
- X if (iListMethods == (Methods *)NULL) {
- X iListMethods = MethodsCreate();
- X iListMethods->methods = ListMethods;
- X iListMethods->create = (GeomCreateFunc *)ListCreate;
- X iListMethods->name = ListName;
- X iListMethods->intersect = ListIntersect;
- X iListMethods->bounds = ListBounds;
- X iListMethods->convert = ListConvert;
- X iListMethods->checkbounds = FALSE;
- X iListMethods->closed = TRUE;
- X }
- X return iListMethods;
- X}
- X
- Xvoid
- XListBounds(list, bounds)
- XList *list;
- XFloat bounds[2][3];
- X{
- X Geom *obj, *next;
- X
- X BoundsInit(list->bounds);
- X /*
- X * For each object on the list,
- X * compute its bounds...
- X */
- X list->unbounded = GeomComputeAggregateBounds(&list->list,
- X list->unbounded, list->bounds);
- X BoundsCopy(list->bounds, bounds);
- X}
- X
- Xvoid
- XListMethodRegister(meth)
- XUserMethodType meth;
- X{
- X if (iListMethods)
- X iListMethods->user = meth;
- X}
- END_OF_FILE
- if test 3113 -ne `wc -c <'libray/libobj/list.c'`; then
- echo shar: \"'libray/libobj/list.c'\" unpacked with wrong size!
- fi
- # end of 'libray/libobj/list.c'
- fi
- if test -f 'libray/libobj/plane.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libray/libobj/plane.c'\"
- else
- echo shar: Extracting \"'libray/libobj/plane.c'\" \(2991 characters\)
- sed "s/^X//" >'libray/libobj/plane.c' <<'END_OF_FILE'
- X/*
- X * plane.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: plane.c,v 4.0 91/07/17 14:38:51 kolb Exp Locker: kolb $
- X *
- X * $Log: plane.c,v $
- X * Revision 4.0 91/07/17 14:38:51 kolb
- X * Initial version.
- X *
- X */
- X#include "geom.h"
- X#include "plane.h"
- X
- Xstatic Methods *iPlaneMethods = NULL;
- Xstatic char planeName[] = "plane";
- X
- Xunsigned long PlaneTests, PlaneHits;
- X
- X/*
- X * create plane primitive
- X */
- XPlane *
- XPlaneCreate(pos, norm)
- XVector *pos, *norm;
- X{
- X Plane *plane;
- X Vector tmpnrm;
- X
- X tmpnrm = *norm;
- X if (VecNormalize(&tmpnrm) == 0.) {
- X RLerror(RL_WARN, "Degenerate plane normal.\n");
- X return (Plane *)NULL;
- X }
- X plane = (Plane *)share_malloc(sizeof(Plane));
- X plane->norm = tmpnrm;
- X plane->pos = *pos;
- X plane->d = dotp(&plane->norm, pos);
- X
- X return plane;
- X}
- X
- XMethods *
- XPlaneMethods()
- X{
- X if (iPlaneMethods == (Methods *)NULL) {
- X iPlaneMethods = MethodsCreate();
- X iPlaneMethods->name = PlaneName;
- X iPlaneMethods->create = (GeomCreateFunc *)PlaneCreate;
- X iPlaneMethods->methods = PlaneMethods;
- X iPlaneMethods->intersect = PlaneIntersect;
- X iPlaneMethods->normal = PlaneNormal;
- X iPlaneMethods->uv = PlaneUV;
- X iPlaneMethods->bounds = PlaneBounds;
- X iPlaneMethods->stats = PlaneStats;
- X iPlaneMethods->checkbounds = FALSE;
- X iPlaneMethods->closed = FALSE;
- X }
- X return iPlaneMethods;
- X}
- X
- Xint
- XPlaneIntersect(plane, ray, mindist, maxdist)
- XPlane *plane;
- XRay *ray;
- XFloat mindist, *maxdist;
- X{
- X Float d;
- X
- X PlaneTests++;
- X
- X d = dotp(&plane->norm, &ray->dir);
- X if (fabs(d) < EPSILON)
- X return FALSE;
- X d = (plane->d - dotp(&plane->norm, &ray->pos)) / d;
- X
- X if (d > mindist && d < *maxdist) {
- X *maxdist = d;
- X PlaneHits++;
- X return TRUE;
- X }
- X return FALSE;
- X}
- X
- X/*ARGSUSED*/
- Xint
- XPlaneNormal(plane, pos, nrm, gnrm)
- XPlane *plane;
- XVector *pos, *nrm, *gnrm;
- X{
- X *gnrm = *nrm = plane->norm;
- X return FALSE;
- X}
- X
- Xvoid
- XPlaneUV(plane, pos, norm, uv, dpdu, dpdv)
- XPlane *plane;
- XVector *pos, *norm, *dpdu, *dpdv;
- XVec2d *uv;
- X{
- X Vector vec, du, dv;
- X
- X VecCoordSys(norm, &du, &dv);
- X VecSub(*pos, plane->pos, &vec);
- X
- X uv->u = dotp(&vec, &du);
- X uv->v = dotp(&vec, &dv);
- X
- X if (dpdu)
- X *dpdu = du;
- X if (dpdv)
- X *dpdv = dv;
- X}
- X
- X/*ARGSUSED*/
- Xvoid
- XPlaneBounds(plane, bounds)
- XPlane *plane;
- XFloat bounds[2][3];
- X{
- X /*
- X * Planes are unbounded by nature. minx > maxx signifies
- X * this.
- X */
- X bounds[LOW][X] = 1.0;
- X bounds[HIGH][X] = -1.0;
- X}
- X
- Xchar *
- XPlaneName()
- X{
- X return planeName;
- X}
- X
- Xvoid
- XPlaneStats(tests, hits)
- Xunsigned long *tests, *hits;
- X{
- X *tests = PlaneTests;
- X *hits = PlaneHits;
- X}
- X
- Xvoid
- XPlaneMethodRegister(meth)
- XUserMethodType meth;
- X{
- X if (iPlaneMethods)
- X iPlaneMethods->user = meth;
- X}
- END_OF_FILE
- if test 2991 -ne `wc -c <'libray/libobj/plane.c'`; then
- echo shar: \"'libray/libobj/plane.c'\" unpacked with wrong size!
- fi
- # end of 'libray/libobj/plane.c'
- fi
- if test -f 'libray/libsurf/fogdeck.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libray/libsurf/fogdeck.c'\"
- else
- echo shar: Extracting \"'libray/libsurf/fogdeck.c'\" \(2785 characters\)
- sed "s/^X//" >'libray/libsurf/fogdeck.c' <<'END_OF_FILE'
- X/*
- X * fogdeck.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: fogdeck.c,v 4.0 91/07/17 14:40:28 kolb Exp Locker: kolb $
- X *
- X * $Log: fogdeck.c,v $
- X * Revision 4.0 91/07/17 14:40:28 kolb
- X * Initial version.
- X *
- X */
- X#include "atmosphere.h"
- X#include "fogdeck.h"
- X
- XFogdeck *
- XFogdeckCreate(alt, offset, scale, chaoscale, octaves, color, trans)
- XFloat alt, offset, chaoscale;
- XVector *scale;
- Xint octaves;
- XColor *color, *trans;
- X{
- X Fogdeck *fogdeck;
- X static void ComputeFogdeck();
- X
- X fogdeck = (Fogdeck *)Malloc(sizeof(Fogdeck));
- X
- X fogdeck->alt = alt;
- X fogdeck->octaves = octaves;
- X fogdeck->scale = *scale;
- X fogdeck->chaoscale = chaoscale;
- X fogdeck->offset = offset;
- X
- X if (color == (Color *)NULL)
- X fogdeck->color.r = fogdeck->color.g = fogdeck->color.b = 0.;
- X else
- X fogdeck->color = *color;
- X if (trans == (Color *)NULL)
- X fogdeck->trans.r = fogdeck->trans.g = fogdeck->trans.b =
- X FAR_AWAY;
- X else {
- X fogdeck->trans = *trans;
- X }
- X return fogdeck;
- X}
- X
- X/*
- X * Add fogdeck to the given color.
- X */
- Xvoid
- XFogdeckApply(fogdeck, ray, pos, dist, color)
- XFogdeck *fogdeck;
- XRay *ray;
- XVector *pos;
- XFloat dist;
- XColor *color;
- X{
- X Float atten, hitdist, density;
- X Color trans;
- X Vector endp;
- X extern Float ExpAtten(), PAChaos();
- X
- X /*
- X * Find distance from origin at which ray strikes
- X * z = fogdeck->alt plane
- X */
- X if (abs(ray->dir.z) < EPSILON)
- X return;
- X hitdist = (fogdeck->alt - ray->pos.z) / ray->dir.z;
- X if (hitdist < EPSILON || hitdist > dist)
- X return;
- X /*
- X * Compute ray endpoint
- X */
- X VecAddScaled(ray->pos, hitdist, ray->dir, &endp);
- X
- X /*
- X * Modify transmissivity based on point of
- X * intersection.
- X */
- X endp.x *= fogdeck->scale.x;
- X endp.y *= fogdeck->scale.y;
- X endp.z *= fogdeck->scale.z;
- X
- X density = fogdeck->offset +
- X fogdeck->chaoscale * PAChaos(&endp, fogdeck->octaves);
- X if (density < EPSILON)
- X density = HUGE;
- X else
- X density = 1. / density;
- X
- X trans = fogdeck->trans;
- X ColorScale(density, trans, &trans);
- X
- X dist -= hitdist;
- X
- X atten = ExpAtten(dist, trans.r);
- X
- X if (trans.r == trans.g &&
- X trans.r == trans.b) {
- X ColorBlend(color, &fogdeck->color, atten, 1. - atten);
- X return;
- X }
- X color->r = atten*color->r + (1. - atten) * fogdeck->color.r;
- X
- X atten = ExpAtten(dist, trans.g);
- X color->g = atten*color->g + (1. - atten) * fogdeck->color.g;
- X atten = ExpAtten(dist, trans.b);
- X color->b = atten*color->b + (1. - atten) * fogdeck->color.b;
- X}
- END_OF_FILE
- if test 2785 -ne `wc -c <'libray/libsurf/fogdeck.c'`; then
- echo shar: \"'libray/libsurf/fogdeck.c'\" unpacked with wrong size!
- fi
- # end of 'libray/libsurf/fogdeck.c'
- fi
- if test -f 'libray/libtext/cloud.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libray/libtext/cloud.c'\"
- else
- echo shar: Extracting \"'libray/libtext/cloud.c'\" \(2607 characters\)
- sed "s/^X//" >'libray/libtext/cloud.c' <<'END_OF_FILE'
- X/*
- X * cloud.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: cloud.c,v 4.0 91/07/17 14:41:57 kolb Exp Locker: kolb $
- X *
- X * $Log: cloud.c,v $
- X * Revision 4.0 91/07/17 14:41:57 kolb
- X * Initial version.
- X *
- X */
- X#include "texture.h"
- X#include "cloud.h"
- X
- X/*
- X * Gardner-style textured ellipsoid. Designed to be used on unit spheres
- X * centered at the origin. (Of course, the spheres may be transformed
- X * into ellipsoids, translated, etc.)
- X */
- XCloudText *
- XCloudTextCreate(scale, h, lambda, octaves, cthresh, lthresh, transcale)
- XFloat scale, h, lambda, cthresh, lthresh, transcale;
- Xint octaves;
- X{
- X CloudText *cloud;
- X
- X cloud = (CloudText *)Malloc(sizeof(CloudText));
- X cloud->beta = 1. + 2 * h;
- X cloud->omega = pow(lambda, -0.5 * cloud->beta);
- X cloud->lambda = lambda;
- X cloud->scale = scale;
- X cloud->cthresh = cthresh;
- X cloud->range = lthresh - cthresh;
- X cloud->transcale = transcale;
- X cloud->maxval = 1. / (1. - cloud->beta);
- X cloud->octaves = octaves;
- X return cloud;
- X}
- X
- Xvoid
- XCloudTextApply(cloud, prim, ray, pos, norm, gnorm, surf)
- XCloudText *cloud;
- XGeom *prim;
- XRay *ray;
- XVector *pos, *norm, *gnorm;
- XSurface *surf;
- X{
- X Ray pray;
- X Float alpha, beta, It, dsquared, d, limb;
- X
- X /*
- X * Transform ray to prim. space.
- X */
- X pray = *ray;
- X (void)TextRayToPrim(&pray);
- X dsquared = dotp(&pray.pos, &pray.pos);
- X if (fabs(dsquared) < 1. + EPSILON) {
- X surf->transp = 1.;
- X surf->amb.r = surf->amb.g = surf->amb.b = 0.;
- X surf->diff.r = surf->diff.g = surf->diff.b = 0.;
- X return;
- X }
- X It = fBm(pos,cloud->omega,cloud->lambda,cloud->octaves);
- X It = (cloud->maxval + It) * 0.5/cloud->maxval;
- X if (It < 0.)
- X It = 0;
- X else if (It > 1.)
- X It = 1;
- X d = sqrt(dsquared);
- X beta = sqrt(dsquared - 1) / d;
- X alpha = -dotp(&pray.pos, &pray.dir) / d;
- X limb = (alpha - beta) / (1 - beta);
- X /*
- X * limb is 0 on the limb, 1 at the center, < 1 outside.
- X */
- X surf->transp = 1. - (It-cloud->cthresh-cloud->range*(1.-limb))/
- X cloud->transcale;
- X
- X if (surf->transp > 1)
- X surf->transp = 1.;
- X if (surf->transp < 0)
- X surf->transp = 0.;
- X
- X ColorScale((1. - surf->transp) *
- X (1. - cloud->scale + cloud->scale*It),
- X surf->diff, &surf->diff);
- X ColorScale(1. - surf->transp, surf->amb, &surf->amb);
- X}
- END_OF_FILE
- if test 2607 -ne `wc -c <'libray/libtext/cloud.c'`; then
- echo shar: \"'libray/libtext/cloud.c'\" unpacked with wrong size!
- fi
- # end of 'libray/libtext/cloud.c'
- fi
- if test -f 'libray/libtext/stripe.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libray/libtext/stripe.c'\"
- else
- echo shar: Extracting \"'libray/libtext/stripe.c'\" \(2911 characters\)
- sed "s/^X//" >'libray/libtext/stripe.c' <<'END_OF_FILE'
- X/*
- X * stripe.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: stripe.c,v 4.0 91/07/17 14:43:52 kolb Exp Locker: kolb $
- X *
- X * $Log: stripe.c,v $
- X * Revision 4.0 91/07/17 14:43:52 kolb
- X * Initial version.
- X *
- X */
- X#include "texture.h"
- X#include "stripe.h"
- X
- XStripe *
- XStripeCreate(surf, width, bump, mapping)
- XSurface *surf;
- XFloat width, bump;
- XMapping *mapping;
- X{
- X Stripe *stripe;
- X
- X stripe = (Stripe *)Malloc(sizeof(Stripe));
- X stripe->surf = surf;
- X stripe->mapping = mapping;
- X stripe->width = width;
- X stripe->bump = bump;
- X return stripe;
- X}
- X
- Xvoid
- XStripeApply(stripe, prim, ray, pos, norm, gnorm, surf)
- XStripe *stripe;
- XGeom *prim;
- XVector *ray, *pos, *norm, *gnorm;
- XSurface *surf;
- X{
- X Vector dpdu, dpdv;
- X Float fu, fv, u, v;
- X
- X TextToUV(stripe->mapping, prim, pos, gnorm, &u, &v, &dpdu, &dpdv);
- X
- X u -= floor(u);
- X v -= floor(v);
- X
- X /*
- X * s s s
- X * | | | | |
- X * 1 +-+------------+
- X * |X|\^^^^^^^^^^/| } s
- X * |X|<+--------+>|
- X * |X|<| |>|
- X * |X|<| |>|
- X * |X|<| |>|
- X * v |X|<| |>|
- X * |X|<| |>|
- X * |X|<| |>|
- X * |X|<+--------+>|
- X * |X|/vvvvvvvvvv\| } s
- X * |X+------------+
- X * |XXXXXXXXXXXXXX| } s
- X * 0 +--------------+
- X * 0 1
- X * u
- X *
- X * where ^ == positive fv, 0 fu, original surf.
- X * v == negative fv, 0 fu, original surf.
- X * > == positive fu, 0 fv, original surf.
- X * < == negative fu, 0 fv, original surf.
- X * blank == 0 fu, 0 fv, original surf.
- X * X == 0 fu, 0 fv, alternate surf.
- X * for stripe->bump > 0. For stripe->bump < 0., change signs.
- X */
- X
- X if (u > 2*stripe->width && v > 2*stripe->width &&
- X u <= 1. - stripe->width && v <= 1. - stripe->width)
- X /* flat surface */
- X return;
- X else if (u < stripe->width || v < stripe->width) {
- X /* on the bottom of the bump. */
- X *surf = *stripe->surf;
- X return;
- X }
- X
- X /*
- X * Lower u & v edges are the 'flat' part of the bump --
- X * make our lives simpler below by 'removing' this area
- X * from u & v.
- X */
- X u = (u - stripe->width) / (1. - stripe->width);
- X v = (v - stripe->width) / (1. - stripe->width);
- X /*
- X * Now the hard part -- where's the bump?
- X */
- X if (v < u) {
- X if (v < 1. - u) {
- X /* bottom */
- X fu = 0.;
- X fv = -stripe->bump;
- X } else {
- X /* right */
- X fu = stripe->bump;
- X fv = 0.;
- X }
- X } else {
- X if (v < 1. - u) {
- X /* left */
- X fu = -stripe->bump;
- X fv = 0.;
- X } else {
- X /* top */
- X fu = 0.;
- X fv = stripe->bump;
- X }
- X }
- X
- X MakeBump(norm, &dpdu, &dpdv, fu, fv);
- X}
- END_OF_FILE
- if test 2911 -ne `wc -c <'libray/libtext/stripe.c'`; then
- echo shar: \"'libray/libtext/stripe.c'\" unpacked with wrong size!
- fi
- # end of 'libray/libtext/stripe.c'
- fi
- if test -f 'libshade/Makefile.SH' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libshade/Makefile.SH'\"
- else
- echo shar: Extracting \"'libshade/Makefile.SH'\" \(2825 characters\)
- sed "s/^X//" >'libshade/Makefile.SH' <<'END_OF_FILE'
- Xcase $CONFIG in
- X'')
- X if test ! -f config.sh; then
- X ln ../config.sh . || \
- X ln ../../config.sh . || \
- X ln ../../../config.sh . || \
- X (echo "Can't find config.sh."; exit 1)
- X fi
- X . config.sh
- X ;;
- Xesac
- X: This forces SH files to create target in same directory as SH file.
- X: This is so that make depend always knows where to find SH derivatives.
- Xcase "$0" in
- X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
- Xesac
- Xecho "Extracting Makefile (with variable substitutions)"
- X: This section of the file will have variable substitutions done on it.
- X: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
- X: Protect any dollar signs and backticks that you do not want interpreted
- X: by putting a backslash in front. You may delete these comments.
- X$spitshell >Makefile <<!GROK!THIS!
- X#
- X# Makefile for rayshade.
- X#
- X# Craig Kolb
- X#
- X# \$Id: Makefile.SH,v 4.0 91/07/17 14:44:47 kolb Exp Locker: kolb $
- X#
- X# Bin directory
- X#
- XBINDIR = $bin
- X#
- X# If you are using LINDA, add -DLINDA
- X# If you are running on a Multimax, add -DMULTIMAX -DSHAREDMEM
- X# Be sure to add any necessary floating point hardware switches.
- X#
- XOPTIMIZE = $optimize
- XURTINC = $urtinc
- XCCFLAGS = $ccflags $large
- XCC = $cc
- XMKDEP = $mkdep
- XYACC = $yacc
- XRANLIB = $ranlib
- X
- X!GROK!THIS!
- X
- X: In the following dollars and backticks do not need the extra backslash.
- X$spitshell >>Makefile <<'!NO!SUBS!'
- XLIBRAYDIR = ../libray
- XINCLUDE = -I.. -I$(LIBRAYDIR)
- XYFLAGS = -d
- X
- XCFLAGS = $(CCFLAGS) $(URTINC) $(INCLUDE) $(OPTIMIZE)
- XSHELL = /bin/sh
- X
- XLIB = libshade.a
- X
- XSUPPORT_C = builtin.c symtab.c misc.c lightdef.c objdef.c options.c \
- X stats.c surfdef.c
- X
- XSUPPORT_H = ../config.h datatypes.h funcdefs.h \
- X ../patchlevel.h rayshade.h
- X
- XPARSE_C = yacc.c lex.c
- X
- XDRIVE_C = setup.c viewing.c shade.c picture.c
- X
- XDRIVE_H = y.tab.h defaults.h viewing.h raytrace.h picture.h
- X
- XSUPPORT_O = $(SUPPORT_C:.c=.o)
- X
- XPARSE_O = $(PARSE_C:.c=.o)
- X
- XDRIVE_O = $(DRIVE_C:.c=.o)
- X
- XHFILES = $(DRIVE_H) $(SUPPORT_H)
- X
- XCFILES = $(DRIVE_C) $(PARSE_C) $(SUPPORT_C)
- X
- XSHFILES = Makefile.SH
- X
- XOFILES = $(DRIVE_O) $(PARSE_O) $(SUPPORT_O)
- X
- XDEPENDSRC = $(DRIVE_C) lex.l yacc.y $(SUPPORT_C)
- X
- X$(LIB): $(OFILES)
- X ar cur $(LIB) $(OFILES)
- X $(RANLIB) $(LIB)
- X
- X#
- X# Uncomment the following rule if using Linda.
- X#
- X#raytrace.lo: raytrace.cl
- X# $(LCC) $(CFLAGS) -c raytrace.cl
- X
- X#
- X# End of configuration section
- X#
- Xinstall: rayshade
- X mv rayshade $(BINDIR)/rayshade
- X
- Xclean:
- X rm -f $(OFILES) core libshade.a
- X
- Xrealclean:
- X rm -f $(OFILES) core libshade.a y.tab.h
- X rm -f *.orig Makefile
- X
- Xlint:
- X lint $(CFLAGS) -x $(CFILES) -lm
- X
- Xtags:
- X ctags -t $(CFILES)
- X
- Xdepend:
- X (sed '/^# DO NOT DELETE THIS LINE/q' Makefile && \
- X $(MKDEP) $(DEPENDSRC) | sed 's/: \.\//: /; /\/usr\/include/d' \
- X ) >Makefile.new
- X cp Makefile Makefile.bak
- X cp Makefile.new Makefile
- X rm -f Makefile.new
- X
- X
- X# DO NOT DELETE THIS LINE
- X!NO!SUBS!
- Xchmod 755 Makefile
- X$eunicefix Makefile
- END_OF_FILE
- if test 2825 -ne `wc -c <'libshade/Makefile.SH'`; then
- echo shar: \"'libshade/Makefile.SH'\" unpacked with wrong size!
- fi
- chmod +x 'libshade/Makefile.SH'
- # end of 'libshade/Makefile.SH'
- fi
- if test -f 'libshade/surfdef.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libshade/surfdef.c'\"
- else
- echo shar: Extracting \"'libshade/surfdef.c'\" \(2988 characters\)
- sed "s/^X//" >'libshade/surfdef.c' <<'END_OF_FILE'
- X/*
- X * surfdef.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: surfdef.c,v 4.0 91/07/17 14:47:53 kolb Exp Locker: kolb $
- X *
- X * $Log: surfdef.c,v $
- X * Revision 4.0 91/07/17 14:47:53 kolb
- X * Initial version.
- X *
- X */
- X#include "rayshade.h"
- X#include "libsurf/surface.h"
- X
- Xstatic Surface *Surfaces; /* Named surfaces */
- X
- XSurface DefaultSurface = {
- X "DeFault", /* name */
- X {0.1, 0.1, 0.1}, /* ambient */
- X {0.6, 0.6, 0.6}, /* diffuse */
- X {0.5, 0.5, 0.5}, /* specular */
- X {0.0, 0.0, 0.0}, /* Diffuse transmission 'curve' */
- X {1.0, 1.0, 1.0}, /* Specular transmission 'curve' */
- X 12., /* reflected Phong coef */
- X 12., /* transmitted Phong coef */
- X 1., /* spec. transmitted attenuation */
- X DEFAULT_INDEX, /* index of refr */
- X 0., /* reflectivity */
- X 0., /* transparency */
- X 0., /* translucency */
- X FALSE, /* noshadow */
- X NULL, /* next */
- X};
- X
- XSurface *SurfaceGetNamed(), *SurfaceFetchNamed();
- X
- X/*
- X * Add surf to the list of defined surfaces.
- X */
- Xvoid
- XSurfaceAddToDefined(surf)
- XSurface *surf;
- X{
- X /*
- X * Make sure index of refraction isn't bogus.
- X */
- X if (surf->transp > EPSILON && surf->index <= 0.)
- X RLerror(RL_PANIC,
- X "Index of refraction must be positive.\n");
- X
- X if (surf->name == (char *)NULL || *surf->name == (char)NULL)
- X RLerror(RL_PANIC, "Surface with NULL name defined.\n");
- X
- X if (SurfaceFetchNamed(surf->name) != (Surface *)NULL)
- X RLerror(RL_WARN,
- X "Redefinition of \"%s\" surface.", surf->name);
- X
- X surf->next = Surfaces;
- X Surfaces = surf;
- X}
- X
- X/*
- X * Search for surface with given name. If not found, complain and exit.
- X */
- XSurface *
- XSurfaceGetNamed(name)
- Xchar *name;
- X{
- X Surface *stmp;
- X
- X stmp = SurfaceFetchNamed(name);
- X if (stmp == (Surface *)NULL)
- X RLerror(RL_PANIC, "Undefined surface \"%s\".", name);
- X
- X return stmp;
- X}
- X
- X/*
- X * Return pointer to surface with given name, NULL if no such surface.
- X */
- XSurface *
- XSurfaceFetchNamed(name)
- Xchar *name;
- X{
- X Surface *stmp;
- X
- X for (stmp = Surfaces; stmp ; stmp = stmp->next)
- X if(strcmp(name, stmp->name) == 0)
- X return stmp;
- X /*
- X * No surface named "name".
- X */
- X return (Surface *)NULL;
- X}
- X
- X/*
- X * Traverse the given hitlist to find the "bottom-most" surface.
- X * If no surface is found, use the default.
- X */
- XSurface *
- XGetShadingSurf(hitlist)
- XHitList *hitlist;
- X{
- X int i;
- X
- X /*
- X * -1 here because the World always has a NULL surface
- X * (DefaultSurf is used instead)
- X */
- X for (i = 0; i < hitlist->nodes -1; i++) {
- X if (hitlist->data[i].obj->surf)
- X return hitlist->data[i].obj->surf;
- X }
- X /*
- X * No suface found -- use the default.
- X */
- X return &DefaultSurface;
- X}
- END_OF_FILE
- if test 2988 -ne `wc -c <'libshade/surfdef.c'`; then
- echo shar: \"'libshade/surfdef.c'\" unpacked with wrong size!
- fi
- # end of 'libshade/surfdef.c'
- fi
- if test -f 'raypaint/Makefile.SH' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'raypaint/Makefile.SH'\"
- else
- echo shar: Extracting \"'raypaint/Makefile.SH'\" \(2800 characters\)
- sed "s/^X//" >'raypaint/Makefile.SH' <<'END_OF_FILE'
- Xcase $CONFIG in
- X'')
- X if test ! -f config.sh; then
- X ln ../config.sh . || \
- X ln ../../config.sh . || \
- X ln ../../../config.sh . || \
- X (echo "Can't find config.sh."; exit 1)
- X fi
- X . config.sh
- X ;;
- Xesac
- X: This forces SH files to create target in same directory as SH file.
- X: This is so that make depend always knows where to find SH derivatives.
- Xcase "$0" in
- X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
- Xesac
- Xecho "Extracting Makefile (with variable substitutions)"
- X: This section of the file will have variable substitutions done on it.
- X: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
- X: Protect any dollar signs and backticks that you do not want interpreted
- X: by putting a backslash in front. You may delete these comments.
- X$spitshell >Makefile <<!GROK!THIS!
- X#
- X# Makefile for raypaint
- X#
- X# Craig Kolb
- X#
- X# \$Id: Makefile.SH,v 4.0 91/07/17 14:48:38 kolb Exp Locker: kolb $
- X#
- X# Bin directory
- X#
- XBINDIR = $bin
- X#
- X# If you are using LINDA, add -DLINDA
- X# If you are running on a Multimax, add -DMULTIMAX -DSHAREDMEM
- X# Be sure to add any necessary floating point hardware switches.
- X#
- XOPTIMIZE = $optimize
- XURTINC = $urtinc
- XCCFLAGS = $ccflags $large
- XURTLIB = $urtlib
- XLDFLAGS = $libs $ldflags
- XCC = $cc
- XMKDEP = $mkdep
- XYACC = $yacc
- X
- X!GROK!THIS!
- X
- X: In the following dollars and backticks do not need the extra backslash.
- X$spitshell >>Makefile <<'!NO!SUBS!'
- XLIBRAYDIR = ../libray
- XLIBSHADEDIR = ../libshade
- XINCLUDE = -I$(LIBRAYDIR) -I$(LIBSHADEDIR) -I..
- XYFLAGS = -d
- X
- X#
- X# If using X11, use:
- X#GRAPHICSLIB = -lX11
- X
- X#
- X# If you are using GL, use:
- XGRAPHICSLIB = -lgl_s
- X
- XLIBRAY = $(LIBRAYDIR)/libray.a
- XLIBSHADE = $(LIBSHADEDIR)/libshade.a
- X
- XCFLAGS = $(CCFLAGS) $(URTINC) $(INCLUDE) $(OPTIMIZE) -DSHARED_EDGES
- XSHELL = /bin/sh
- X
- X#
- X# If you are using a Multimax, add -lpp
- X# If you have a fast malloc library, use it (e.g., -lmalloc on MIPS machines)
- X#
- XLIBS = $(LIBSHADE) $(LIBRAY) $(URTLIB)
- X
- XDRIVE_C = main.c graphics.c render.c version.c
- X
- XDRIVE_O = $(DRIVE_C:.c=.o)
- X
- XCFILES = $(DRIVE_C)
- X
- XSHFILES = Makefile.SH
- X
- XOBJ = $(DRIVE_O)
- X
- XDEPENDSRC = $(DRIVE_C)
- X
- Xraypaint: $(OBJ) $(LIBS)
- X $(CC) $(OPTIMIZE) -o raypaint $(OBJ) $(LIBS) $(LDFLAGS) $(GRAPHICSLIB)
- X
- X#
- X# Uncomment the following rule if using Linda.
- X#
- X#raytrace.lo: raytrace.cl
- X# $(LCC) $(CFLAGS) -c raytrace.cl
- X
- X#
- X# End of configuration section
- X#
- Xinstall: raypaint
- X mv raypaint $(BINDIR)/raypaint
- X
- Xclean:
- X rm -f $(OBJ) core
- X
- Xrealclean:
- X rm -f $(OBJ) core y.tab.h
- X rm -f *.orig Makefile
- X
- Xlint:
- X lint $(CFLAGS) -x $(CFILES) -lm
- X
- Xtags:
- X ctags -t $(CFILES)
- X
- Xdepend:
- X (sed '/^# DO NOT DELETE THIS LINE/q' Makefile && \
- X $(MKDEP) $(DEPENDSRC) | sed 's/: \.\//: /; /\/usr\/include/d' \
- X ) >Makefile.new
- X cp Makefile Makefile.bak
- X cp Makefile.new Makefile
- X rm -f Makefile.new
- X
- X
- X# DO NOT DELETE THIS LINE
- X!NO!SUBS!
- Xchmod 755 Makefile
- X$eunicefix Makefile
- END_OF_FILE
- if test 2800 -ne `wc -c <'raypaint/Makefile.SH'`; then
- echo shar: \"'raypaint/Makefile.SH'\" unpacked with wrong size!
- fi
- chmod +x 'raypaint/Makefile.SH'
- # end of 'raypaint/Makefile.SH'
- fi
- if test -f 'raypaint/glgraphics.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'raypaint/glgraphics.c'\"
- else
- echo shar: Extracting \"'raypaint/glgraphics.c'\" \(2838 characters\)
- sed "s/^X//" >'raypaint/glgraphics.c' <<'END_OF_FILE'
- X/*
- X * glgraphics.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: glgraphics.c,v 4.0 91/07/17 17:36:39 kolb Exp Locker: kolb $
- X *
- X * $Log: glgraphics.c,v $
- X * Revision 4.0 91/07/17 17:36:39 kolb
- X * Initial version.
- X *
- X *
- X */
- X
- X#include <gl.h>
- X#include <device.h>
- X
- X#define CPACK(x) cpack(((((x)[2] << 8) | (x)[1]) << 8) | x[0])
- X
- XGraphicsInit(xsize, ysize, name)
- Xint xsize, ysize;
- Xchar *name;
- X{
- X#ifndef _IBMR2
- X foreground();
- X#endif
- X prefsize(xsize, ysize);
- X winopen(name);
- X ortho2(-0.5, (float)xsize -0.5, -0.5, (float)ysize - 0.5);
- X viewport(0, xsize -1, 0, ysize -1);
- X color(BLACK);
- X clear();
- X RGBmode();
- X gconfig();
- X unqdevice(INPUTCHANGE);
- X qdevice(LEFTMOUSE); /* Pop a square on request */
- X qdevice(MIDDLEMOUSE);
- X qdevice(RIGHTMOUSE);
- X qdevice(REDRAW);
- X}
- X
- X/*
- X * Draw the pixel at (xp, yp) in the color given by the rgb-triple,
- X * 0 indicating 0 intensity, 255 max intensity.
- X */
- XGraphicsDrawPixel(xp, yp, color)
- Xint xp, yp;
- Xunsigned char color[3];
- X{
- X unsigned long int pix;
- X
- X pix = (((color[2] << 8) | color[1]) << 8) | color[0];
- X lrectwrite(xp, yp, xp, yp, &pix);
- X}
- X
- X/*
- X * Draw the rectangle with lower left corner (xp, yp) and upper right
- X * corner (xp+ys, yp+ys). The colors of the l-l, l-r, u-r, and u-l
- X * corners are given as arrays of unsigned chars as above.
- X */
- XGraphicsDrawRectangle(xp, yp, xs, ys, ll, lr, ur, ul)
- Xint xp, yp, xs, ys;
- Xunsigned char ll[3], lr[3], ur[3], ul[3];
- X{
- X int p[2];
- X
- X#if defined(_IBMR2) && !defined(SHARED_EDGES)
- X /*
- X * RS6000 doesn't seem to draw lower and left edges
- X * of rectangles correctly.
- X */
- X xp--; yp--;
- X xs++; ys++;
- X#endif
- X bgnpolygon();
- X
- X p[0] = xp; p[1] = yp;
- X CPACK(ll);
- X v2i(p);
- X
- X p[0] += xs;
- X CPACK(lr);
- X v2i(p);
- X
- X p[1] += ys;
- X CPACK(ur);
- X v2i(p);
- X
- X p[0] = xp;
- X CPACK(ul);
- X v2i(p);
- X
- X endpolygon();
- X}
- X
- XGraphicsLeftMouseEvent()
- X{
- X /*
- X * Return TRUE if left mouse button is down.
- X */
- X return getbutton(LEFTMOUSE);
- X}
- X
- XGraphicsMiddleMouseEvent()
- X{
- X return getbutton(MIDDLEMOUSE);
- X}
- X
- XGraphicsRightMouseEvent()
- X{
- X return getbutton(RIGHTMOUSE);
- X}
- X
- X/*
- X * Return position of mouse in unnormalized screen coordinates.
- X */
- XGraphicsGetMousePos(x, y)
- Xint *x, *y;
- X{
- X int xo, yo;
- X
- X getorigin(&xo, &yo);
- X *x = getvaluator( MOUSEX ) - xo;
- X *y = getvaluator( MOUSEY ) - yo;
- X}
- X
- XGraphicsRedraw()
- X{
- X Device dev;
- X short val;
- X
- X while (qtest()) {
- X dev = qread(&val);
- X if (dev == REDRAW) {
- X reshapeviewport();
- X return TRUE;
- X }
- X }
- X return FALSE;
- X}
- END_OF_FILE
- if test 2838 -ne `wc -c <'raypaint/glgraphics.c'`; then
- echo shar: \"'raypaint/glgraphics.c'\" unpacked with wrong size!
- fi
- # end of 'raypaint/glgraphics.c'
- fi
- if test -f 'raypaint/main.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'raypaint/main.c'\"
- else
- echo shar: Extracting \"'raypaint/main.c'\" \(2648 characters\)
- sed "s/^X//" >'raypaint/main.c' <<'END_OF_FILE'
- X/*
- X * main.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: main.c,v 4.0 91/07/17 17:36:46 kolb Exp Locker: kolb $
- X *
- X * $Log: main.c,v $
- X * Revision 4.0 91/07/17 17:36:46 kolb
- X * Initial version.
- X *
- X *
- X */
- X
- Xchar rcsid[] = "$Id: main.c,v 4.0 91/07/17 17:36:46 kolb Exp Locker: kolb $";
- X
- X#include "rayshade.h"
- X#include "options.h"
- X#include "stats.h"
- X#include "viewing.h"
- X#include "picture.h"
- X
- Xvoid RSInitialize(), RSStartFrame();
- X
- Xint
- Xmain(argc, argv)
- Xint argc;
- Xchar **argv;
- X{
- X Float utime, stime;
- X
- X /*
- X * Initialize variables, etc.
- X */
- X RSInitialize(argc, argv);
- X RSStartFrame(Options.startframe);
- X /*
- X * Print more information than we'll ever need to know...
- X */
- X if (Options.verbose) {
- X extern Geom *World;
- X /* World object info. */
- X AggregatePrintInfo(World, Stats.fstats);
- X /* Print info about rendering options and the like. */
- X RSOptionsList();
- X }
- X /*
- X * Print preprocessing time.
- X */
- X RSGetCpuTime(&utime, &stime);
- X fprintf(Stats.fstats,"Preprocessing time:\t");
- X fprintf(Stats.fstats,"%2.2fu %2.2fs\n", utime, stime);
- X fprintf(Stats.fstats,"Starting trace.\n");
- X (void)fflush(Stats.fstats);
- X /*
- X * Render the image.
- X */
- X Render(argc, argv);
- X StatsPrint();
- X return 0;
- X}
- X
- Xstatic void
- XRSStartFrame(frame)
- Xint frame;
- X{
- X /*
- X * Set the frame start time
- X */
- X Options.framenum = frame;
- X Options.framestart = Options.starttime +
- X Options.framenum*Options.framelength;
- X SamplingSetTime(Options.framestart, Options.shutterspeed,
- X Options.framenum);
- X /*
- X * Set up viewing parameters.
- X */
- X RSViewing();
- X /*
- X * Initialize world
- X */
- X WorldSetup();
- X}
- X
- X/*
- X * Initialize non-time-varying goodies.
- X */
- Xstatic void
- XRSInitialize(argc, argv)
- Xint argc;
- Xchar **argv;
- X{
- X /*
- X * Initialize variables, etc.
- X */
- X RSSetup();
- X /*
- X * Parse options from command line.
- X */
- X RSOptionsSet(argc, argv);
- X /*
- X * Process input file.
- X */
- X if (Options.verbose) {
- X VersionPrint();
- X fprintf(Stats.fstats,"Reading input file...\n");
- X (void)fflush(Stats.fstats);
- X }
- X RSReadInputFile();
- X /*
- X * Set variables that weren't set on command line
- X * or in input file.
- X */
- X RSCleanup();
- X /*
- X * Set sampling options.
- X */
- X SamplingSetOptions(Options.samples, Options.gaussian,
- X Options.filterwidth);
- X}
- END_OF_FILE
- if test 2648 -ne `wc -c <'raypaint/main.c'`; then
- echo shar: \"'raypaint/main.c'\" unpacked with wrong size!
- fi
- # end of 'raypaint/main.c'
- fi
- if test -f 'rayshade/Makefile.SH' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'rayshade/Makefile.SH'\"
- else
- echo shar: Extracting \"'rayshade/Makefile.SH'\" \(2719 characters\)
- sed "s/^X//" >'rayshade/Makefile.SH' <<'END_OF_FILE'
- Xcase $CONFIG in
- X'')
- X if test ! -f config.sh; then
- X ln ../config.sh . || \
- X ln ../../config.sh . || \
- X ln ../../../config.sh . || \
- X (echo "Can't find config.sh."; exit 1)
- X fi
- X . config.sh
- X ;;
- Xesac
- X: This forces SH files to create target in same directory as SH file.
- X: This is so that make depend always knows where to find SH derivatives.
- Xcase "$0" in
- X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
- Xesac
- Xecho "Extracting Makefile (with variable substitutions)"
- X: This section of the file will have variable substitutions done on it.
- X: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
- X: Protect any dollar signs and backticks that you do not want interpreted
- X: by putting a backslash in front. You may delete these comments.
- X$spitshell >Makefile <<!GROK!THIS!
- X#
- X# Makefile for rayshade.
- X#
- X# Craig Kolb
- X#
- X# \$Id: Makefile.SH,v 4.0 91/07/17 14:50:30 kolb Exp Locker: kolb $
- X#
- X# Bin directory
- X#
- XBINDIR = $bin
- XOPTIMIZE = $optimize
- XURTINC = $urtinc
- XCCFLAGS = $ccflags $large
- XURTLIB = $urtlib
- XLDFLAGS = $libs $ldflags
- XCC = $cc
- XMKDEP = $mkdep
- XYACC = $yacc
- XCLC = $lindacc
- X
- X!GROK!THIS!
- X
- X: In the following dollars and backticks do not need the extra backslash.
- X$spitshell >>Makefile <<'!NO!SUBS!'
- XLIBRAYDIR = ../libray
- XLIBSHADEDIR = ../libshade
- XINCLUDE = -I$(LIBRAYDIR) -I$(LIBSHADEDIR) -I.. $(URTINC)
- XYFLAGS = -d
- X
- XLIBRAY = $(LIBRAYDIR)/libray.a
- XLIBSHADE = $(LIBSHADEDIR)/libshade.a
- X
- X#
- X# If you are using LINDA, add -DLINDA
- X# If you are running 'tsnet'-style LINDA, add -DTSNET
- X# If you are running on a Multimax, add -DMULTIMAX -DSHAREDMEM
- X#
- X
- XCFLAGS = $(CCFLAGS) $(INCLUDE) $(OPTIMIZE)
- X
- X#
- X# C-Linda flags, if appropriate
- X#CLFLAGS = -linda ts 20000
- X#
- X
- XSHELL = /bin/sh
- X
- XLIBS = $(LIBSHADE) $(LIBRAY) $(URTLIB)
- X
- XDRIVE_C = main.c raytrace.c version.c
- X
- XDRIVE_H = raytrace.h
- X
- XDRIVE_O = $(DRIVE_C:.c=.o)
- X
- XHFILES = $(DRIVE_H)
- X
- XCFILES = $(DRIVE_C)
- X
- XSHFILES = Makefile.SH
- X
- XOBJ = $(DRIVE_O)
- X
- XDEPENDSRC = $(DRIVE_C)
- X
- X#
- X# Change $(CC) below to $(CLC) if using Linda.
- X#
- Xrayshade: $(OBJ) $(LIBS)
- X $(CC) $(OPTIMIZE) -o rayshade $(OBJ) $(LIBS) $(LDFLAGS)
- X
- X#
- X# Uncomment the following rule if using Linda.
- X#
- X#raytrace.lo: raytrace.cl
- X# $(CLC) $(INCLUDE) $(LCFLAGS) -c raytrace.cl
- X
- X#
- X# End of configuration section
- X#
- Xinstall: rayshade
- X mv rayshade $(BINDIR)/rayshade
- X
- Xclean:
- X rm -f $(OBJ) core
- X
- Xrealclean:
- X rm -f $(OBJ) core y.tab.h
- X rm -f *.orig Makefile
- X
- Xlint:
- X lint $(CFLAGS) -x $(CFILES) -lm
- X
- Xtags:
- X ctags -t $(CFILES)
- X
- Xdepend:
- X (sed '/^# DO NOT DELETE THIS LINE/q' Makefile && \
- X $(MKDEP) $(DEPENDSRC) | sed 's/: \.\//: /; /\/usr\/include/d' \
- X ) >Makefile.new
- X cp Makefile Makefile.bak
- X cp Makefile.new Makefile
- X rm -f Makefile.new
- X
- X
- X# DO NOT DELETE THIS LINE
- X!NO!SUBS!
- Xchmod 755 Makefile
- X$eunicefix Makefile
- END_OF_FILE
- if test 2719 -ne `wc -c <'rayshade/Makefile.SH'`; then
- echo shar: \"'rayshade/Makefile.SH'\" unpacked with wrong size!
- fi
- chmod +x 'rayshade/Makefile.SH'
- # end of 'rayshade/Makefile.SH'
- fi
- if test -f 'rayview/Makefile.SH' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'rayview/Makefile.SH'\"
- else
- echo shar: Extracting \"'rayview/Makefile.SH'\" \(2878 characters\)
- sed "s/^X//" >'rayview/Makefile.SH' <<'END_OF_FILE'
- Xcase $CONFIG in
- X'')
- X if test ! -f config.sh; then
- X ln ../config.sh . || \
- X ln ../../config.sh . || \
- X ln ../../../config.sh . || \
- X (echo "Can't find config.sh."; exit 1)
- X fi
- X . config.sh
- X ;;
- Xesac
- X: This forces SH files to create target in same directory as SH file.
- X: This is so that make depend always knows where to find SH derivatives.
- Xcase "$0" in
- X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
- Xesac
- Xecho "Extracting Makefile (with variable substitutions)"
- X: This section of the file will have variable substitutions done on it.
- X: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
- X: Protect any dollar signs and backticks that you do not want interpreted
- X: by putting a backslash in front. You may delete these comments.
- X$spitshell >Makefile <<!GROK!THIS!
- X#
- X# Makefile for rayview
- X#
- X# Craig Kolb
- X#
- X# \$Id: Makefile.SH,v 4.0 91/07/17 14:55:03 kolb Exp Locker: kolb $
- X#
- X# Bin directory
- X#
- XBINDIR = $bin
- X#
- X# If you are using LINDA, add -DLINDA
- X# If you are running on a Multimax, add -DMULTIMAX -DSHAREDMEM
- X# Be sure to add any necessary floating point hardware switches.
- X#
- XOPTIMIZE = $optimize
- XURTINC = $urtinc
- XCCFLAGS = $ccflags $large
- XURTLIB = $urtlib
- XLDFLAGS = $libs $ldflags
- XCC = $cc
- XMKDEP = $mkdep
- XYACC = $yacc
- X
- X!GROK!THIS!
- X
- X: In the following dollars and backticks do not need the extra backslash.
- X$spitshell >>Makefile <<'!NO!SUBS!'
- XLIBRAYDIR = ../libray
- XLIBSHADEDIR = ../libshade
- XINCLUDE = -I$(LIBRAYDIR) -I$(LIBSHADEDIR) -I..
- XYFLAGS = -d
- X
- X#
- X# If using GL on an SGI machine, use:
- XGRAPHICSLIBS = -lsphere -lgl_s
- XSPHERELIB = -DSPHERELIB
- X
- X#
- X# If using GL on an RS6000, use:
- X#GRAPHICSLIBS = -lgl
- X#SPHERELIB=
- X
- XLIBRAY = $(LIBRAYDIR)/libray.a
- XLIBSHADE = $(LIBSHADEDIR)/libshade.a
- X
- XCFLAGS = $(CCFLAGS) $(SPHERELIB) $(URTINC) $(INCLUDE) $(OPTIMIZE)
- XSHELL = /bin/sh
- X
- X#
- X# If you have a fast malloc library, use it (e.g., -lmalloc on MIPS machines)
- X#
- XLIBS = $(LIBSHADE) $(LIBRAY) $(URTLIB)
- X
- XDRIVE_C = main.c glmethods.c spheregen.c version.c
- X
- XDRIVE_O = $(DRIVE_C:.c=.o)
- X
- XCFILES = $(DRIVE_C)
- X
- XSHFILES = Makefile.SH
- X
- XOBJ = $(DRIVE_O)
- X
- XDEPENDSRC = $(DRIVE_C)
- X
- X#
- X# Change $(CC) below to $(LCC) if using Linda.
- X#
- Xrayview: $(OBJ) $(LIBS)
- X $(CC) $(OPTIMIZE) -o rayview $(OBJ) $(GRAPHICSLIBS) $(LIBS) $(LDFLAGS)
- X
- X#
- X# Uncomment the following rule if using Linda.
- X#
- X#raytrace.lo: raytrace.cl
- X# $(LCC) $(CFLAGS) -c raytrace.cl
- X
- X#
- X# End of configuration section
- X#
- Xinstall: rayview
- X mv rayview $(BINDIR)/rayview
- X
- Xclean:
- X rm -f $(OBJ) core
- X
- Xrealclean:
- X rm -f $(OBJ) core y.tab.h
- X rm -f *.orig Makefile
- X
- Xlint:
- X lint $(CFLAGS) -x $(CFILES) -lm
- X
- Xtags:
- X ctags -t $(CFILES)
- X
- Xdepend:
- X (sed '/^# DO NOT DELETE THIS LINE/q' Makefile && \
- X $(MKDEP) $(DEPENDSRC) | sed 's/: \.\//: /; /\/usr\/include/d' \
- X ) >Makefile.new
- X cp Makefile Makefile.bak
- X cp Makefile.new Makefile
- X rm -f Makefile.new
- X
- X
- X# DO NOT DELETE THIS LINE
- X!NO!SUBS!
- Xchmod 755 Makefile
- X$eunicefix Makefile
- END_OF_FILE
- if test 2878 -ne `wc -c <'rayview/Makefile.SH'`; then
- echo shar: \"'rayview/Makefile.SH'\" unpacked with wrong size!
- fi
- chmod +x 'rayview/Makefile.SH'
- # end of 'rayview/Makefile.SH'
- fi
- echo shar: End of archive 6 \(of 19\).
- cp /dev/null ark6isdone
- 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
-
- exit 0 # Just in case...
-