[comp.sources.amiga] v90i063: Surf r2 - bezier surfaces of revolution, Part01/04

Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator) (02/11/90)

Submitted-by: <edavies@sanjuan.uvic.ca>
Posting-number: Volume 90, Issue 063
Archive-name: applications/surf-r2/part01

This is the second release of BezSurf, my surface of revolution
program. The first release was summer of 1988. New release features
a few minor enhancements to make it more useful and useable.

#!/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 1 (of 4)."
# Contents:  README.txt bezpt.c bezpt.h control.c control.h fasttrig.c
#   fasttrig.h gadgetdef.h lmkfile main.c makefile mapimgpix.c
#   mapstuff.h menu_color.c menudef.c menudef.h menuexp.h mergergb.lnk
#   mouse.c mytypes.h packer.c poly.h readilbm.h revolve.h scrndef.c
#   scrndef.h scrnio.c scrnio.h scrnio.ih surf.lnk
# Wrapped by tadguy@xanth on Sat Feb 10 15:47:37 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'README.txt' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README.txt'\"
else
echo shar: Extracting \"'README.txt'\" \(9921 characters\)
sed "s/^X//" >'README.txt' <<'END_OF_FILE'
XProgram: BezSurf Release 2
XAuthor: Eric Davies
X
XChanges:
X    1) I've added the ability to write out data files that can be
X    translated to input files for various 3d modelling programs.
X
X    2) Leonard Norrgaard did a very nice job of adding the capability
X    to modify the endpoints of segments.
X
X    3) Increased the number of grey shades available.
X
XDistribution
X------------
XBezSurf is public domain. Feel free to copy it, enchance it, or port it to other
Xmachines, etc. If you liked it, included it in some PD disk distribution or
Xwhat not, maybe send me a post card, its real boost to the ego, especially those
Xfrom overseas.
X
XCompilation
X-----------
XCompiled under Lattice C 5.04 with the help of Jim Uhle
XWill also compile under Aztec 3.4a and up.
X
XSoftware Disclaimer
X-------------------
XThis software is free and hence comes with no guarantees.
XIt has always worked pretty reliably for me, but since I
Xwrote it, thats not saying much. There was some problem that
Xseemed to go away with AmigaDos 1.2 (very embarrassing, especially
Xsince it never happened to me, probably memory shortage problems).
X
X
XDocument Disclaimer
X-------------------
XThis document gives a partial description of BezSurf and its use. Many
Xof the menu-items and gadgets are not described here. I believe most people
Xwill discover their purpose without too much trouble. If I'm wrong, you can
Xquery me by email (at least for a little while) at:
X
X                 edavies@sol.UVic.ca
X                 edavies@uvunix.bitnet
X
X(I discovered that previous address of edavies@uvvm.bitnet didn't work)
X
XOr by snail mail (if some part of Canada Post is not on strike) at:
X      Eric Davies
X      214-4026 Quadra St.
X      Victoria, B.C.
X      Canada
X      V8X 4E3
X
XI've just finished my Masters, and have no idea how long my university
Xaccounts are going to hang around. If you don't get a response, or your
Xmail bounces, when using email, try the snail mail address. But please
Xinclude an email address since I can probably reply using a friends 
Xaccount.
X
XDescription
X-----------
XBezSurf (or Surf for short) is a program for producing bezier surfaces of
Xrevolution. It produces awesome pictures of wineglasses and doorknobs, and
Xother objects one could turn on a lathe. BezSurf includes the capacity to
Xmap iff image files onto any surface that it can draw.
X
XHistory
X-------
XI originally wrote BezSurf for my final project in an introductory course
Xin computer graphics at the University of Victoria. The target machine
Xwas a colour Sun Work Station. Being a loyal amigoid, I ported it down to
Xthe Amiga when I had a bit more free time, the Late Night Developers
Xsupplying resources and technical assistence as needed. I proudly claim any
Xerrors or bugs as my own, following the lead of a certain wine glass
Xmanufacturer, "the minute flaws in the product are your guarantee of its
Xhandcrafted nature".
X
XBack in January of 89, Leonard Noorgaard of Finland, mailed me a diff file
Xthat added the ability to edit the endpoints of line segments. This file
Xreached me at least two months later (the edavies@uvvm.bitnet address
Xturned out to be a semi-blackhole), whereupon I added it to some other
Xchanges of mine.
X
XOf course, the whole thing got shelved for a long while when I started
Xwriting my thesis...
X
XBasic Usage
X-----------
XI always run it from the Cli, but I've seen it run from the workbench
Xwithout any problems.
X
X    1)  press "lines".
X        press and hold down the left mouse button.
X        move the mouse someplace else and release the button.
X        a line should have been rubber banded and left on the screen.
X        repeat as desired {
X            press and drag the mouse to define new line connected to
X            last one line.
X        }
X
X    2)  press "curves".
X        the endpoints of the first line should be bracked by squares.
X        repeat as desired {
X            bring the left mouse button near one of squares.
X            press left button, move to new location, and release left button.
X            nearest square should have accompanied mouse, causing the
X            line to curve in strange and wonderful ways.
X            press right button to move the next line.
X        }
XNote: the ability to edit the end points has "enhanced" step 2 slightly,
X      but it is a very intuitive enhancement.
X
X    3)  press "panel"
X        takes you to the control panel, so you can change the lighting, save
X        files, etc. It is suggested that you try "tilt" with about 20
X        degrees ( adds a more 3d effect ).
X        to get back to display, press [display] on the control panel.
X
X    4)  press "wire"
X        generates wireframe with hidden line removal.
X
X    5)  press "shade"
X        generates shaded image with hidden surface removal.
X
X    6)  saving the images you created is done via the "files" menu in the
X        control panel.
X            save as... saves the ilbm to the specfied file name
X            save first... tacks on a ".0" to the file name and saves
X            save next... tacks on an ascending number and saves
X        "save first" and "save next" are provided in case somebody wants to
X        try producing animation sequences with Surf.
X
X    7)  Anything else, excluding maps, should be self apparent with a little bit
X        of experimentation.
X
XError Messages
X--------------
XError messages are displayed in a requestor. If displayed, you must click
Xin the requestor's close box to continue. The messages usually indicate
Xthat your file name is wrong, screwy file contents, you don't have enough
Xmemory, etc.
X
XAborting a time consuming activity
X----------------------------------
XUnder the "Image" menu, the "abort" item will terminate any drawing in
Xprogress.
X
XMapping Iff images onto Surfaces (Grey Scale Result)
X--------------------------------
XThis is my answer to photon paints mapping of images onto spheres, cones,
Xetc. Before you can perform the mapping, you need two things: (1) a loaded
Xmap image, and (2) a surface { not necessarily in that order though its
Xprobably better to load the image first if you are not sure you have enough
Xmemory }.
X
X    Loading the map image:
X        Go to the control panel window (see earlier discussion).
X        Under the files menu, select the "Open Map" item.
X        Enter the pathname of an ilbm image file (note:Ehb not supported).
X        Wait until the hourglass goes away.
X
XNow, go and define a surface if you haven't already. Once you have both a
Xsurface defined and an image file loaded, click on the "Map" gadget on the
Xdisplay screen. Be prepared to wait an hour or two for your image to
Xbe produced, it is very slow.
X
XUsing lots of bezier and revolution slices (ie, very small patches) results
Xin images that look less scarred.
X
XThe "MapRevV" and "MapRevH" sliders determine how many times the map image is
Xreplicated on the surface.
X
XClosing the map file frees up the memory used to store the map image file.
XOpenning a new map file automatically closes the old one.
X
XMapping Iff images onto Surfaces (Colour Result)
X--------------------------------
XThe idea here is to produce three different image files, one that contains
Xthe red component, one the green, and one the blue. After the files are
Xproduced, use the mergergb tool to combine them into a single file for use
Xby the RAY2 program available from the QRT (public domain) package or DBW
X(shareware).
X
Xprocedure: set interlace and lores screen.
X           set the grey model to "R only"
X           load the iff image file
X           set the screen color to "Red" (or grey).
X           Generate the surface mapping.
X           Save with a ".r" extension.
X           set the grey model to "G only"
X           load the iff image file again
X           set the screen color to "Green" (or grey).
X           Generate the surface mapping.
X           Save with a ".g" extension.
X           set the grey model to "B only".
X           load the iff image file again.
X           set the screen color to "Blue" (or grey).
X           Generate the surface mapping.
X           Save with a ".b" extension.
X
X           now run the mergergb program with the filename without extensions
X           as the sole argument. Ie, if you named the files smith.r, smith.g,
X           and smith.b, then type:
X                    mergergb smith
X           In this case, mergergb will produce smith.tmp, which can then be
X           fed into RAY2. Without other arguments, RAY2 wil produce an
X           interlaced ham image.
X
X
XProducing data files for Modellers
X----------------------------------
XConstruct your object. Then select the "Write Data" menu item. A list of
Xthe points in the object will be written out.
XThe file tov3d, is a program that will convert the data file written out
Xto something that should be acceptable by VideoScape3d. However, the
Xresulting datafile has never been tested since I don't have VS3d.
XUsage of tov3d:
X
X   tov3d  -maxx f -maxy f -maxz f [-minx f] [-miny f] [-minz f]
X         [-ci inside_colour] [-co outside_colour] [-o output_filename] 
X         inputfile
X
X   The object is scaled to fill the bounding box described by the
X   min(xyz)/max(xyz) parameters [each f is a floating point number]
X   If min value is not given, the program uses the negative of the max value.
X   
X   If no output file is named, the string ".v3d" is appended to the name
X   of the input file and that is used.
X
X   If you do not give either an inside colour or an outside colour, no
X   polygons will be generated.
X
X   For instance, with
X      tov3d -maxx 3 -maxy 4.3 -maxz 10.0 -minx 2 2 -co 3 treedata
X
X   the bounding box is:
X        X = [2, 3]
X        Y = [-4.3, 4.3]
X        Z = [-10, 10]
X   and the output file is treedata.v3d
X
XA Final Comment:
X     The old version exists compiled for the 2500 using inline math operations.
X     Does it ever fly, even when mapping. Hopefully some kind soul will do the
X     same thing for release 2, and post it.
X
XThe Future: "Son of Surf" ?
END_OF_FILE
if test 9921 -ne `wc -c <'README.txt'`; then
    echo shar: \"'README.txt'\" unpacked with wrong size!
