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. 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 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 (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 (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... | |
![]() | |
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... | |
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. More... | |
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. 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... | |
![]() | |
TypedObject (const TypedObject ©) | |
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... | |
void | operator= (const TypedObject ©) |
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 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. More... | |
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. More... | |
Additional Inherited Members | |
![]() | |
static TypedWritable *const | Null = (TypedWritable*)0L |
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 43 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 518 of file textureReference.cxx.
References LVecBase2d::almost_equal(), EggVertex::copy_grefs_from(), EggVertexPool::create_unique_vertex(), EggVertex::get_pool(), get_texture(), EggVertex::get_uv(), EggTexture::get_uv_name(), EggVertex::gref_size(), EggPrimitive::has_texture(), EggVertex::has_uv(), TypedObject::is_of_type(), register_with_read_factory(), EggPrimitive::replace(), EggVertex::set_uv(), ImageFile::update_properties(), and LVector2d::zero().
Referenced by EggFile::apply_properties_to_source(), and update_egg().
void TextureReference::clear_placement | ( | ) |
Removes any reference to a TexturePlacement.
Definition at line 375 of file textureReference.cxx.
References get_placement(), and set_placement().
Referenced by 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 940 of file textureReference.cxx.
References TypedWritable::complete_pointers(), TextureProperties::complete_pointers(), TypedWritable::fillin(), TextureProperties::fillin(), DatagramIterator::get_bool(), DatagramIterator::get_float64(), DatagramIterator::get_int32(), DatagramIterator::get_string(), LMatrix3d::read_datagram(), and BamReader::read_pointer().
Referenced by write_datagram().
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 79 of file textureReference.cxx.
References EggTexture::determine_wrap_u(), EggTexture::determine_wrap_v(), from_egg_quick(), 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(), LMatrix3d::ident_mat(), LMatrix3d::invert_from(), 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 157 of file textureReference.cxx.
References release_egg_data().
Referenced by from_egg(), and EggFile::scan_textures().
EggFile * TextureReference::get_egg_file | ( | ) | const |
Returns the EggFile that references this texture.
Definition at line 198 of file textureReference.cxx.
References get_source().
Referenced by rebind_egg_data().
const LTexCoordd & TextureReference::get_max_uv | ( | ) | const |
Returns the maximum UV coordinate in use for the texture by this reference.
Definition at line 278 of file textureReference.cxx.
References get_wrap_u().
Referenced by TexturePlacement::determine_size(), and get_min_uv().
const LTexCoordd & TextureReference::get_min_uv | ( | ) | const |
Returns the minimum UV coordinate in use for the texture by this reference.
Definition at line 266 of file textureReference.cxx.
References get_max_uv().
Referenced by TexturePlacement::determine_size(), and has_uvs().
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 388 of file textureReference.cxx.
References mark_egg_stale().
Referenced by EggFile::choose_placements(), clear_placement(), and EggFile::remove_egg().
SourceTextureImage * TextureReference::get_source | ( | ) | const |
Returns the SourceTextureImage that this object refers to.
Definition at line 209 of file textureReference.cxx.
References get_texture().
Referenced by EggFile::build_cross_links(), and get_egg_file().
TextureImage * TextureReference::get_texture | ( | ) | const |
Returns the TextureImage that this object refers to.
Definition at line 219 of file textureReference.cxx.
References SourceTextureImage::get_texture(), and get_tref_name().
Referenced by apply_properties_to_source(), EggFile::build_cross_links(), EggFile::choose_placements(), get_source(), and update_egg().
const string & TextureReference::get_tref_name | ( | ) | const |
Returns the name of the EggTexture entry that references this texture.
Definition at line 231 of file textureReference.cxx.
References operator<().
Referenced by get_texture(), and EggFile::write_texture_refs().
EggTexture::WrapMode TextureReference::get_wrap_u | ( | ) | const |
Returns the specification for the wrapping in the U direction.
Definition at line 290 of file textureReference.cxx.
References get_wrap_v().
Referenced by TexturePlacement::determine_size(), and get_max_uv().
EggTexture::WrapMode TextureReference::get_wrap_v | ( | ) | const |
Returns the specification for the wrapping in the V direction.
Definition at line 301 of file textureReference.cxx.
References is_equivalent().
Referenced by TexturePlacement::determine_size(), and get_wrap_u().
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 255 of file textureReference.cxx.
References get_min_uv().
Referenced by TexturePlacement::determine_size(), operator<(), and EggFile::scan_textures().
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 315 of file textureReference.cxx.
References LVecBase2d::almost_equal(), LMatrix3d::almost_equal(), TextureProperties::egg_properties_match(), and set_placement().
Referenced by get_wrap_v(), and EggFile::scan_textures().
void TextureReference::mark_egg_stale | ( | ) |
Marks the egg file that shares this reference as stale.
Definition at line 399 of file textureReference.cxx.
References EggFile::mark_stale(), and update_egg().
Referenced by TexturePlacement::add_egg(), get_placement(), 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 242 of file textureReference.cxx.
References has_uvs().
Referenced by get_tref_name().
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 186 of file textureReference.cxx.
References get_egg_file().
Referenced by release_egg_data(), and EggFile::write_texture_refs().
|
static |
Registers the current object as something that can be read from a Bam file.
Definition at line 891 of file textureReference.cxx.
References BamReader::get_factory(), and write_datagram().
Referenced by apply_properties_to_source().
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 172 of file textureReference.cxx.
References rebind_egg_data().
Referenced by from_egg_quick(), and 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 355 of file textureReference.cxx.
References TexturePlacement::add_egg(), clear_placement(), and TexturePlacement::remove_egg().
Referenced by EggFile::choose_placements(), clear_placement(), and is_equivalent().
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 413 of file textureReference.cxx.
References apply_properties_to_source(), 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 mark_egg_stale(), and EggFile::update_egg().
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 904 of file textureReference.cxx.
References Datagram::add_bool(), Datagram::add_float64(), Datagram::add_int32(), Datagram::add_string(), complete_pointers(), TypedWritable::write_datagram(), TextureProperties::write_datagram(), LMatrix3d::write_datagram(), and BamWriter::write_pointer().
Referenced by register_with_read_factory().