00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "eggListTextures.h"
00016 #include "eggTextureCollection.h"
00017 #include "pnmImageHeader.h"
00018 #include "pystub.h"
00019
00020
00021
00022
00023
00024
00025 EggListTextures::
00026 EggListTextures() {
00027 set_program_description
00028 ("egg-list-textures reads an egg file and writes a list of the "
00029 "textures it references. It is particularly useful for building "
00030 "up the textures.txa file used for egg-palettize, since the output "
00031 "format is crafted to be compatible with that file's input format.");
00032 }
00033
00034
00035
00036
00037
00038
00039 void EggListTextures::
00040 run() {
00041 if (!do_reader_options()) {
00042 exit(1);
00043 }
00044
00045 EggTextureCollection tc;
00046 tc.find_used_textures(_data);
00047 EggTextureCollection::TextureReplacement treplace;
00048 tc.collapse_equivalent_textures(EggTexture::E_complete_filename, treplace);
00049 tc.sort_by_basename();
00050
00051 EggTextureCollection::iterator ti;
00052 for (ti = tc.begin(); ti != tc.end(); ++ti) {
00053 Filename fullpath = (*ti)->get_fullpath();
00054 PNMImageHeader header;
00055 if (header.read_header(fullpath)) {
00056 cout << fullpath.get_basename() << " : "
00057 << header.get_x_size() << " " << header.get_y_size() << "\n";
00058 } else {
00059 cout << fullpath.get_basename() << " : unknown\n";
00060 }
00061 }
00062 }
00063
00064
00065 int main(int argc, char *argv[]) {
00066
00067 pystub();
00068
00069 EggListTextures prog;
00070 prog.parse_command_line(argc, argv);
00071 prog.run();
00072 return 0;
00073 }