Panda3D
|
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. | |
void | clear_placement () |
Removes any reference to a TexturePlacement. | |
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 | from_egg (EggFile *egg_file, EggData *data, EggTexture *egg_tex) |
Sets up the TextureReference using information extracted from an egg file. | |
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. | |
EggFile * | get_egg_file () const |
Returns the EggFile that references this texture. | |
const LTexCoordd & | get_max_uv () const |
Returns the maximum UV coordinate in use for the texture by this reference. | |
const LTexCoordd & | get_min_uv () const |
Returns the minimum UV coordinate in use for the texture by this reference. | |
TexturePlacement * | get_placement () const |
Returns the particular TexturePlacement that is appropriate for this egg file. | |
SourceTextureImage * | get_source () const |
Returns the SourceTextureImage that this object refers to. | |
TextureImage * | get_texture () const |
Returns the TextureImage that this object refers to. | |
const std::string & | get_tref_name () const |
Returns the name of the EggTexture entry that references this texture. | |
virtual TypeHandle | get_type () const |
EggTexture::WrapMode | get_wrap_u () const |
Returns the specification for the wrapping in the U direction. | |
EggTexture::WrapMode | get_wrap_v () const |
Returns the specification for the wrapping in the V direction. | |
bool | has_uvs () const |
Returns true if this TextureReference actually uses the texture on geometry, with UV's and everything, or false otherwise. | |
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. | |
void | mark_egg_stale () |
Marks the egg file that shares this reference as stale. | |
bool | operator< (const TextureReference &other) const |
Defines an ordering of TextureReference pointers in alphabetical order by their tref name. | |
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. | |
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. | |
void | set_placement (TexturePlacement *placement) |
Sets the particular TexturePlacement that is appropriate for this egg file. | |
void | update_egg () |
Updates the egg file with all the relevant information to reference the texture in its new home, wherever that might be. | |
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. | |
![]() | |
TypedWritable (const TypedWritable ©) | |
virtual ReferenceCount * | as_reference_count () |
Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. | |
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. | |
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. | |
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 () |
UpdateSeq | get_bam_modified () const |
Returns the current bam_modified counter. | |
void | mark_bam_modified () |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. | |
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. | |
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. | |
![]() | |
TypedObject (const TypedObject ©)=default | |
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. | |
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. | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. | |
TypedObject & | operator= (const TypedObject ©)=default |
![]() | |
void | operator delete (void *, void *) |
void | operator delete (void *ptr) |
void | operator delete[] (void *, void *) |
void | operator delete[] (void *ptr) |
void * | operator new (size_t size) |
void * | operator new (size_t size, void *ptr) |
void * | operator new[] (size_t size) |
void * | operator new[] (size_t size, void *ptr) |
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. | |
![]() | |
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. | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
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. | |
Additional Inherited Members | |
![]() | |
get_type | |
![]() | |
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.
TextureReference::TextureReference | ( | ) |
Definition at line 47 of file textureReference.cxx.
TextureReference::~TextureReference | ( | ) |
Definition at line 66 of file textureReference.cxx.
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 452 of file textureReference.cxx.
References ImageFile::update_properties().
Referenced by EggFile::apply_properties_to_source().
void TextureReference::clear_placement | ( | ) |
Removes any reference to a TexturePlacement.
Definition at line 325 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 833 of file textureReference.cxx.
References TypedWritable::complete_pointers(), and TextureProperties::complete_pointers().
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 74 of file textureReference.cxx.
References EggTexture::determine_wrap_u(), EggTexture::determine_wrap_v(), EggTexture::get_alpha_file_channel, EggTexture::get_alpha_filename, EggRenderMode::get_alpha_mode(), EggTexture::get_anisotropic_degree, Filename::get_basename_wo_extension(), EggFilenameNode::get_filename(), ImageFile::get_num_channels(), SourceTextureImage::get_size(), TextureImage::get_source(), Palettizer::get_texture(), EggTransform::get_transform2d(), EggTexture::has_alpha_channel(), EggTexture::has_alpha_filename, EggTransform::has_transform2d(), and ImageFile::update_properties().
Referenced by EggFile::scan_textures().
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 148 of file textureReference.cxx.
Referenced by EggFile::scan_textures().
|
inlinestatic |
Definition at line 121 of file textureReference.h.
EggFile * TextureReference::get_egg_file | ( | ) | const |
Returns the EggFile that references this texture.
Definition at line 181 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 242 of file textureReference.cxx.
Referenced by TexturePlacement::determine_size().
const LTexCoordd & TextureReference::get_min_uv | ( | ) | const |
Returns the minimum UV coordinate in use for the texture by this reference.
Definition at line 233 of file textureReference.cxx.
Referenced by TexturePlacement::determine_size().
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 335 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 189 of file textureReference.cxx.
Referenced by EggFile::build_cross_links().
TextureImage * TextureReference::get_texture | ( | ) | const |
Returns the TextureImage that this object refers to.
Definition at line 197 of file textureReference.cxx.
References SourceTextureImage::get_texture().
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 206 of file textureReference.cxx.
|
inlinevirtual |
Reimplemented from TypedWritable.
Definition at line 129 of file textureReference.h.
EggTexture::WrapMode TextureReference::get_wrap_u | ( | ) | const |
Returns the specification for the wrapping in the U direction.
Definition at line 251 of file textureReference.cxx.
Referenced by TexturePlacement::determine_size().
EggTexture::WrapMode TextureReference::get_wrap_v | ( | ) | const |
Returns the specification for the wrapping in the V direction.
Definition at line 259 of file textureReference.cxx.
Referenced by TexturePlacement::determine_size().
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 225 of file textureReference.cxx.
Referenced by TexturePlacement::determine_size(), and EggFile::scan_textures().
|
inlinestatic |
Definition at line 124 of file textureReference.h.
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 270 of file textureReference.cxx.
References TextureProperties::egg_properties_match().
Referenced by EggFile::scan_textures().
void TextureReference::mark_egg_stale | ( | ) |
Marks the egg file that shares this reference as stale.
Definition at line 343 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 215 of file textureReference.cxx.
void TextureReference::output | ( | std::ostream & | out | ) | const |
Definition at line 461 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 171 of file textureReference.cxx.
|
static |
Registers the current object as something that can be read from a Bam file.
Definition at line 791 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 160 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 307 of file textureReference.cxx.
References TexturePlacement::add_egg(), and TexturePlacement::remove_egg().
Referenced by EggFile::choose_placements(), and 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 354 of file textureReference.cxx.
References TexturePlacement::compute_tex_matrix(), TextureImage::get_alpha_mode(), Filename::get_basename(), TexturePlacement::get_dest(), EggFilenameNode::get_filename(), TexturePlacement::get_image(), 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(), EggRenderMode::set_alpha_mode(), EggTransform::set_transform2d(), and ImageFile::update_egg_tex().
Referenced by EggFile::update_egg().
void TextureReference::write | ( | std::ostream & | out, |
int | indent_level = 0 ) const |
Definition at line 469 of file textureReference.cxx.
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 801 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().