43 _preferred_source =
nullptr;
44 _read_source_image =
false;
45 _allow_release_source_image =
true;
47 _ever_read_image =
false;
48 _forced_grayscale =
false;
50 _mid_pixel_ratio = 0.0;
52 _alpha_mode = EggRenderMode::AM_unspecified;
53 _txa_wrap_u = EggTexture::WM_unspecified;
54 _txa_wrap_v = EggTexture::WM_unspecified;
55 _texture_named =
false;
56 _got_txa_file =
false;
67 _egg_files.insert(egg_file);
77 if (_egg_files.empty()) {
81 assign_to_groups(empty);
92 if (_explicitly_assigned_groups.
empty()) {
95 std::copy(_egg_files.begin(), _egg_files.end(), std::back_inserter(needed_eggs));
101 EggFiles::const_iterator ei;
102 for (ei = _egg_files.begin(); ei != _egg_files.end(); ++ei) {
104 intersect.
make_intersection(_explicitly_assigned_groups, (*ei)->get_complete_groups());
105 if (!intersect.
empty()) {
119 needed_eggs.push_back(*ei);
124 while (!needed_eggs.empty()) {
129 WorkingEggs::const_iterator ei;
130 for (ei = needed_eggs.begin(); ei != needed_eggs.end(); ++ei) {
131 total.
make_union(total, (*ei)->get_complete_groups());
145 PaletteGroups::iterator gi = total.
begin();
147 int best_egg_count = compute_egg_count(best, needed_eggs);
149 while (gi != total.
end()) {
153 bool prefer_group =
false;
154 int group_egg_count = compute_egg_count(group, needed_eggs);
155 if (group_egg_count != best_egg_count) {
156 prefer_group = (group_egg_count > best_egg_count);
164 best_egg_count = group_egg_count;
171 definitely_in.
insert(best);
174 for (ei = needed_eggs.begin(); ei != needed_eggs.end(); ++ei) {
175 if ((*ei)->get_complete_groups().count(best) == 0) {
177 next_needed_eggs.push_back(*ei);
180 needed_eggs.swap(next_needed_eggs);
186 assign_to_groups(definitely_in);
195 return _actual_assigned_groups;
205 Placement::const_iterator pi;
206 pi = _placement.find(group);
207 if (pi == _placement.end()) {
221 Placement::iterator pi;
222 for (pi = _placement.begin(); pi != _placement.end(); ++pi) {
223 (*pi).second->force_replace();
235 Placement::iterator pi;
236 for (pi = _placement.begin(); pi != _placement.end(); ++pi) {
237 (*pi).second->mark_eggs_stale();
248 _texture_named =
true;
258 return _texture_named;
267 _pre_txa_properties = _properties;
272 if (source !=
nullptr) {
276 _pre_txa_alpha_mode = _alpha_mode;
277 _alpha_mode = EggRenderMode::AM_unspecified;
290 _got_txa_file =
true;
294 if (source !=
nullptr) {
304 if (_request._got_size) {
306 _x_size = _request._x_size;
307 _y_size = _request._y_size;
310 if (_txa_wrap_u != _request._wrap_u ||
311 _txa_wrap_v != _request._wrap_v) {
312 _txa_wrap_u = _request._wrap_u;
313 _txa_wrap_v = _request._wrap_v;
319 Placement::iterator pi;
320 for (pi = _placement.begin(); pi != _placement.end(); ++pi) {
326 if (_properties.has_num_channels() && !_request._keep_format) {
327 int num_channels = _properties.get_num_channels();
330 if (num_channels == 3 || num_channels == 4) {
331 consider_grayscale();
336 if (num_channels == 2 || num_channels == 4) {
342 if (_request._got_num_channels) {
343 _properties.set_num_channels(_request._num_channels);
346 _properties._generic_format = _request._generic_format;
347 _properties._keep_format = _request._keep_format;
349 if (_request._format != EggTexture::F_unspecified) {
350 _properties._format = _request._format;
351 _properties._force_format = _request._force_format;
354 if (_request._minfilter != EggTexture::FT_unspecified) {
355 _properties._minfilter = _request._minfilter;
357 if (_request._magfilter != EggTexture::FT_unspecified) {
358 _properties._magfilter = _request._magfilter;
361 _properties._anisotropic_degree = _request._anisotropic_degree;
363 if (_properties._color_type ==
nullptr) {
364 _properties._color_type = _request._properties._color_type;
365 _properties._alpha_type = _request._properties._alpha_type;
369 _properties.fully_define();
373 if (_properties != _pre_txa_properties) {
381 if (!_properties.egg_properties_match(_pre_txa_properties)) {
388 if (_request._alpha_mode != EggRenderMode::AM_unspecified) {
389 _alpha_mode = _request._alpha_mode;
394 if (_properties.has_num_channels()) {
395 int num_channels = _properties.get_num_channels();
396 if (num_channels == 1 || num_channels == 3) {
397 _alpha_mode = EggRenderMode::AM_unspecified;
402 if (_pre_txa_alpha_mode != _alpha_mode) {
413 return _got_txa_file;
423 Placement::iterator pi;
424 for (pi = _placement.begin(); pi != _placement.end(); ++pi) {
436 return _request._omit;
447 return _request._coverage_threshold;
457 return _request._margin;
466 if (_placement.empty()) {
481 return !_placement.empty();
520 int alpha_file_channel) {
521 string key = get_source_key(filename, alpha_filename, alpha_file_channel);
523 Sources::iterator si;
524 si = _sources.find(key);
525 if (si != _sources.end()) {
531 _sources.insert(Sources::value_type(key, source));
535 _preferred_source =
nullptr;
536 _read_source_image =
false;
548 if (_preferred_source !=
nullptr) {
549 return _preferred_source;
565 bool any_referenced =
false;
566 Sources::iterator si;
567 for (si = _sources.begin(); si != _sources.end() && !any_referenced; ++si) {
570 any_referenced =
true;
577 for (si = _sources.begin(); si != _sources.end(); ++si) {
585 if (best ==
nullptr) {
587 best_size = source_size;
589 }
else if (source_size > best_size) {
592 best_size = source_size;
594 }
else if (source_size == best_size &&
598 best_size = source_size;
604 if (best ==
nullptr && !_sources.empty()) {
609 if (any_referenced) {
610 for (si = _sources.begin();
611 si != _sources.end() && best ==
nullptr;
619 best = (*_sources.begin()).second;
623 _preferred_source = best;
624 return _preferred_source;
634 Sources::iterator si;
635 for (si = _sources.begin(); si != _sources.end(); ++si) {
657 Placement::iterator pi;
658 for (pi = _placement.begin(); pi != _placement.end(); ++pi) {
666 std::pair<Dests::iterator, bool> insert_result = generate.insert
667 (Dests::value_type(filename, dest));
668 if (!insert_result.second) {
671 dest = (*insert_result.first).second;
685 remove_old_dests(empty, _dests);
686 copy_new_dests(generate, empty);
691 remove_old_dests(generate, _dests);
692 copy_new_dests(generate, _dests);
697 for (di = _dests.begin(); di != _dests.end(); ++di) {
701 _dests.swap(generate);
710 if (!_read_source_image) {
712 if (source !=
nullptr) {
713 source->
read(_source_image);
715 _read_source_image =
true;
716 _allow_release_source_image =
true;
717 _ever_read_image =
true;
720 return _source_image;
730 if (_read_source_image && _allow_release_source_image) {
731 _source_image.
clear();
732 _read_source_image =
false;
743 _source_image = image;
744 _allow_release_source_image =
false;
745 _read_source_image =
true;
746 _ever_read_image =
true;
755 if (!_read_source_image) {
757 if (source !=
nullptr) {
769 if (!_read_source_image) {
771 if (source !=
nullptr) {
786 Sources::const_iterator si;
787 for (si = _sources.begin(); si != _sources.end(); ++si) {
791 indent(out, indent_level);
794 out <<
" (unknown size)";
810 <<
"Cutout image (ratio " << (PN_stdfloat)_mid_pixel_ratio <<
")\n";
814 if (!_egg_files.empty()) {
817 egg_vector.reserve(_egg_files.size());
818 EggFiles::const_iterator ei;
819 for (ei = _egg_files.begin(); ei != _egg_files.end(); ++ei) {
820 egg_vector.push_back(*ei);
822 sort(egg_vector.begin(), egg_vector.end(),
828 for (evi = egg_vector.begin(); evi != egg_vector.end(); ++evi) {
830 indent(out, indent_level + 2)
831 << egg->get_name() <<
" (";
840 if (!_explicitly_assigned_groups.
empty()) {
842 <<
"Explicitly assigned to " << _explicitly_assigned_groups <<
" in .txa\n";
845 if (_placement.empty()) {
850 <<
"Assigned to " << _actual_assigned_groups <<
"\n";
860 indent(out, indent_level) << get_name();
863 if (_placement.empty()) {
864 out <<
" (not used)";
866 Placement::const_iterator pi;
867 pi = _placement.begin();
868 out <<
" (" << (*pi).second->get_group()->get_name();
870 while (pi != _placement.end()) {
871 out <<
" " << (*pi).second->get_group()->get_name();
879 if (source ==
nullptr ||
891 if (source !=
nullptr &&
896 out <<
" scale " << scale <<
"%";
902 Placement::iterator pi;
903 for (pi = _placement.begin(); pi != _placement.end(); ++pi) {
907 nassertv(image !=
nullptr);
908 indent(out, indent_level + 2)
914 indent(out, indent_level + 2)
915 <<
"not placed because unknown.\n";
919 nassertv(image !=
nullptr);
920 indent(out, indent_level + 2)
926 out <<
" at size " << image->
get_x_size() <<
" " 928 if (source !=
nullptr &&
933 out <<
" scale " << scale <<
"%";
950 WorkingEggs::const_iterator ei;
951 for (ei = egg_files.begin(); ei != egg_files.end(); ++ei) {
952 if ((*ei)->get_complete_groups().count(group) != 0) {
968 PaletteGroups::const_iterator gi;
969 Placement::const_iterator pi;
971 Placement new_placement;
974 pi = _placement.begin();
976 while (gi != groups.
end() && pi != _placement.end()) {
985 (new_placement.end(), Placement::value_type(a, place));
998 (new_placement.end(), Placement::value_type(a, place));
1004 while (gi != groups.
end()) {
1009 new_placement.insert
1010 (new_placement.end(), Placement::value_type(a, place));
1014 while (pi != _placement.end()) {
1021 _placement.swap(new_placement);
1022 _actual_assigned_groups = groups;
1031 consider_grayscale() {
1037 if (!_read_source_image && _ever_read_image) {
1038 if (_forced_grayscale) {
1039 _properties.force_grayscale();
1049 for (
int y = 0; y < source.
get_y_size(); y++) {
1050 for (
int x = 0; x < source.
get_x_size(); x++) {
1052 if (PPM_GETR(v) != PPM_GETG(v) || PPM_GETR(v) != PPM_GETB(v)) {
1054 _forced_grayscale =
false;
1061 _properties.force_grayscale();
1062 _forced_grayscale =
true;
1076 if (_read_source_image || !_ever_read_image || _alpha_bits == -1) {
1078 int num_mid_pixels = 0;
1083 for (
int y = 0; y < source.
get_y_size(); y++) {
1084 for (
int x = 0; x < source.
get_x_size(); x++) {
1086 if (alpha_val == 0) {
1087 _alpha_bits |= AB_zero;
1088 }
else if (alpha_val == maxval) {
1089 _alpha_bits |= AB_one;
1091 _alpha_bits |= AB_mid;
1099 _mid_pixel_ratio = 0.0;
1100 if (num_pixels != 0) {
1101 _mid_pixel_ratio = (double)num_mid_pixels / (
double)num_pixels;
1107 if (_alpha_bits != 0) {
1108 if (_alpha_bits == AB_one) {
1110 _properties.force_nonalpha();
1112 }
else if (_alpha_bits == AB_zero) {
1115 _properties.force_nonalpha();
1116 if (_read_source_image) {
1117 nout << *
this <<
" has an all-zero alpha channel; dropping alpha.\n";
1120 }
else if (_alpha_mode == EggRenderMode::AM_unspecified) {
1123 if ((_alpha_bits & AB_mid) == 0) {
1125 _alpha_mode = EggRenderMode::AM_binary;
1127 }
else if ((_alpha_bits & AB_one) != 0 && _mid_pixel_ratio < pal->_cutout_ratio) {
1130 _alpha_mode = pal->_cutout_mode;
1135 _alpha_mode = EggRenderMode::AM_blend;
1146 Dests::const_iterator ai = a.begin();
1147 Dests::const_iterator bi = b.begin();
1149 while (ai != a.end() && bi != b.end()) {
1150 const string &astr = (*ai).first;
1151 const string &bstr = (*bi).first;
1157 }
else if (bstr < astr) {
1159 (*bi).second->unlink();
1169 while (bi != b.end()) {
1171 (*bi).second->unlink();
1175 while (ai != a.end()) {
1186 Dests::const_iterator ai = a.begin();
1187 Dests::const_iterator bi = b.begin();
1189 while (ai != a.end() && bi != b.end()) {
1190 const string &astr = (*ai).first;
1191 const string &bstr = (*bi).first;
1195 (*ai).second->copy(
this);
1198 }
else if (bstr < astr) {
1204 (*ai).second->copy_if_stale((*bi).second,
this);
1210 while (ai != a.end()) {
1212 (*ai).second->copy(
this);
1221 string TextureImage::
1223 int alpha_file_channel) {
1228 format_string(alpha_file_channel);
1237 register_factory(get_class_type(), make_TextureImage);
1257 datagram.
add_bool(_ever_read_image);
1258 datagram.
add_bool(_forced_grayscale);
1274 Placement::const_iterator pi;
1275 for (pi = _placement.begin(); pi != _placement.end(); ++pi) {
1281 Sources::const_iterator si;
1282 for (si = _sources.begin(); si != _sources.end(); ++si) {
1287 Dests::const_iterator di;
1288 for (di = _dests.begin(); di != _dests.end(); ++di) {
1306 for (i = 0; i < _num_placement; i++) {
1309 DCAST_INTO_R(group, p_list[pi++], pi);
1310 DCAST_INTO_R(placement, p_list[pi++], pi);
1311 _placement.insert(Placement::value_type(group, placement));
1314 for (i = 0; i < _num_sources; i++) {
1316 DCAST_INTO_R(source, p_list[pi++], pi);
1321 bool inserted = _sources.insert(Sources::value_type(key, source)).second;
1323 nout <<
"Warning: texture key " << key
1324 <<
" is nonunique; texture lost.\n";
1328 for (i = 0; i < _num_dests; i++) {
1330 DCAST_INTO_R(dest, p_list[pi++], pi);
1331 bool inserted = _dests.insert(Dests::value_type(dest->
get_filename(), dest)).second;
1333 nout <<
"Warning: dest filename " << dest->
get_filename()
1334 <<
" is nonunique; texture lost.\n";
1353 me->fillin(scan, manager);
1363 ImageFile::fillin(scan, manager);
1367 _ever_read_image = scan.
get_bool();
1368 _forced_grayscale = scan.
get_bool();
1370 _alpha_mode = (EggRenderMode::AlphaMode)scan.
get_int16();
1371 if (pal->_read_pi_version >= 16) {
1376 _ever_read_image =
false;
1377 _mid_pixel_ratio = 0.0;
1380 if (pal->_read_pi_version >= 17) {
1381 _txa_wrap_u = (EggTexture::WrapMode)scan.
get_uint8();
1382 _txa_wrap_v = (EggTexture::WrapMode)scan.
get_uint8();
1385 _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.
void add_int16(int16_t value)
Adds a signed 16-bit integer to the datagram.
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...
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....
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
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.
uint8_t get_uint8()
Extracts an unsigned 8-bit integer.
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.
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,...
int get_egg_count() const
Returns the number of egg files that share this SourceTextureImage.
void write_scale_info(std::ostream &out, int indent_level=0)
Writes the information about the texture's size and placement.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
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...
void output_filename(std::ostream &out) const
Writes the filename (or pair of filenames) to the indicated output stream.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
const PaletteGroups & get_explicit_groups() const
Returns the set of PaletteGroups that the egg file has been explicitly assigned to in the ....
const PaletteGroups & get_complete_groups() const
Returns the complete set of PaletteGroups that the egg file is assigned to.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void pre_txa_file()
Sets some state up that must be set prior to reading the .txa file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::string get_string()
Extracts a variable-length string.
void note_egg_file(EggFile *egg_file)
Records that a particular egg file references this texture.
void add_uint32(uint32_t value)
Adds an unsigned 32-bit integer to the datagram.
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.
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 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,...
const TextureProperties & get_properties() const
Returns the grouping properties of the image.
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 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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int get_x_size() const
Returns the size of the image file in pixels in the X direction.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
std::string get_fullpath() const
Returns the entire filename: directory, basename, extension.
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–but ...
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...
int get_num_channels() const
Returns the number of channels of the image.
uint32_t get_uint32()
Extracts an unsigned 32-bit integer.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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,...
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object,...
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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,...
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...
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,...
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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,...
void add_uint8(uint8_t value)
Adds an unsigned 8-bit integer to the datagram.
TexturePlacement * prepare(TextureImage *texture)
Marks the indicated Texture as ready for placing somewhere within this group, and returns a placehold...
int16_t get_int16()
Extracts a signed 16-bit integer.
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,...
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
const Filename & get_filename() const
Returns the primary filename of the image file.
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 ...
EggTexture::WrapMode get_txa_wrap_u() const
Returns the wrap mode specified in the u direction in the txa file, or WM_unspecified.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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().