mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
add egg-list-textures
This commit is contained in:
parent
d122e0084b
commit
ae3fa2320d
@ -59,6 +59,9 @@ EggReader() {
|
|||||||
|
|
||||||
_tex_type = (PNMFileType *)NULL;
|
_tex_type = (PNMFileType *)NULL;
|
||||||
_delod = -1.0;
|
_delod = -1.0;
|
||||||
|
|
||||||
|
_got_tex_dirname = false;
|
||||||
|
_got_tex_extension = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -72,3 +72,11 @@
|
|||||||
eggToC.cxx eggToC.h
|
eggToC.cxx eggToC.h
|
||||||
|
|
||||||
#end bin_target
|
#end bin_target
|
||||||
|
|
||||||
|
#begin bin_target
|
||||||
|
#define TARGET egg-list-textures
|
||||||
|
|
||||||
|
#define SOURCES \
|
||||||
|
eggListTextures.cxx eggListTextures.h
|
||||||
|
|
||||||
|
#end bin_target
|
||||||
|
73
pandatool/src/eggprogs/eggListTextures.cxx
Normal file
73
pandatool/src/eggprogs/eggListTextures.cxx
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
// Filename: eggListTextures.cxx
|
||||||
|
// Created by: drose (23May05)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the Panda 3d
|
||||||
|
// Software license. You should have received a copy of this license
|
||||||
|
// along with this source code; you will also find a current copy of
|
||||||
|
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||||
|
//
|
||||||
|
// To contact the maintainers of this program write to
|
||||||
|
// panda3d-general@lists.sourceforge.net .
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "eggListTextures.h"
|
||||||
|
#include "eggTextureCollection.h"
|
||||||
|
#include "pnmImageHeader.h"
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: EggListTextures::Constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
EggListTextures::
|
||||||
|
EggListTextures() {
|
||||||
|
set_program_description
|
||||||
|
("egg-list-textures reads an egg file and writes a list of the "
|
||||||
|
"textures it references. It is particularly useful for building "
|
||||||
|
"up the textures.txa file used for egg-palettize, since the output "
|
||||||
|
"format is crafted to be compatible with that file's input format.");
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: EggListTextures::run
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void EggListTextures::
|
||||||
|
run() {
|
||||||
|
if (!do_reader_options()) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
EggTextureCollection tc;
|
||||||
|
tc.find_used_textures(_data);
|
||||||
|
EggTextureCollection::TextureReplacement treplace;
|
||||||
|
tc.collapse_equivalent_textures(EggTexture::E_complete_filename, treplace);
|
||||||
|
tc.sort_by_basename();
|
||||||
|
|
||||||
|
EggTextureCollection::iterator ti;
|
||||||
|
for (ti = tc.begin(); ti != tc.end(); ++ti) {
|
||||||
|
Filename fullpath = (*ti)->get_fullpath();
|
||||||
|
PNMImageHeader header;
|
||||||
|
if (header.read_header(fullpath)) {
|
||||||
|
cout << fullpath.get_basename() << " : "
|
||||||
|
<< header.get_x_size() << " " << header.get_y_size() << "\n";
|
||||||
|
} else {
|
||||||
|
cout << fullpath.get_basename() << " : unknown\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
EggListTextures prog;
|
||||||
|
prog.parse_command_line(argc, argv);
|
||||||
|
prog.run();
|
||||||
|
return 0;
|
||||||
|
}
|
39
pandatool/src/eggprogs/eggListTextures.h
Normal file
39
pandatool/src/eggprogs/eggListTextures.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
// Filename: eggListTextures.h
|
||||||
|
// Created by: drose (23May05)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the Panda 3d
|
||||||
|
// Software license. You should have received a copy of this license
|
||||||
|
// along with this source code; you will also find a current copy of
|
||||||
|
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||||
|
//
|
||||||
|
// To contact the maintainers of this program write to
|
||||||
|
// panda3d-general@lists.sourceforge.net .
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef EGGLISTTEXTURES_H
|
||||||
|
#define EGGLISTTEXTURES_H
|
||||||
|
|
||||||
|
#include "pandatoolbase.h"
|
||||||
|
|
||||||
|
#include "eggReader.h"
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Class : EggListTextures
|
||||||
|
// Description : Reads an egg file and outputs the list of textures it
|
||||||
|
// uses.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
class EggListTextures : public EggReader {
|
||||||
|
public:
|
||||||
|
EggListTextures();
|
||||||
|
|
||||||
|
void run();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user