#include <textureReference.h>
Inheritance diagram for TextureReference:
Public Member Functions | |
TextureReference () | |
~TextureReference () | |
void | from_egg (EggFile *egg_file, EggData *data, EggTexture *egg_tex) |
Sets up the TextureReference using information extracted from an egg file. | |
EggFile * | get_egg_file () const |
Returns the EggFile that references this texture. | |
SourceTextureImage * | get_source () const |
Returns the SourceTextureImage that this object refers to. | |
TextureImage * | get_texture () const |
Returns the TextureImage that this object refers to. | |
bool | has_uvs () const |
Returns true if this TextureReference actually uses the texture on geometry, with UV's and everything, or false otherwise. | |
const TexCoordd & | get_min_uv () const |
Returns the minimum UV coordinate in use for the texture by this reference. | |
const TexCoordd & | get_max_uv () const |
Returns the maximum UV coordinate in use for the texture by this reference. | |
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. | |
void | set_placement (TexturePlacement *placement) |
Sets the particular TexturePlacement that is appropriate for this egg file. | |
void | clear_placement () |
Removes any reference to a TexturePlacement. | |
TexturePlacement * | get_placement () const |
Returns the particular TexturePlacement that is appropriate for this egg file. | |
void | mark_egg_stale () |
Marks the egg file that shares this reference as stale. | |
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 | apply_properties_to_source () |
Applies the texture properties as read from the egg file to the source image's properties. | |
void | output (ostream &out) const |
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. | |
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. | |
virtual TypeHandle | get_type () const |
virtual void | finalize () |
virtual TypeHandle | force_init_type (void) |
int | get_type_index () const |
bool | is_of_type (TypeHandle handle) const |
bool | is_exact_type (TypeHandle handle) const |
Static Public Member Functions | |
void | register_with_read_factory () |
Registers the current object as something that can be read from a Bam file. | |
TypeHandle | get_class_type () |
void | init_type () |
Static Public Attributes | |
TypedWritable *const | Null |
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 | |
TypedWritable * | make_TextureReference (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. | |
Private Member Functions | |
void | get_uv_range (EggGroupNode *group, Palettizer::RemapUV remap) |
Checks the geometry in the egg file to see what range of UV's are requested for this particular texture reference. | |
void | update_uv_range (EggGroupNode *group, Palettizer::RemapUV remap) |
Actually applies the UV translates that were assumed in the previous call to get_uv_range(). | |
bool | get_geom_uvs (EggPrimitive *geom, TexCoordd &geom_min_uv, TexCoordd &geom_max_uv) |
Determines the minimum and maximum UV range for a particular primitive. | |
void | translate_geom_uvs (EggPrimitive *geom, const TexCoordd &trans) const |
Applies the indicated translation to each UV in the primitive. | |
Static Private Member Functions | |
void | collect_uv (bool &any_uvs, TexCoordd &min_uv, TexCoordd &max_uv, const TexCoordd &got_min_uv, const TexCoordd &got_max_uv) |
Updates any_uvs, min_uv, and max_uv with the indicated min and max UV's already determined. | |
LVector2d | translate_uv (const TexCoordd &min_uv, const TexCoordd &max_uv) |
Returns the needed adjustment to translate the given bounding box so that its center lies in the unit square (0,0) - (1,1). | |
Private Attributes | |
EggFile * | _egg_file |
EggTexture * | _egg_tex |
EggData * | _egg_data |
LMatrix3d | _tex_mat |
LMatrix3d | _inv_tex_mat |
SourceTextureImage * | _source_texture |
TexturePlacement * | _placement |
bool | _uses_alpha |
bool | _any_uvs |
TexCoordd | _min_uv |
TexCoordd | _max_uv |
EggTexture::WrapMode | _wrap_u |
EggTexture::WrapMode | _wrap_v |
TextureProperties | _properties |
Static Private Attributes | |
TypeHandle | _type_handle |
It also includes information about the way in which the egg file uses the texture; e.g. does it repeat.
Definition at line 56 of file textureReference.h.
|
Definition at line 56 of file textureReference.cxx. References _any_uvs, _max_uv, _min_uv, _placement, _source_texture, _uses_alpha, _wrap_u, _wrap_v, NULL, and EggTexture::WM_unspecified. |
|
Definition at line 79 of file textureReference.cxx. References _egg_data, _egg_file, _egg_tex, _inv_tex_mat, _tex_mat, EggTexture::get_transform(), and EggTexture::has_transform(). |
|
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::mark_stale(). |
|
Removes any reference to a TexturePlacement.
Definition at line 307 of file textureReference.cxx. References _egg_tex, EggRenderMode::AM_unspecified, and EggTexture::set_alpha_mode(). |
|
Updates any_uvs, min_uv, and max_uv with the indicated min and max UV's already determined.
Definition at line 791 of file textureReference.cxx. References fillin(), params, and parse_params(). |
|
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 894 of file textureReference.cxx. |
|
Reads the binary data from the given datagram iterator, which was written by a previous call to write_datagram().
Reimplemented from TypedWritable. Definition at line 955 of file textureReference.cxx. Referenced by collect_uv(). |
|
Sets up the TextureReference using information extracted from an egg file.
Definition at line 94 of file textureReference.cxx. References _inv_tex_mat, and _tex_mat. |
|
Reimplemented from TypedWritable. Definition at line 126 of file textureReference.h. |
|
Returns the EggFile that references this texture.
Definition at line 157 of file textureReference.cxx. References _source_texture, SourceTextureImage::get_texture(), nassertr, and NULL. |
|
Determines the minimum and maximum UV range for a particular primitive. Returns true if it has any UV's, false otherwise. Definition at line 735 of file textureReference.cxx. References _properties, _tex_mat, and writer(). |
|
Returns the maximum UV coordinate in use for the texture by this reference.
Definition at line 236 of file textureReference.cxx. References _placement, TexturePlacement::add_egg(), NULL, and TexturePlacement::remove_egg(). |
|
Returns the minimum UV coordinate in use for the texture by this reference.
Definition at line 220 of file textureReference.cxx. References _wrap_v, and EggTexture::WrapMode. |
|
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 326 of file textureReference.cxx. References _egg_tex, _placement, Filename::get_basename(), EggTexture::get_filename(), OR_unknown, EggTexture::set_filename(), and ImageFile::update_egg_tex(). Referenced by EggFile::is_stale(). |
|
Returns the SourceTextureImage that this object refers to.
Definition at line 172 of file textureReference.cxx. References _any_uvs. |
|
Returns the TextureImage that this object refers to.
Definition at line 185 of file textureReference.cxx. References _any_uvs, _min_uv, nassertr, and TexCoordd. Referenced by EggFile::is_stale(). |
|
Reimplemented from TypedWritable. Definition at line 134 of file textureReference.h. References output(). |
|
Checks the geometry in the egg file to see what range of UV's are requested for this particular texture reference. If pal->_remap_uv is not RU_never, this will also attempt to remap the UV's found so that the midpoint lies in the unit square (0,0) - (1,1), in the hopes of maximizing overlap of UV coordinates between different polygons. However, the hypothetical translations are not actually applied to the egg file at this point (because we might decide not to place the texture in a palette); they will actually be applied when update_uv_range(), below, is called later. Definition at line 563 of file textureReference.cxx. References EggGroup::DT_none, and pal. |
|
Returns the specification for the wrapping in the U direction.
Definition at line 252 of file textureReference.cxx. References NULL, and set_placement(). |
|
Returns the specification for the wrapping in the V direction.
Definition at line 267 of file textureReference.cxx. References _placement. |
|
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 205 of file textureReference.cxx. References _wrap_u, and EggTexture::WrapMode. |
|
Reimplemented from TypedWritable. Definition at line 129 of file textureReference.h. References _type_handle. |
|
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 932 of file textureReference.cxx. |
|
Marks the egg file that shares this reference as stale.
Definition at line 341 of file textureReference.cxx. References _placement. Referenced by TexturePlacement::add_egg(), TexturePlacement::get_group(), and TexturePlacement::get_properties(). |
|
Definition at line 466 of file textureReference.cxx. References DCAST_INTO_V, EggGroup::DT_none, EggGroup::get_class_type(), EggGroup::get_dart_type(), and EggGroupNode::is_of_type(). Referenced by get_type(). |
|
Registers the current object as something that can be read from a Bam file.
Definition at line 835 of file textureReference.cxx. |
|
Sets the particular TexturePlacement that is appropriate for this egg file. This is called by EggFile::choose_placements(). Definition at line 284 of file textureReference.cxx. Referenced by get_wrap_u(). |
|
Applies the indicated translation to each UV in the primitive.
Definition at line 762 of file textureReference.cxx. References _egg_file, _placement, _properties, _source_texture, TextureProperties::complete_pointers(), TypedWritable::complete_pointers(), DCAST_INTO_R, and NULL. |
|
Returns the needed adjustment to translate the given bounding box so that its center lies in the unit square (0,0) - (1,1).
Definition at line 819 of file textureReference.cxx. References _any_uvs, _max_uv, _min_uv, _properties, _uses_alpha, _wrap_u, and _wrap_v. |
|
Updates the egg file with all the relevant information to reference the texture in its new home, wherever that might be.
Definition at line 360 of file textureReference.cxx. References _egg_tex, _placement, and pal. |
|
Actually applies the UV translates that were assumed in the previous call to get_uv_range().
Definition at line 656 of file textureReference.cxx. References EggPrimitive::begin(), EggVertex::copy_grefs_from(), EggVertexPool::create_unique_vertex(), EggPrimitive::end(), EggVertex::get_pool(), EggVertex::get_uv(), EggVertex::gref_size(), EggVertex::has_uv(), EggPrimitive::iterator, EggPrimitive::replace(), and EggVertex::set_uv(). |
|
Definition at line 478 of file textureReference.cxx. References pal. Referenced by EggFile::remove_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 853 of file textureReference.cxx. |
|
Definition at line 108 of file textureReference.h. Referenced by get_source(), get_texture(), TextureReference(), and translate_uv(). |
|
Definition at line 100 of file textureReference.h. Referenced by ~TextureReference(). |
|
Definition at line 98 of file textureReference.h. Referenced by translate_geom_uvs(), and ~TextureReference(). |
|
Definition at line 99 of file textureReference.h. Referenced by clear_placement(), get_placement(), update_egg(), and ~TextureReference(). |
|
Definition at line 102 of file textureReference.h. Referenced by from_egg(), and ~TextureReference(). |
|
Definition at line 109 of file textureReference.h. Referenced by TextureReference(), and translate_uv(). |
|
Definition at line 109 of file textureReference.h. Referenced by get_texture(), TextureReference(), and translate_uv(). |
|
Definition at line 104 of file textureReference.h. Referenced by get_max_uv(), get_placement(), get_wrap_v(), mark_egg_stale(), TextureReference(), translate_geom_uvs(), and update_egg(). |
|
Definition at line 112 of file textureReference.h. Referenced by get_geom_uvs(), translate_geom_uvs(), and translate_uv(). |
|
Definition at line 103 of file textureReference.h. Referenced by get_egg_file(), TextureReference(), and translate_geom_uvs(). |
|
Definition at line 102 of file textureReference.h. Referenced by from_egg(), get_geom_uvs(), and ~TextureReference(). |
|
Reimplemented from TypedWritable. Definition at line 46 of file textureReference.cxx. Referenced by init_type(). |
|
Definition at line 106 of file textureReference.h. Referenced by TextureReference(), and translate_uv(). |
|
Definition at line 110 of file textureReference.h. Referenced by has_uvs(), TextureReference(), and translate_uv(). |
|
Definition at line 110 of file textureReference.h. Referenced by get_min_uv(), TextureReference(), and translate_uv(). |