42 int Palettizer::_pi_version = 20;
59 int Palettizer::_min_pi_version = 8;
62 int Palettizer::_read_pi_version = 0;
66 std::ostream &operator << (std::ostream &out, Palettizer::RemapUV remap) {
68 case Palettizer::RU_never:
69 return out <<
"never";
71 case Palettizer::RU_group:
72 return out <<
"per group";
74 case Palettizer::RU_poly:
75 return out <<
"per polygon";
77 case Palettizer::RU_invalid:
78 return out <<
"(invalid)";
81 return out <<
"**invalid**(" << (int)remap <<
")";
86 class SortGroupsByDependencyOrder {
92 return a->get_name() < b->get_name();
97 class SortGroupsByPreference {
112 _generated_image_pattern =
"%g_palette_%p_%i";
114 _shadow_dirname =
"shadow";
116 _omit_solitary =
false;
117 _omit_everything =
false;
118 _coverage_threshold = 2.5;
119 _aggressively_clean_mapdir =
true;
120 _force_power_2 =
true;
122 _alpha_type =
nullptr;
123 _shadow_color_type =
nullptr;
124 _shadow_alpha_type =
nullptr;
125 _pal_x_size = _pal_y_size = 512;
126 _background.set(0.0, 0.0, 0.0, 0.0);
127 _cutout_mode = EggRenderMode::AM_dual;
134 _remap_char_uv = RU_poly;
179 EggFiles::const_iterator efi;
180 for (efi = _egg_files.begin(); efi != _egg_files.end(); ++efi) {
181 (*efi).second->build_cross_links();
186 <<
" generated image pattern: " << _generated_image_pattern <<
"\n" 187 <<
" map directory: " << _map_dirname <<
"\n" 188 <<
" shadow directory: " 190 <<
" egg relative directory: " 192 <<
" palettize size: " << _pal_x_size <<
" by " << _pal_y_size <<
"\n" 193 <<
" background: " << _background <<
"\n" 194 <<
" margin: " << _margin <<
"\n" 195 <<
" coverage threshold: " << _coverage_threshold <<
"\n" 196 <<
" force textures to power of 2: " << yesno(_force_power_2) <<
"\n" 197 <<
" aggressively clean the map directory: " 198 << yesno(_aggressively_clean_mapdir) <<
"\n" 199 <<
" omit everything: " << yesno(_omit_everything) <<
"\n" 200 <<
" round UV area: " << yesno(_round_uvs) <<
"\n";
202 cout <<
" round UV area to nearest " << _round_unit <<
" with fuzz " 203 << _round_fuzz <<
"\n";
205 cout <<
" remap UV's: " << _remap_uv <<
"\n" 206 <<
" remap UV's for characters: " << _remap_char_uv <<
"\n";
207 cout <<
" alpha cutouts: " << _cutout_mode <<
" " << _cutout_ratio <<
"\n";
209 if (_color_type !=
nullptr) {
210 cout <<
" generate image files of type: " 212 if (_alpha_type !=
nullptr) {
218 if (_shadow_color_type !=
nullptr) {
219 cout <<
" generate shadow palette files of type: " 221 if (_shadow_alpha_type !=
nullptr) {
227 cout <<
"\ntexture source pathnames and assignments\n";
228 Textures::const_iterator ti;
229 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
232 cout <<
" " << texture->get_name() <<
":\n";
237 cout <<
"\negg files and textures referenced\n";
238 EggFiles::const_iterator ei;
239 for (ei = _egg_files.begin(); ei != _egg_files.end(); ++ei) {
240 EggFile *egg_file = (*ei).second;
248 Groups::const_iterator gi;
249 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
250 sorted_groups.push_back((*gi).second);
252 sort(sorted_groups.begin(), sorted_groups.end(),
253 SortGroupsByPreference());
255 cout <<
"\npalette groups\n";
257 for (si = sorted_groups.begin(); si != sorted_groups.end(); ++si) {
259 if (si != sorted_groups.begin()) {
262 cout <<
" " << group->get_name()
269 cout <<
"\ntextures\n";
270 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
275 cout <<
"\nsurprises\n";
276 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
279 cout <<
" " << texture->get_name() <<
"\n";
282 for (ei = _egg_files.begin(); ei != _egg_files.end(); ++ei) {
283 EggFile *egg_file = (*ei).second;
285 cout <<
" " << egg_file->get_name() <<
"\n";
302 Groups::const_iterator gi;
303 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
304 sorted_groups.push_back((*gi).second);
307 sort(sorted_groups.begin(), sorted_groups.end(),
308 SortGroupsByDependencyOrder());
313 for (si = sorted_groups.begin();
314 si != sorted_groups.end();
320 if (!placements.empty()) {
323 cout <<
"\n" << group->get_name() <<
", by itself:\n";
324 compute_statistics(cout, 2, placements);
329 if (complete.
size() > 1) {
332 if (complete_placements.size() != placements.size()) {
333 cout <<
"\n" << group->get_name()
334 <<
", with dependents (" << complete <<
"):\n";
335 compute_statistics(cout, 2, complete_placements);
341 cout <<
"\nOverall:\n";
342 compute_statistics(cout, 2, overall_placements);
357 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
364 _shadow_color_type =
nullptr;
365 _shadow_alpha_type =
nullptr;
367 if (!_txa_file.
read(txa_file, txa_filename)) {
371 if (_color_type ==
nullptr) {
372 nout <<
"No valid output image file type available; cannot run.\n" 373 <<
"Use :imagetype command in .txa file.\n";
379 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
384 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
392 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
398 }
while (any_changed);
409 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
424 _command_line_textures.clear();
427 CommandLineEggs::const_iterator ei;
428 for (ei = _command_line_eggs.begin();
429 ei != _command_line_eggs.end();
443 EggFiles::const_iterator efi;
444 for (efi = _egg_files.begin(); efi != _egg_files.end(); ++efi) {
445 (*efi).second->build_cross_links();
450 CommandLineTextures::iterator ti;
451 for (ti = _command_line_textures.begin();
452 ti != _command_line_textures.end();
456 if (force_texture_read || texture->
is_newer_than(state_filename)) {
473 for (ti = _command_line_textures.begin();
474 ti != _command_line_textures.end();
484 for (efi = _egg_files.begin(); efi != _egg_files.end(); ++efi) {
485 (*efi).second->choose_placements();
490 for (ti = _command_line_textures.begin();
491 ti != _command_line_textures.end();
500 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
518 Textures::iterator ti;
519 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
525 CommandLineEggs::const_iterator ei;
526 for (ei = _command_line_eggs.begin();
527 ei != _command_line_eggs.end();
536 EggFiles::const_iterator efi;
537 for (efi = _egg_files.begin(); efi != _egg_files.end(); ++efi) {
538 EggFile *egg_file = (*efi).second;
546 for (efi = _egg_files.begin(); efi != _egg_files.end(); ++efi) {
547 (*efi).second->build_cross_links();
551 (*efi).second->apply_properties_to_source();
556 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
558 if (force_texture_read || texture->
is_newer_than(state_filename)) {
572 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
581 for (efi = _egg_files.begin(); efi != _egg_files.end(); ++efi) {
582 (*efi).second->choose_placements();
587 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
595 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
608 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
621 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
635 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
640 Textures::iterator ti;
641 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
661 EggFiles::iterator ei;
662 for (ei = _egg_files.begin(); ei != _egg_files.end(); ++ei) {
663 EggFile *egg_file = (*ei).second;
665 (egg_file->
is_stale() || redo_all)) {
667 invalid_eggs.push_back(ei);
679 for (ii = invalid_eggs.begin(); ii != invalid_eggs.end(); ++ii) {
680 EggFiles::iterator ei = (*ii);
681 EggFile *egg_file = (*ei).second;
685 nout <<
"Removing invalid egg file: " 696 _egg_files.erase(ei);
702 <<
"Some errors in egg files encountered.\n" 703 <<
"Re-run make install or make opt-pal to try to regenerate these.\n\n";
717 EggFiles::iterator ei;
718 for (ei = _egg_files.begin(); ei != _egg_files.end(); ++ei) {
719 EggFile *egg_file = (*ei).second;
723 bool read_ok = egg_file->
read_egg(_noabs);
725 nout <<
"Error! Unable to re-read egg file.\n";
750 EggFiles::iterator ei = _egg_files.find(name);
751 if (ei != _egg_files.end()) {
756 file->set_name(name);
757 _egg_files.insert(EggFiles::value_type(name, file));
767 EggFiles::iterator ei = _egg_files.find(name);
768 if (ei != _egg_files.end()) {
771 _egg_files.erase(ei);
785 _command_line_eggs.push_back(egg_file);
794 Groups::iterator gi = _groups.find(name);
795 if (gi != _groups.end()) {
800 group->set_name(name);
801 _groups.insert(Groups::value_type(name, group));
811 Groups::const_iterator gi = _groups.find(name);
812 if (gi != _groups.end()) {
826 if (!_default_groupdir.empty() && !default_group->
has_dirname()) {
829 return default_group;
841 Textures::iterator ti = _textures.find(name);
842 if (ti != _textures.end()) {
848 string downcase_name =
downcase(name);
849 ti = _textures.find(downcase_name);
850 if (ti != _textures.end()) {
855 image->set_name(name);
857 _textures.insert(Textures::value_type(downcase_name, image));
866 const char *Palettizer::
868 return flag ?
"yes" :
"no";
877 if (str ==
"never") {
880 }
else if (str ==
"group") {
883 }
else if (str ==
"poly") {
896 compute_statistics(std::ostream &out,
int indent_level,
900 Placements::const_iterator pi;
901 for (pi = placements.begin(); pi != placements.end(); ++pi) {
906 counter.
report(out, indent_level);
915 register_factory(get_class_type(), make_Palettizer);
927 datagram.
add_string(_generated_image_pattern);
939 datagram.
add_bool(_omit_everything);
942 datagram.
add_bool(_aggressively_clean_mapdir);
957 EggFiles::const_iterator ei;
958 for (ei = _egg_files.begin(); ei != _egg_files.end(); ++ei) {
965 Groups::const_iterator gi;
966 for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
971 Textures::const_iterator ti;
972 for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
987 if (p_list[index] !=
nullptr) {
988 DCAST_INTO_R(_color_type, p_list[index], index);
992 if (p_list[index] !=
nullptr) {
993 DCAST_INTO_R(_alpha_type, p_list[index], index);
997 if (p_list[index] !=
nullptr) {
998 DCAST_INTO_R(_shadow_color_type, p_list[index], index);
1002 if (p_list[index] !=
nullptr) {
1003 DCAST_INTO_R(_shadow_alpha_type, p_list[index], index);
1008 for (i = 0; i < _num_egg_files; i++) {
1010 DCAST_INTO_R(egg_file, p_list[index], index);
1011 _egg_files.insert(EggFiles::value_type(egg_file->get_name(), egg_file));
1015 for (i = 0; i < _num_groups; i++) {
1017 DCAST_INTO_R(group, p_list[index], index);
1018 _groups.insert(Groups::value_type(group->get_name(), group));
1022 for (i = 0; i < _num_textures; i++) {
1024 DCAST_INTO_R(texture, p_list[index], index);
1026 string name =
downcase(texture->get_name());
1027 std::pair<Textures::iterator, bool> result = _textures.insert(Textures::value_type(name, texture));
1028 if (!result.second) {
1031 _texture_conflicts.push_back(texture);
1050 TextureConflicts::iterator ci;
1051 for (ci = _texture_conflicts.begin();
1052 ci != _texture_conflicts.end();
1055 string downcase_name =
downcase(texture_b->get_name());
1057 Textures::iterator ti = _textures.find(downcase_name);
1058 nassertv(ti != _textures.end());
1060 _textures.erase(ti);
1062 if (!texture_b->
is_used() || !texture_a->is_used()) {
1065 if (texture_a->is_used()) {
1066 bool inserted1 = _textures.insert(Textures::value_type(downcase_name, texture_a)).second;
1067 nassertd(inserted1) { }
1069 }
else if (texture_b->
is_used()) {
1070 bool inserted2 = _textures.insert(Textures::value_type(downcase_name, texture_b)).second;
1071 nassertd(inserted2) { }
1076 nout <<
"Texture name conflict: \"" << texture_a->get_name()
1077 <<
"\" vs. \"" << texture_b->get_name() <<
"\"\n";
1078 if (texture_a->get_name() != downcase_name &&
1079 texture_b->get_name() != downcase_name) {
1081 bool inserted1 = _textures.insert(Textures::value_type(downcase_name, texture_a)).second;
1082 bool inserted2 = _textures.insert(Textures::value_type(texture_b->get_name(), texture_b)).second;
1083 nassertd(inserted1 && inserted2) { }
1087 bool inserted1 = _textures.insert(Textures::value_type(texture_a->get_name(), texture_a)).second;
1088 bool inserted2 = _textures.insert(Textures::value_type(texture_b->get_name(), texture_b)).second;
1089 nassertd(inserted1 && inserted2) { }
1108 me->fillin(scan, manager);
1123 if (_read_pi_version > _pi_version || _read_pi_version < _min_pi_version) {
1128 if (_read_pi_version >= 12) {
1129 _generated_image_pattern = scan.
get_string();
1137 if (_read_pi_version >= 13) {
1145 if (_read_pi_version >= 14) {
1146 _omit_everything = scan.
get_bool();
1150 _aggressively_clean_mapdir = scan.
get_bool();
1155 _remap_char_uv = (RemapUV)scan.
get_int32();
1156 if (_read_pi_version >= 16) {
1157 _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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
static RemapUV string_remap(const std::string &str)
Returns the RemapUV code corresponding to the indicated string, or RU_invalid if the string is invali...
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...
PaletteGroup * get_palette_group(const std::string &name)
Returns the PaletteGroup with the given name.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void post_txa_file()
Once the egg file has been matched against all of the matching lines the .txa file,...
PaletteGroup * test_palette_group(const std::string &name) const
Returns the PaletteGroup with the given name.
bool get_bool()
Extracts a boolean value.
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.
uint8_t get_uint8()
Extracts an unsigned 8-bit integer.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void add_float64(PN_float64 value)
Adds a 64-bit floating-point number to the datagram.
bool match_egg(EggFile *egg_file) const
Searches for a matching line in the .txa file for the given egg file and applies its specifications.
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...
TextureImage * get_texture(const std::string &name)
Returns the TextureImage 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 write_description(std::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...
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.
void write_scale_info(std::ostream &out, int indent_level=0)
Writes the information about the texture's size and placement.
get_suggested_extension
Returns a suitable filename extension (without a leading dot) to suggest for files of this type,...
bool had_data() const
Returns true if the EggData for this EggFile has ever been loaded in this session.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
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.
void report(std::ostream &out, int indent_level)
Reports the measured texture memory usage.
string downcase(const string &s)
Returns the input string with all uppercase letters converted to lowercase.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool remove_egg_file(const std::string &name)
Removes the named egg file from the database, if it exists.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
int32_t get_int32()
Extracts a signed 32-bit integer.
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object,...
std::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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 get_textures(pset< TextureImage * > &result) const
Fills up the indicated set with the set of textures referenced by this egg file.
bool read(std::istream &in, const std::string &filename)
Reads the indicated stream, and returns true if successful, or false if there is an error.
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),...
void read_txa_file(std::istream &txa_file, const std::string &txa_filename)
Reads in the .txa file and keeps it ready for matching textures and egg files.
bool is_used() const
Returns true if this particular texture has been placed somewhere, anywhere, or false if it is not us...
void release_egg_data()
Releases the memory that was loaded by a previous call to read_egg().
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
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...
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,...
The name of a file, such as a texture file or an Egg file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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().
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void add_string(const std::string &str)
Adds a variable-length string to the datagram.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This corresponds to a particular assignment of a TextureImage with a PaletteGroup,...
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 std::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 write_source_pathnames(std::ostream &out, int indent_level=0) const
Writes the list of source pathnames that might contribute to this texture to the indicated output str...
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 set_dirname(const std::string &dirname)
Sets the directory name associated with the palette group.
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.
void get_placements(pvector< TexturePlacement * > &placements) const
Adds the set of TexturePlacements associated with this group to the indicated vector.
void add_int32(int32_t value)
Adds a signed 32-bit integer to the datagram.
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.
bool read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.
bool has_dirname() const
Returns true if the directory name has been explicitly set for this group.
void get_complete_placements(pvector< TexturePlacement * > &placements) const
Adds the set of TexturePlacements associated with this group and all dependent groups to the indicate...
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 add_uint8(uint8_t value)
Adds an unsigned 8-bit integer to the datagram.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PaletteGroup * get_default_group()
Returns the default group to which an egg file should be assigned if it is not mentioned in the ....
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,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
const PaletteGroups & get_groups() const
Returns the set of groups this group depends on.
void clear_depends()
Eliminates all the dependency information for this group.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool exists() const
Returns true if the filename exists on the disk, false otherwise.
void write_texture_refs(std::ostream &out, int indent_level=0) const
Writes the list of texture references to the indicated output stream, one per line.
int get_dependency_order() const
Returns the dependency order of this group.
This represents a single egg file known to the palettizer.
bool match_texture(TextureImage *texture) const
Searches for a matching line in the .txa file for the given texture and applies its specifications.
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to 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,...
EggFile * get_egg_file(const std::string &name)
Returns the EggFile with the given name.
void release_source_image()
Frees the memory that was allocated by a previous call to read_source_image().
void write_image_info(std::ostream &out, int indent_level=0) const
Writes a list of the PaletteImages associated with this group, and all of their textures,...