fi
# end of 'README.txt'
fi
if test -f 'bezpt.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'bezpt.c'\"
else
echo shar: Extracting \"'bezpt.c'\" \(3257 characters\)
sed "s/^X//" >'bezpt.c' <<'END_OF_FILE'
X#include "mytypes.h"
X#include "scrnio.h"
X#include "control.h"
X#include "bezpt.h"
X
XBezCoord Bezpt[MaxSegs+1];
X
Xint NumBezPts;
Xint ActSeg;
Xbool SegDrawn;
Xint BezMesh = DefBezMeshVal;
Xfloat BezStepSize = 1.0/DefBezMeshVal;
X
Xvoid SetBezMesh( value )
X    int value;
X{
X    BezMesh = value;
X    BezStepSize = 1.0/value;
X}
X
X
Xvoid ClearSegments()
X{
X    NumBezPts = 0;
X    ActSeg = 0;
X}
X
X
Xstatic  float xa, xb, xc, xd;
Xstatic  float ya, yb, yc, yd;
X/*
X * start up calculations that must be performed before calling
X * CalcBezPt on any given segment
X */
Xvoid InitCalcBez()
X{
X        xa = -StartPtX(ActSeg) + 3.0*( Cntrl1X(ActSeg) - Cntrl2X(ActSeg))
X            + EndPtX(ActSeg);
X        xb = 3.0 *( StartPtX(ActSeg) + Cntrl2X(ActSeg) - 2.0*Cntrl1X(ActSeg));
X        xc = 3.0*( Cntrl1X(ActSeg) - StartPtX(ActSeg));
X        xd = StartPtX(ActSeg);
X
X        ya = -StartPtY(ActSeg) + 3.0*( Cntrl1Y(ActSeg) - Cntrl2Y(ActSeg))
X            + EndPtY(ActSeg);
X        yb = 3.0 *( StartPtY(ActSeg) + Cntrl2Y(ActSeg) - 2.0*Cntrl1Y(ActSeg));
X        yc = 3.0*( Cntrl1Y(ActSeg) - StartPtY(ActSeg));
X        yd = StartPtY(ActSeg);
X}
X
X/*
X * calculate a point on the bezier curve of a segment
X */
Xvoid CalcBezPt( t, xvp, yvp)
X    float t;
X    float *xvp, *yvp;
X{
X    *xvp = (( t*xa + xb) * t + xc) *t + xd;
X
X    *yvp = (( t*ya + yb) * t + yc) *t + yd;
X}
X
X
X
Xvoid XdrawBezSeg()
X{
X    float t;
X    float ftox, ftoy;
X    int fromx, fromy, tox, toy;
X
X    InitCalcBez();
X    for( fromx = StartPtX(ActSeg), fromy = StartPtY(ActSeg), t=BezStepSize;
X        t < 1.0; fromx = tox, fromy = toy, t+= BezStepSize ) {
X
X        CalcBezPt( t, &ftox, &ftoy );
X        tox = (int)ftox;
X        toy = (int)ftoy;
X        DrawLine( fromx, fromy, tox, toy, XOR );
X        DrawPnt( tox, toy, XOR );
X    }
X    DrawLine( fromx, fromy, EndPtX(ActSeg), EndPtY(ActSeg),XOR);
X}
X
X
X
Xvoid XdrawAllBezSegs()
X{
X    ResetActSeg();
X    do {
X        XdrawBezSeg();
X        NextSeg();
X    } while( ActSeg);
X
X    DrawStartPt();      /* Leonards changes */
X    DrawEndPt();        /* Leonards changes */
X    DrawControl0();
X    DrawControl1();
X}
X
X
X
Xvoid ResetCurve()
X{
X    if( NumBezPts > 0 && CurMode == FITBEZIER ) {
X        int i;
X
X        ClrWindow(true);
X        for( i = 0; i < NumBezPts; i++ ) {
X            Bezpt[i].x.cur1 = Bezpt[i].x.prev2 = Bezpt[i].x.cur0;
X            Bezpt[i].y.cur1 = Bezpt[i].y.prev2 = Bezpt[i].y.cur0;
X        }
X        ActSeg = 0;
X
X        XdrawAllBezSegs();
X    }
X}
X
X
X/*
X * set the value of a bezpt element
X */
Xstatic void SetBezPt( xval, yval )
X    int xval, yval;
X{
X    BezVal *i;
X
X    i = &Bezpt[NumBezPts-1].x;
X    i->cur0 = i->prev2 = i->cur1 = xval;
X    i = &Bezpt[NumBezPts-1].y;
X    i->cur0 = i->prev2 = i->cur1 = yval;
X}
X
X
X
X
Xvoid InitBezPt(xval,yval)
Xint xval, yval;
X{
X    int segno;
X
X    NumBezPts++;
X    SetBezPt(xval,yval);
X    segno = NumBezPts -2;
X    if( segno >= 0) {
X
X        DrawLine( StartPtX( segno), StartPtY(segno),
X                EndPtX( segno), EndPtY(segno), XOR );
X    }
X}
X
X
X
X
X
Xvoid EditBezPt(xval, yval)
X{
X    int segno = NumBezPts -2;
X
X    DrawLine( StartPtX(segno), StartPtY(segno),
X          EndPtX( segno ), EndPtY(segno), XOR );
X
X    SetBezPt(xval, yval);
X
X    DrawLine( StartPtX( segno), StartPtY(segno),
X          EndPtX( segno), EndPtY(segno), XOR );
X}
X
END_OF_FILE
if test 3257 -ne `wc -c <'bezpt.c'`; then
    echo shar: \"'bezpt.c'\" unpacked with wrong size!
fi
# end of 'bezpt.c'
fi
if test -f 'bezpt.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'bezpt.h'\"
else
echo shar: Extracting \"'bezpt.h'\" \(2220 characters\)
sed "s/^X//" >'bezpt.h' <<'END_OF_FILE'
X#include "fasttrig.h"
X/*
X * structures and such for manipulating bezier curves
X */
X
X#define MaxSegs  50  /* max number of bezier segments */
X
Xtypedef struct {
X    int prev2;  /* second control point of segment n-1 */
X    int cur0;   /* begin of segment n, end of segment n-1 */
X    int cur1;   /* first control point of segment n */
X} BezVal;
X
X
Xtypedef struct {
X    BezVal  x, y;
X} BezCoord;
X
X#define DefBezMeshVal 10
X
Xextern BezCoord Bezpt[MaxSegs+1];
Xextern void SetBezMesh( /* Panel_item, int, struct input_event */);
Xextern int BezMesh;
Xextern float BezStepSize;
X
Xextern void InitCalcBez( /* void */ );
Xextern void CalcBezPt(/* float, float *, float * */);
Xextern void XdrawAllBezSegs(/* void */);
Xextern void XdrawBezSeg(/* void */);
Xextern void InitBezPt( /* int, int */);
Xextern void EditBezPt( /* int, int */);
Xextern void ResetCurve( /* void */ );
X
Xextern int NumBezPts;
Xextern int ActSeg;
X#define BezRings() (GetNumSegs() * BezMesh + 1)
X#define GetFirstSeg()   (0)
X#define GetNumSegs()    (NumBezPts-1)
X#define ResetActSeg()   { ActSeg = GetFirstSeg(); }
X#define GetCurSeg()     (ActSeg)
X#define PrevSegNo()   (ActSeg -1 < 0 ? GetNumSegs(): ActSeg -1 )
X#define PrevSeg()   { ActSeg = PrevSegNo(); }
X#define NextSegNo() ((ActSeg+1) % GetNumSegs())
X#define NextSeg()       { ActSeg = NextSegNo(); }
X
Xenum BezPtEnum { BPEStartPt, BPEEndPt, BPECntrlPt1, BPECntrlPt2 };
X
X#define StartPtX(XSegNo) Bezpt[XSegNo].x.cur0
X#define StartPtY(XSegNo) Bezpt[XSegNo].y.cur0
X
X#define Cntrl1X(XSegNo) Bezpt[XSegNo].x.cur1
X#define Cntrl1Y(XSegNo) Bezpt[XSegNo].y.cur1
X
X#define Cntrl2X(XSegNo) Bezpt[XSegNo+1].x.prev2
X#define Cntrl2Y(XSegNo) Bezpt[XSegNo+1].y.prev2
X
X#define EndPtX(XSegNo) Bezpt[XSegNo+1].x.cur0
X#define EndPtY(XSegNo) Bezpt[XSegNo+1].y.cur0
X
X#define DrawStartPt() DrawBox( Bezpt[ActSeg].x.cur0, \
X                               Bezpt[ActSeg].y.cur0, XOR )
X
X#define DrawEndPt() DrawBox( Bezpt[ActSeg+1].x.cur0, \
X                               Bezpt[ActSeg+1].y.cur0, XOR )
X
X#define DrawControl0() DrawSqr( Bezpt[ActSeg].x.cur1,\
X                                Bezpt[ActSeg].y.cur1, XOR )
X
X#define DrawControl1() DrawSqr( Bezpt[ActSeg+1].x.prev2,\
X                                Bezpt[ActSeg+1].y.prev2, XOR )
X
END_OF_FILE
if test 2220 -ne `wc -c <'bezpt.h'`; then
    echo shar: \"'bezpt.h'\" unpacked with wrong size!
