1 |
< |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
2 |
< |
|
3 |
< |
/* SCCSid "$SunId$ SGI" */ |
4 |
< |
|
1 |
> |
/* RCSid: $Id$ */ |
2 |
|
/* |
3 |
|
* Header file for holodeck programs |
4 |
|
* |
5 |
|
* 9/29/97 GWLarson |
6 |
|
*/ |
7 |
+ |
#ifndef _RAD_HOLO_H_ |
8 |
+ |
#define _RAD_HOLO_H_ |
9 |
|
|
10 |
|
#include "standard.h" |
11 |
|
#include "color.h" |
12 |
|
|
13 |
+ |
#ifdef __cplusplus |
14 |
+ |
extern "C" { |
15 |
+ |
#endif |
16 |
+ |
|
17 |
|
#ifndef HDMAX |
18 |
|
#define HDMAX 128 /* maximum active holodeck sections */ |
19 |
|
#endif |
20 |
|
|
21 |
+ |
#ifndef MAXDIRSE |
22 |
+ |
#define MAXDIRSE 32 /* maximum seeks per directory write */ |
23 |
+ |
#endif |
24 |
+ |
|
25 |
|
#define DCINF (unsigned)((1L<<16)-1) /* special value for infinity */ |
26 |
|
#define DCLIN (unsigned)(1L<<11) /* linear depth limit */ |
27 |
|
|
28 |
|
typedef struct { |
29 |
|
BYTE r[2][2]; /* ray direction index */ |
30 |
|
COLR v; /* color value */ |
31 |
< |
unsigned int2 d; /* depth code (from entry wall) */ |
31 |
> |
uint16 d; /* depth code (from entry wall) */ |
32 |
|
} RAYVAL; /* ray value */ |
33 |
|
|
34 |
|
/* |
49 |
|
} GCOORD; /* grid coordinates (two for beam) */ |
50 |
|
|
51 |
|
typedef struct { |
52 |
< |
unsigned int4 nrd; /* number of beam rays bundled on disk */ |
53 |
< |
long fo; /* position in file */ |
52 |
> |
uint32 nrd; /* number of beam rays bundled on disk */ |
53 |
> |
off_t fo; /* position in file */ |
54 |
|
} BEAMI; /* beam index */ |
55 |
|
|
56 |
|
typedef struct { |
57 |
< |
unsigned int4 nrm; /* number of beam rays bundled in memory */ |
57 |
> |
uint32 nrm; /* number of beam rays bundled in memory */ |
58 |
|
unsigned long tick; /* clock tick for LRU replacement */ |
59 |
|
} BEAM; /* followed by nrm RAYVAL's */ |
60 |
|
|
64 |
|
typedef struct { |
65 |
|
FVECT orig; /* prism origin (first) */ |
66 |
|
FVECT xv[3]; /* side vectors (second) */ |
67 |
< |
int2 grid[3]; /* grid resolution (third) */ |
67 |
> |
int16 grid[3]; /* grid resolution (third) */ |
68 |
|
} HDGRID; /* holodeck section grid (must match HOLO struct) */ |
69 |
|
|
70 |
|
typedef struct holo { |
71 |
|
FVECT orig; /* prism origin (first) */ |
72 |
|
FVECT xv[3]; /* side vectors (second) */ |
73 |
< |
int2 grid[3]; /* grid resolution (third) */ |
73 |
> |
int16 grid[3]; /* grid resolution (third) */ |
74 |
|
int fd; /* file descriptor */ |
75 |
< |
short dirty; /* beam index needs update to file */ |
75 |
> |
struct { |
76 |
> |
int s, n; /* dirty section start, length */ |
77 |
> |
} dirseg[MAXDIRSE+1]; /* dirty beam index segments */ |
78 |
> |
short dirty; /* number of dirty segments */ |
79 |
|
double tlin; /* linear range for depth encoding */ |
80 |
|
FVECT wg[3]; /* wall grid vectors (derived) */ |
71 |
– |
double wo[6]; /* wall grid offsets (derived) */ |
81 |
|
int wi[6]; /* wall super-indices (derived) */ |
82 |
|
char *priv; /* pointer to private client data */ |
83 |
|
BEAM **bl; /* beam pointers (memory cache) */ |
102 |
|
extern BEAM *hdgetbeam(); |
103 |
|
extern RAYVAL *hdnewrays(); |
104 |
|
extern unsigned hdmemuse(); |
105 |
< |
extern long hdfiluse(), hdfilen(), hdallocfrag(); |
105 |
> |
extern off_t hdfiluse(), hdfilen(), hdallocfrag(); |
106 |
|
extern double hdray(), hdinter(); |
107 |
|
extern unsigned hdcode(); |
108 |
|
extern int hdfilord(); |
109 |
|
|
110 |
+ |
#define FF_NEVER 0 /* never free fragments */ |
111 |
+ |
#define FF_WRITE 01 /* free fragment on write */ |
112 |
+ |
#define FF_ALLOC 02 /* free fragment on ray alloc */ |
113 |
+ |
#define FF_READ 04 /* free fragment on read */ |
114 |
+ |
#define FF_KILL 010 /* free fragment on beam kill */ |
115 |
+ |
|
116 |
+ |
extern int hdfragflags; /* tells when to free fragments */ |
117 |
|
extern unsigned hdcachesize; /* target cache size (bytes) */ |
118 |
|
extern unsigned long hdclock; /* holodeck system clock */ |
119 |
|
extern HOLO *hdlist[HDMAX+1]; /* holodeck pointers (NULL term.) */ |
130 |
|
|
131 |
|
#define HOLOFMT "Holodeck" /* file format identifier */ |
132 |
|
#define HOLOVERS 0 /* file format version number */ |
133 |
< |
#define HOLOMAGIC (323+sizeof(long)+8*HOLOVERS) /* file magic number */ |
133 |
> |
#define HOLOMAGIC (323+sizeof(off_t)+8*HOLOVERS) /* file magic number */ |
134 |
|
|
135 |
|
/* |
136 |
|
* A holodeck file consists of an information header terminated by a |
150 |
|
* in future versions, but we thought this would be best for paging speed |
151 |
|
* in our initial implementation. |
152 |
|
*/ |
153 |
+ |
|
154 |
+ |
|
155 |
+ |
#ifdef __cplusplus |
156 |
+ |
} |
157 |
+ |
#endif |
158 |
+ |
#endif /* _RAD_HOLO_H_ */ |
159 |
+ |
|