[37] | 1 | /********** shading - 3-d shading map **********/ |
---|
| 2 | |
---|
| 3 | /* Copyright 1990 by Marc Levoy - all rights reserved */ |
---|
| 4 | |
---|
| 5 | /* The following declarations show the layout of the .shd file. */ |
---|
| 6 | /* If changed, the version number must be incremented and code */ |
---|
| 7 | /* written to handle loading of both old and current versions. */ |
---|
| 8 | |
---|
| 9 | /* Version for new .shd files: */ |
---|
| 10 | #define SHD_CUR_VERSION 1 /* Initial release */ |
---|
| 11 | short shd_version; /* Version of this .shd file */ |
---|
| 12 | |
---|
| 13 | short shd_len[NM]; /* Size of this shading map */ |
---|
| 14 | |
---|
| 15 | long shd_length; /* Total number of shades & opacities in map */ |
---|
| 16 | /* (= (ICSIZE+1) * product of lens) */ |
---|
| 17 | PIXEL *shd_address; /* Pointer to shading map */ |
---|
| 18 | |
---|
| 19 | /* End of layout of .shd file. */ |
---|
| 20 | |
---|
| 21 | /* Subscripted access to shading map */ |
---|
| 22 | /* (ICSIZE+1 chars at each IX,IY,IZ) */ |
---|
| 23 | #define SHD_ADDRESS(IZ,IY,IX,C) (shd_address+\ |
---|
| 24 | (((IZ)*shd_len[Y]+(IY))*shd_len[X]+(IX))*\ |
---|
| 25 | (ICSIZE+1)+(C)) |
---|
| 26 | #define SHD(IZ,IY,IX,C) (*SHD_ADDRESS(IZ,IY,IX,C)) |
---|
| 27 | |
---|
| 28 | short out_shd_len[NM]; /* Size of output shading map */ |
---|
| 29 | long out_shd_length; /* Total number of shades & opacities in map */ |
---|
| 30 | PIXEL *out_shd_address; /* Pointer to map */ |
---|
| 31 | |
---|
| 32 | /* Subscripted access to output map */ |
---|
| 33 | #define OUT_SHD_ADDRESS(IZ,IY,IX,C) \ |
---|
| 34 | (out_shd_address+\ |
---|
| 35 | (((IZ)*out_shd_len[Y]+\ |
---|
| 36 | (IY))*out_shd_len[X]+\ |
---|
| 37 | (IX))*(ICSIZE+1)+(C)) |
---|
| 38 | #define OUT_SHD(IZ,IY,IX,C) (*OUT_SHD_ADDRESS(IZ,IY,IX,C)) |
---|
| 39 | |
---|
| 40 | short acc_shd_len[NM]; /* Size of 3-d shading accumulator */ |
---|
| 41 | long acc_shd_length; /* Total number of shades & opacities */ |
---|
| 42 | WPIXELSUM *acc_shd_address; /* Pointer to accumulator */ |
---|
| 43 | |
---|
| 44 | /* Subscripted access to accumulator */ |
---|
| 45 | #define ACC_SHD_ADDRESS(IZ,IY,IX,C) \ |
---|
| 46 | (acc_shd_address+\ |
---|
| 47 | (((IZ)*acc_shd_len[Y]+\ |
---|
| 48 | (IY))*acc_shd_len[X]+\ |
---|
| 49 | (IX))*(ICSIZE+1)+(C)) |
---|
| 50 | #define ACC_SHD(IZ,IY,IX,C) (*ACC_SHD_ADDRESS(IZ,IY,IX,C)) |
---|
| 51 | |
---|
| 52 | BOOLEAN shd_histogram_exists; /* True if histogram exists */ |
---|
| 53 | long shading_color_histogram[MAX_PIXEL+1]; /* Histogram of shading map */ |
---|
| 54 | long shading_opacity_histogram[MAX_PIXEL+1]; /* */ |
---|