fi
# end of 'bezpt.h'
fi
if test -f 'control.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'control.c'\"
else
echo shar: Extracting \"'control.c'\" \(1578 characters\)
sed "s/^X//" >'control.c' <<'END_OF_FILE'
X#include "bezpt.h"
X#include "control.h"
X#include "scrnio.h"
X#include "mytypes.h"
X
XCURMODE CurMode  = DRAWPOLY;
X
X
Xvoid SetFitBez()
X{
X    if( GetNumSegs() < 1 )  {
X        return;
X    }
X    ClrWindow(true);
X    CurMode = FITBEZIER;
X    XdrawAllBezSegs();
X}
X
X
X
X
Xvoid SetPolyDraw()
X{
X    ClrWindow(true);
X    CurMode = DRAWPOLY;
X    ClearSegments();
X}
X
X/* one of Leonaards Additions */
X
Xvoid EditStartPt(x,y)
X    int x, y;
X{
X    DrawStartPt();
X    XdrawBezSeg();
X
X    if( PrevSegNo() != GetNumSegs() ) {
X        PrevSeg();
X        XdrawBezSeg();
X        NextSeg();
X    }
X
X    StartPtX( GetCurSeg()) = x;
X    StartPtY( GetCurSeg()) = y;
X
X    if( PrevSegNo() != GetNumSegs() ) {
X        PrevSeg();
X        XdrawBezSeg();
X        NextSeg();
X    }
X
X    XdrawBezSeg();
X    DrawStartPt();
X}
X
Xvoid EditEndPt(x,y)
X    int x, y;
X{
X    DrawEndPt();
X    XdrawBezSeg();
X
X    if( NextSegNo() != GetFirstSeg() ) {
X        NextSeg();
X        XdrawBezSeg();
X        PrevSeg();
X    }
X
X    EndPtX( GetCurSeg()) = x;
X    EndPtY( GetCurSeg()) = y;
X
X    if( NextSegNo() != GetFirstSeg() ) {
X        NextSeg();
X        XdrawBezSeg();
X        PrevSeg();
X    }
X
X    XdrawBezSeg();
X    DrawEndPt();
X}
X
X
X
Xvoid EditControl0(x,y)
X    int x, y;
X{
X        DrawControl0();
X        XdrawBezSeg();
X        Cntrl1X(GetCurSeg()) = x;
X        Cntrl1Y(GetCurSeg()) = y;
X        XdrawBezSeg();
X        DrawControl0();
X}
X
Xvoid EditControl1(x,y)
Xint x, y;
X{
X        DrawControl1();
X        XdrawBezSeg();
X        Cntrl2X(GetCurSeg()) = x;
X        Cntrl2Y(GetCurSeg()) = y;
X        XdrawBezSeg();
X        DrawControl1();
X}
END_OF_FILE
if test 1578 -ne `wc -c <'control.c'`; then
    echo shar: \"'control.c'\" unpacked with wrong size!
fi
# end of 'control.c'
fi
if test -f 'control.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'control.h'\"
else
echo shar: Extracting \"'control.h'\" \(177 characters\)
sed "s/^X//" >'control.h' <<'END_OF_FILE'
Xtypedef enum { FITBEZIER, DRAWPOLY, NOTACTIVE } CURMODE;
X
Xvoid SetFitBez();
Xvoid SetPolyDraw();
X
Xextern CURMODE CurMode;
Xextern void EditControl0();
Xextern void EditControl1();
END_OF_FILE
if test 177 -ne `wc -c <'control.h'`; then
    echo shar: \"'control.h'\" unpacked with wrong size!
fi
# end of 'control.h'
fi
if test -f 'fasttrig.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fasttrig.c'\"
else
echo shar: Extracting \"'fasttrig.c'\" \(1059 characters\)
sed "s/^X//" >'fasttrig.c' <<'END_OF_FILE'
X#include <math.h>
X#include "fasttrig.h"
X
Xextern char *malloc();
X
Xfloat *sintab;
Xfloat *costab;
X
Xstatic int oldn = -1,
X       oldrange = -1,
X       oldstart = -1;
X
X
X/*
X * return true if could not get memory for trig lookup tables
X */
Xbool InitFastTrig(angstart, angrange, n)
X    int angstart;
X    int angrange;
X    int n;
X{
X
X
X    int i;
X    float AngleInc;
X    float curangle;
X
X    if( n == oldn && oldrange == angrange && oldstart == angstart ) {
X        return(false);
X    }
X
X    if( n != oldn ) {
X        if( sintab ) free(sintab);
X        if( costab ) free(costab);
X        sintab = (float *)malloc( n * sizeof( float ));
X        costab = (float *)malloc( n * sizeof( float ));
X        if( !sintab || !costab ) {
X           return(true);
X        }
X    }
X
X    oldn = n;
X    oldrange = angrange;
X    oldstart = angstart;
X
X    AngleInc = (PI*angrange)/(180 *(n-1));
X    for( curangle = angstart*PI/180.0, i = 0;
X         i< n; i++, curangle += AngleInc ) {
X
X        sintab[i] = sin( curangle );
X        costab[i] = cos( curangle );
X    }
X    return(false);
X}
END_OF_FILE
if test 1059 -ne `wc -c <'fasttrig.c'`; then
    echo shar: \"'fasttrig.c'\" unpacked with wrong size!
fi
# end of 'fasttrig.c'
fi
if test -f 'fasttrig.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fasttrig.h'\"
else
echo shar: Extracting \"'fasttrig.h'\" \(358 characters\)
sed "s/^X//" >'fasttrig.h' <<'END_OF_FILE'
X#ifndef FASTTRIG_H_FILE
X#define FASTTRIG_H_FILE
X
X#ifndef MYTYPES_H_FILE
X#include "mytypes.h"
X#endif !MYTYPES_H_FILE
X
X#define MaxTrigEntries 512
X#ifndef PI
X#define PI 3.1415927
X#endif PI
Xextern float *sintab;
Xextern float *costab;
X
X#define fsin(sdeg) sintab[sdeg]
X#define fcos(sdeg) costab[sdeg]
X
Xbool InitFastTrig(/* float, int */);
X
X#endif !FASTTRIG_H_FILE
END_OF_FILE
if test 358 -ne `wc -c <'fasttrig.h'`; then
    echo shar: \"'fasttrig.h'\" unpacked with wrong size!
fi
# end of 'fasttrig.h'
fi
if test -f 'gadgetdef.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'gadgetdef.h'\"
else
echo shar: Extracting \"'gadgetdef.h'\" \(900 characters\)
sed "s/^X//" >'gadgetdef.h' <<'END_OF_FILE'
X#ifndef GADGETDEF_H_FILE
X#define GADGETDEF_H_FILE
X#include "mytypes.h"
X
X#define MPtrXOffset -1L
X#define MPtrYOffset -1L
X#define MPtrCol17 623L
X#define MPtrCol18 0L
X#define MPtrCol19 976L
X
Xextern UWORD *HourGlass;
X
Xextern void InitGadgets();
Xextern void EndGadgets();
Xextern void GadgetHandler();
X
Xenum GadgetName { N_DefLines, N_EditLines, N_EditBez, N_Map, N_Wire,
X                  N_Shaded, N_TiltAng, N_PtIntens, N_BkIntens, N_SurfDist,
X                  N_PtLocX, N_PtLocY, N_PtLocZ, N_BezSlices, N_RevSlices,
X                  N_RevAngle, N_Kspec, N_Kdiffuse, N_GoPanel, N_GoSurf,
X                  N_BackPlane, N_RevStart, N_RepH, N_RepV };
X
Xstruct GadExtens {
X    float minfval, maxfval, curfval; /* min,max, and cur float values */
X    short minival, maxival, curival; /* same but short ints */
X    bool isfloat;   /* true if value is floating, false if short */
X};
X
X#endif GADGETDEF_H_FILE
END_OF_FILE
if test 900 -ne `wc -c <'gadgetdef.h'`; then
    echo shar: \"'gadgetdef.h'\" unpacked with wrong size!
