Panda3D

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
TextureReference Class Reference

This is the particular reference of a texture filename by an egg file. More...

`#include "textureReference.h"`

Inheritance diagram for TextureReference:

## 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.
Public Member Functions inherited from TypedWritable
| TypedWritable (const TypedWritable &copy)
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 &copy)
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.
Public Member Functions inherited from TypedObject
| TypedObject (const TypedObject &copy)=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 &copy)=default
Public Member Functions inherited from MemoryBase
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 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.
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.

## Additional Inherited Members
Public Attributes inherited from TypedObject
| get_type
Static Public Attributes inherited from TypedWritable
static TypedWritable *const | Null = nullptr

## Detailed Description

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.

## Constructor & Destructor Documentation

## ◆ TextureReference()

TextureReference::TextureReference | ( |  | ) |

Definition at line 47 of file textureReference.cxx.

## ◆ ~TextureReference()

TextureReference::~TextureReference | ( |  | ) |

Definition at line 66 of file textureReference.cxx.

## Member Function Documentation

## ◆ apply_properties_to_source()

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.

## ◆ clear_placement()

void TextureReference::clear_placement | ( |  | ) |

Removes any reference to a TexturePlacement.

Definition at line 325 of file textureReference.cxx.

References set_placement().

## ◆ complete_pointers()

int TextureReference::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 TypedWritable.

Definition at line 833 of file textureReference.cxx.

References TypedWritable::complete_pointers().

## ◆ from_egg()

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 Filename::get_basename_wo_extension(), TextureImage::get_source(), and ImageFile::update_properties().

Referenced by EggFile::scan_textures().

## ◆ from_egg_quick()

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().

## ◆ get_class_type()

static TypeHandle TextureReference::get_class_type | ( |  | ) |
| inline static

Definition at line 121 of file textureReference.h.

## ◆ get_egg_file()

EggFile * TextureReference::get_egg_file | ( |  | ) | const

Returns the EggFile that references this texture.

Definition at line 181 of file textureReference.cxx.

## ◆ get_max_uv()

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.

## ◆ 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 233 of file textureReference.cxx.

## ◆ get_placement()

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.

## ◆ get_source()

SourceTextureImage * TextureReference::get_source | ( |  | ) | const

Returns the SourceTextureImage that this object refers to.

Definition at line 189 of file textureReference.cxx.

## ◆ get_texture()

TextureImage * TextureReference::get_texture | ( |  | ) | const

Returns the TextureImage that this object refers to.

Definition at line 197 of file textureReference.cxx.

Referenced by update_egg().

## ◆ get_tref_name()

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.

## ◆ get_type()

virtual TypeHandle TextureReference::get_type | ( |  | ) | const
| inline virtual

Reimplemented from TypedWritable.

Definition at line 129 of file textureReference.h.

## ◆ get_wrap_u()

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.

## ◆ get_wrap_v()

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.

## ◆ has_uvs()

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 EggFile::scan_textures().

## ◆ init_type()

static void TextureReference::init_type | ( |  | ) |
| inline static

Definition at line 124 of file textureReference.h.

## ◆ is_equivalent()

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.

Referenced by EggFile::scan_textures().

## ◆ mark_egg_stale()

void TextureReference::mark_egg_stale | ( |  | ) |

Marks the egg file that shares this reference as stale.

Definition at line 343 of file textureReference.cxx.

## ◆ operator<()

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.

## ◆ output()

void TextureReference::output | ( | std::ostream & | out | ) | const

Definition at line 461 of file textureReference.cxx.

## ◆ rebind_egg_data()

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.

## ◆ register_with_read_factory()

void TextureReference::register_with_read_factory | ( |  | ) |
| 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().

## ◆ release_egg_data()

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.

## ◆ set_placement()

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.

Referenced by clear_placement().

## ◆ update_egg()

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 TextureImage::get_alpha_mode(), Filename::get_basename(), ImageFile::get_num_channels(), get_texture(), TextureImage::get_txa_wrap_u(), TextureImage::get_txa_wrap_v(), ImageFile::has_num_channels(), and ImageFile::update_egg_tex().

## ◆ write()

void TextureReference::write | ( | std::ostream & | out,
|  | int | indent_level = 0 ) const

Definition at line 469 of file textureReference.cxx.

## ◆ write_datagram()

void TextureReference::write_datagram | ( | BamWriter * | writer,
|  | Datagram & | datagram )
| virtual

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(), and BamWriter::write_pointer().

The documentation for this class was generated from the following files:

- pandatool/src/palettizer/textureReference.h
- pandatool/src/palettizer/textureReference.cxx