home *** CD-ROM | disk | FTP | other *** search
/ Best Objectech Shareware Selections / UNTITLED.iso / boss / grap / util / 010 / fractint.h < prev    next >
C/C++ Source or Header  |  1993-05-08  |  20KB  |  656 lines

  1. /* FRACTINT.H - common structures and values for the FRACTINT routines */
  2.  
  3. #if defined(PUTTHEMHERE)        /* this MUST be defined ONLY in FRACTINT.C */
  4. struct videoinfo videoentry;
  5. int helpmode;
  6. #endif
  7.  
  8. #ifndef FRACTINT_H
  9. #define FRACTINT_H
  10.  
  11. #if !defined(PUTTHEMHERE)  
  12. extern struct videoinfo videoentry;
  13. extern int        helpmode;
  14. #endif
  15.  
  16. #include <math.h>
  17. #include "port.h"
  18.  
  19. typedef BYTE BOOLEAN;
  20.  
  21. #ifndef C6
  22. #define _fastcall    /* _fastcall is a Microsoft C6.00 extension */
  23. #endif
  24.  
  25. #ifndef XFRACT
  26. #ifdef __TURBOC__
  27. #   define _bios_printer(a,b,c)   biosprint((a),(c),(b))
  28. #   define _bios_serialcom(a,b,c) bioscom((a),(c),(b))
  29. #else
  30. #ifndef __WATCOMC__
  31. #ifndef MK_FP
  32. #   define MK_FP(seg,off) (VOIDFARPTR )( (((long)(seg))<<16) | \
  33.                                           ((unsigned)(off)) )
  34. #endif
  35. #endif
  36. #endif
  37. #else
  38. #   define MK_FP(seg,off) (VOIDFARPTR )(seg+off)
  39. #endif
  40.  
  41. #ifndef XFRACT
  42. #define clock_ticks() clock()
  43. #endif
  44.  
  45. #ifdef XFRACT
  46. #define _fstrcpy(to,from) strcpy(to,from)
  47. #endif
  48.  
  49. #define MAXPARAMS 10        /* maximum number of parameters */
  50. #define MAXPIXELS 2048        /* Maximum pixel count across/down the screen */
  51. #define DEFAULTASPECT 0.75    /* Assumed overall screen dimensions, y/x     */
  52.  
  53. struct videoinfo {        /* All we need to know about a Video Adapter */
  54.     char    name[26];    /* Adapter name (IBM EGA, etc)        */
  55.     char    comment[26];    /* Comments (UNTESTED, etc)        */
  56.     int    keynum;     /* key number used to invoked this mode */
  57.                 /* 2-10 = F2-10, 11-40 = S,C,A{F1-F10}    */
  58.     int    videomodeax;    /* begin with INT 10H, AX=(this)    */
  59.     int    videomodebx;    /*        ...and BX=(this)    */
  60.     int    videomodecx;    /*        ...and CX=(this)    */
  61.     int    videomodedx;    /*        ...and DX=(this)    */
  62.                 /* NOTE:  IF AX==BX==CX==0, SEE BELOW    */
  63.     int    dotmode;    /* video access method used by asm code */
  64.                 /*    1 == BIOS 10H, AH=12,13 (SLOW)    */
  65.                 /*    2 == access like EGA/VGA    */
  66.                 /*    3 == access like MCGA        */
  67.                 /*    4 == Tseng-like  SuperVGA*256    */
  68.                 /*    5 == P'dise-like SuperVGA*256   */
  69.                 /*    6 == Vega-like     SuperVGA*256    */
  70.                 /*    7 == "Tweaked" IBM-VGA ...*256  */
  71.                 /*    8 == "Tweaked" SuperVGA ...*256 */
  72.                 /*    9 == Targa Format        */
  73.                 /*    10 = Hercules            */
  74.                 /*    11 = "disk video" (no screen)   */
  75.                 /*    12 = 8514/A            */
  76.                 /*    13 = CGA 320x200x4, 640x200x2    */
  77.                 /*    14 = Tandy 1000         */
  78.                 /*    15 = TRIDENT  SuperVGA*256    */
  79.                 /*    16 = Chips&Tech SuperVGA*256    */
  80.     int    xdots;        /* number of dots across the screen    */
  81.     int    ydots;        /* number of dots down the screen    */
  82.     int    colors;     /* number of colors available        */
  83.     };
  84.  
  85.  
  86. #define INFO_ID     "Fractal"
  87. #define FRACTAL_INFO   struct fractal_info
  88.  
  89. /*
  90.  * Note: because non-MSDOS machines store structures differently, we have
  91.  * to do special processing of the fractal_info structure in loadfile.c.
  92.  * Make sure changes to the structure here get reflected there.
  93.  */
  94. #ifndef XFRACT
  95. #define FRACTAL_INFO_SIZE sizeof(FRACTAL_INFO)
  96. #else
  97. /* This value should be the MSDOS size, not the Unix size. */
  98. #define FRACTAL_INFO_SIZE 502
  99. #endif
  100.  
  101. struct fractal_info        /*  for saving data in GIF file     */
  102. {
  103.     char  info_id[8];        /* Unique identifier for info block */
  104.     short iterations;
  105.     short fractal_type;        /* 0=Mandelbrot 1=Julia 2= ... */
  106.     double xmin;
  107.     double xmax;
  108.     double ymin;
  109.     double ymax;
  110.     double creal;
  111.     double cimag;
  112.     short videomodeax;
  113.     short videomodebx;
  114.     short videomodecx;
  115.     short videomodedx;
  116.     short dotmode;
  117.     short xdots;
  118.     short ydots;
  119.     short colors;
  120.     short version;        /* used to be 'future[0]' */
  121.     float parm3;
  122.     float parm4;
  123.     float potential[3];
  124.     short rseed;
  125.     short rflag;
  126.     short biomorph;
  127.     short inside;
  128.     short logmap;
  129.     float invert[3];
  130.     short decomp[2];
  131.     short symmetry;
  132.             /* version 2 stuff */
  133.     short init3d[16];
  134.     short previewfactor;
  135.     short xtrans;
  136.     short ytrans;
  137.     short red_crop_left;
  138.     short red_crop_right;
  139.     short blue_crop_left;
  140.     short blue_crop_right;
  141.     short red_bright;
  142.     short blue_bright;
  143.     short xadjust;
  144.     short eyeseparation;
  145.     short glassestype;
  146.             /* version 3 stuff, release 13 */
  147.     short outside;
  148.             /* version 4 stuff, release 14 */
  149.     double x3rd;      /* 3rd corner */
  150.     double y3rd;
  151.     char stdcalcmode;      /* 1/2/g/b */
  152.     char useinitorbit;      /* init Mandelbrot orbit flag */
  153.     short calc_status;      /* resumable, finished, etc */
  154.     long tot_extend_len;  /* total length of extension blocks in .gif file */
  155.     short distest;
  156.     short floatflag;
  157.     short bailout;
  158.     long calctime;
  159.     BYTE trigndx[4];      /* which trig functions selected */
  160.     short finattract;
  161.     double initorbit[2];  /* init Mandelbrot orbit values */
  162.     short periodicity;      /* periodicity checking */
  163.             /* version 5 stuff, release 15 */
  164.     short pot16bit;      /* save 16 bit continuous potential info */
  165.     float faspectratio;   /* finalaspectratio, y/x */
  166.     short system;       /* 0 for dos, 1 for windows */
  167.     short release;      /* release number, with 2 decimals implied */
  168.     short flag3d;       /* stored only for now, for future use */
  169.     short transparent[2];
  170.     short ambient;
  171.     short haze;
  172.     short randomize;
  173.             /* version 6 stuff, release 15.x */
  174.     short rotate_lo;
  175.     short rotate_hi;
  176.     short distestwidth;
  177.             /* version 7 stuff, release 16 */
  178.     double dparm3;
  179.     double dparm4;
  180.             /* version 8 stuff, release 17 */
  181.     short fillcolor;
  182.             /* version 9 stuff, release 18 */
  183.     double mxmaxfp;
  184.     double mxminfp;
  185.     double mymaxfp;
  186.     double myminfp;
  187.     short zdots;
  188.     float originfp;
  189.     float depthfp;
  190.     float heightfp;
  191.     float widthfp;
  192.     float distfp;
  193.     float eyesfp;
  194.     short orbittype;
  195.     short juli3Dmode;
  196.     short maxfn;
  197.     short inversejulia;
  198.     double dparm5;
  199.     double dparm6;
  200.     double dparm7;
  201.     double dparm8;
  202.     double dparm9;
  203.     double dparm10;
  204.     short future[50];      /* for stuff we haven't thought of yet */
  205. };
  206.  
  207.  
  208.  
  209. #define MAXVIDEOMODES 300    /* maximum entries in fractint.cfg      */
  210. #ifndef XFRACT
  211. #define MAXVIDEOTABLE 40        /* size of the resident video modes table */
  212. #else
  213. #define MAXVIDEOTABLE 2         /* size of the resident video modes table */
  214. #endif
  215.  
  216. #define AUTOINVERT -123456.789
  217.  
  218. #define N_ATTR 8            /* max number of attractors    */
  219.  
  220. extern    long     l_at_rad;    /* finite attractor radius  */
  221. extern    double     f_at_rad;    /* finite attractor radius  */
  222.  
  223. #define NUMIFS      64     /* number of ifs functions in ifs array */
  224. #define IFSPARM    7     /* number of ifs parameters */
  225. #define IFS3DPARM 13     /* number of ifs 3D parameters */
  226.  
  227. #define ITEMNAMELEN 18     /* max length of names in .frm/.l/.ifs/.fc */
  228.  
  229. struct moreparams
  230. {
  231.    int      type;                        /* index in fractalname of the fractal */
  232.    char     *param[MAXPARAMS-4];    /* name of the parameters */
  233.    double   paramvalue[MAXPARAMS-4];     /* default parameter values */
  234. };
  235.  
  236. struct fractalspecificstuff
  237. {
  238.    char  *name;             /* name of the fractal */
  239.                     /* (leading "*" supresses name display) */ 
  240.    char  *param[4];            /* name of the parameters */
  241.    double paramvalue[4];         /* default parameter values */
  242.    int     helptext;            /* helpdefs.h HT_xxxx, -1 for none */
  243.    int     helpformula;            /* helpdefs.h HF_xxxx, -1 for none */
  244.    int     flags;             /* constraints, bits defined below */
  245.    float xmin;                /* default XMIN corner */
  246.    float xmax;                /* default XMAX corner */
  247.    float ymin;                /* default YMIN corner */
  248.    float ymax;                /* default YMAX corner */
  249.    int     isinteger;            /* 1 if integerfractal, 0 otherwise */
  250.    int     tojulia;            /* mandel-to-julia switch */
  251.    int     tomandel;            /* julia-to-mandel switch */
  252.    int     tofloat;            /* integer-to-floating switch */
  253.    int     symmetry;            /* applicable symmetry logic
  254.                        0 = no symmetry
  255.                       -1 = y-axis symmetry (If No Params)
  256.                        1 = y-axis symmetry
  257.                       -2 = x-axis symmetry (No Parms)
  258.                        2 = x-axis symmetry
  259.                       -3 = y-axis AND x-axis (No Parms)
  260.                        3 = y-axis AND x-axis symmetry
  261.                       -4 = polar symmetry (No Parms)
  262.                        4 = polar symmetry
  263.                        5 = PI