fi
# end of 'gadgetdef.h'
fi
if test -f 'lmkfile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'lmkfile'\"
else
echo shar: Extracting \"'lmkfile'\" \(1937 characters\)
sed "s/^X//" >'lmkfile' <<'END_OF_FILE'
X.c.o:
X#        copy $*.c to ram:
X        lc -ff -o$*.o $*.c
X#        lc -ff -oram:$*.o ram:$*.c
X#        copy ram:$*.o to $*.o
X#        -delete ram:$*.o
X#        -delete ram:$*.c
X
Xofiles = scrnio.o scrnops.o scrndef.o main.o gadgetdef.o menudef.o mouse.o gadgetuse.o
Xgfiles = bezpt.o revolve.o control.o poly.o fasttrig.o
Ximagefiles = readilbm.o writeilbm.o packer.o mapstuff.o mapcalc.o getfilenames.o mapimgpix.o
X
Xall:		surf MergeRGB tov3d
X
Xsurf:		$(ofiles) $(gfiles) $(imagefiles)
X		blink with surf.lnk
X
XMergeRGB:	MergeRGB.o
X		Blink with MergeRGB.lnk
X
XMergeRGB.o:	mergergb.c
X
Xtov3d:		tov3d.o
X		blink with tov3d.lnk
X
Xtov3d.o:	tov3d.c
X
Xbezpt.o:	bezpt.c scrnio.h control.h bezpt.h mytypes.h
X
Xcontrol.o:	control.c bezpt.h control.h scrnio.h mytypes.h
X
Xfasttrig.o:	fasttrig.c fasttrig.h
X
Xgadgetdef.o:	gadgetdef.c scrnio.ih scrndef.h gadgetdef.h mytypes.h bezpt.h poly.h revolve.h readilbm.h
X
Xgadgetuse.o:	gadgetuse.c scrnio.ih scrndef.h gadgetdef.h mytypes.h poly.h readilbm.h
X
Xgetfilenames.o:	getfilenames.c scrnio.ih scrndef.h mytypes.h
X
Xmain.o:		main.c scrnio.h mytypes.h
X
Xmapcalc.o:	mapcalc.c mytypes.h revolve.h mapstuff.h menuexp.h
X
Xmapimgpix.o:	mapimgpix.c mytypes.h readilbm.h
X
Xmapstuff.o:	mapstuff.c mytypes.h poly.h bezpt.h revolve.h readilbm.h mapstuff.h menuexp.h
X
Xmenudef.o:	menudef.c menuexp.h gadgetdef.h scrnio.h menudef.h scrndef.h poly.h readilbm.h menu_color.c menu_scrn.c menu_image.c menu_files.c
X
Xmouse.o:	mouse.c scrnio.ih scrnio.h mytypes.h bezpt.h control.h
X
Xpacker.o:	packer.c
X
Xpoly.o:		poly.c mytypes.h scrnio.h bezpt.h revolve.h control.h poly.h readilbm.h menuexp.h
X
Xreadilbm.o:	readilbm.c readilbm.h
X
Xrevolve.o:	revolve.c fasttrig.h bezpt.h revolve.h mytypes.h
X
Xscrndef.o:	scrndef.c scrndef.h
X
Xscrnio.o:	scrnio.c scrnio.ih scrndef.h scrnio.h gadgetdef.h menudef.h
X
Xscrnops.o:	scrnops.c scrnio.ih scrndef.h scrnio.h gadgetdef.h menudef.h bezpt.h revolve.h control.h poly.h
X
Xwriteilbm.o:	writeilbm.c mytypes.h
X
END_OF_FILE
if test 1937 -ne `wc -c <'lmkfile'`; then
    echo shar: \"'lmkfile'\" unpacked with wrong size!
fi
# end of 'lmkfile'
fi
if test -f 'main.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'main.c'\"
else
echo shar: Extracting \"'main.c'\" \(205 characters\)
sed "s/^X//" >'main.c' <<'END_OF_FILE'
X#include "scrnio.h"
X#include "mytypes.h"
X
Xmain()
X{
X    sqrt(1.0);          /* transcedental math library to be loaded */
X    InitWindow();
X  /*  ClrWindow(true); */
X    SwitchBox();
X    CloseDisplay();
X}
X
END_OF_FILE
if test 205 -ne `wc -c <'main.c'`; then
    echo shar: \"'main.c'\" unpacked with wrong size!
fi
# end of 'main.c'
fi
if test -f 'makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'makefile'\"
else
echo shar: Extracting \"'makefile'\" \(1658 characters\)
sed "s/^X//" >'makefile' <<'END_OF_FILE'
XOBJS1 = bezpt.o control.o fasttrig.o gadgetdef.o gadgetuse.o getfilenames.o main.o
XOBJS2 = mapcalc.o mapimgpix.o mapstuff.o menudef.o mouse.o packer.o poly.o
XOBJS3 = readilbm.o revolve.o scrndef.o scrnio.o scrnops.o writeilbm.o
X
XCFLAGS = +L -DMANX
X
Xsurf: $(OBJS1) $(OBJS2) $(OBJS3)
X    ln -o surf $(OBJS1) $(OBJS2) $(OBJS3) -lm32 -lc32
X
Xmergergb: mergergb.o
X    ln -o mergergb mergergb.o -lc32
X
Xmergergb.o: mergergb.c
X
Xtov3d: tov3d.o
X    ln -o tov3d tov3d.o -lm32 -lc32
X
Xtov3d.o: tov3d.c
X
Xbezpt.o:        scrnio.h control.h bezpt.h mytypes.h
X
Xcontrol.o:      bezpt.h control.h scrnio.h mytypes.h
X
Xfasttrig.o:     fasttrig.h
X
Xgadgetdef.o:    scrnio.ih scrndef.h gadgetdef.h mytypes.h bezpt.h poly.h revolve.h readilbm.h
X
Xgadgetuse.o:    scrnio.ih scrndef.h gadgetdef.h mytypes.h poly.h readilbm.h
X
Xgetfilenames.o: scrnio.ih scrndef.h mytypes.h
X
Xmain.o: scrnio.h mytypes.h
X
Xmapcalc.o:      mytypes.h revolve.h mapstuff.h menuexp.h
X
Xmapimgpix.o:    mytypes.h readilbm.h
X
Xmapstuff.o:     mytypes.h poly.h bezpt.h revolve.h readilbm.h mapstuff.h menuexp.h
X
Xmenudef.o:      menuexp.h gadgetdef.h scrnio.h menudef.h scrndef.h poly.h readilbm.h menu_color.c menu_scrn.c menu_image.c menu_files.c
X
Xmouse.o:        scrnio.ih scrnio.h mytypes.h bezpt.h control.h
X
Xpacker.o:
X
Xpoly.o: mytypes.h scrnio.h bezpt.h revolve.h control.h poly.h readilbm.h menuexp.h
X
Xreadilbm.o:     readilbm.h
X
Xrevolve.o:      fasttrig.h bezpt.h revolve.h mytypes.h
X
Xscrndef.o:      scrndef.h
X
Xscrnio.o:       scrnio.ih scrndef.h scrnio.h gadgetdef.h menudef.h
X
Xscrnops.o:      scrnio.ih scrndef.h scrnio.h gadgetdef.h menudef.h bezpt.h revolve.h control.h poly.h
X
Xwriteilbm.o:    mytypes.h
X
X
END_OF_FILE
if test 1658 -ne `wc -c <'makefile'`; then
    echo shar: \"'makefile'\" unpacked with wrong size!
fi
# end of 'makefile'
fi
if test -f 'mapimgpix.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mapimgpix.c'\"
else
echo shar: Extracting \"'mapimgpix.c'\" \(2534 characters\)
sed "s/^X//" >'mapimgpix.c' <<'END_OF_FILE'
X#include "mytypes.h"
X#include "readilbm.h"
X
X#define DefRes 2
Xint MapImageV = DefRes*DefRepV,
X    MapImageH= DefRes*DefRepH; /* virtual screen size */
Xstatic int PixV=DefRes,
X           PixH=DefRes;  /* true ilbm size in pixels */
Xshort MapRepV = DefRepV,
X      MapRepH = DefRepH;
Xstatic short BytesPerLine;
Xstatic unsigned char *Raster= null;
Xstatic long MaxShade;
Xstatic bool AxisFlipped = DefXYFlip;
X/*
X * Update the MapImageH and MapImageV variables
X */
Xvoid PrepImgPix()
X{
X    MapImageV = PixV * MapRepV;
X    MapImageH = PixH * MapRepH;
X    if( AxisFlipped ) {
X        int temp;
X        temp = MapImageV;
X        MapImageV = MapImageH;
X        MapImageH = temp;
X    }
X}
X/*
X * free up any memory holding mapping image
X */
Xvoid CloseImgPix()
X{
X        if( Raster) free(Raster);
X        Raster = null;
X        PixV = 0xff; PixH = 0xff;
X        PrepImgPix();
X}
X
X/*
X * cause x and y axises to be reversed
X */
Xvoid FlipImgPix( flip )
X    bool flip;
X{
X    AxisFlipped = flip;
X    PrepImgPix();
X}
X
X/*
X * 4 bits per pixel means 2 pixels per byte
X */
Xbool OpenImgPix(sizex, sizey, maxshade)
X    int sizex, sizey;
X    short maxshade;
X{
X    CloseImgPix();
X    if( maxshade == 0 ) {
X        OutErr("OpenImgPix: got max shade = 0\n");
X        maxshade = 1;
X     }
X    MaxShade = maxshade;
X    BytesPerLine = (sizex +1)/2;
X    Raster = (unsigned char *) malloc( BytesPerLine * sizey);
X    if( !Raster ) {
X        printf("OpenImgPix: not enough memory\n");
X        return(false); /* no memory err */
X    }
X
X    PixV = sizey;
X    PixH = sizex;
X    PrepImgPix();
X    return(true);
X}
X
X#define CalcByte(cbx,cby) (Raster + ( BytesPerLine * cby ) + (cbx >> 1))
X
X
Xvoid SetImgPix(x, y, val)
X    int x, y; /* location */
X    int val;
X{
X    unsigned char *bite;
X    unsigned char shade;
X
X    if( x > PixH || x < 0 || y > PixV || y < 0 ) {
X        OutErr("SetImgPix(%d,%d,%d) out of range\n",x,y,val);
X        return;
X    }
X
X    if( !Raster) return;
X    shade = ( (val<< 4)-val)/MaxShade;
X    bite = CalcByte(x,y);
X    if( x & 1) {
X        *bite = (*bite & 0xf) | ( shade <<4 );
X    }
X    else {
X        *bite = (*bite & 0xf0) | shade;
X    }
X}
X
X
Xshort GetImgPix(x,y)
X    int x, y;
X{
X    unsigned char *bite;
X
X    if( AxisFlipped ) {
X        int temp;
X        temp = x; x = y; y = temp;
X    }
X
X    x %= PixH;
X    y %= PixV;
X
X    if( !Raster ) {
X        return( (short)(((x ^ y)& 0x10) ? 0xff: 0));
X    }
X    bite = CalcByte(x,y);
X
X    if( x & 1) {
X        return((short)(*bite & 0xf0));
X    }
X    else {
X        return( (short)((*bite & 0x0f) <<4));
X    }
X}
END_OF_FILE
if test 2534 -ne `wc -c <'mapimgpix.c'`; then
    echo shar: \"'mapimgpix.c'\" unpacked with wrong size!
