Panda3D
|
This represents a single source texture that is referenced by one or more egg files. More...
#include "textureImage.h"
Public Member Functions | |
virtual ReferenceCount * | as_reference_count () |
Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. | |
void | assign_groups () |
Assigns the texture to all of the PaletteGroups the various egg files that use it need. | |
void | clear_basic_properties () |
Resets the properties to a neutral state, for instance in preparation for calling update_properties() with all the known contributing properties. | |
void | clear_name () |
Resets the Namable's name to empty. | |
void | clear_source_basic_properties () |
Calls clear_basic_properties() on each source texture image used by this texture, to reset the properties in preparation for re-applying them from the set of all known egg files. | |
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 the pointers that were retrieved from the Bam file for each pointer object written. | |
void | copy_unplaced (bool redo_all) |
Copies the texture to whichever destination directories are appropriate for the groups in which it has been unplaced. | |
void | determine_placement_size () |
Calls determine_size() on each TexturePlacement for the texture, to ensure that each TexturePlacement is still requesting the best possible size for the texture. | |
string | encode_to_bam_stream () const |
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string. | |
bool | encode_to_bam_stream (string &data, BamWriter *writer=NULL) const |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. | |
bool | exists () const |
Returns true if the file or files named by the image file exist, false otherwise. | |
virtual void | finalize (BamReader *manager) |
Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed. | |
virtual TypeHandle | force_init_type () |
void | force_replace () |
Removes the texture from any PaletteImages it is assigned to, but does not remove it from the groups. | |
int | get_alpha_file_channel () const |
Returns the particular channel number of the alpha image file from which the alpha channel should be extracted. | |
const Filename & | get_alpha_filename () const |
Returns the alpha filename of the image file. | |
EggRenderMode::AlphaMode | get_alpha_mode () const |
Returns the alpha mode that should be used to render objects with this texture, as specified by the user or as determined from examining the texture's alpha channel. | |
UpdateSeq | get_bam_modified () const |
Returns the current bam_modified counter. | |
int | get_best_parent_from_Set (const std::set< int > &) const |
double | get_coverage_threshold () const |
Returns the appropriate coverage threshold for this texture. | |
const Filename & | get_filename () const |
Returns the primary filename of the image file. | |
const PaletteGroups & | get_groups () const |
Once assign_groups() has been called, this returns the actual set of groups the TextureImage has been assigned to. | |
int | get_margin () const |
Returns the appropriate margin for this texture. | |
const string & | get_name () const |
int | get_num_channels () const |
Returns the number of channels of the image. | |
bool | get_omit () const |
Returns true if the user specifically requested to omit this texture via the "omit" keyword in the .txa file, or false otherwise. | |
TexturePlacement * | get_placement (PaletteGroup *group) const |
Gets the TexturePlacement object which represents the assignment of this texture to the indicated group. | |
SourceTextureImage * | get_preferred_source () |
Determines the preferred source image for examining size and reading pixels, etc. | |
const TextureProperties & | get_properties () const |
Returns the grouping properties of the image. | |
SourceTextureImage * | get_source (const Filename &filename, const Filename &alpha_filename, int alpha_file_channel) |
Returns the SourceTextureImage corresponding to the given filename(s). | |
EggTexture::WrapMode | get_txa_wrap_u () const |
Returns the wrap mode specified in the u direction in the txa file, or WM_unspecified. | |
EggTexture::WrapMode | get_txa_wrap_v () const |
Returns the wrap mode specified in the v direction in the txa file, or WM_unspecified. | |
virtual TypeHandle | get_type () const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
int | get_x_size () const |
Returns the size of the image file in pixels in the X direction. | |
int | get_y_size () const |
Returns the size of the image file in pixels in the Y direction. | |
bool | got_txa_file () const |
Returns true if this TextureImage has been looked up in the .txa file this session, false otherwise. | |
bool | has_name () const |
Returns true if the Namable has a nonempty name set, false if the name is empty. | |
bool | has_num_channels () const |
Returns true if the number of channels in the image is known, false otherwise. | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. | |
bool | is_newer_than (const Filename &reference_filename) |
Returns true if the source image is newer than the indicated file, false otherwise. | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. | |
bool | is_size_known () const |
Returns true if the size of the image file is known, false otherwise. | |
bool | is_surprise () const |
Returns true if this particular texture is a 'surprise', i.e. | |
bool | is_texture_named () const |
Returns true if this particular texture has been named by the user for procession this session, for instance by listing an egg file on the command line that references it. | |
bool | is_used () const |
Returns true if this particular texture has been placed somewhere, anywhere, or false if it is not used. | |
bool | make_shadow_image (const string &basename) |
Sets up the ImageFile as a "shadow image" of a particular PaletteImage. | |
void | mark_bam_modified () |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. | |
void | mark_eggs_stale () |
Marks all the egg files that reference this texture stale. | |
void | mark_texture_named () |
Indicates that this particular texture has been named by the user for processing this session, normally by listing an egg file on the command line that references it. | |
void | note_egg_file (EggFile *egg_file) |
Records that a particular egg file references this texture. | |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete[] (void *, void *) |
void | operator delete[] (void *ptr) |
void * | operator new (size_t size, void *ptr) |
void * | operator new (size_t size) |
void * | operator new[] (size_t size, void *ptr) |
void * | operator new[] (size_t size) |
void | output (ostream &out) const |
Outputs the Namable. | |
void | output_filename (ostream &out) const |
Writes the filename (or pair of filenames) to the indicated output stream. | |
void | post_txa_file () |
Once the .txa file has been read and the TextureImage matched against it, considers applying the requested size change. | |
void | pre_txa_file () |
Updates any internal state prior to reading the .txa file. | |
bool | read (PNMImage &image) const |
Reads in the image (or images, if the alpha_filename is separate) and stores it in the indicated PNMImage. | |
void | read_header () |
Causes the header part of the image to be reread, usually to confirm that its image properties (size, number of channels, etc.) haven't changed. | |
const PNMImage & | read_source_image () |
Reads in the original image, if it has not already been read, and returns it. | |
void | release_source_image () |
Frees the memory that was allocated by a previous call to read_source_image(). | |
virtual bool | require_fully_complete () const |
Some objects require all of their nested pointers to have been completed before the objects themselves can be completed. | |
bool | set_filename (const string &dirname, const string &basename) |
Sets the filename, and if applicable, the alpha_filename, from the indicated basename. | |
bool | set_filename (PaletteGroup *group, const string &basename) |
Sets the filename, and if applicable, the alpha_filename, from the indicated basename. | |
void | set_name (const string &name) |
void | set_source_image (const PNMImage &image) |
Accepts the indicated source image as if it had been read from disk. | |
void | unlink () |
Deletes the image file or files. | |
virtual void | update_bam_nested (BamWriter *manager) |
Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates. | |
void | update_egg_tex (EggTexture *egg_tex) const |
Sets the indicated EggTexture to refer to this file. | |
void | update_properties (const TextureProperties &properties) |
If the indicate TextureProperties structure is more specific than this one, updates this one. | |
bool | write (const PNMImage &image) const |
Writes out the image in the indicated PNMImage to the _filename and/or _alpha_filename. | |
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. | |
void | write_scale_info (ostream &out, int indent_level=0) |
Writes the information about the texture's size and placement. | |
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 stream, one per line. | |
Static Public Member Functions | |
static bool | decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, const string &data, BamReader *reader=NULL) |
Reads the string created by a previous call to encode_to_bam_stream(), and extracts the single object on that string. | |
static TypeHandle | get_class_type () |
static void | init_type () |
static void | register_with_read_factory () |
Registers the current object as something that can be read from a Bam file. | |
Static Public Attributes | |
static TypedWritable *const | Null = (TypedWritable*)0L |
Protected Member Functions | |
void | fillin (DatagramIterator &scan, BamReader *manager) |
Reads the binary data from the given datagram iterator, which was written by a previous call to write_datagram(). | |
Static Protected Member Functions | |
static TypedWritable * | make_TextureImage (const FactoryParams ¶ms) |
This method is called by the BamReader when an object of this type is encountered in a Bam file; it should allocate and return a new object with all the data read. | |
Protected Attributes | |
int | _alpha_file_channel |
Filename | _alpha_filename |
Filename | _filename |
TextureProperties | _properties |
bool | _size_known |
int | _x_size |
int | _y_size |
Friends | |
class | TxaLine |
This represents a single source texture that is referenced by one or more egg files.
It may be assigned to multiple PaletteGroups, and thus placed on multiple PaletteImages (up to one per PaletteGroup).
Since a TextureImage may be referenced by multiple egg files that are each assigned to a different set of groups, it tries to maximize sharing between egg files and minimize the number of different PaletteGroups it is assigned to.
Definition at line 51 of file textureImage.h.
ReferenceCount * TypedWritable::as_reference_count | ( | ) | [virtual, inherited] |
Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type.
Reimplemented in PandaNode, and TypedWritableReferenceCount.
Definition at line 155 of file typedWritable.cxx.
Referenced by BamReader::change_pointer(), BamReader::register_change_this(), and BamReader::resolve().
TypedObject * TypedObject::as_typed_object | ( | ) | [inline, inherited] |
Returns the object, upcast (if necessary) to a TypedObject pointer.
Definition at line 99 of file typedObject.I.
const TypedObject * TypedObject::as_typed_object | ( | ) | const [inline, inherited] |
Returns the object, upcast (if necessary) to a TypedObject pointer.
Definition at line 110 of file typedObject.I.
void TextureImage::assign_groups | ( | ) |
Assigns the texture to all of the PaletteGroups the various egg files that use it need.
Attempts to choose the minimum set of PaletteGroups that satisfies all of the egg files.
Definition at line 81 of file textureImage.cxx.
References PaletteGroups::begin(), PaletteGroups::empty(), PaletteGroups::end(), PaletteGroups::insert(), PaletteGroup::is_preferred_over(), PaletteGroups::make_intersection(), PaletteGroups::make_union(), and PaletteGroups::remove_null().
Referenced by Palettizer::process_all(), and Palettizer::process_command_line_eggs().
void ImageFile::clear_basic_properties | ( | ) | [inherited] |
Resets the properties to a neutral state, for instance in preparation for calling update_properties() with all the known contributing properties.
Definition at line 153 of file imageFile.cxx.
References TextureProperties::clear_basic().
Referenced by clear_source_basic_properties().
void Namable::clear_name | ( | ) | [inline, inherited] |
void TextureImage::clear_source_basic_properties | ( | ) |
Calls clear_basic_properties() on each source texture image used by this texture, to reset the properties in preparation for re-applying them from the set of all known egg files.
Definition at line 701 of file textureImage.cxx.
References ImageFile::clear_basic_properties().
Referenced by Palettizer::process_all().
int TextureImage::complete_pointers | ( | TypedWritable ** | p_list, |
BamReader * | manager | ||
) | [virtual] |
Called after the object is otherwise completely read from a Bam file, this function's job is to store the pointers that were retrieved from the Bam file for each pointer object written.
The return value is the number of pointers processed from the list.
Reimplemented from ImageFile.
Definition at line 1426 of file textureImage.cxx.
References PaletteGroups::complete_pointers(), ImageFile::get_alpha_file_channel(), ImageFile::get_alpha_filename(), and ImageFile::get_filename().
void TextureImage::copy_unplaced | ( | bool | redo_all | ) |
Copies the texture to whichever destination directories are appropriate for the groups in which it has been unplaced.
Also removes the old filenames for previous sessions where it was unplaced, but is no longer.
If redo_all is true, this recopies the texture whether it needed to or not.
Definition at line 722 of file textureImage.cxx.
References ImageFile::get_filename(), TexturePlacement::get_omit_reason(), FilenameUnifier::make_canonical(), and TexturePlacement::set_dest().
Referenced by Palettizer::generate_images().
bool TypedWritable::decode_raw_from_bam_stream | ( | TypedWritable *& | ptr, |
ReferenceCount *& | ref_ptr, | ||
const string & | data, | ||
BamReader * | reader = NULL |
||
) | [static, inherited] |
Reads the string created by a previous call to encode_to_bam_stream(), and extracts the single object on that string.
Returns true on success, false on on error.
This variant sets the TypedWritable and ReferenceCount pointers separately; both are pointers to the same object. The reference count is not incremented; it is the caller's responsibility to manage the reference count.
Note that this method cannot be used to retrieve objects that do not inherit from ReferenceCount, because these objects cannot persist beyond the lifetime of the BamReader that reads them. To retrieve these objects from a bam stream, you must construct a BamReader directly.
If you happen to know that the particular object in question inherits from TypedWritableReferenceCount or PandaNode, consider calling the variant of decode_from_bam_stream() defined for those methods, which presents a simpler interface.
Definition at line 353 of file typedWritable.cxx.
References BamReader::init(), DatagramInputFile::open(), DatagramInputFile::read_header(), BamReader::read_object(), ReferenceCount::ref(), BamReader::resolve(), BamReader::set_source(), and ReferenceCount::unref().
void TextureImage::determine_placement_size | ( | ) |
Calls determine_size() on each TexturePlacement for the texture, to ensure that each TexturePlacement is still requesting the best possible size for the texture.
Definition at line 458 of file textureImage.cxx.
References TexturePlacement::determine_size().
Referenced by Palettizer::process_all(), and Palettizer::process_command_line_eggs().
bool TypedWritable::encode_to_bam_stream | ( | string & | data, |
BamWriter * | writer = NULL |
||
) | const [inherited] |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.
Returns true on success, false on failure.
This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.
Definition at line 283 of file typedWritable.cxx.
References BamWriter::init(), DatagramOutputFile::open(), BamWriter::set_target(), DatagramOutputFile::write_header(), and BamWriter::write_object().
string TypedWritable::encode_to_bam_stream | ( | ) | const [inline, inherited] |
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string.
Returns empty string on failure.
This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.
Definition at line 86 of file typedWritable.I.
bool ImageFile::exists | ( | ) | const [inherited] |
Returns true if the file or files named by the image file exist, false otherwise.
Definition at line 303 of file imageFile.cxx.
References TextureProperties::uses_alpha().
Referenced by get_preferred_source(), and PaletteImage::update_image().
void TextureImage::fillin | ( | DatagramIterator & | scan, |
BamReader * | manager | ||
) | [protected, virtual] |
Reads the binary data from the given datagram iterator, which was written by a previous call to write_datagram().
Reimplemented from ImageFile.
Definition at line 1494 of file textureImage.cxx.
References PaletteGroups::fillin(), DatagramIterator::get_bool(), DatagramIterator::get_float64(), DatagramIterator::get_int16(), DatagramIterator::get_string(), DatagramIterator::get_uint32(), DatagramIterator::get_uint8(), and BamReader::read_pointers().
Referenced by make_TextureImage().
void TypedWritable::finalize | ( | BamReader * | manager | ) | [virtual, inherited] |
Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.
Reimplemented in PartBundle, Geom, GeomPrimitive, GeomVertexArrayData, GeomVertexArrayFormat, GeomVertexData, InternalName, GeomNode, LightAttrib, RenderAttrib, RenderEffect, RenderEffects, RenderState, PaletteGroup, and Palettizer.
Definition at line 145 of file typedWritable.cxx.
Referenced by BamReader::finalize_now().
void TextureImage::force_replace | ( | ) |
Removes the texture from any PaletteImages it is assigned to, but does not remove it from the groups.
It will be re-placed within each group when PaletteGroup::place_all() is called.
Definition at line 234 of file textureImage.cxx.
Referenced by post_txa_file().
int ImageFile::get_alpha_file_channel | ( | ) | const [inherited] |
Returns the particular channel number of the alpha image file from which the alpha channel should be extracted.
This is normally 0 to represent the grayscale combination of r, g, and b; or it may be a 1-based channel number (for instance, 4 for the alpha channel of a 4-component image).
Definition at line 291 of file imageFile.cxx.
Referenced by complete_pointers(), and PaletteGroup::prepare().
const Filename & ImageFile::get_alpha_filename | ( | ) | const [inherited] |
Returns the alpha filename of the image file.
This is the name of the file that contains the alpha channel, if it is stored in a separate file, or the empty string if it is not.
Definition at line 276 of file imageFile.cxx.
Referenced by complete_pointers(), and PaletteGroup::prepare().
EggRenderMode::AlphaMode TextureImage::get_alpha_mode | ( | ) | const |
Returns the alpha mode that should be used to render objects with this texture, as specified by the user or as determined from examining the texture's alpha channel.
Definition at line 545 of file textureImage.cxx.
Referenced by TextureReference::update_egg().
UpdateSeq TypedWritable::get_bam_modified | ( | ) | const [inline, inherited] |
Returns the current bam_modified counter.
This counter is normally incremented automatically whenever the object is modified.
Definition at line 66 of file typedWritable.I.
Referenced by BamWriter::consider_update(), and BamWriter::write_pointer().
double TextureImage::get_coverage_threshold | ( | ) | const |
Returns the appropriate coverage threshold for this texture.
This is either the Palettizer::_coverage_threshold parameter, given globally via -r, or a particular value for this texture as supplied by the "coverage" keyword in the .txa file.
Definition at line 489 of file textureImage.cxx.
Referenced by TexturePlacement::determine_size().
const Filename & ImageFile::get_filename | ( | ) | const [inherited] |
Returns the primary filename of the image file.
Definition at line 263 of file imageFile.cxx.
Referenced by complete_pointers(), DestTextureImage::copy_if_stale(), copy_unplaced(), get_preferred_source(), is_newer_than(), PaletteImage::optimal_resize(), PaletteGroup::prepare(), PaletteImage::update_filename(), PaletteImage::update_image(), and write_scale_info().
const PaletteGroups & TextureImage::get_groups | ( | ) | const |
Once assign_groups() has been called, this returns the actual set of groups the TextureImage has been assigned to.
Definition at line 202 of file textureImage.cxx.
Referenced by EggFile::choose_placements().
int TextureImage::get_margin | ( | ) | const |
Returns the appropriate margin for this texture.
This is either the Palettizer::_margin parameter, or a particular value for this texture as supplied by the "margin" keyword in the .txa file.
Definition at line 502 of file textureImage.cxx.
int ImageFile::get_num_channels | ( | ) | const [inherited] |
Returns the number of channels of the image.
It is an error to call this unless has_num_channels() returns true.
Definition at line 130 of file imageFile.cxx.
References TextureProperties::get_num_channels().
Referenced by DestTextureImage::copy(), DestTextureImage::copy_if_stale(), TextureReference::from_egg(), post_txa_file(), TextureReference::update_egg(), and write_scale_info().
bool TextureImage::get_omit | ( | ) | const |
Returns true if the user specifically requested to omit this texture via the "omit" keyword in the .txa file, or false otherwise.
Definition at line 474 of file textureImage.cxx.
Referenced by TexturePlacement::determine_size().
TexturePlacement * TextureImage::get_placement | ( | PaletteGroup * | group | ) | const |
Gets the TexturePlacement object which represents the assignment of this texture to the indicated group.
If the texture has not been assigned to the indicated group, returns NULL.
Definition at line 215 of file textureImage.cxx.
Referenced by EggFile::choose_placements().
SourceTextureImage * TextureImage::get_preferred_source | ( | ) |
Determines the preferred source image for examining size and reading pixels, etc.
This is the largest and most recent of all the available source images.
Definition at line 612 of file textureImage.cxx.
References ImageFile::exists(), SourceTextureImage::get_egg_count(), ImageFile::get_filename(), SourceTextureImage::get_size(), ImageFile::get_x_size(), and ImageFile::get_y_size().
Referenced by DestTextureImage::copy_if_stale(), is_newer_than(), TxaLine::match_texture(), post_txa_file(), pre_txa_file(), PaletteGroup::prepare(), read_header(), read_source_image(), PaletteImage::update_image(), and write_scale_info().
const TextureProperties & ImageFile::get_properties | ( | ) | const [inherited] |
Returns the grouping properties of the image.
Definition at line 140 of file imageFile.cxx.
Referenced by TexturePlacement::get_properties(), pre_txa_file(), and write_source_pathnames().
SourceTextureImage * TextureImage::get_source | ( | const Filename & | filename, |
const Filename & | alpha_filename, | ||
int | alpha_file_channel | ||
) |
Returns the SourceTextureImage corresponding to the given filename(s).
If the given filename has never been used as a SourceTexture for this particular texture, creates a new SourceTextureImage and returns that.
Definition at line 582 of file textureImage.cxx.
Referenced by TextureReference::from_egg(), and PaletteGroup::prepare().
EggTexture::WrapMode TextureImage::get_txa_wrap_u | ( | ) | const |
Returns the wrap mode specified in the u direction in the txa file, or WM_unspecified.
Definition at line 556 of file textureImage.cxx.
Referenced by TexturePlacement::determine_size(), and TextureReference::update_egg().
EggTexture::WrapMode TextureImage::get_txa_wrap_v | ( | ) | const |
Returns the wrap mode specified in the v direction in the txa file, or WM_unspecified.
Definition at line 567 of file textureImage.cxx.
Referenced by TexturePlacement::determine_size(), and TextureReference::update_egg().
int TypedObject::get_type_index | ( | ) | const [inline, inherited] |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
This is equivalent to get_type().get_index().
Definition at line 52 of file typedObject.I.
References TypeHandle::get_index().
int ImageFile::get_x_size | ( | ) | const [inherited] |
Returns the size of the image file in pixels in the X direction.
It is an error to call this unless is_size_known() returns true.
Definition at line 93 of file imageFile.cxx.
References ImageFile::is_size_known().
Referenced by TexturePlacement::compute_tex_matrix(), DestTextureImage::copy_if_stale(), PaletteImage::count_coverage(), PaletteImage::count_utilization(), TexturePlacement::fill_image(), TexturePlacement::fill_swapped_image(), get_preferred_source(), TxaLine::match_texture(), post_txa_file(), write_scale_info(), and write_source_pathnames().
int ImageFile::get_y_size | ( | ) | const [inherited] |
Returns the size of the image file in pixels in the Y direction.
It is an error to call this unless is_size_known() returns true.
Definition at line 106 of file imageFile.cxx.
References ImageFile::is_size_known().
Referenced by TexturePlacement::compute_tex_matrix(), DestTextureImage::copy_if_stale(), PaletteImage::count_coverage(), PaletteImage::count_utilization(), TexturePlacement::fill_image(), TexturePlacement::fill_swapped_image(), get_preferred_source(), TxaLine::match_texture(), post_txa_file(), write_scale_info(), and write_source_pathnames().
bool TextureImage::got_txa_file | ( | ) | const |
Returns true if this TextureImage has been looked up in the .txa file this session, false otherwise.
Definition at line 445 of file textureImage.cxx.
Referenced by PaletteGroup::update_unknown_textures().
bool Namable::has_name | ( | ) | const [inline, inherited] |
Returns true if the Namable has a nonempty name set, false if the name is empty.
Definition at line 75 of file namable.I.
Referenced by XFileNode::add_child(), EggComponentData::add_name(), Texture::do_read_dds_file(), Texture::do_read_one(), Character::fillin(), EggGroupUniquifier::get_category(), EggXfmSAnim::optimize(), NodePathComponent::output(), AsyncTask::output(), EggNamedObject::output(), EggSAnimData::write(), EggPrimitive::write_body(), ParametricCurveCollection::write_egg(), ParametricCurve::write_egg(), EggNamedObject::write_header(), XFileDataNodeTemplate::write_text(), and XFileDataDef::write_text().
bool ImageFile::has_num_channels | ( | ) | const [inherited] |
Returns true if the number of channels in the image is known, false otherwise.
Definition at line 118 of file imageFile.cxx.
References TextureProperties::has_num_channels().
Referenced by TextureReference::update_egg().
bool TypedObject::is_exact_type | ( | TypeHandle | handle | ) | const [inline, inherited] |
Returns true if the current object is the indicated type exactly.
Definition at line 74 of file typedObject.I.
References TypeHandle::get_name().
Referenced by GraphicsStateGuardian::async_reload_texture(), PortalNode::combine_with(), PandaNode::combine_with(), GeomNode::combine_with(), CollisionNode::combine_with(), Character::combine_with(), PGItem::cull_callback(), FactoryParams::get_param_of_type(), CollisionHandlerPusher::handle_entries(), SceneGraphReducer::r_flatten(), ConnectionWriter::send(), FltToEggLevelState::set_transform(), and VirtualFileSystem::unmount().
bool TextureImage::is_newer_than | ( | const Filename & | reference_filename | ) |
Returns true if the source image is newer than the indicated file, false otherwise.
If the image has already been read, this always returns false.
Definition at line 857 of file textureImage.cxx.
References ImageFile::get_filename(), and get_preferred_source().
Referenced by Palettizer::process_all(), and Palettizer::process_command_line_eggs().
bool TypedObject::is_of_type | ( | TypeHandle | handle | ) | const [inline, inherited] |
Returns true if the current object is or derives from the indicated type.
Definition at line 63 of file typedObject.I.
References TypeHandle::is_derived_from().
Referenced by EggSliderData::add_back_pointer(), EggJointData::add_back_pointer(), CIntervalManager::add_c_interval(), XFileNode::add_child(), CollisionTraverser::add_collider(), CollisionHandlerPhysical::add_collider(), EggXfmSAnim::add_data(), CharacterJointBundle::add_node(), NonlinearImager::add_screen(), EggGroupNode::apply_first_attribute(), EggGroupNode::apply_last_attribute(), DeferredNodeProperty::apply_to_node(), RecorderController::begin_playback(), NodePath::clear_clip_plane(), EggGroupNode::clear_connected_shading(), NodePath::clear_light(), EggBase::convert_paths(), NodePath::decode_from_bam_stream(), VrpnClient::disconnect_device(), PhysicsManager::do_physics(), GraphicsStateGuardian::fetch_specified_part(), EggRenderState::fill_state(), AnimBundleNode::find_anim_bundle(), EggGroupNode::find_coordsys_entry(), XFile::find_data_object(), Character::find_joint(), EggGroupNode::find_materials(), Character::find_slider(), XFile::find_template(), EggGroupNode::find_textures(), EggMaterialCollection::find_used_materials(), EggTextureCollection::find_used_textures(), EggGroupNode::force_filenames(), EggJointData::force_initial_rest_frame(), WindowFramework::get_aspect_2d(), EggPoolUniquifier::get_category(), EggGroupUniquifier::get_category(), EggGroupNode::get_connected_shading(), PandaFramework::get_mouse(), FactoryParams::get_param_of_type(), EggGroupNode::has_absolute_pathnames(), NodePath::has_clip_plane(), NodePath::has_clip_plane_off(), NodePath::has_light(), PandaFramework::hide_collision_solids(), x11GraphicsWindow::open_window(), eglGraphicsWindow::open_window(), EggNode::parse_egg(), CharacterMaker::part_to_node(), EggGroupNode::post_apply_flat_attribute(), EggBinner::prepare_node(), PortalClipper::prepare_portal(), NodePath::project_texture(), EggMatrixTablePointer::quantize_channels(), ParametricCurveCollection::r_add_curves(), SceneGraphReducer::r_collect_vertex_data(), EggGroupNode::r_load_externals(), EggGroupNode::rebuild_vertex_pools(), EggGroupNode::recompute_polygon_normals(), EggGroupNode::remove_invalid_primitives(), EggGroupNode::remove_unused_vertices(), EggLoader::reparent_decals(), EggMaterialCollection::replace_materials(), EggTextureCollection::replace_textures(), EggGroupNode::resolve_filenames(), EggGroupNode::reverse_vertex_ordering(), NodePath::set_clip_plane(), NodePath::set_clip_plane_off(), NodePath::set_light(), ProjectionScreen::set_projector(), NonlinearImager::set_source_camera(), EggXfmSAnim::set_value(), NonlinearImager::set_viewer_camera(), PandaFramework::show_collision_solids(), BamCache::store(), XFileToEggConverter::strip_nodes(), EggGroupNode::strip_normals(), DataGraphTraverser::traverse(), DataGraphTraverser::traverse_below(), EggGroupNode::triangulate_polygons(), EggGroupNode::unify_attributes(), EggNameUniquifier::uniquify(), NodeCullCallbackData::upcall(), PhysicsCollisionHandler::validate_target(), EggXfmSAnim::write(), EggGroup::write(), EggToDXFLayer::write_3d_face(), and EggToDXFLayer::write_entities().
bool ImageFile::is_size_known | ( | ) | const [inherited] |
Returns true if the size of the image file is known, false otherwise.
Definition at line 81 of file imageFile.cxx.
Referenced by TexturePlacement::determine_size(), ImageFile::get_x_size(), ImageFile::get_y_size(), write_scale_info(), and write_source_pathnames().
bool TextureImage::is_surprise | ( | ) | const |
Returns true if this particular texture is a 'surprise', i.e.
it wasn't matched by a line in the .txa file that didn't include the keyword 'cont'.
Definition at line 514 of file textureImage.cxx.
Referenced by Palettizer::report_pi().
bool TextureImage::is_texture_named | ( | ) | const |
Returns true if this particular texture has been named by the user for procession this session, for instance by listing an egg file on the command line that references it.
Definition at line 280 of file textureImage.cxx.
Referenced by PaletteImage::update_image().
bool TextureImage::is_used | ( | ) | const |
Returns true if this particular texture has been placed somewhere, anywhere, or false if it is not used.
Definition at line 532 of file textureImage.cxx.
Referenced by Palettizer::finalize(), and Palettizer::report_pi().
bool ImageFile::make_shadow_image | ( | const string & | basename | ) | [inherited] |
Sets up the ImageFile as a "shadow image" of a particular PaletteImage.
This is a temporary ImageFile that's used to read and write the shadow palette image, which is used to keep a working copy of the palette.
Returns true if the filename changes from what it was previously, false otherwise.
Definition at line 56 of file imageFile.cxx.
References ImageFile::set_filename().
Referenced by PaletteImage::setup_shadow_image().
TypedWritable * TextureImage::make_TextureImage | ( | const FactoryParams & | params | ) | [static, protected] |
This method is called by the BamReader when an object of this type is encountered in a Bam file; it should allocate and return a new object with all the data read.
Definition at line 1476 of file textureImage.cxx.
References fillin().
Referenced by register_with_read_factory().
void TypedWritable::mark_bam_modified | ( | ) | [inline, inherited] |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams.
This should normally not need to be called by user code; it should be called internally when the object has been changed in a way that legitimately requires its retransmission to any connected clients.
Definition at line 54 of file typedWritable.I.
Referenced by PandaNode::add_child(), PandaNode::add_stashed(), PandaNode::adjust_draw_mask(), PandaNode::apply_attribs_to_vertices(), PandaNode::clear_attrib(), PandaNode::clear_effect(), PandaNode::clear_tag(), PandaNode::copy_all_properties(), PandaNode::copy_tags(), PandaNode::disable_cull_callback(), PandaNode::force_bounds_stale(), PandaNode::remove_all_children(), PandaNode::remove_child(), PandaNode::remove_stashed(), PandaNode::reset_all_prev_transform(), PandaNode::reset_prev_transform(), PandaNode::set_attrib(), PandaNode::set_bounds(), PandaNode::set_bounds_type(), PandaNode::set_cull_callback(), PandaNode::set_effect(), PandaNode::set_effects(), PandaNode::set_final(), PandaNode::set_internal_bounds(), PandaNode::set_into_collide_mask(), PandaNode::set_prev_transform(), PandaNode::set_state(), PandaNode::set_tag(), PandaNode::set_transform(), PandaNode::stash_child(), and PandaNode::unstash_child().
void TextureImage::mark_eggs_stale | ( | ) |
Marks all the egg files that reference this texture stale.
Should be called only when the texture properties change in some catastrophic way that will require every egg file referencing it to be regenerated, even if it is not palettized.
Definition at line 251 of file textureImage.cxx.
Referenced by post_txa_file().
void TextureImage::mark_texture_named | ( | ) |
Indicates that this particular texture has been named by the user for processing this session, normally by listing an egg file on the command line that references it.
Definition at line 267 of file textureImage.cxx.
Referenced by Palettizer::process_all(), and Palettizer::process_command_line_eggs().
void TextureImage::note_egg_file | ( | EggFile * | egg_file | ) |
Records that a particular egg file references this texture.
This is essential to know when deciding how to assign the TextureImage to the various PaletteGroups.
Definition at line 67 of file textureImage.cxx.
References PaletteGroups::empty(), and EggFile::get_complete_groups().
Referenced by EggFile::build_cross_links().
void Namable::output | ( | ostream & | out | ) | const [inline, inherited] |
Outputs the Namable.
This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.
Reimplemented in AnimBundle, AnimChannelFixed< SwitchType >, AnimChannelMatrixFixed, AnimControl, AnimGroup, PartBundle, CollisionNode, CollisionTraverser, ButtonNode, EggNamedObject, AsyncTask, AsyncTaskChain, AsyncTaskManager, AdaptiveLru, Material, SimpleLru, HermiteCurve, RopeNode, SheetNode, Fog, GeomNode, LensNode, Loader, PandaNode, PlaneNode, PolylightNode, PortalNode, CallbackNode, FadeLODNode, LODNode, ForceNode, Thread, MouseRecorder, TextNode, MouseWatcherRegion, WebcamVideo, and MayaShader.
void ImageFile::output_filename | ( | ostream & | out | ) | const [inherited] |
Writes the filename (or pair of filenames) to the indicated output stream.
Definition at line 483 of file imageFile.cxx.
References FilenameUnifier::make_user_filename(), and TextureProperties::uses_alpha().
Referenced by PalettePage::write_image_info(), and write_source_pathnames().
void TextureImage::post_txa_file | ( | ) |
Once the .txa file has been read and the TextureImage matched against it, considers applying the requested size change.
Updates the TextureImage's size with the size the texture ought to be, if this can be determined.
Definition at line 319 of file textureImage.cxx.
References TextureProperties::egg_properties_match(), force_replace(), TextureProperties::fully_define(), TextureProperties::get_num_channels(), ImageFile::get_num_channels(), get_preferred_source(), SourceTextureImage::get_size(), ImageFile::get_x_size(), ImageFile::get_y_size(), TextureProperties::has_num_channels(), mark_eggs_stale(), TexturePlacement::mark_unfilled(), and TextureProperties::set_num_channels().
Referenced by Palettizer::process_all(), Palettizer::process_command_line_eggs(), and PaletteGroup::update_unknown_textures().
void TextureImage::pre_txa_file | ( | ) |
Updates any internal state prior to reading the .txa file.
Definition at line 291 of file textureImage.cxx.
References get_preferred_source(), ImageFile::get_properties(), and TextureRequest::pre_txa_file().
Referenced by Palettizer::process_all(), Palettizer::process_command_line_eggs(), and PaletteGroup::update_unknown_textures().
bool ImageFile::read | ( | PNMImage & | image | ) | const [inherited] |
Reads in the image (or images, if the alpha_filename is separate) and stores it in the indicated PNMImage.
Returns true on success, false on failure.
Definition at line 326 of file imageFile.cxx.
References PNMImage::add_alpha(), PNMImage::get_alpha(), PNMImage::get_channel_val(), PNMImage::get_gray(), PNMImageHeader::get_num_channels(), PNMImageHeader::get_x_size(), PNMImageHeader::get_y_size(), FilenameUnifier::make_user_filename(), PNMImage::read(), PNMImage::set_alpha(), and PNMImageHeader::set_type().
Referenced by read_source_image().
void TextureImage::read_header | ( | ) |
Causes the header part of the image to be reread, usually to confirm that its image properties (size, number of channels, etc.) haven't changed.
Definition at line 840 of file textureImage.cxx.
References get_preferred_source(), and SourceTextureImage::read_header().
Referenced by Palettizer::process_command_line_eggs().
const PNMImage & TextureImage::read_source_image | ( | ) |
Reads in the original image, if it has not already been read, and returns it.
Definition at line 786 of file textureImage.cxx.
References get_preferred_source(), and ImageFile::read().
Referenced by DestTextureImage::copy(), TexturePlacement::fill_image(), TexturePlacement::fill_swapped_image(), Palettizer::process_all(), and Palettizer::process_command_line_eggs().
void TextureImage::register_with_read_factory | ( | ) | [static] |
Registers the current object as something that can be read from a Bam file.
Definition at line 1354 of file textureImage.cxx.
References BamReader::get_factory(), and make_TextureImage().
void TextureImage::release_source_image | ( | ) |
Frees the memory that was allocated by a previous call to read_source_image().
The next time read_source_image() is called, it will have to read the disk again.
Definition at line 809 of file textureImage.cxx.
References PNMImage::clear().
Referenced by DestTextureImage::copy(), TexturePlacement::fill_image(), TexturePlacement::fill_swapped_image(), and Palettizer::process_all().
bool TypedWritable::require_fully_complete | ( | ) | const [virtual, inherited] |
Some objects require all of their nested pointers to have been completed before the objects themselves can be completed.
If this is the case, override this method to return true, and be careful with circular references (which would make the object unreadable from a bam file).
Reimplemented in GeomVertexData, ClipPlaneAttrib, and RenderEffects.
Definition at line 118 of file typedWritable.cxx.
bool ImageFile::set_filename | ( | PaletteGroup * | group, |
const string & | basename | ||
) | [inherited] |
Sets the filename, and if applicable, the alpha_filename, from the indicated basename.
The extension appropriate to the image file type specified in _color_type (and _alpha_type) is automatically applied.
Returns true if the filename changes from what it was previously, false otherwise.
Definition at line 181 of file imageFile.cxx.
References PaletteGroup::get_dirname().
Referenced by ImageFile::make_shadow_image().
bool ImageFile::set_filename | ( | const string & | dirname, |
const string & | basename | ||
) | [inherited] |
Sets the filename, and if applicable, the alpha_filename, from the indicated basename.
The extension appropriate to the image file type specified in _color_type (and _alpha_type) is automatically applied.
Returns true if the filename changes from what it was previously, false otherwise.
Definition at line 223 of file imageFile.cxx.
References Filename::get_fullpath_wo_extension(), and PNMFileType::get_suggested_extension().
void TextureImage::set_source_image | ( | const PNMImage & | image | ) |
Accepts the indicated source image as if it had been read from disk.
This image is copied into the structure, and will be returned by future calls to read_source_image().
Definition at line 825 of file textureImage.cxx.
void ImageFile::unlink | ( | ) | [inherited] |
Deletes the image file or files.
Definition at line 442 of file imageFile.cxx.
References FilenameUnifier::make_user_filename(), and Filename::unlink().
void TypedWritable::update_bam_nested | ( | BamWriter * | manager | ) | [virtual, inherited] |
Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates.
Reimplemented in CFDoCullCommand, and PandaNode.
Definition at line 77 of file typedWritable.cxx.
void ImageFile::update_egg_tex | ( | EggTexture * | egg_tex | ) | const [inherited] |
Sets the indicated EggTexture to refer to this file.
Definition at line 459 of file imageFile.cxx.
References EggTexture::clear_alpha_file_channel(), FilenameUnifier::make_egg_filename(), EggTexture::set_alpha_file_channel(), EggTexture::set_alpha_filename(), TextureProperties::update_egg_tex(), and TextureProperties::uses_alpha().
Referenced by TextureReference::update_egg().
void ImageFile::update_properties | ( | const TextureProperties & | properties | ) | [inherited] |
If the indicate TextureProperties structure is more specific than this one, updates this one.
Definition at line 164 of file imageFile.cxx.
References TextureProperties::update_properties().
Referenced by TextureReference::apply_properties_to_source(), and TextureReference::from_egg().
bool ImageFile::write | ( | const PNMImage & | image | ) | const [inherited] |
Writes out the image in the indicated PNMImage to the _filename and/or _alpha_filename.
Returns true on success, false on failure.
Definition at line 391 of file imageFile.cxx.
References PNMImage::get_alpha_val(), PNMImageHeader::get_maxval(), PNMImageHeader::get_x_size(), PNMImageHeader::get_y_size(), PNMImageHeader::has_alpha(), Filename::make_dir(), FilenameUnifier::make_user_filename(), PNMImage::remove_alpha(), PNMImage::set_gray_val(), Filename::unlink(), and PNMImage::write().
Referenced by DestTextureImage::copy(), and PaletteImage::update_image().
Fills the indicated datagram up with a binary representation of the current object, in preparation for writing to a Bam file.
Reimplemented from ImageFile.
Definition at line 1367 of file textureImage.cxx.
References Datagram::add_bool(), Datagram::add_float64(), Datagram::add_int16(), Datagram::add_string(), Datagram::add_uint32(), Datagram::add_uint8(), PaletteGroups::write_datagram(), and BamWriter::write_pointer().
void TextureImage::write_scale_info | ( | ostream & | out, |
int | indent_level = 0 |
||
) |
Writes the information about the texture's size and placement.
Definition at line 953 of file textureImage.cxx.
References TexturePlacement::get_dest(), ImageFile::get_filename(), TexturePlacement::get_image(), ImageFile::get_num_channels(), TexturePlacement::get_omit_reason(), get_preferred_source(), ImageFile::get_x_size(), ImageFile::get_y_size(), ImageFile::is_size_known(), and FilenameUnifier::make_user_filename().
Referenced by Palettizer::report_pi().
void TextureImage::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 stream, one per line.
Definition at line 877 of file textureImage.cxx.
References PaletteGroups::empty(), EggFile::get_default_group(), SourceTextureImage::get_egg_count(), EggFile::get_explicit_groups(), TextureProperties::get_num_channels(), ImageFile::get_properties(), ImageFile::get_x_size(), ImageFile::get_y_size(), TextureProperties::has_num_channels(), ImageFile::is_size_known(), and ImageFile::output_filename().
Referenced by Palettizer::report_pi().