1 | /********************************************************************** <BR>
|
---|
2 | This file is part of Crack dot Com's free source code release of
|
---|
3 | Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
|
---|
4 | information about compiling & licensing issues visit this URL</a>
|
---|
5 | <PRE> If that doesn't help, contact Jonathan Clark at
|
---|
6 | golgotha_source@usa.net (Subject should have "GOLG" in it)
|
---|
7 | ***********************************************************************/
|
---|
8 |
|
---|
9 | #ifndef TEX_CACHE_HH
|
---|
10 | #define TEX_CACHE_HH
|
---|
11 |
|
---|
12 |
|
---|
13 | #include "palette/pal.hh"
|
---|
14 |
|
---|
15 | class i4_file_class;
|
---|
16 |
|
---|
17 | //very similar to mipheader.
|
---|
18 | //color,base_*,flags,num_mip_levels
|
---|
19 | //should match corresponding mipheader_t's
|
---|
20 |
|
---|
21 | //the format of the cache file is like this:
|
---|
22 | //the header
|
---|
23 | //the entries
|
---|
24 | //the entry lumps (a directory, basically)
|
---|
25 | //a sw32 that should == the size of the file
|
---|
26 | //(the last sw32 is to protect against corrupt cache files)
|
---|
27 |
|
---|
28 | inline w32 tex_cache_entry_disk_size()
|
---|
29 | {
|
---|
30 | return (4*4) + (2*2) + 2;
|
---|
31 | }
|
---|
32 |
|
---|
33 | class tex_cache_entry_t
|
---|
34 | {
|
---|
35 | public:
|
---|
36 | w32 id;
|
---|
37 | w32 lowmipoffset;
|
---|
38 | w32 average_color;
|
---|
39 | w32 last_modified;
|
---|
40 |
|
---|
41 | sw16 base_width;
|
---|
42 | sw16 base_height;
|
---|
43 |
|
---|
44 | w8 flags;
|
---|
45 | sw8 num_mip_levels;
|
---|
46 |
|
---|
47 | void write(i4_file_class *f);
|
---|
48 | void read(i4_file_class *f);
|
---|
49 | };
|
---|
50 |
|
---|
51 | inline sw32 tex_cache_header_disk_size()
|
---|
52 | {
|
---|
53 | i4_pixel_format blah;
|
---|
54 | return (blah.write(0) * 3 + 4*2);
|
---|
55 | }
|
---|
56 |
|
---|
57 | class tex_cache_header_t
|
---|
58 | {
|
---|
59 | enum {SQUARE_TEXTURES=1};
|
---|
60 |
|
---|
61 | public:
|
---|
62 | i4_pixel_format regular_format;
|
---|
63 | i4_pixel_format chroma_format;
|
---|
64 | i4_pixel_format alpha_format;
|
---|
65 | w32 max_mip_dimention;
|
---|
66 | w32 num_entries;
|
---|
67 | w8 flags;
|
---|
68 |
|
---|
69 | //not written
|
---|
70 | tex_cache_entry_t *entries;
|
---|
71 | void read(i4_file_class *f);
|
---|
72 | void write(i4_file_class *f);
|
---|
73 | };
|
---|
74 |
|
---|
75 | #endif
|
---|
76 |
|
---|
77 |
|
---|
78 |
|
---|
79 |
|
---|
80 |
|
---|