fi
# end of 'mapimgpix.c'
fi
if test -f 'mapstuff.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mapstuff.h'\"
else
echo shar: Extracting \"'mapstuff.h'\" \(293 characters\)
sed "s/^X//" >'mapstuff.h' <<'END_OF_FILE'
X#define SingleTinyVal 1.0e-12
X#define SingleLargeVal 1.0e12
X
X#define MP_XMIN 0
X#define MP_XMAX 1
X#define MP_YMIN 0
X#define MP_YMAX 2
X
Xbool InitMapping( /* void */);
X
Xvoid CalcMapConsts();
Xvoid MapXYRatio( /* float px, py; float *outx, outy; */);
Xvoid DrawRhomMap( /* MapRhomboid  *mpr; */ );
X
END_OF_FILE
if test 293 -ne `wc -c <'mapstuff.h'`; then
    echo shar: \"'mapstuff.h'\" unpacked with wrong size!
fi
# end of 'mapstuff.h'
fi
if test -f 'menu_color.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'menu_color.c'\"
else
echo shar: Extracting \"'menu_color.c'\" \(2692 characters\)
sed "s/^X//" >'menu_color.c' <<'END_OF_FILE'
X/*
X * Menu description for selecting color mapping
X */
Xstatic struct IntuiText colortext[] = {
X   { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"grey",  NULL },
X   { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"red",   NULL },
X   { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"green", NULL },
X   { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"blue",  NULL },
X   { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"rainbow",NULL }
X};
X
X#define ColNum (sizeof(colortext)/sizeof(struct IntuiText))
X#define ColXMask ((1<<ColNum)-1)
X#define ColorExclude(entry) (ColXMask^( 1<<entry))
X
X#define COLMEMFLAGS  ( CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED )
X
Xstruct MenuItem coloritems[] = {
X  { &coloritems[1], /* next item */
X    10, 0, 80 , 10, /* x,y,w,h */
X    COLMEMFLAGS| CHECKED,
X    ColorExclude(0), /* mutual exclude bits */
X    (APTR) &colortext[0],  /* grey */
X    NULL, /* highlight image */
X    'h', /* command byte ? */
X    NULL, /* submenu item */
X    0 /* next select for select dragging */
X    },
X  { &coloritems[2], /* next item */
X    10, 10, 80 , 10, /* x,y,w,h */
X    COLMEMFLAGS,
X    ColorExclude(1), /* mutual exclude bits */
X    (APTR) &colortext[1],     /* red */
X    NULL, /* highlight image */
X    'h', /* command byte ? */
X    NULL, /* submenu item */
X    0 /* next select for select dragging */
X    },
X  { &coloritems[3], /* next item */
X    10, 20, 80 , 10, /* x,y,w,h */
X    COLMEMFLAGS,
X    ColorExclude(2), /* mutual exclude bits */
X    (APTR) &colortext[2],
X    NULL, /* highlight image */
X    'h', /* command byte ? */
X    NULL, /* submenu item */
X    0 /* next select for select dragging */
X    },
X  { &coloritems[4], /* next item */
X    10, 30, 80 , 10, /* x,y,w,h */
X    COLMEMFLAGS,
X    ColorExclude(3), /* mutual exclude bits */
X    (APTR) &colortext[3],
X    NULL, /* highlight image */
X    'h', /* command byte ? */
X    NULL, /* submenu item */
X    0 /* next select for select dragging */
X    },
X  { NULL, /* next item */
X    10, 40, 80 , 10, /* x,y,w,h */
X    COLMEMFLAGS,
X    ColorExclude(4), /* mutual exclude bits */
X    (APTR) &colortext[4],
X    NULL, /* highlight image */
X    'h', /* command byte ? */
X    NULL, /* submenu item */
X    0 /* next select for select dragging */
X    }
X};
X
X
X
Xvoid MenuSetColMap()
X{
X    int which;
X
X    for( which = 0; which < ColNum; which++ ) {
X        if( Selected(coloritems[which]))
X            break;
X    }
X
X    SetHourGlassCol();
X
X    switch( which ) {
X    case 0:
X        SetMono( 0xf, 0xf, 0xf );
X        break;
X    case 1:
X        SetMono( 0xf, 0, 0 );
X        break;
X    case 2:
X        SetMono( 0, 0xf, 0 );
X        break;
X    case 3:
X        SetMono( 0x0, 0x0, 0xf );
X        break;
X    case 4:
X        SetRainbow();
X        break;
X    default:
X        break;
X    }
X}
END_OF_FILE
if test 2692 -ne `wc -c <'menu_color.c'`; then
    echo shar: \"'menu_color.c'\" unpacked with wrong size!
fi
# end of 'menu_color.c'
fi
if test -f 'menudef.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'menudef.c'\"
else
echo shar: Extracting \"'menudef.c'\" \(1556 characters\)
sed "s/^X//" >'menudef.c' <<'END_OF_FILE'
X#include <exec/types.h>
X#include <exec/memory.h>
X#include <intuition/intuition.h>
X#include <graphics/gfxmacros.h>
X#ifdef MANX
X#include <functions.h>
X#endif
X#include "scrnio.h"
X#include "menudef.h"
X
X#include "scrndef.h"
X#include "poly.h"
X#include "readilbm.h"
X
X#define Selected(ax) ((ax).Flags & CHECKED)
X
X#include "menu_color.c"
X#include "menu_scrn.c"
X#include "menu_image.c"
X#include "menu_files.c"
X
Xstruct Menu menu[] ={
X    { &menu[1], /* next menu */
X    8, 0, /* x, y */
X    6*8, 10, /* w,h */
X    MENUENABLED,
X    (BYTE *)"File",
X    fileitems,
X    0,0,0,0
X    },
X    { &menu[2], /* next menu */
X    7*8, 0, /* x, y */
X    6*8, 10, /* w,h */
X    MENUENABLED,
X    (BYTE *)"Color",
X    coloritems,
X    0,0,0,0
X    },
X    { &menu[3], /* next menu */
X    14*8,0, /* x, y */
X    7*8, 10, /* w,h */
X    MENUENABLED,
X    (BYTE *)"Screen",
X    scrnitems,
X    0,0,0,0
X    },
X    { NULL, /* next menu */
X    22*8,0, /* x, y */
X    6*8, 10, /* w,h */
X    MENUENABLED,
X    (BYTE *)"Image",
X    imageitems,
X    0,0,0,0
X    }
X};
X
X
X
Xvoid MenuHandler(code)
XUSHORT code;
X{
X    if( code == 0xffff ) { /* invalid menu pick */
X        return;
X    }
X
X    switch( MENUNUM(code)) {
X        case 0: /* write ilbm */
X            MenuDoFile(ITEMNUM(code));
X            break;
X        case 1: /* set screen color */
X            MenuSetColMap();
X            break;
X        case 2: /* set screen type */
X            MenuSetScrn();
X            break;
X        case 3: /* set image stuff */
X            MenuSetImage();
X            break;
X        default:
X            break;
X    }
X}
END_OF_FILE
if test 1556 -ne `wc -c <'menudef.c'`; then
    echo shar: \"'menudef.c'\" unpacked with wrong size!
fi
# end of 'menudef.c'
fi
if test -f 'menudef.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'menudef.h'\"
else
echo shar: Extracting \"'menudef.h'\" \(67 characters\)
sed "s/^X//" >'menudef.h' <<'END_OF_FILE'
Xextern struct Menu menu[];
Xextern void MenuHandler(/* USHORT */);
X
END_OF_FILE
if test 67 -ne `wc -c <'menudef.h'`; then
    echo shar: \"'menudef.h'\" unpacked with wrong size!
fi
# end of 'menudef.h'
fi
if test -f 'menuexp.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'menuexp.h'\"
else
echo shar: Extracting \"'menuexp.h'\" \(356 characters\)
sed "s/^X//" >'menuexp.h' <<'END_OF_FILE'
X#ifndef MENUEXP_H_FILE
X#define MENUEXP_H_FILE
X
X#ifndef INTUITION_INTUITION_H
X#include <intuition/intuition.h>
X#endif  INTUITION_INTUITION_H
X
X
Xextern USHORT *AbortDrawPtr;
Xextern USHORT *DebugOnPtr;
X
X#define AbortDraw (*AbortDrawPtr & CHECKED)
X#define ClrAbort() { *AbortDrawPtr &= ~CHECKED; }
X#define DebugOn (*DebugOnPtr & CHECKED)
X
X#endif MENUEXP_H_FILE
END_OF_FILE
if test 356 -ne `wc -c <'menuexp.h'`; then
    echo shar: \"'menuexp.h'\" unpacked with wrong size!
