source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/vrippack-0.31/src/march/levoy.c @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 7.0 KB
Line 
1From levoy@blueridge  Fri Nov  6 17:30:29 1992
2Received: from blueridge.stanford.edu by redclay.stanford.edu (920330.SGI/inc-1.0)
3        id AA20730; Fri, 6 Nov 92 17:30:29 -0800
4Received: by blueridge (920330.SGI/inc-1.0)
5        id AA10004; Fri, 6 Nov 92 17:23:44 -0800
6Date: Fri, 6 Nov 92 17:23:44 -0800
7From: levoy@blueridge.stanford.edu (Marc Levoy)
8Message-Id: <9211070123.AA10004@blueridge>
9To: turk@redclay.stanford.edu
10Subject: My .opc file format
11Status: RO
12
13NM = 3
14PIXEL is unsigned char
15Shorts and longs are VAX byte ordering!
16You can use my ~levoy/libs/file.c if you don't want to swap them yourself.
17To convert a .shd file into .opc:
18
19run my den program and type:
20        shd
21                load
22                        myfile (.shd is assumed)
23                sopc
24                        myfile (.opc is assumed)
25                return
26        quit
27
28I have the comb currently in cyb.shd in /kittyhawk/usr/voldata/cyb/test
29I have various versions of the blocks from splatted mesh points in blocks*.shd
30in /kittyhawk/usr/voldata/cyb/custom
31
32If you want to read my .den files, which don't require a shading step,
33I also enclose the format of those files.
34
35
36/********** opacity - 3-d opacity map **********/
37
38/* Copyright 1990 by Marc Levoy - all rights reserved */
39
40/* The following declarations show the layout of the .opc file.              */
41/* If changed, the version number must be incremented and code               */
42/* written to handle loading of both old and current versions.               */
43
44                                /* Version for new .opc files:               */
45#define OPC_CUR_VERSION 1       /*   Initial release                         */
46short opc_version;              /* Version of this .opc file                 */
47
48short opc_len[NM];              /* Size of this opacity map                  */
49
50long opc_length;                /* Total number of opacities in map          */
51                                /*   (= product of lens)                     */
52PIXEL *opc_address;             /* Pointer to opacity map                    */
53
54/* End of layout of .opc file.                                               */
55
56                                /* Subscripted access to opacity map         */
57                                /*   (1 char at each IX,IY,IZ)               */
58#define OPC_ADDRESS(IZ,IY,IX)   (opc_address+\
59                                 ((IZ)*opc_len[Y]+(IY))*opc_len[X]+(IX))
60#define OPC(IZ,IY,IX)           (*OPC_ADDRESS(IZ,IY,IX))
61
62short out_opc_len[NM];          /* Size of output opacity map                */
63long out_opc_length;            /* Total number of opacities in map          */
64PIXEL *out_opc_address;         /* Pointer to map                            */
65
66                                /* Subscripted access to output map          */
67#define OUT_OPC_ADDRESS(IZ,IY,IX)       \
68                                (out_opc_address+\
69                                 ((IZ)*out_opc_len[Y]+\
70                                  (IY))*out_opc_len[X]+\
71                                 (IX))
72#define OUT_OPC(IZ,IY,IX)       (*OUT_OPC_ADDRESS(IZ,IY,IX))
73
74short acc_opc_len[NM];          /* Size of 3-d opacity accumulator           */
75long acc_opc_length;            /* Total number of opacities                 */
76WPIXELSUM *acc_opc_address;     /* Pointer to accumulator                    */
77
78                                /* Subscripted access to accumulator         */
79#define ACC_OPC_ADDRESS(IZ,IY,IX)       \
80                                (acc_opc_address+\
81                                 ((IZ)*acc_opc_len[Y]+\
82                                  (IY))*acc_opc_len[X]+\
83                                 (IX))
84#define ACC_OPC(IZ,IY,IX)       (*ACC_OPC_ADDRESS(IZ,IY,IX))
85
86BOOLEAN opc_histogram_exists;                   /* True if histogram exists  */
87long opacity_histogram[MAX_PIXEL+1];            /* Histogram of opacity map  */
88
89short light_len[NM];            /* Size of light strength map                */
90long light_length;              /* Total number of strengths in map          */
91PIXEL *light_address;           /* Pointer to map                            */
92
93                                /* Subscripted access to light strength map  */
94#define LIGHT_ADDRESS(IZ,IY,IX) \
95                                (light_address+\
96                                 ((IZ)*light_len[Y]+\
97                                  (IY))*light_len[X]+\
98                                 (IX))
99#define LIGHT(IZ,IY,IX)         (*LIGHT_ADDRESS(IZ,IY,IX))
100
101
102
103-------------------------------------------------------
104
105
106
107
108Ignore orig and extr lens, just look at map_len[NM].
109DENSITY is unsigned char.
110
111
112/********** map - 3-d density map **********/
113
114/* Copyright 1990 by Marc Levoy - all rights reserved */
115
116/* The following declarations show the layout of the .den file.              */
117/* If changed, the version number must be incremented and code               */
118/* written to handle loading of both old and current versions.               */
119
120                                /* Version for new .den files:               */
121#define MAP_CUR_VERSION 1       /*   Initial release                         */
122short map_version;              /* Version of this .den file                 */
123
124short orig_min[NM],             /* Dimensions of original data file          */
125      orig_max[NM],             /*   (CT:  from <file>.header file           */
126      orig_len[NM];             /*    ED:  from <file>.mi file)              */
127
128short extr_min[NM],             /* Portion of file extracted for this map    */
129      extr_max[NM],             /*   (mins and maxes will be subset of       */
130      extr_len[NM];             /*    orig and lengths will be <= orig)      */
131
132short map_min[NM],              /* Dimensions of this map                    */
133      map_max[NM],              /*   (mins will be 0 in this program and     */
134      map_len[NM];              /*    lens may be != extr if warps > 0)      */
135
136short map_warps;                /* Number of warps since extraction          */
137                                /*   (0 = none)                              */
138
139long map_length;                /* Total number of densities in map          */
140                                /*   (= product of lens)                     */
141DENSITY *map_address;           /* Pointer to map                            */
142
143/* End of layout of .den file.                                               */
144
145                                /* Slow subscripted access to map            */
146                                /*   (assumes nothing about mins or sizeof)  */
147#define SLOW_MAP_ADDRESS(IZ,IY,IX)      \
148                                (map_address+\
149                                 ((((IZ)-map_min[Z])*map_len[Y]+\
150                                   ((IY)-map_min[Y]))*map_len[X]+\
151                                  ((IX)-map_min[X]))*\
152                                 sizeof(DENSITY))
153#define SLOW_MAP(IZ,IY,IX)      (*SLOW_MAP_ADDRESS(IZ,IY,IX))
154
155                                /* Fast subscripted access to map            */
156                                /*   (assumes mins = 0 and chars)            */
157#define MAP_ADDRESS(IZ,IY,IX)   (map_address+\
158                                 ((IZ)*map_len[Y]+(IY))*map_len[X]+(IX))
159#define MAP(IZ,IY,IX)           (*MAP_ADDRESS(IZ,IY,IX))
160
161short out_map_len[NM];          /* Size of output density map                */
162long out_map_length;            /* Total number of densities in map          */
163                                /*   (= product of lens)                     */
164DENSITY *out_map_address;       /* Pointer to map                            */
165
166                                /* Fast subscripted access to output map     */
167#define OUT_MAP_ADDRESS(IZ,IY,IX)       \
168                                (out_map_address+\
169                                 ((IZ)*out_map_len[Y]+\
170                                  (IY))*out_map_len[X]+\
171                                 (IX))
172#define OUT_MAP(IZ,IY,IX)       (*OUT_MAP_ADDRESS(IZ,IY,IX))
173
174short acc_map_len[NM];          /* Size of density accumulator               */
175long acc_map_length;            /* Total number of densities                 */
176WDENSITYSUM *acc_map_address;   /* Pointer to accumulator                    */
177
178                                /* Fast subscripted access to accumulator    */
179#define ACC_MAP_ADDRESS(IZ,IY,IX)       \
180                                (acc_map_address+\
181                                 ((IZ)*acc_map_len[Y]+\
182                                  (IY))*acc_map_len[X]+\
183                                 (IX))
184#define ACC_MAP(IZ,IY,IX)       (*ACC_MAP_ADDRESS(IZ,IY,IX))
185
186                                /* Cyberware point splatting code            */
187char splat_code;                /* One of {'A':add}                          */
188
189BOOLEAN map_histogram_exists;                   /* True if histogram exists  */
190long density_histogram[MAX_DENSITY+1];          /* Histogram of density map  */
191
Note: See TracBrowser for help on using the repository browser.