15 #include "textureImage.h" 16 #include "sourceTextureImage.h" 17 #include "destTextureImage.h" 19 #include "paletteGroup.h" 20 #include "paletteImage.h" 21 #include "texturePlacement.h" 22 #include "filenameUnifier.h" 23 #include "string_utils.h" 26 #include "datagramIterator.h" 27 #include "bamReader.h" 28 #include "bamWriter.h" 29 #include "pnmFileType.h" 30 #include "indirectCompareNames.h" 45 _read_source_image =
false;
46 _allow_release_source_image =
true;
48 _ever_read_image =
false;
49 _forced_grayscale =
false;
51 _mid_pixel_ratio = 0.0;
53 _alpha_mode = EggRenderMode::AM_unspecified;
54 _txa_wrap_u = EggTexture::WM_unspecified;
55 _txa_wrap_v = EggTexture::WM_unspecified;
56 _texture_named =
false;
57 _got_txa_file =
false;
71 _egg_files.insert(egg_file);
84 if (_egg_files.empty()) {
88 assign_to_groups(empty);
99 if (_explicitly_assigned_groups.
empty()) {
102 copy(_egg_files.begin(), _egg_files.end(), back_inserter(needed_eggs));
108 EggFiles::const_iterator ei;
109 for (ei = _egg_files.begin(); ei != _egg_files.end(); ++ei) {
111 intersect.
make_intersection(_explicitly_assigned_groups, (*ei)->get_complete_groups());
112 if (!intersect.
empty()) {
126 needed_eggs.push_back(*ei);
131 while (!needed_eggs.empty()) {
136 WorkingEggs::const_iterator ei;
137 for (ei = needed_eggs.begin(); ei != needed_eggs.end(); ++ei) {
138 total.
make_union(total, (*ei)->get_complete_groups());
152 PaletteGroups::iterator gi = total.
begin();
154 int best_egg_count = compute_egg_count(best, needed_eggs);
156 while (gi != total.
end()) {
160 bool prefer_group =
false;
161 int group_egg_count = compute_egg_count(group, needed_eggs);
162 if (group_egg_count != best_egg_count) {
163 prefer_group = (group_egg_count > best_egg_count);
171 best_egg_count = group_egg_count;
178 definitely_in.
insert(best);
181 for (ei = needed_eggs.begin(); ei != needed_eggs.end(); ++ei) {
182 if ((*ei)->get_complete_groups().count(best) == 0) {
184 next_needed_eggs.push_back(*ei);
187 needed_eggs.swap(next_needed_eggs);
193 assign_to_groups(definitely_in);
205 return _actual_assigned_groups;
218 Placement::const_iterator pi;
219 pi = _placement.find(group);
220 if (pi == _placement.end()) {
237 Placement::iterator pi;
238 for (pi = _placement.begin(); pi != _placement.end(); ++pi) {
239 (*pi).second->force_replace();
254 Placement::iterator pi;
255 for (pi = _placement.begin(); pi != _placement.end(); ++pi) {
256 (*pi).second->mark_eggs_stale();
270 _texture_named =
true;
283 return _texture_named;
295 _pre_txa_properties = _properties;
304 _pre_txa_alpha_mode = _alpha_mode;
305 _alpha_mode = EggRenderMode::AM_unspecified;
322 _got_txa_file =
true;
336 if (_request._got_size) {
338 _x_size = _request._x_size;
339 _y_size = _request._y_size;
342 if (_txa_wrap_u != _request._wrap_u ||
343 _txa_wrap_v != _request._wrap_v) {
344 _txa_wrap_u = _request._wrap_u;
345 _txa_wrap_v = _request._wrap_v;
351 Placement::iterator pi;
352 for (pi = _placement.begin(); pi != _placement.end(); ++pi) {
358 if (_properties.has_num_channels() && !_request._keep_format) {
359 int num_channels = _properties.get_num_channels();
362 if (num_channels == 3 || num_channels == 4) {
363 consider_grayscale();
368 if (num_channels == 2 || num_channels == 4) {
374 if (_request._got_num_channels) {
375 _properties.set_num_channels(_request._num_channels);
378 _properties._generic_format = _request._generic_format;
379 _properties._keep_format = _request._keep_format;
381 if (_request._format != EggTexture::F_unspecified) {
382 _properties._format = _request._format;
383 _properties._force_format = _request._force_format;
386 if (_request._minfilter != EggTexture::FT_unspecified) {
387 _properties._minfilter = _request._minfilter;
389 if (_request._magfilter != EggTexture::FT_unspecified) {
390 _properties._magfilter = _request._magfilter;
393 _properties._anisotropic_degree = _request._anisotropic_degree;
395 if (_properties._color_type == (
PNMFileType *)NULL) {
396 _properties._color_type = _request._properties._color_type;
397 _properties._alpha_type = _request._properties._alpha_type;
401 _properties.fully_define();
405 if (_properties != _pre_txa_properties) {
413 if (!_properties.egg_properties_match(_pre_txa_properties)) {
420 if (_request._alpha_mode != EggRenderMode::AM_unspecified) {
421 _alpha_mode = _request._alpha_mode;
426 if (_properties.has_num_channels()) {
427 int num_channels = _properties.get_num_channels();
428 if (num_channels == 1 || num_channels == 3) {
429 _alpha_mode = EggRenderMode::AM_unspecified;
435 if (_pre_txa_alpha_mode != _alpha_mode) {
448 return _got_txa_file;
461 Placement::iterator pi;
462 for (pi = _placement.begin(); pi != _placement.end(); ++pi) {
477 return _request._omit;
492 return _request._coverage_threshold;
505 return _request._margin;
517 if (_placement.empty()) {
535 return !_placement.empty();
585 int alpha_file_channel) {
586 string key = get_source_key(filename, alpha_filename, alpha_file_channel);
588 Sources::iterator si;
589 si = _sources.find(key);
590 if (si != _sources.end()) {
596 _sources.insert(Sources::value_type(key, source));
601 _read_source_image =
false;
616 return _preferred_source;
632 bool any_referenced =
false;
633 Sources::iterator si;
634 for (si = _sources.begin(); si != _sources.end() && !any_referenced; ++si) {
637 any_referenced =
true;
644 for (si = _sources.begin(); si != _sources.end(); ++si) {
654 best_size = source_size;
656 }
else if (source_size > best_size) {
659 best_size = source_size;
661 }
else if (source_size == best_size &&
665 best_size = source_size;
676 if (any_referenced) {
677 for (si = _sources.begin();
686 best = (*_sources.begin()).second;
690 _preferred_source = best;
691 return _preferred_source;
704 Sources::iterator si;
705 for (si = _sources.begin(); si != _sources.end(); ++si) {
733 Placement::iterator pi;
734 for (pi = _placement.begin(); pi != _placement.end(); ++pi) {
742 pair<Dests::iterator, bool> insert_result = generate.insert
743 (Dests::value_type(filename, dest));
744 if (!insert_result.second) {
748 dest = (*insert_result.first).second;
762 remove_old_dests(empty, _dests);
763 copy_new_dests(generate, empty);
768 remove_old_dests(generate, _dests);
769 copy_new_dests(generate, _dests);
774 for (di = _dests.begin(); di != _dests.end(); ++di) {
778 _dests.swap(generate);
789 if (!_read_source_image) {
792 source->
read(_source_image);
794 _read_source_image =
true;
795 _allow_release_source_image =
true;
796 _ever_read_image =
true;
799 return _source_image;
812 if (_read_source_image && _allow_release_source_image) {
813 _source_image.
clear();
814 _read_source_image =
false;
828 _source_image = image;
829 _allow_release_source_image =
false;
830 _read_source_image =
true;
831 _ever_read_image =
true;
843 if (!_read_source_image) {
860 if (!_read_source_image) {
880 Sources::const_iterator si;
881 for (si = _sources.begin(); si != _sources.end(); ++si) {
885 indent(out, indent_level);
888 out <<
" (unknown size)";
903 indent(out, indent_level)
904 <<
"Cutout image (ratio " << (PN_stdfloat)_mid_pixel_ratio <<
")\n";
908 if (!_egg_files.empty()) {
911 egg_vector.reserve(_egg_files.size());
912 EggFiles::const_iterator ei;
913 for (ei = _egg_files.begin(); ei != _egg_files.end(); ++ei) {
914 egg_vector.push_back(*ei);
916 sort(egg_vector.begin(), egg_vector.end(),
919 indent(out, indent_level)
922 for (evi = egg_vector.begin(); evi != egg_vector.end(); ++evi) {
924 indent(out, indent_level + 2)
925 << egg->get_name() <<
" (";
934 if (!_explicitly_assigned_groups.
empty()) {
935 indent(out, indent_level)
936 <<
"Explicitly assigned to " << _explicitly_assigned_groups <<
" in .txa\n";
939 if (_placement.empty()) {
940 indent(out, indent_level)
943 indent(out, indent_level)
944 <<
"Assigned to " << _actual_assigned_groups <<
"\n";
957 indent(out, indent_level) << get_name();
960 if (_placement.empty()) {
961 out <<
" (not used)";
963 Placement::const_iterator pi;
964 pi = _placement.begin();
965 out <<
" (" << (*pi).second->get_group()->get_name();
967 while (pi != _placement.end()) {
968 out <<
" " << (*pi).second->get_group()->get_name();
993 out <<
" scale " << scale <<
"%";
999 Placement::iterator pi;
1000 for (pi = _placement.begin(); pi != _placement.end(); ++pi) {
1005 indent(out, indent_level + 2)
1011 indent(out, indent_level + 2)
1012 <<
"not placed because unknown.\n";
1017 indent(out, indent_level + 2)
1023 out <<
" at size " << image->
get_x_size() <<
" " 1030 out <<
" scale " << scale <<
"%";
1050 WorkingEggs::const_iterator ei;
1051 for (ei = egg_files.begin(); ei != egg_files.end(); ++ei) {
1052 if ((*ei)->get_complete_groups().count(group) != 0) {
1072 PaletteGroups::const_iterator gi;
1073 Placement::const_iterator pi;
1077 gi = groups.
begin();
1078 pi = _placement.begin();
1080 while (gi != groups.
end() && pi != _placement.end()) {
1088 new_placement.insert
1089 (new_placement.end(), Placement::value_type(a, place));
1101 new_placement.insert
1102 (new_placement.end(), Placement::value_type(a, place));
1108 while (gi != groups.
end()) {
1113 new_placement.insert
1114 (new_placement.end(), Placement::value_type(a, place));
1118 while (pi != _placement.end()) {
1125 _placement.swap(new_placement);
1126 _actual_assigned_groups = groups;
1138 consider_grayscale() {
1145 if (!_read_source_image && _ever_read_image) {
1146 if (_forced_grayscale) {
1147 _properties.force_grayscale();
1157 for (
int y = 0; y < source.
get_y_size(); y++) {
1158 for (
int x = 0; x < source.
get_x_size(); x++) {
1160 if (PPM_GETR(v) != PPM_GETG(v) || PPM_GETR(v) != PPM_GETB(v)) {
1162 _forced_grayscale =
false;
1169 _properties.force_grayscale();
1170 _forced_grayscale =
true;
1186 if (_read_source_image || !_ever_read_image || _alpha_bits == -1) {
1188 int num_mid_pixels = 0;
1193 for (
int y = 0; y < source.
get_y_size(); y++) {
1194 for (
int x = 0; x < source.
get_x_size(); x++) {
1196 if (alpha_val == 0) {
1197 _alpha_bits |= AB_zero;
1198 }
else if (alpha_val == maxval) {
1199 _alpha_bits |= AB_one;
1201 _alpha_bits |= AB_mid;
1209 _mid_pixel_ratio = 0.0;
1210 if (num_pixels != 0) {
1211 _mid_pixel_ratio = (double)num_mid_pixels / (
double)num_pixels;
1217 if (_alpha_bits != 0) {
1218 if (_alpha_bits == AB_one) {
1220 _properties.force_nonalpha();
1222 }
else if (_alpha_bits == AB_zero) {
1225 _properties.force_nonalpha();
1226 if (_read_source_image) {
1227 nout << *
this <<
" has an all-zero alpha channel; dropping alpha.\n";
1230 }
else if (_alpha_mode == EggRenderMode::AM_unspecified) {
1233 if ((_alpha_bits & AB_mid) == 0) {
1235 _alpha_mode = EggRenderMode::AM_binary;
1237 }
else if ((_alpha_bits & AB_one) != 0 && _mid_pixel_ratio < pal->_cutout_ratio) {
1240 _alpha_mode = pal->_cutout_mode;
1245 _alpha_mode = EggRenderMode::AM_blend;
1259 Dests::const_iterator ai = a.begin();
1260 Dests::const_iterator bi = b.begin();
1262 while (ai != a.end() && bi != b.end()) {
1263 const string &astr = (*ai).first;
1264 const string &bstr = (*bi).first;
1270 }
else if (bstr < astr) {
1272 (*bi).second->unlink();
1282 while (bi != b.end()) {
1284 (*bi).second->unlink();
1288 while (ai != a.end()) {
1302 Dests::const_iterator ai = a.begin();
1303 Dests::const_iterator bi = b.begin();
1305 while (ai != a.end() && bi != b.end()) {
1306 const string &astr = (*ai).first;
1307 const string &bstr = (*bi).first;
1311 (*ai).second->copy(
this);
1314 }
else if (bstr < astr) {
1320 (*ai).second->copy_if_stale((*bi).second,
this);
1326 while (ai != a.end()) {
1328 (*ai).second->copy(
this);
1339 string TextureImage::
1341 int alpha_file_channel) {
1346 format_string(alpha_file_channel);
1358 register_factory(get_class_type(), make_TextureImage);
1382 datagram.
add_bool(_ever_read_image);
1383 datagram.
add_bool(_forced_grayscale);
1399 Placement::const_iterator pi;
1400 for (pi = _placement.begin(); pi != _placement.end(); ++pi) {
1406 Sources::const_iterator si;
1407 for (si = _sources.begin(); si != _sources.end(); ++si) {
1412 Dests::const_iterator di;
1413 for (di = _dests.begin(); di != _dests.end(); ++di) {
1434 for (i = 0; i < _num_placement; i++) {
1437 DCAST_INTO_R(group, p_list[pi++], pi);
1438 DCAST_INTO_R(placement, p_list[pi++], pi);
1439 _placement.insert(Placement::value_type(group, placement));
1442 for (i = 0; i < _num_sources; i++) {
1444 DCAST_INTO_R(source, p_list[pi++], pi);
1449 bool inserted = _sources.insert(Sources::value_type(key, source)).second;
1451 nout <<
"Warning: texture key " << key
1452 <<
" is nonunique; texture lost.\n";
1456 for (i = 0; i < _num_dests; i++) {
1458 DCAST_INTO_R(dest, p_list[pi++], pi);
1459 bool inserted = _dests.insert(Dests::value_type(dest->
get_filename(), dest)).second;
1461 nout <<
"Warning: dest filename " << dest->
get_filename()
1462 <<
" is nonunique; texture lost.\n";
1483 parse_params(params, scan, manager);
1484 me->fillin(scan, manager);
1497 ImageFile::fillin(scan, manager);
1501 _ever_read_image = scan.
get_bool();
1502 _forced_grayscale = scan.
get_bool();
1504 _alpha_mode = (EggRenderMode::AlphaMode)scan.
get_int16();
1505 if (pal->_read_pi_version >= 16) {
1510 _ever_read_image =
false;
1511 _mid_pixel_ratio = 0.0;
1514 if (pal->_read_pi_version >= 17) {
1515 _txa_wrap_u = (EggTexture::WrapMode)scan.
get_uint8();
1516 _txa_wrap_v = (EggTexture::WrapMode)scan.
get_uint8();
1519 _actual_assigned_groups.
fillin(scan, manager);
void mark_eggs_stale()
Marks all the egg files that reference this texture stale.
void make_intersection(const PaletteGroups &a, const PaletteGroups &b)
Computes the intersection of PaletteGroups a and b, and stores the result in this object...
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...
bool read(PNMImage &image) const
Reads in the image (or images, if the alpha_filename is separate) and stores it in the indicated PNMI...
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...
This represents a texture filename as it has been resized and copied to the map directory (e...
void add_uint8(PN_uint8 value)
Adds an unsigned 8-bit integer to the datagram.
This is our own Panda specialization on the default STL map.
int get_num_channels() const
Returns the number of channels (1 through 4) associated with the image.
iterator end() const
Returns an iterator suitable for traversing the set.
bool determine_size()
Attempts to determine the appropriate size of the texture for the given placement.
bool get_bool()
Extracts a boolean value.
void add_string(const string &str)
Adds a variable-length string to the datagram.
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
void pre_txa_file()
Updates any internal state prior to reading the .txa file.
bool exists() const
Returns true if the file or files named by the image file exist, false otherwise. ...
void add_float64(PN_float64 value)
Adds a 64-bit floating-point number to the datagram.
void remove_null()
Removes the special "null" group from the set.
string get_fullpath() const
Returns the entire filename: directory, basename, extension.
int get_alpha_file_channel() const
Returns the particular channel number of the alpha image file from which the alpha channel should be ...
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...
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 clear_source_basic_properties()
Calls clear_basic_properties() on each source texture image used by this texture, to reset the proper...
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.
int get_egg_count() const
Returns the number of egg files that share this SourceTextureImage.
SourceTextureImage * get_source(const Filename &filename, const Filename &alpha_filename, int alpha_file_channel)
Returns the SourceTextureImage corresponding to the given filename(s).
int get_y_size() const
Returns the size of the image file in pixels in the Y direction.
PaletteImage * get_image() const
Returns the particular PaletteImage on which the texture has been placed.
Base class for objects that can be written to and read from Bam files.
iterator begin() const
Returns an iterator suitable for traversing the set.
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...
void output_filename(ostream &out) const
Writes the filename (or pair of filenames) to the indicated output stream.
static void register_with_read_factory()
Registers the current object as something that can be read from a Bam file.
void fillin(DatagramIterator &scan, BamReader *manager)
Reads the binary data from the given datagram iterator, which was written by a previous call to write...
bool read_header()
Reads the actual image header to determine the image properties, like its size.
TexturePlacement * get_placement(PaletteGroup *group) const
Gets the TexturePlacement object which represents the assignment of this texture to the indicated gro...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
EggTexture::WrapMode get_txa_wrap_v() const
Returns the wrap mode specified in the v direction in the txa file, or WM_unspecified.
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...
const PaletteGroups & get_explicit_groups() const
Returns the set of PaletteGroups that the egg file has been explicitly assigned to in the ...
PN_uint8 get_uint8()
Extracts an unsigned 8-bit integer.
PN_uint32 get_uint32()
Extracts an unsigned 32-bit integer.
const PaletteGroups & get_complete_groups() const
Returns the complete set of PaletteGroups that the egg file is assigned to.
void pre_txa_file()
Sets some state up that must be set prior to reading the .txa file.
PN_int16 get_int16()
Extracts a signed 16-bit integer.
string get_string()
Extracts a variable-length string.
void note_egg_file(EggFile *egg_file)
Records that a particular egg file references this texture.
SourceTextureImage * get_preferred_source()
Determines the preferred source image for examining size and reading pixels, etc. ...
bool is_valid() const
Returns true if the image has been read in or correctly initialized with a height and width...
This is our own Panda specialization on the default STL vector.
xel & get_xel_val(int x, int y)
Returns the RGB color at the indicated pixel.
bool is_used() const
Returns true if this particular texture has been placed somewhere, anywhere, or false if it is not us...
void add_int16(PN_int16 value)
Adds a signed 16-bit integer to the datagram.
void force_replace()
Removes the texture from any PaletteImages it is assigned to, but does not remove it from the groups...
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.
const TextureProperties & get_properties() const
Returns the grouping properties of the image.
void mark_unfilled()
Marks the texture as unfilled, so that it will need to be copied into the palette image again...
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...
bool is_size_known() const
Returns true if the size of the image file is known, false otherwise.
void read_header()
Causes the header part of the image to be reread, usually to confirm that its image properties (size...
EggRenderMode::AlphaMode get_alpha_mode() const
Returns the alpha mode that should be used to render objects with this texture, as specified by the u...
The name of a file, such as a texture file or an Egg file.
int get_x_size() const
Returns the size of the image file in pixels in the X direction.
bool get_omit() const
Returns true if the user specifically requested to omit this texture via the "omit" keyword in the ...
void read_pointers(DatagramIterator &scan, int count)
A convenience function to read a contiguous list of pointers.
An STL function object class, this is intended to be used on any ordered collection of pointers to cl...
static void make_canonical(Filename &filename)
Does the same thing as Filename::make_canonical()–it converts the filename to its canonical form–bu...
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...
int get_num_channels() const
Returns the number of channels of the image.
bool empty() const
Returns true if the set is empty, false otherwise.
void clear_basic_properties()
Resets the properties to a neutral state, for instance in preparation for calling update_properties()...
bool get_size()
Determines the size of the SourceTextureImage, if it is not already known.
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.
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.
This is a texture image reference as it appears in an egg file: the source image of the texture...
void assign_groups()
Assigns the texture to all of the PaletteGroups the various egg files that use it need...
double get_coverage_threshold() const
Returns the appropriate coverage threshold for this texture.
bool has_num_channels() const
Returns true if the number of channels is known.
OmitReason get_omit_reason() const
Returns the reason the texture has been omitted from a palette image, or OR_none if it has not...
int get_margin() const
Returns the appropriate margin for this texture.
bool is_surprise() const
Returns true if this particular texture is a 'surprise', i.e.
int compare_timestamps(const Filename &other, bool this_missing_is_old=true, bool other_missing_is_old=true) const
Returns a number less than zero if the file named by this object is older than the given file...
const Filename & get_alpha_filename() const
Returns the alpha filename of the image file.
void mark_texture_named()
Indicates that this particular texture has been named by the user for processing this session...
void make_union(const PaletteGroups &a, const PaletteGroups &b)
Computes the union of PaletteGroups a and b, and stores the result in this object.
PN_float64 get_float64()
Extracts a 64-bit floating-point number.
void clear()
Frees all memory allocated for the image, and clears all its parameters (size, color, type, etc).
void insert(PaletteGroup *group)
Inserts a new group to the set, if it is not already there.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
void set_source_image(const PNMImage &image)
Accepts the indicated source image as if it had been read from disk.
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 add_uint32(PN_uint32 value)
Adds an unsigned 32-bit integer to the datagram.
DestTextureImage * get_dest() const
Returns the DestTextureImage that corresponds to this texture as it was copied to the install directo...
bool is_texture_named() const
Returns true if this particular texture has been named by the user for procession this session...
This is a single palette image, one of several within a PalettePage, which is in turn one of several ...
bool is_preferred_over(const PaletteGroup &other) const
Returns true if this group should be preferred for adding textures over the other group...
TexturePlacement * prepare(TextureImage *texture)
Marks the indicated Texture as ready for placing somewhere within this group, and returns a placehold...
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 set_dest(DestTextureImage *dest)
Sets the DestTextureImage that corresponds to this texture as it was copied to the install directory...
bool got_txa_file() const
Returns true if this TextureImage has been looked up in the .txa file this session, false otherwise.
void post_txa_file()
Once the .txa file has been read and the TextureImage matched against it, considers applying the requ...
xelval get_alpha_val(int x, int y) const
Returns the alpha component color at the indicated pixel.
TypeHandle is the identifier used to differentiate C++ class types.
const Filename & get_filename() const
Returns the primary filename of the image file.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
EggTexture::WrapMode get_txa_wrap_u() const
Returns the wrap mode specified in the u direction in the txa file, or WM_unspecified.
This represents a single egg file known to the palettizer.
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...
PaletteGroup * get_default_group() const
Returns the PaletteGroup that was specified as the default group on the command line at the time the ...
const PaletteGroups & get_groups() const
Once assign_groups() has been called, this returns the actual set of groups the TextureImage has been...
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.
void release_source_image()
Frees the memory that was allocated by a previous call to read_source_image().