fi
# end of 'menuexp.h'
fi
if test -f 'mergergb.lnk' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mergergb.lnk'\"
else
echo shar: Extracting \"'mergergb.lnk'\" \(104 characters\)
sed "s/^X//" >'mergergb.lnk' <<'END_OF_FILE'
XROOT 	lib:c.o
X	MergeRGB.o
X
XLIBRARY	LIB:lc.lib
X	Lib:lcm.lib
X	LIB:amiga.lib
X
XTO MergeRGB
X
Xverbose
Xnodebug
END_OF_FILE
if test 104 -ne `wc -c <'mergergb.lnk'`; then
    echo shar: \"'mergergb.lnk'\" unpacked with wrong size!
fi
# end of 'mergergb.lnk'
fi
if test -f 'mouse.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mouse.c'\"
else
echo shar: Extracting \"'mouse.c'\" \(3337 characters\)
sed "s/^X//" >'mouse.c' <<'END_OF_FILE'
X#include "scrnio.ih"
X#ifdef MANX
X#include <functions.h>
X#endif
X#include "scrnio.h"
X#include "mytypes.h"
X
X#include "bezpt.h"
X#include "control.h"
X
X
Xstatic bool buttondown;  /* is left button down */
Xstatic short mousex, mousey;
Xstatic enum BezPtEnum selbezpt;  /* selected bez pt */
X
Xvoid HandleTicks(mesg)
Xstruct IntuiMessage *mesg;
X{
X    int x, y;
X
X    x = CntrX(mesg->MouseX);
X    y = CntrY(mesg->MouseY);
X
X    if(!buttondown || (mousex == x && mousey == y )){
X        return;
X    }
X
X    mousex = x;
X    mousey = y;
X
X    switch( CurMode ) {
X
X    case DRAWPOLY:
X         EditBezPt( mousex, mousey);
X         break;
X
X    case FITBEZIER:
X        switch(selbezpt) {
X        case BPEStartPt:
X            EditStartPt(mousex, mousey);
X            break;
X
X        case BPEEndPt:
X            EditEndPt(mousex, mousey);
X            break;
X
X        case BPECntrlPt1:
X            EditControl0(mousex, mousey);
X            break;
X
X        case BPECntrlPt2:
X            EditControl1(mousex, mousey);
X            break;
X        }
X        break;
X
X    default:
X        break;
X    }
X}
X
X
X
Xvoid HandleMButtons(mesg)
Xstruct IntuiMessage *mesg;
X{
X
X    long startdist, enddist, leftdist, rightdist;
X    long tx, ty;
X
X    mousex = CntrX(mesg->MouseX);
X    mousey = CntrY(mesg->MouseY);
X
X    switch( mesg->Code) {
X    case SELECTDOWN:
X        buttondown = true;  /* down */
X
X        switch( CurMode ) {
X        case DRAWPOLY:
X            InitBezPt( mousex, mousey);
X            if( GetNumSegs() == 0 ) {
X                InitBezPt( mousex, mousey );
X            }
X            break;
X
X        case FITBEZIER:
X            tx = mousex - StartPtX(GetCurSeg());
X            ty = mousey - StartPtY(GetCurSeg());
X            startdist = tx * tx + ty * ty;
X
X            tx = mousex - EndPtX(GetCurSeg());
X            ty = mousey - EndPtY(GetCurSeg());
X            enddist = tx * tx + ty * ty;
X
X            tx = mousex - Cntrl1X(GetCurSeg());
X            ty = mousey - Cntrl1Y(GetCurSeg());
X            leftdist = tx * tx + ty * ty;
X
X            tx = mousex - Cntrl2X(GetCurSeg());
X            ty = mousey - Cntrl2Y(GetCurSeg());
X            rightdist = tx *tx + ty * ty;
X
X            if( leftdist <= rightdist &&
X                 leftdist <= startdist &&
X                 leftdist <= enddist ) {
X                selbezpt = BPECntrlPt1;
X                EditControl0( mousex, mousey );
X                }
X            else if ( rightdist <= startdist &&
X                    rightdist <= enddist ) {
X                selbezpt = BPECntrlPt2;
X                EditControl1( mousex, mousey );
X                }
X            else if ( startdist <= enddist ) {
X                selbezpt = BPEStartPt;
X                EditStartPt(mousex, mousey);
X            }
X            else {
X                selbezpt = BPEEndPt;
X                EditEndPt(mousex, mousey);
X            }
X            break;
X
X        default:
X            break;
X        }
X        break;
X
X
X    case SELECTUP:
X        buttondown = false; /* up */
X        break;
X
X    case MENUUP:
X        if( CurMode == FITBEZIER ) {
X            DrawStartPt();
X            DrawEndPt();
X            DrawControl0();
X            DrawControl1();
X            NextSeg();
X            DrawStartPt();
X            DrawEndPt();
X            DrawControl0();
X            DrawControl1();
X        }
X        break;
X
X    default:
X        break;
X    }
X}
END_OF_FILE
if test 3337 -ne `wc -c <'mouse.c'`; then
    echo shar: \"'mouse.c'\" unpacked with wrong size!
fi
# end of 'mouse.c'
fi
if test -f 'mytypes.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mytypes.h'\"
else
echo shar: Extracting \"'mytypes.h'\" \(309 characters\)
sed "s/^X//" >'mytypes.h' <<'END_OF_FILE'
X#ifndef MYTYPES_H_FILE
X#define MYTYPES_H_FILE
X#define true 1
X#define false 0
X
Xtypedef char bool;
Xextern char *calloc(), *malloc();
X
X#define null 0L
X
X#ifndef MANX
X#include "exec/types.h"
X#include "libraries/mathffp.h"
X#define ceil	SPCeil
X#define floor	SPFloor
X#define fabs	SPAbs
X#endif
X
X
X#endif MYTYPES_H_FILE
END_OF_FILE
if test 309 -ne `wc -c <'mytypes.h'`; then
    echo shar: \"'mytypes.h'\" unpacked with wrong size!
fi
# end of 'mytypes.h'
fi
if test -f 'packer.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'packer.c'\"
else
echo shar: Extracting \"'packer.c'\" \(3850 characters\)
sed "s/^X//" >'packer.c' <<'END_OF_FILE'
X/*
X * this file is a hacked up version of the original, who blurb is below
X * changes made: internal buffer no longer static, but is now on stack
X */
X/*----------------------------------------------------------------------*
X * packer.c Convert data to "cmpByteRun1" run compression.     11/15/85
X *
X * By Jerry Morrison and Steve Shaw, Electronic Arts.
X * This software is in the public domain.
X *
X *      control bytes:
X *       [0..127]   : followed by n+1 bytes of data.
X *       [-1..-127] : followed by byte to be repeated (-n)+1 times.
X *       -128       : NOOP.
X *
X * This version for the Commodore-Amiga computer.
X *----------------------------------------------------------------------*/
X#include <exec/types.h>
X
X#define DUMP    0
X#define RUN     1
X
X#define MinRun 3
X#define MaxRun 128
X#define MaxDat 128
X
Xstatic short putSize;
X#define GetByte()       (*source++)
X#define PutByte(c)      { *dest++ = c;   ++putSize; }
X
Xstatic BYTE *buf;  /* [TBD] should be 128?  on stack?*/
X
Xstatic BYTE *PutDump(dest, nn)
X    BYTE *dest;
X    int nn;
X{
X        int i;
X
X    PutByte(nn-1);
X    for(i = 0;  i < nn;  i++)   PutByte(buf[i]);
X    return(dest);
X}
X
Xstatic BYTE *PutRun(dest, nn, cc)
X    BYTE *dest;
X    int nn, cc;
X{
X    PutByte(-(nn-1));
X    PutByte(cc);
X    return(dest);
X}
X
X#define OutDump(nn)   dest = PutDump(dest, nn)
X#define OutRun(nn,cc) dest = PutRun(dest, nn, cc)
X
X/*----------- PackRow --------------------------------------------------*/
X/* Given POINTERS TO POINTERS, packs one row, updating the source and
X   destination pointers.  RETURNs count of packed bytes.*/
Xint PackRow(source, dest, rowSize)
X    BYTE *source, *dest;
X    int rowSize;
X{
X    char innerbuf[256];
X    char c,lastc = '\0';
X    BOOL mode = DUMP;
X    short nbuf = 0;             /* number of chars in buffer */
X    short rstart = 0;           /* buffer index current run starts */
X
X    /*
X     * cute way to make local buffer known to external procedures
X     * since static variables increase executable size in Manx
X     */
X    buf = innerbuf; /* way to put make local buffer known to external procs */
X    putSize = 0;
X    buf[0] = lastc = c = GetByte();  /* so have valid lastc */
X    nbuf = 1;   rowSize--;      /* since one byte eaten.*/
X
X
X    for (;  rowSize;  --rowSize) {
X        buf[nbuf++] = c = GetByte();
X        switch (mode) {
X                case DUMP:
X                        /* If the buffer is full, write the length byte,
X                           then the data */
X                        if (nbuf>MaxDat) {
X                                OutDump(nbuf-1);
X                                buf[0] = c;
X                                nbuf = 1;   rstart = 0;
X                                break;
X                                }
X
X                        if (c == lastc) {
X                            if (nbuf-rstart >= MinRun) {
X                                if (rstart > 0) OutDump(rstart);
X                                mode = RUN;
X                                }
X                            else if (rstart == 0)
X                                mode = RUN;     /* no dump in progress,
X                                so can't lose by making these 2 a run.*/
X                            }
X                        else  rstart = nbuf-1;          /* first of run */
X                        break;
X
X                case RUN: if ( (c != lastc)|| ( nbuf-rstart > MaxRun)) {
X                        /* output run */
X                        OutRun(nbuf-1-rstart,lastc);
X                        buf[0] = c;
X                        nbuf = 1; rstart = 0;
X                        mode = DUMP;
X                        }
X                        break;
X                }
X
X        lastc = c;
X        }
X
X    switch (mode) {
X        case DUMP: OutDump(nbuf); break;
X        case RUN: OutRun(nbuf-rstart,lastc); break;
X        }
X    return(putSize);
X}
X
END_OF_FILE
if test 3850 -ne `wc -c <'packer.c'`; then
    echo shar: \"'packer.c'\" unpacked with wrong size!
