15 #include "palettizer.h" 17 #include "textureImage.h" 18 #include "pal_string_utils.h" 19 #include "paletteGroup.h" 20 #include "filenameUnifier.h" 21 #include "textureMemoryCounter.h" 24 #include "pnmFileTypeRegistry.h" 25 #include "pnmFileType.h" 28 #include "datagramIterator.h" 29 #include "bamReader.h" 30 #include "bamWriter.h" 40 int Palettizer::_pi_version = 20;
55 int Palettizer::_min_pi_version = 8;
58 int Palettizer::_read_pi_version = 0;
62 ostream &operator << (ostream &out, Palettizer::RemapUV remap) {
64 case Palettizer::RU_never:
65 return out <<
"never";
67 case Palettizer::RU_group:
68 return out <<
"per group";
70 case Palettizer::RU_poly:
71 return out <<
"per polygon";
73 case Palettizer::RU_invalid:
74 return out <<
"(invalid)";
77 return out <<
"**invalid**(" << (int)remap <<
")";
88 return a->get_name() < b->get_name();
110 _generated_image_pattern =
"%g_palette_%p_%i";
112 _shadow_dirname =
"shadow";
114 _omit_solitary =
false;
115 _omit_everything =
false;
116 _coverage_threshold = 2.5;
117 _aggressively_clean_mapdir =
true;
118 _force_power_2 =
true;
123 _pal_x_size = _pal_y_size = 512;
124 _background.set(0.0, 0.0, 0.0, 0.0);
125 _cutout_mode = EggRenderMode::AM_dual;
132 _remap_char_uv = RU_poly;
134 get_palette_group(
"null");
190 EggFiles::const_iterator efi;
191 for (efi = _egg_files.begin(); efi != _egg_files.end(); ++efi) {
192 (*efi).second->build_cross_links();
197 <<
" generated image pattern: " << _generated_image_pattern <<
"\n" 198 <<
" map directory: " << _map_dirname <<
"\n" 199 <<
" shadow directory: " 201 <<
" egg relative directory: " 203 <<
" palettize size: " << _pal_x_size <<
" by " << _pal_y_size <<
"\n" 204 <<
" background: " << _background <<
"\n" 205 <<
" margin: " << _margin <<
"\n" 206 <<
" coverage threshold: " << _coverage_threshold <<
"\n" 207 <<
" force textures to power of 2: " << yesno(_force_power_2) <<
"\n" 208 <<
" aggressively clean the map directory: " 209 << yesno(_aggressively_clean_mapdir) <<
"\n" 210 <<
" omit everything: " << yesno(_omit_everything) <<
"\n" 211 <<
" round UV area: " << yesno(_round_uvs) <<
"\n";
213 cout <<
" round UV area to nearest " << _round_unit <<
" with fuzz " 214 << _round_fuzz <<
"\n";
216 cout <<
" remap UV's: " << _remap_uv <<
"\n" 217 <<
" remap UV's for characters: " << _remap_char_uv <<
"\n";
218 cout <<
" alpha cutouts: " << _cutout_mode <<
" " << _cutout_ratio <<
"\n";
221 cout <<
" generate image files of type: " 222 << _color_type->get_suggested_extension();
224 cout <<
"," << _alpha_type->get_suggested_extension();
230 cout <<
" generate shadow palette files of type: " 231 << _shadow_color_type->get_suggested_extension();
233 cout <<
"," << _shadow_alpha_type->get_suggested_extension();
238 cout <<
"\ntexture source pathnames and assignments\n";
239 Textures::const_iterator ti;
240 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
243 cout <<
" " << texture->get_name() <<
":\n";
248 cout <<
"\negg files and textures referenced\n";
249 EggFiles::const_iterator ei;
250 for (ei = _egg_files.begin(); ei != _egg_files.end(); ++ei) {
251 EggFile *egg_file = (*ei).second;
259 Groups::const_iterator gi;
260 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
261 sorted_groups.push_back((*gi).second);
263 sort(sorted_groups.begin(), sorted_groups.end(),
266 cout <<
"\npalette groups\n";
268 for (si = sorted_groups.begin(); si != sorted_groups.end(); ++si) {
270 if (si != sorted_groups.begin()) {
273 cout <<
" " << group->get_name()
279 cout <<
"\ntextures\n";
280 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
285 cout <<
"\nsurprises\n";
286 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
289 cout <<
" " << texture->get_name() <<
"\n";
292 for (ei = _egg_files.begin(); ei != _egg_files.end(); ++ei) {
293 EggFile *egg_file = (*ei).second;
295 cout <<
" " << egg_file->get_name() <<
"\n";
314 Groups::const_iterator gi;
315 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
316 sorted_groups.push_back((*gi).second);
319 sort(sorted_groups.begin(), sorted_groups.end(),
325 for (si = sorted_groups.begin();
326 si != sorted_groups.end();
332 if (!placements.empty()) {
335 cout <<
"\n" << group->get_name() <<
", by itself:\n";
336 compute_statistics(cout, 2, placements);
341 if (complete.
size() > 1) {
344 if (complete_placements.size() != placements.size()) {
345 cout <<
"\n" << group->get_name()
346 <<
", with dependents (" << complete <<
"):\n";
347 compute_statistics(cout, 2, complete_placements);
353 cout <<
"\nOverall:\n";
354 compute_statistics(cout, 2, overall_placements);
371 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
381 if (!_txa_file.read(txa_file, txa_filename)) {
386 nout <<
"No valid output image file type available; cannot run.\n" 387 <<
"Use :imagetype command in .txa file.\n";
393 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
398 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
406 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
412 }
while (any_changed);
426 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
445 _command_line_textures.clear();
449 CommandLineEggs::const_iterator ei;
450 for (ei = _command_line_eggs.begin();
451 ei != _command_line_eggs.end();
459 _txa_file.match_egg(egg_file);
465 EggFiles::const_iterator efi;
466 for (efi = _egg_files.begin(); efi != _egg_files.end(); ++efi) {
467 (*efi).second->build_cross_links();
472 CommandLineTextures::iterator ti;
473 for (ti = _command_line_textures.begin();
474 ti != _command_line_textures.end();
478 if (force_texture_read || texture->
is_newer_than(state_filename)) {
489 _txa_file.match_texture(texture);
495 for (ti = _command_line_textures.begin();
496 ti != _command_line_textures.end();
506 for (efi = _egg_files.begin(); efi != _egg_files.end(); ++efi) {
507 (*efi).second->choose_placements();
512 for (ti = _command_line_textures.begin();
513 ti != _command_line_textures.end();
522 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
543 Textures::iterator ti;
544 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
551 CommandLineEggs::const_iterator ei;
552 for (ei = _command_line_eggs.begin();
553 ei != _command_line_eggs.end();
562 EggFiles::const_iterator efi;
563 for (efi = _egg_files.begin(); efi != _egg_files.end(); ++efi) {
564 EggFile *egg_file = (*efi).second;
566 _txa_file.match_egg(egg_file);
572 for (efi = _egg_files.begin(); efi != _egg_files.end(); ++efi) {
573 (*efi).second->build_cross_links();
578 (*efi).second->apply_properties_to_source();
583 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
585 if (force_texture_read || texture->
is_newer_than(state_filename)) {
591 _txa_file.match_texture(texture);
599 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
608 for (efi = _egg_files.begin(); efi != _egg_files.end(); ++efi) {
609 (*efi).second->choose_placements();
614 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
622 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
638 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
654 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
671 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
676 Textures::iterator ti;
677 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
701 EggFiles::iterator ei;
702 for (ei = _egg_files.begin(); ei != _egg_files.end(); ++ei) {
703 EggFile *egg_file = (*ei).second;
705 (egg_file->
is_stale() || redo_all)) {
707 invalid_eggs.push_back(ei);
719 for (ii = invalid_eggs.begin(); ii != invalid_eggs.end(); ++ii) {
720 EggFiles::iterator ei = (*ii);
721 EggFile *egg_file = (*ei).second;
725 nout <<
"Removing invalid egg file: " 736 _egg_files.erase(ei);
742 <<
"Some errors in egg files encountered.\n" 743 <<
"Re-run make install or make opt-pal to try to regenerate these.\n\n";
760 EggFiles::iterator ei;
761 for (ei = _egg_files.begin(); ei != _egg_files.end(); ++ei) {
762 EggFile *egg_file = (*ei).second;
766 bool read_ok = egg_file->
read_egg(_noabs);
768 nout <<
"Error! Unable to re-read egg file.\n";
796 EggFiles::iterator ei = _egg_files.find(name);
797 if (ei != _egg_files.end()) {
802 file->set_name(name);
803 _egg_files.insert(EggFiles::value_type(name, file));
816 EggFiles::iterator ei = _egg_files.find(name);
817 if (ei != _egg_files.end()) {
820 _egg_files.erase(ei);
837 _command_line_eggs.push_back(egg_file);
849 Groups::iterator gi = _groups.find(name);
850 if (gi != _groups.end()) {
855 group->set_name(name);
856 _groups.insert(Groups::value_type(name, group));
869 Groups::const_iterator gi = _groups.find(name);
870 if (gi != _groups.end()) {
885 PaletteGroup *default_group = get_palette_group(_default_groupname);
886 if (!_default_groupdir.empty() && !default_group->
has_dirname()) {
889 return default_group;
905 Textures::iterator ti = _textures.find(name);
906 if (ti != _textures.end()) {
912 string downcase_name = downcase(name);
913 ti = _textures.find(downcase_name);
914 if (ti != _textures.end()) {
919 image->set_name(name);
921 _textures.insert(Textures::value_type(downcase_name, image));
932 const char *Palettizer::
934 return flag ?
"yes" :
"no";
946 if (str ==
"never") {
949 }
else if (str ==
"group") {
952 }
else if (str ==
"poly") {
968 compute_statistics(ostream &out,
int indent_level,
972 Placements::const_iterator pi;
973 for (pi = placements.begin(); pi != placements.end(); ++pi) {
978 counter.
report(out, indent_level);
990 register_factory(get_class_type(), make_Palettizer);
1005 datagram.
add_string(_generated_image_pattern);
1017 datagram.
add_bool(_omit_everything);
1020 datagram.
add_bool(_aggressively_clean_mapdir);
1025 datagram.
add_int32((
int)_remap_char_uv);
1035 EggFiles::const_iterator ei;
1036 for (ei = _egg_files.begin(); ei != _egg_files.end(); ++ei) {
1044 Groups::const_iterator gi;
1045 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
1050 Textures::const_iterator ti;
1051 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
1070 DCAST_INTO_R(_color_type, p_list[index], index);
1075 DCAST_INTO_R(_alpha_type, p_list[index], index);
1080 DCAST_INTO_R(_shadow_color_type, p_list[index], index);
1085 DCAST_INTO_R(_shadow_alpha_type, p_list[index], index);
1090 for (i = 0; i < _num_egg_files; i++) {
1092 DCAST_INTO_R(egg_file, p_list[index], index);
1093 _egg_files.insert(EggFiles::value_type(egg_file->get_name(), egg_file));
1097 for (i = 0; i < _num_groups; i++) {
1099 DCAST_INTO_R(group, p_list[index], index);
1100 _groups.insert(Groups::value_type(group->get_name(), group));
1104 for (i = 0; i < _num_textures; i++) {
1106 DCAST_INTO_R(texture, p_list[index], index);
1108 string name = downcase(texture->get_name());
1109 pair<Textures::iterator, bool> result = _textures.insert(Textures::value_type(name, texture));
1110 if (!result.second) {
1113 _texture_conflicts.push_back(texture);
1134 TextureConflicts::iterator ci;
1135 for (ci = _texture_conflicts.begin();
1136 ci != _texture_conflicts.end();
1139 string downcase_name = downcase(texture_b->get_name());
1141 Textures::iterator ti = _textures.find(downcase_name);
1142 nassertv(ti != _textures.end());
1144 _textures.erase(ti);
1146 if (!texture_b->
is_used() || !texture_a->is_used()) {
1149 if (texture_a->is_used()) {
1150 bool inserted1 = _textures.insert(Textures::value_type(downcase_name, texture_a)).second;
1151 nassertd(inserted1) { }
1153 }
else if (texture_b->
is_used()) {
1154 bool inserted2 = _textures.insert(Textures::value_type(downcase_name, texture_b)).second;
1155 nassertd(inserted2) { }
1160 nout <<
"Texture name conflict: \"" << texture_a->get_name()
1161 <<
"\" vs. \"" << texture_b->get_name() <<
"\"\n";
1162 if (texture_a->get_name() != downcase_name &&
1163 texture_b->get_name() != downcase_name) {
1165 bool inserted1 = _textures.insert(Textures::value_type(downcase_name, texture_a)).second;
1166 bool inserted2 = _textures.insert(Textures::value_type(texture_b->get_name(), texture_b)).second;
1167 nassertd(inserted1 && inserted2) { }
1171 bool inserted1 = _textures.insert(Textures::value_type(texture_a->get_name(), texture_a)).second;
1172 bool inserted2 = _textures.insert(Textures::value_type(texture_b->get_name(), texture_b)).second;
1173 nassertd(inserted1 && inserted2) { }
1194 parse_params(params, scan, manager);
1195 me->fillin(scan, manager);
1213 if (_read_pi_version > _pi_version || _read_pi_version < _min_pi_version) {
1218 if (_read_pi_version >= 12) {
1219 _generated_image_pattern = scan.
get_string();
1227 if (_read_pi_version >= 13) {
1235 if (_read_pi_version >= 14) {
1236 _omit_everything = scan.
get_bool();
1240 _aggressively_clean_mapdir = scan.
get_bool();
1245 _remap_char_uv = (RemapUV)scan.
get_int32();
1246 if (_read_pi_version >= 16) {
1247 _cutout_mode = (EggRenderMode::AlphaMode)scan.
get_uint8();
bool is_valid() const
Returns true if the palette information file was read correctly, or false if there was some error and...
void setup_shadow_images()
Ensures that each PaletteImage's _shadow_image has the correct filename and image types...
void report_statistics() const
Output a report of the palettization effectiveness, texture memory utilization, and so on...
static Filename make_bam_filename(Filename filename)
Returns a new filename that's made relative to the bam file itself, suitable for writing to the bam f...
void write_image_info(ostream &out, int indent_level=0) const
Writes a list of the PaletteImages associated with this group, and all of their textures, to the indicated output stream.
void update_unknown_textures(const TxaFile &txa_file)
Checks for new information on any textures within the group for which some of the saved information i...
void add_uint8(PN_uint8 value)
Adds an unsigned 8-bit integer to the datagram.
void post_txa_file()
Once the egg file has been matched against all of the matching lines the .txa file, do whatever adjustment is necessary.
bool get_bool()
Extracts a boolean value.
void add_string(const string &str)
Adds a variable-length string to the datagram.
void pre_txa_file()
Updates any internal state prior to reading the .txa file.
void scan_textures()
Scans the egg file for texture references and updates the _textures list appropriately.
void add_float64(PN_float64 value)
Adds a 64-bit floating-point number to the datagram.
void optimal_resize()
Attempts to resize each PalettteImage down to its smallest possible size.
void place_all()
Once all the textures have been assigned to this group, try to place them all onto suitable PaletteIm...
PaletteGroup * test_palette_group(const string &name) const
Returns the PaletteGroup with the given name.
bool get_noabs() const
Returns the current setting of the noabs flag.
bool is_newer_than(const Filename &reference_filename)
Returns true if the source image is newer than the indicated file, false otherwise.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
void clear_source_basic_properties()
Calls clear_basic_properties() on each source texture image used by this texture, to reset the proper...
This is the main engine behind egg-palettize.
bool had_data() const
Returns true if the EggData for this EggFile has ever been loaded in this session.
Base class for objects that can be written to and read from Bam files.
void process_all(bool force_texture_read, const Filename &state_filename)
Reprocesses all textures known.
void determine_placement_size()
Calls determine_size() on each TexturePlacement for the texture, to ensure that each TexturePlacement...
This is the highest level of grouping for TextureImages.
This is the base class of a family of classes that represent particular image file types that PNMImag...
const Filename & get_source_filename() const
Returns the filename this egg file was read from.
void remove_egg()
Removes this egg file from all things that reference it, in preparation for removing it from the data...
void pre_txa_file()
Does some processing prior to scanning the .txa file.
bool read_egg(bool noabs)
Reads in the egg file from its _source_filename.
virtual void finalize(BamReader *manager)
Called by the BamReader to perform any final actions needed for setting up the object after all objec...
size_type size() const
Returns the number of elements in the set.
EggFile * get_egg_file(const string &name)
Returns the EggFile with the given name.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
void write_source_pathnames(ostream &out, int indent_level=0) const
Writes the list of source pathnames that might contribute to this texture to the indicated output str...
PN_int32 get_int32()
Extracts a signed 32-bit integer.
PN_uint8 get_uint8()
Extracts an unsigned 8-bit integer.
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object, in preparation for writing to a Bam file.
bool remove_egg_file(const string &name)
Removes the named egg file from the database, if it exists.
string get_string()
Extracts a variable-length string.
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class's make_from_bam() method to read in all...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
static PNMFileTypeRegistry * get_global_ptr()
Returns a pointer to the global PNMFileTypeRegistry object.
void reset_dependency_level()
Unconditionally sets the dependency level and order of this group to zero, in preparation for a later...
void read_txa_file(istream &txa_file, const string &txa_filename)
Reads in the .txa file and keeps it ready for matching textures and egg files.
This is our own Panda specialization on the default STL vector.
void choose_placements()
Once all the textures have been assigned to groups (but before they may actually be placed)...
bool is_used() const
Returns true if this particular texture has been placed somewhere, anywhere, or false if it is not us...
void report(ostream &out, int indent_level)
Reports the measured texture memory usage.
void release_egg_data()
Releases the memory that was loaded by a previous call to read_egg().
void add_bool(bool value)
Adds a boolean value to the datagram.
static Filename make_user_filename(Filename filename)
Returns a new filename that's made relative to the current directory, suitable for reporting to the u...
static RemapUV string_remap(const string &str)
Returns the RemapUV code corresponding to the indicated string, or RU_invalid if the string is invali...
void read_header()
Causes the header part of the image to be reread, usually to confirm that its image properties (size...
bool write_egg()
Writes out the egg file to its _dest_filename.
void report_pi() const
Output a verbose description of all the palettization information to standard output, for the user's perusal.
The name of a file, such as a texture file or an Egg file.
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin()...
void all_params_set()
Called after all command line parameters have been set up, this is a hook to do whatever initializati...
void update_egg()
Once all textures have been placed appropriately, updates the egg file with all the information to re...
void read_pointers(DatagramIterator &scan, int count)
A convenience function to read a contiguous list of pointers.
static Filename get_bam_filename(Filename filename)
Returns an absolute pathname based on the given relative pathname, presumably read from the bam file ...
bool has_data() const
Returns true if the EggData for this EggFile has been loaded, and not yet released.
void reset_images()
Throws away all of the current PaletteImages, so that new ones may be created (and the packing made m...
bool write_eggs()
Adjusts the egg files to reference the newly generated textures, and writes them out.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
void copy_unplaced(bool redo_all)
Copies the texture to whichever destination directories are appropriate for the groups in which it ha...
void add_placement(TexturePlacement *placement)
Adds the indicated TexturePlacement to the counter.
This corresponds to a particular assignment of a TextureImage with a PaletteGroup, and specifically describes which PaletteImage (if any), and where on the PaletteImage, the TextureImage has been assigned to.
bool unlink() const
Permanently deletes the file associated with the filename, if possible.
void generate_images(bool redo_all)
Actually generates the appropriate palette and unplaced texture images into the map directories...
void update_images(bool redo_all)
Regenerates each PaletteImage on this group that needs it.
void register_finalize(TypedWritable *whom)
Should be called by an object reading itself from the Bam file to indicate that this particular objec...
void assign_groups()
Assigns the texture to all of the PaletteGroups the various egg files that use it need...
void process_command_line_eggs(bool force_texture_read, const Filename &state_filename)
Processes all the textures named in the _command_line_eggs, placing them on the appropriate palettes ...
void set_noabs(bool noabs)
Changes the current setting of the noabs flag.
PNMFileType * get_type_from_extension(const string &filename) const
Tries to determine what the PNMFileType is likely to be for a particular image file based on its exte...
bool is_surprise() const
Returns true if this particular texture is a 'surprise', i.e.
bool is_surprise() const
Returns true if this particular egg file is a 'surprise', i.e.
void set_dependency_level(int level)
Sets the dependency level of this group to the indicated level, provided that level is not lower than...
bool is_stale() const
Returns true if the egg file needs to be updated, i.e.
void make_complete(const PaletteGroups &a)
Completes the set with the transitive closure of all dependencies: for each PaletteGroup already in t...
void set_dirname(const string &dirname)
Sets the directory name associated with the palette group.
This class is used to gather statistics on texture memory usage, etc.
void mark_texture_named()
Indicates that this particular texture has been named by the user for processing this session...
void reset_images()
Throws away all of the current PaletteImages, so that new ones may be created (and the packing made m...
PN_float64 get_float64()
Extracts a 64-bit floating-point number.
bool set_dependency_order()
Updates the dependency order of this group.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
const PNMImage & read_source_image()
Reads in the original image, if it has not already been read, and returns it.
void write_scale_info(ostream &out, int indent_level=0)
Writes the information about the texture's size and placement.
void write_texture_refs(ostream &out, int indent_level=0) const
Writes the list of texture references to the indicated output stream, one per line.
bool has_dirname() const
Returns true if the directory name has been explicitly set for this group.
static void register_with_read_factory()
Registers the current object as something that can be read from a Bam file.
bool is_preferred_over(const PaletteGroup &other) const
Returns true if this group should be preferred for adding textures over the other group...
void get_textures(pset< TextureImage *> &result) const
Fills up the indicated set with the set of textures referenced by this egg file.
PaletteGroup * get_default_group()
Returns the default group to which an egg file should be assigned if it is not mentioned in the ...
void add_int32(PN_int32 value)
Adds a signed 32-bit integer to the datagram.
A class to retrieve the individual data elements previously stored in a Datagram. ...
This represents a single source texture that is referenced by one or more egg files.
void post_txa_file()
Once the .txa file has been read and the TextureImage matched against it, considers applying the requ...
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Called after the object is otherwise completely read from a Bam file, this function's job is to store...
void optimal_resize()
Attempts to resize each PalettteImage down to its smallest possible size.
TypeHandle is the identifier used to differentiate C++ class types.
bool read_stale_eggs(bool redo_all)
Reads in any egg file that is known to be stale, even if it was not listed on the command line...
void add_command_line_egg(EggFile *egg_file)
Adds the indicated EggFile to the list of eggs that are considered to have been read on the command l...
void write_description(ostream &out, int indent_level=0) const
Writes a one-line description of the egg file and its group assignments to the indicated output strea...
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
TextureImage * get_texture(const string &name)
Returns the TextureImage with the given name.
PaletteGroup * get_palette_group(const string &name)
Returns the PaletteGroup with the given name.
const PaletteGroups & get_groups() const
Returns the set of groups this group depends on.
void get_complete_placements(pvector< TexturePlacement *> &placements) const
Adds the set of TexturePlacements associated with this group and all dependent groups to the indicate...
void clear_depends()
Eliminates all the dependency information for this group.
void get_placements(pvector< TexturePlacement *> &placements) const
Adds the set of TexturePlacements associated with this group to the indicated vector.
bool exists() const
Returns true if the filename exists on the disk, false otherwise.
int get_dependency_order() const
Returns the dependency order of this group.
This represents a single egg file known to the palettizer.
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.
void read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.
static void set_rel_dirname(const Filename &rel_dirname)
Sets the name of the directory that texture filenames will be written relative to, when generating egg files.
void release_source_image()
Frees the memory that was allocated by a previous call to read_source_image().