| 1 | greg | 3.21 | /* RCSid: $Id$ */ | 
| 2 | gregl | 3.1 | /* | 
| 3 |  |  | * Header file for rholo program | 
| 4 |  |  | */ | 
| 5 |  |  |  | 
| 6 |  |  | #include "holo.h" | 
| 7 |  |  | #include "vars.h" | 
| 8 |  |  |  | 
| 9 |  |  | #ifndef RPACKSIZ | 
| 10 |  |  | #define RPACKSIZ        21              /* good packet size */ | 
| 11 |  |  | #endif | 
| 12 |  |  |  | 
| 13 |  |  | typedef struct packet { | 
| 14 |  |  | int2    hd;             /* holodeck section (first) */ | 
| 15 |  |  | int4    bi;             /* beam index (second) */ | 
| 16 |  |  | int4    nr;             /* number of rays (third) */ | 
| 17 | gregl | 3.5 | int4    nc;             /* number calculated (fourth) */ | 
| 18 | gwlarson | 3.15 | RAYVAL  ra[RPACKSIZ];   /* ray values (fifth) */ | 
| 19 | gregl | 3.1 | float   *offset;        /* offset array if !vbool(OBSTRUCTIONS) */ | 
| 20 |  |  | struct packet   *next;  /* next in packet list */ | 
| 21 |  |  | } PACKET;               /* a beam packet */ | 
| 22 |  |  |  | 
| 23 |  |  | typedef struct { | 
| 24 |  |  | int2    hd;             /* holodeck section (first) */ | 
| 25 |  |  | int4    bi;             /* beam index (second) */ | 
| 26 |  |  | int4    nr;             /* number of rays (third) */ | 
| 27 | gregl | 3.5 | int4    nc;             /* number calculated (fourth) */ | 
| 28 | gregl | 3.1 | } PACKHEAD;             /* followed by ray values */ | 
| 29 |  |  |  | 
| 30 |  |  | #define packsiz(nr)     (sizeof(PACKHEAD)+(nr)*sizeof(RAYVAL)) | 
| 31 | gregl | 3.3 | #define packra(p)       ((RAYVAL *)((p)+1)) | 
| 32 | gregl | 3.1 |  | 
| 33 | gwlarson | 3.16 | typedef struct { | 
| 34 | gwlarson | 3.20 | int     nb;             /* number of beams in list */ | 
| 35 |  |  | PACKHEAD        *bl;    /* allocated beam list */ | 
| 36 |  |  | } BEAMLIST;             /* a list of beam requests */ | 
| 37 |  |  |  | 
| 38 |  |  | typedef struct { | 
| 39 | gwlarson | 3.16 | FVECT   vpt;            /* view (eye point) position */ | 
| 40 |  |  | double  rng;            /* desired mean radius for sample rays */ | 
| 41 |  |  | } VIEWPOINT;            /* target eye position */ | 
| 42 |  |  |  | 
| 43 | gregl | 3.1 | /* input variables */ | 
| 44 | gwlarson | 3.14 | #define CACHE           0               /* amount of memory to use as cache */ | 
| 45 |  |  | #define DISKSPACE       1               /* how much disk space to use */ | 
| 46 |  |  | #define EYESEP          2               /* eye separation distance */ | 
| 47 | gwlarson | 3.18 | #define GEOMETRY        3               /* section geometry */ | 
| 48 |  |  | #define GRID            4               /* target grid size */ | 
| 49 |  |  | #define OBSTRUCTIONS    5               /* shall we track obstructions? */ | 
| 50 |  |  | #define OCTREE          6               /* octree file name */ | 
| 51 |  |  | #define PORTS           7               /* section portals */ | 
| 52 |  |  | #define RENDER          8               /* rendering options */ | 
| 53 |  |  | #define REPORT          9               /* report interval and error file */ | 
| 54 |  |  | #define RIF             10              /* rad input file */ | 
| 55 |  |  | #define SECTION         11              /* holodeck section boundaries */ | 
| 56 |  |  | #define TIME            12              /* maximum rendering time */ | 
| 57 |  |  | #define VDIST           13              /* virtual distance calculation */ | 
| 58 | gregl | 3.1 |  | 
| 59 | gwlarson | 3.18 | #define NRHVARS         14              /* number of variables */ | 
| 60 | gregl | 3.1 |  | 
| 61 |  |  | #define RHVINIT { \ | 
| 62 | gwlarson | 3.14 | {"CACHE",       2,      0,      NULL,   fltvalue}, \ | 
| 63 |  |  | {"DISKSPACE",   3,      0,      NULL,   fltvalue}, \ | 
| 64 |  |  | {"EYESEP",      3,      0,      NULL,   fltvalue}, \ | 
| 65 | gwlarson | 3.18 | {"geometry",    3,      0,      NULL,   NULL}, \ | 
| 66 | gwlarson | 3.14 | {"GRID",        2,      0,      NULL,   fltvalue}, \ | 
| 67 |  |  | {"OBSTRUCTIONS",3,      0,      NULL,   boolvalue}, \ | 
| 68 |  |  | {"OCTREE",      3,      0,      NULL,   onevalue}, \ | 
| 69 | gwlarson | 3.18 | {"portals",     3,      0,      NULL,   NULL}, \ | 
| 70 | gregl | 3.1 | {"render",      3,      0,      NULL,   catvalues}, \ | 
| 71 | gwlarson | 3.14 | {"REPORT",      3,      0,      NULL,   onevalue}, \ | 
| 72 |  |  | {"RIF",         3,      0,      NULL,   onevalue}, \ | 
| 73 | gregl | 3.1 | {"section",     3,      0,      NULL,   NULL}, \ | 
| 74 |  |  | {"TIME",        2,      0,      NULL,   fltvalue}, \ | 
| 75 | gregl | 3.6 | {"VDISTANCE",   2,      0,      NULL,   boolvalue}, \ | 
| 76 | gregl | 3.1 | } | 
| 77 |  |  |  | 
| 78 | gregl | 3.2 | /* bundle set requests */ | 
| 79 | gregl | 3.4 | #define BS_NEW          1               /* replace current set with new one */ | 
| 80 |  |  | #define BS_ADD          2               /* add to current set */ | 
| 81 | gregl | 3.5 | #define BS_ADJ          3               /* adjust current set quantities */ | 
| 82 |  |  | #define BS_DEL          4               /* delete from current set */ | 
| 83 | gwlarson | 3.20 | #define BS_MAX          5               /* set to max of old and new */ | 
| 84 | gregl | 3.2 |  | 
| 85 | gregl | 3.1 | extern char     *progname;      /* our program name */ | 
| 86 |  |  | extern char     *hdkfile;       /* holodeck file name */ | 
| 87 |  |  | extern char     froot[];        /* root file name */ | 
| 88 |  |  |  | 
| 89 | gregl | 3.4 | extern char     *outdev;        /* output device name */ | 
| 90 |  |  |  | 
| 91 | gregl | 3.8 | extern int      readinp;        /* read input from stdin */ | 
| 92 |  |  |  | 
| 93 | gregl | 3.10 | extern int      force;          /* allow overwrite of holodeck */ | 
| 94 |  |  |  | 
| 95 | gregl | 3.1 | extern int      nowarn;         /* turn warnings off? */ | 
| 96 |  |  |  | 
| 97 | gregl | 3.9 | extern int      ncprocs;        /* number of requested compute processes */ | 
| 98 |  |  | extern int      nprocs;         /* number of running compute processes */ | 
| 99 | gregl | 3.4 |  | 
| 100 | gwlarson | 3.19 | extern int      chunkycmp;      /* using "chunky" comparison mode */ | 
| 101 | gwlarson | 3.16 |  | 
| 102 |  |  | extern VIEWPOINT        myeye;  /* target view position */ | 
| 103 | gregl | 3.1 |  | 
| 104 |  |  | extern time_t   starttime;      /* time we got started */ | 
| 105 |  |  | extern time_t   endtime;        /* time we should end by */ | 
| 106 |  |  | extern time_t   reporttime;     /* time for next report */ | 
| 107 |  |  |  | 
| 108 | gregl | 3.11 | extern long     nraysdone;      /* number of rays done */ | 
| 109 |  |  | extern long     npacksdone;     /* number of packets done */ | 
| 110 |  |  |  | 
| 111 | gregl | 3.1 | extern int      rtargc;         /* rtrace command */ | 
| 112 |  |  | extern char     *rtargv[]; | 
| 113 |  |  |  | 
| 114 |  |  | extern PACKET   *do_packets(), *get_packets(), *flush_queue(); | 
| 115 | gwlarson | 3.20 |  | 
| 116 |  |  | extern int2     *viewbeams(); |