This is the particular reference of a texture filename by an egg file. More...
#include "textureReference.h"
Public Member Functions | |
void | apply_properties_to_source () |
Applies the texture properties as read from the egg file to the source image's properties. More... | |
void | clear_placement () |
Removes any reference to a TexturePlacement. More... | |
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. More... | |
void | from_egg (EggFile *egg_file, EggData *data, EggTexture *egg_tex) |
Sets up the TextureReference using information extracted from an egg file. More... | |
void | from_egg_quick (const TextureReference &other) |
Sets up the pointers within the TextureReference to the same egg file pointers indicated by the other TextureReference object, without changing any of the other internal data stored here regarding the egg structures. More... | |
EggFile * | get_egg_file () const |
Returns the EggFile that references this texture. More... | |
const LTexCoordd & | get_max_uv () const |
Returns the maximum UV coordinate in use for the texture by this reference. More... | |
const LTexCoordd & | get_min_uv () const |
Returns the minimum UV coordinate in use for the texture by this reference. More... | |
TexturePlacement * | get_placement () const |
Returns the particular TexturePlacement that is appropriate for this egg file. More... | |
SourceTextureImage * | get_source () const |
Returns the SourceTextureImage that this object refers to. More... | |
TextureImage * | get_texture () const |
Returns the TextureImage that this object refers to. More... | |
const std::string & | get_tref_name () const |
Returns the name of the EggTexture entry that references this texture. More... | |
virtual TypeHandle | get_type () const |
EggTexture::WrapMode | get_wrap_u () const |
Returns the specification for the wrapping in the U direction. More... | |
EggTexture::WrapMode | get_wrap_v () const |
Returns the specification for the wrapping in the V direction. More... | |
bool | has_uvs () const |
Returns true if this TextureReference actually uses the texture on geometry, with UV's and everything, or false otherwise. More... | |
bool | is_equivalent (const TextureReference &other) const |
Returns true if all essential properties of this TextureReference are the same as that of the other, or false if any of them differ. More... | |
void | mark_egg_stale () |
Marks the egg file that shares this reference as stale. More... | |
bool | operator< (const TextureReference &other) const |
Defines an ordering of TextureReference pointers in alphabetical order by their tref name. More... | |
void | output (std::ostream &out) const |
void | rebind_egg_data (EggData *data, EggTexture *egg_tex) |
After an EggData has previously been released via release_egg_data(), this can be called to indicate that the egg file has been reloaded and we should assign the indicated pointers. More... | |
void | release_egg_data () |
Called to indicate that the EggData previously passed to from_egg() is about to be deallocated, and all of its pointers should be cleared. More... | |
void | set_placement (TexturePlacement *placement) |
Sets the particular TexturePlacement that is appropriate for this egg file. More... | |
void | update_egg () |
Updates the egg file with all the relevant information to reference the texture in its new home, wherever that might be. More... | |
void | write (std::ostream &out, int indent_level=0) const |
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. More... | |
Public Member Functions inherited from TypedWritable | |
TypedWritable (const TypedWritable ©) | |
virtual ReferenceCount * | as_reference_count () |
Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. More... | |
vector_uchar | encode_to_bam_stream () const |
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object. More... | |
bool | encode_to_bam_stream (vector_uchar &data, BamWriter *writer=nullptr) const |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More... | |
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. More... | |
virtual TypeHandle | force_init_type () |
UpdateSeq | get_bam_modified () const |
Returns the current bam_modified counter. More... | |
void | mark_bam_modified () |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More... | |
void | operator= (const TypedWritable ©) |
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. More... | |
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. More... | |
Public Member Functions inherited from TypedObject | |
TypedObject (const TypedObject ©)=default | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
int | get_best_parent_from_Set (const std::set< int > &) const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More... | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. More... | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. More... | |
TypedObject & | operator= (const TypedObject ©)=default |
Static Public Member Functions | |
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. More... | |
Static Public Member Functions inherited from TypedWritable | |
static bool | decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, vector_uchar data, BamReader *reader=nullptr) |
Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts the single object on those bytes. More... | |
static TypeHandle | get_class_type () |
static void | init_type () |
Static Public Member Functions inherited from TypedObject | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. More... | |
Additional Inherited Members | |
Public Attributes inherited from TypedObject | |
get_type | |
Static Public Attributes inherited from TypedWritable | |
static TypedWritable *const | Null = nullptr |
This is the particular reference of a texture filename by an egg file.
It also includes information about the way in which the egg file uses the texture; e.g. does it repeat.
Definition at line 40 of file textureReference.h.
void TextureReference::apply_properties_to_source | ( | ) |
Applies the texture properties as read from the egg file to the source image's properties.
This updates the source image with the now-known properties indicated with in the tref block of the egg file.
Definition at line 453 of file textureReference.cxx.
Referenced by EggFile::apply_properties_to_source().
void TextureReference::clear_placement | ( | ) |
Removes any reference to a TexturePlacement.
Definition at line 326 of file textureReference.cxx.
References set_placement().
|
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 TypedWritable.
Definition at line 834 of file textureReference.cxx.
void TextureReference::from_egg | ( | EggFile * | egg_file, |
EggData * | data, | ||
EggTexture * | egg_tex | ||
) |
Sets up the TextureReference using information extracted from an egg file.
Definition at line 75 of file textureReference.cxx.
void TextureReference::from_egg_quick | ( | const TextureReference & | other | ) |
Sets up the pointers within the TextureReference to the same egg file pointers indicated by the other TextureReference object, without changing any of the other internal data stored here regarding the egg structures.
This is intended for use when we have already shown that the two TextureReferences describe equivalent data.
Definition at line 149 of file textureReference.cxx.
EggFile * TextureReference::get_egg_file | ( | ) | const |
Returns the EggFile that references this texture.
Definition at line 182 of file textureReference.cxx.
const LTexCoordd & TextureReference::get_max_uv | ( | ) | const |
Returns the maximum UV coordinate in use for the texture by this reference.
Definition at line 243 of file textureReference.cxx.
const LTexCoordd & TextureReference::get_min_uv | ( | ) | const |
Returns the minimum UV coordinate in use for the texture by this reference.
Definition at line 234 of file textureReference.cxx.
TexturePlacement * TextureReference::get_placement | ( | ) | const |
Returns the particular TexturePlacement that is appropriate for this egg file.
This will not be filled in until EggFile::choose_placements() has been called.
Definition at line 336 of file textureReference.cxx.
Referenced by EggFile::choose_placements(), and EggFile::remove_egg().
SourceTextureImage * TextureReference::get_source | ( | ) | const |
Returns the SourceTextureImage that this object refers to.
Definition at line 190 of file textureReference.cxx.
TextureImage * TextureReference::get_texture | ( | ) | const |
Returns the TextureImage that this object refers to.
Definition at line 198 of file textureReference.cxx.
Referenced by EggFile::build_cross_links(), EggFile::choose_placements(), and update_egg().
const string & TextureReference::get_tref_name | ( | ) | const |
Returns the name of the EggTexture entry that references this texture.
Definition at line 207 of file textureReference.cxx.
EggTexture::WrapMode TextureReference::get_wrap_u | ( | ) | const |
Returns the specification for the wrapping in the U direction.
Definition at line 252 of file textureReference.cxx.
EggTexture::WrapMode TextureReference::get_wrap_v | ( | ) | const |
Returns the specification for the wrapping in the V direction.
Definition at line 260 of file textureReference.cxx.
bool TextureReference::has_uvs | ( | ) | const |
Returns true if this TextureReference actually uses the texture on geometry, with UV's and everything, or false otherwise.
Strictly speaking, this should always return true.
Definition at line 226 of file textureReference.cxx.
bool TextureReference::is_equivalent | ( | const TextureReference & | other | ) | const |
Returns true if all essential properties of this TextureReference are the same as that of the other, or false if any of them differ.
This is useful when reading a new egg file and comparing its references to its previously- defined references.
Definition at line 271 of file textureReference.cxx.
References TextureProperties::egg_properties_match().
void TextureReference::mark_egg_stale | ( | ) |
Marks the egg file that shares this reference as stale.
Definition at line 344 of file textureReference.cxx.
References EggFile::mark_stale().
Referenced by TexturePlacement::add_egg(), TexturePlacement::mark_eggs_stale(), and TexturePlacement::remove_egg().
bool TextureReference::operator< | ( | const TextureReference & | other | ) | const |
Defines an ordering of TextureReference pointers in alphabetical order by their tref name.
Definition at line 216 of file textureReference.cxx.
void TextureReference::rebind_egg_data | ( | EggData * | data, |
EggTexture * | egg_tex | ||
) |
After an EggData has previously been released via release_egg_data(), this can be called to indicate that the egg file has been reloaded and we should assign the indicated pointers.
Definition at line 172 of file textureReference.cxx.
|
static |
Registers the current object as something that can be read from a Bam file.
Definition at line 792 of file textureReference.cxx.
References BamReader::get_factory().
Referenced by init_palettizer().
void TextureReference::release_egg_data | ( | ) |
Called to indicate that the EggData previously passed to from_egg() is about to be deallocated, and all of its pointers should be cleared.
Definition at line 161 of file textureReference.cxx.
Referenced by EggFile::release_egg_data().
void TextureReference::set_placement | ( | TexturePlacement * | placement | ) |
Sets the particular TexturePlacement that is appropriate for this egg file.
This is called by EggFile::choose_placements().
Definition at line 308 of file textureReference.cxx.
References TexturePlacement::add_egg(), and TexturePlacement::remove_egg().
Referenced by clear_placement().
void TextureReference::update_egg | ( | ) |
Updates the egg file with all the relevant information to reference the texture in its new home, wherever that might be.
Definition at line 355 of file textureReference.cxx.
References TextureImage::get_alpha_mode(), ImageFile::get_num_channels(), TexturePlacement::get_omit_reason(), get_texture(), TextureImage::get_txa_wrap_u(), TextureImage::get_txa_wrap_v(), EggTexture::has_alpha_channel(), ImageFile::has_num_channels(), and EggRenderMode::set_alpha_mode().
Fills the indicated datagram up with a binary representation of the current object, in preparation for writing to a Bam file.
Reimplemented from TypedWritable.
Definition at line 802 of file textureReference.cxx.
References Datagram::add_bool(), Datagram::add_float64(), Datagram::add_int32(), Datagram::add_string(), TypedWritable::write_datagram(), TextureProperties::write_datagram(), and BamWriter::write_pointer().