fi
# end of 'packer.c'
fi
if test -f 'poly.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'poly.h'\"
else
echo shar: Extracting \"'poly.h'\" \(712 characters\)
sed "s/^X//" >'poly.h' <<'END_OF_FILE'
X#ifndef POLY_H_FILE
X#define POLY_H_FILE
X#include <exec/types.h>
X#include "mytypes.h"
X#include "revolve.h"
X
X
X#define RhomVxNum 4
X
Xtypedef struct {
X    ScrnPair    pt[RhomVxNum];
X    float       depth;
X    float       intensity;
X} Rhomboid;
X
Xtypedef struct {
X    Rhomboid   rhom;
X    short   bezindex,
X            revindex;
X} MapRhomboid;
X
Xextern bool SpecOn;
X
X#define DefLightSrcX 0.0
X#define DefLightSrcY 0.0
X#define DefLightSrcZ 0.0
X#define DefIntensity 0.8
X#define DefAmbience 0.15
X#define DefKd   0.8
X#define DefKs   0.2
X
X
Xextern float Ambience,
X             PtIntensity,
X             Kd, Ks;
X
Xextern Pt3 LightSrc;
X
Xextern void RevNoShade();
Xextern void RevShade();
Xextern void RevMap();
X
X#endif !POLY_H_FILE
END_OF_FILE
if test 712 -ne `wc -c <'poly.h'`; then
    echo shar: \"'poly.h'\" unpacked with wrong size!
fi
# end of 'poly.h'
fi
if test -f 'readilbm.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'readilbm.h'\"
else
echo shar: Extracting \"'readilbm.h'\" \(749 characters\)
sed "s/^X//" >'readilbm.h' <<'END_OF_FILE'
X#ifndef READILBM_H_FILE
X
X#define READILBM_H_FILE
X
X#ifndef MYTYPES_H_FILE
X#include "mytypes.h"
X#endif MYTYPES_H_FILE
X
X#define DefRepV 1
X#define DefRepH 1
X
X/*
X * how many times the image should be replicated on screen
X */
Xextern short MapRepV, MapRepH;
X
X/*
X * Size of image read in
X */
Xextern int MapImageV, MapImageH;
X/*
X * ReadPixel returns an intensity between 0-255
X */
Xextern short GetImgPix(/* short vert, hori */);
Xextern void CloseImgPix();
Xbool OpenImgPix( /* int sizex, sizey; short maxshade */);
Xvoid SetImgPix( /* int x, y; short val */ );
Xshort GetImgPix( /* int x, y */);
Xextern void PrepImgPix(/* void */);
X#define DefXYFlip false
Xextern void FlipImgPix( /* bool flip */);
Xextern void SetGreyModel( /* int */);
X
X#endif READILBM_H_FILE
X
END_OF_FILE
if test 749 -ne `wc -c <'readilbm.h'`; then
    echo shar: \"'readilbm.h'\" unpacked with wrong size!
fi
# end of 'readilbm.h'
fi
if test -f 'revolve.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'revolve.h'\"
else
echo shar: Extracting \"'revolve.h'\" \(1181 characters\)
sed "s/^X//" >'revolve.h' <<'END_OF_FILE'
X#ifndef REVOLVE_H_FILE
X
X#define REVOLVE_H_FILE
X#include "mytypes.h"
X
Xtypedef enum { RevX, RevY } RevAxisType;
Xextern RevAxisType RevAxis;
X
X#define DefRevMeshVal 30
X#define DefSurfDist 3000
X#define DefTilt 15
X#define DefRotRange 360
X#define DefRotStart 0
X#define DefPersp false
X#define DefViewDist 3000
X
Xtypedef struct {
X    short x, y;
X} ScrnPair;
X
X
X
X
Xtypedef struct {
X        float x, y, z;
X} Pt3;
X
Xtypedef struct {
X        Pt3 d3;
X        ScrnPair d2;
X} PtGen;
X
Xextern short RevMesh;
Xextern short RevImageR,
X             RevImageB;
X
Xextern void SetRotStart();
Xextern void SetRotRange(/* Panel_item, int, struct input_event */);
Xextern void SetSecAng(/* Panel_item, int, struct input_event */);
Xextern void SetPolyMode( /* Panel_item, int, struct input_event */);
Xextern void SetFitBez( /* Panel_item, int, struct input_event */);
Xextern bool Revolve( /* Panel_item, int, struct input_event */);
Xextern void SetRevAxis( /* Panel_item, int, struct input_event */);
Xextern void SetRevMesh( /* Panel_item, int, struct input_event */);
Xextern void SetSurfDist(/* Panel_item, int, struct input_event */);
Xextern void SetViewDist();
Xextern void SetPerspective();
X#endif !REVOLVE_H_FILE
END_OF_FILE
if test 1181 -ne `wc -c <'revolve.h'`; then
    echo shar: \"'revolve.h'\" unpacked with wrong size!
fi
# end of 'revolve.h'
fi
if test -f 'scrndef.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'scrndef.c'\"
else
echo shar: Extracting \"'scrndef.c'\" \(2098 characters\)
sed "s/^X//" >'scrndef.c' <<'END_OF_FILE'
X/* this file contains definition for the screen */
X
X#include <exec/types.h>
X#include <intuition/intuition.h>
X#include <graphics/gfxmacros.h>
X#ifdef MANX
X#include <functions.h>
X#endif
X
X#include "scrndef.h"
X
Xstruct TextAttr myfont1 = {
X    (UBYTE *)"topaz.font", 8, 0, 0
X};
X
X
X
Xstruct NewScreen SurfScrnDef = {
X    0,0,   /* left and top edge */
X    SurfInitW, SurfInitH+ButHeight,  /* width and height */
X    SurfInitD,   /* num bitplanes bit planes */
X    0,1, /* detail, block pen */
X    SurfInitType, /* lores non interlaced */
X    CUSTOMSCREEN,
X    &myfont1,
X    NULL /*(UBYTE *) "Screen" */,
X    NULL,
X    NULL
X};
X
X
Xstruct NewWindow SurfWinDef = {
X    0, ButHeight, /* left, top */
X    SurfInitW, SurfInitH, /* width, height */
X    -1, -1, /* default detail and block pen */
X    MOUSEBUTTONS | MOUSEMOVE| INTUITICKS /* | CLOSEWINDOW */,
X    RMBTRAP | SIMPLE_REFRESH | GIMMEZEROZERO | BORDERLESS
X     | BACKDROP,
X    NULL, NULL, /* gadget, checkmark */
X    NULL /* (UBYTE *) "BezSurf - By Eric Davies" */,
X    NULL, /* pointer to screen */
X    NULL, /* pointer to super bitmap */
X    10, 10, 640, 200, /* min and max dimensions */
X    CUSTOMSCREEN
X};
X
Xstruct NewWindow GadWinDef = {
X    0, 0, /* left, top */
X    SurfInitW, ButHeight, /* width, height */
X    -1, 0, /* default detail and block pen */
X    GADGETUP,
X    SIMPLE_REFRESH | BORDERLESS | BACKDROP,
X    NULL, NULL, /* gadget, checkmark */
X    NULL /*(UBYTE *) "Gadwin" */,
X    NULL, /* pointer to screen */
X    NULL, /* pointer to super bitmap */
X    10, 10, 10, 10, /* min and max dimensions */
X    CUSTOMSCREEN
X};
X
X
X
Xstruct NewWindow CntrlWinDef = {
X    0, 0, /* left, top */
X    640, 180, /* width, height */
X    -1, -1, /* default detail and block pen */
X    CLOSEWINDOW| GADGETUP| MENUPICK,
X    SIMPLE_REFRESH | WINDOWCLOSE | WINDOWDEPTH
X    | WINDOWDRAG | WINDOWSIZING,
X    NULL, NULL, /* gadget(set by program), checkmark */
X    (UBYTE *)  "BezSurf - Control Panel - By Eric Davies",
X    NULL, /* pointer to screen */
X    NULL, /* pointer to super bitmap */
X    10, 10, 640, 200, /* min and max dimensions */
X    WBENCHSCREEN
X};
END_OF_FILE
if test 2098 -ne `wc -c <'scrndef.c'`; then
    echo shar: \"'scrndef.c'\" unpacked with wrong size!
fi
# end of 'scrndef.c'
fi
if test -f 'scrndef.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'scrndef.h'\"
else
echo shar: Extracting \"'scrndef.h'\" \(424 characters\)
sed "s/^X//" >'scrndef.h' <<'END_OF_FILE'
X#ifndef SCRNDEF_H_FILE
X#define SCRNDEF_H_FILE
X
X#define ButHeight 10   /* height of GadWin */
X#define SurfInitW 320  /* initial width */
X#define SurfInitH 200  /* initial height */
X#define SurfInitD 4    /* 16 color */
X#define SurfInitType 0 /* Lores */
X
Xextern struct NewWindow SurfWinDef;
Xextern struct NewWindow CntrlWinDef;
Xextern struct NewScreen SurfScrnDef;
Xextern struct NewWindow GadWinDef;
X
X#endif !SCRNDEF_H_FILE
X
END_OF_FILE
if test 424 -ne `wc -c <'scrndef.h'`; then
    echo shar: \"'scrndef.h'\" unpacked with wrong size!
fi
# end of 'scrndef.h'
fi
if test -f 'scrnio.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'scrnio.c'\"
else
echo shar: Extracting \"'scrnio.c'\" \(3573 characters\)
sed "s/^X//" >'scrnio.c' <<'END_OF_FILE'
X/* main program */
X
X#include "scrnio.ih"
X#ifdef MANX
X#include <functions.h>
X#endif MANX
X
X#include "scrndef.h"
X#include "scrnio.h"
X#include "gadgetdef.h"
X#include "menudef.h"
X
Xstruct Screen *SurfScrn = NULL;
Xstruct Window *SurfWin = NULL;
Xstruct Window *CntrlWin = NULL;
Xstruct Window *GadWin = NULL;
X/*
X * bit masks for waiting for signals
X */
Xshort CntrlSigBit, SurfSigBit, GadSigBit;
Xlong SignalMask = 0;
X
Xstruct RastPort *rp;
Xstruct ViewPort *vp;
X
Xstruct Library *GfxBase = 0,
X               *IntuitionBase = 0;
X
Xint XOR = COMPLEMENT, /* so my other modules don't need to */
X    WRITE = JAM1;     /* include so many amiga includes */
X
Xint WinHOrig, WinVOrig;
Xint WinFgCol;
Xint ColorMax;
Xint NumColors;
X
X/*
X * data structures needed to use amiga polygons routines
X */
Xstatic WORD PolyArea[5*5];
Xstatic struct AreaInfo PolyInfo;
Xstatic PLANEPTR PolyWorkSpace;
Xstatic struct TmpRas PolyTmpRas;
X
X
X
Xstatic void ResetWinDat() {
X
X    WinHOrig = SurfWinDef.Width >>1;
X    WinVOrig = SurfWinDef.Height >>1;
X
X
X    rp = SurfWin->RPort;
X    SetDrMd( rp,  JAM1 );
X}
X
X
X
X/*
X * open surface window/screen
X */
XOpenSurf() {
X    NumColors = 1 << SurfScrnDef.Depth;
X    ColorMax = ( NumColors -1) * DitherLevels + 1;
X    WinFgCol = (NumColors - 1) & 0x1f;
X
X    SurfScrnDef.BlockPen = ( WinFgCol *3) /4;
X    SurfScrnDef.DetailPen = WinFgCol>>2;
X
X    SurfScrn = OpenScreen( &SurfScrnDef );
X    MenuSetColMap();
X    SurfWinDef.Screen = GadWinDef.Screen = SurfScrn;
X    SurfWinDef.Width = GadWinDef.Width = SurfScrnDef.Width;
X    SurfWinDef.Height = SurfScrnDef.Height - ButHeight;
X
X    SurfWin = OpenWindow( &SurfWinDef );
X    GadWin = OpenWindow( &GadWinDef );
X    SurfSigBit = SurfWin->UserPort->mp_SigBit;
X    GadSigBit = GadWin->UserPort->mp_SigBit;
X    SignalMask = (1<<CntrlSigBit) | (1<<SurfSigBit)| (1<<GadSigBit);
X
X    ResetWinDat();
X    ShowTitle( SurfScrn, 0L ); /* hide screen title behind backdrop */
X
X    InitArea( &PolyInfo, PolyArea, 5);
X    rp->AreaInfo = &PolyInfo;
X
X    PolyWorkSpace = AllocRaster( SurfWinDef.Width, SurfWinDef.Height);
X
X    if( !PolyWorkSpace ) {
X        CloseDisplay();
X        perror("no space for temporary rastern");
X        exit(0);
X    }
X    else {
X        InitTmpRas( &PolyTmpRas, PolyWorkSpace,
X                    RASSIZE( SurfWinDef.Width, SurfWinDef.Height ));
X        rp->TmpRas = &PolyTmpRas;
X    }
X}
X
X
Xvoid InitWindow()
X{
X    GfxBase = OpenLibrary("graphics.library",0);
X    if( GfxBase == 0 ) {
X        OutErr("graphics library won't open");
X        exit(10);
X    }
X
X    IntuitionBase = OpenLibrary("intuition.library",0);
X    if( IntuitionBase == 0 ) {
X        OutErr("intuition library won't open");
X        exit(10);
X    }
X
X    InitGadgets();
X    CntrlWin = OpenWindow( &CntrlWinDef );
X    CntrlSigBit = CntrlWin->UserPort->mp_SigBit;
X
X    MenuSetScrn();
X
X    if( !SurfScrn || !SurfWin || !CntrlWin ) {
X        OutErr("couldn't open at least one window or screen");
X        CloseDisplay();
X        exit( 0 );
X    }
X
X    SetMenuStrip(CntrlWin, menu );
X}
X
X
X/*
X * remove surface window/screen
X */
XCloseSurf() {
X
X    if( PolyWorkSpace)
X        FreeRaster( PolyWorkSpace, SurfWinDef.Width, SurfWinDef.Height );
X
X    if( SurfWin )
X        CloseWindow( SurfWin );
X
X    if( GadWin )
X        CloseWindow( GadWin );
X
X    if( SurfScrn )
X        CloseScreen( SurfScrn );
X}
X
X
Xvoid CloseDisplay()
X{
X
X    CloseSurf();
X
X
X    if( CntrlWin ) {
X        ClearMenuStrip( CntrlWin );
X        CloseWindow( CntrlWin );
X    }
X
X    EndGadgets();
X
X    if ( IntuitionBase )
X        CloseLibrary(IntuitionBase);
X
X    if ( GfxBase )
X        CloseLibrary(GfxBase);
X}
X
X
END_OF_FILE
if test 3573 -ne `wc -c <'scrnio.c'`; then
    echo shar: \"'scrnio.c'\" unpacked with wrong size!
fi
# end of 'scrnio.c'
fi
if test -f 'scrnio.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'scrnio.h'\"
else
echo shar: Extracting \"'scrnio.h'\" \(600 characters\)
sed "s/^X//" >'scrnio.h' <<'END_OF_FILE'
X#ifndef SCRNIO_H
X#define SCRNIO_H 1
X
X#ifndef MYTYPES_H_FILE
X#include "mytypes.h"
X#endif
Xextern void InitWindow();
Xextern void CloseDisplay();
Xextern void SetMono();
Xextern void ClearWindow();
Xextern void DrawPoly();
X
Xextern short DitherPower, DitherLevels;
Xextern int WinHOrig, WinVOrig;
Xextern int XOR, WRITE;
Xextern short DitherMask;
X
Xextern void FreeOldDither();
Xextern bool AllocDither();
X
X#define CntrX(XVAL) ((XVAL) - WinHOrig)
X#define CntrY(YVAL) (WinVOrig - (YVAL)) /* fudge for the mouse */
X
X#define UCntrX(XVAL) ((XVAL) + WinHOrig)
X#define UCntrY(YVAL) (WinVOrig - (YVAL))
X
X#endif SCRNIO_H
END_OF_FILE
if test 600 -ne `wc -c <'scrnio.h'`; then
    echo shar: \"'scrnio.h'\" unpacked with wrong size!
fi
# end of 'scrnio.h'
fi
if test -f 'scrnio.ih' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'scrnio.ih'\"
else
echo shar: Extracting \"'scrnio.ih'\" \(523 characters\)
sed "s/^X//" >'scrnio.ih' <<'END_OF_FILE'
X/* main program */
X
X#include <exec/types.h>
X#include <intuition/intuition.h>
X#include <graphics/gfxmacros.h>
X
X
Xextern struct Screen *SurfScrn;
Xextern struct Window *SurfWin;
Xextern struct Window *CntrlWin;
Xextern struct Window *GadWin;
Xextern long BackColor;
X/*
X * bit masks for waiting for signals
X */
Xextern short CntrlSigBit, SurfSigBit, GadSigBit;
Xextern long SignalMask;
X
Xextern struct RastPort *rp;
Xextern struct ViewPort *vp;
X
X
X
Xextern int WinFgCol;
Xextern int ColorMax;
Xextern int NumColors;
X
X#define DefBkPlane 0
X
END_OF_FILE
if test 523 -ne `wc -c <'scrnio.ih'`; then
    echo shar: \"'scrnio.ih'\" unpacked with wrong size!
fi
# end of 'scrnio.ih'
fi
if test -f 'surf.lnk' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'surf.lnk'\"
else
echo shar: Extracting \"'surf.lnk'\" \(472 characters\)
sed "s/^X//" >'surf.lnk' <<'END_OF_FILE'
XROOT    lib:c.o
X        scrnio.o
X        scrnops.o
X        scrndef.o
X        main.o
X        gadgetdef.o
X        menudef.o
X        mouse.o
X        gadgetuse.o
X        bezpt.o
X        revolve.o
X        control.o
X        poly.o
X        fasttrig.o
X        readilbm.o
X        writeilbm.o
X        packer.o
X        mapstuff.o
X        mapcalc.o
X        getfilenames.o
X        mapimgpix.o
X
X
XLIBRARY LIB:lcmffp.lib
X        Lib:lc.lib
X        LIB:amiga.lib
X
XTO Surf
X
Xverbose
Xnodebug
END_OF_FILE
if test 472 -ne `wc -c <'surf.lnk'`; then
    echo shar: \"'surf.lnk'\" unpacked with wrong size!
fi
# end of 'surf.lnk'
fi
echo shar: End of archive 1 \(of 4\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 4 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
-- 
Mail submissions (sources or binaries) to <amiga@cs.odu.edu>.
Mail comments to the moderator at <amiga-request@cs.odu.edu>.
Post requests for sources, and general dicussion to comp.sys.amiga.