|
|
|
This corresponds to a particular assignment of a TextureImage with a PaletteGroup, and specifically describes which PaletteImage (if any), and where on the PaletteImage, the TextureImage has been assigned to.
More...
#include "texturePlacement.h"
List of all members.
Public Types |
|
typedef pvector< TextureImage * > | TextureSwaps |
Public Member Functions |
|
| TexturePlacement (TextureImage *texture, PaletteGroup *group) |
| void | add_egg (TextureReference *reference) |
| | Records the fact that a particular egg file is using this particular 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 | compute_tex_matrix (LMatrix3d &transform) |
| | Stores in the indicated matrix the appropriate texture matrix transform for the new placement of the texture.
|
| bool | determine_size () |
| | Attempts to determine the appropriate size of the texture for the given placement.
|
| void | fill_image (PNMImage &image) |
| | Fills in the rectangle of the palette image represented by the texture placement with the image pixels.
|
| void | fill_swapped_image (PNMImage &image, int index) |
| | Fills in the rectangle of the swapped palette image represented by the texture placement with the image pixels.
|
| void | flag_error_image (PNMImage &image) |
| | Sets the rectangle of the palette image represented by the texture placement to red, to represent a missing texture.
|
| void | force_replace () |
| | Removes the texture from its particular PaletteImage, but does not remove it from the PaletteGroup.
|
| DestTextureImage * | get_dest () const |
| | Returns the DestTextureImage that corresponds to this texture as it was copied to the install directory.
|
| PaletteGroup * | get_group () const |
| | Returns the group that this placement represents.
|
| PaletteImage * | get_image () const |
| | Returns the particular PaletteImage on which the texture has been placed.
|
| const string & | get_name () const |
| | Returns the name of the texture that this placement represents.
|
| OmitReason | get_omit_reason () const |
| | Returns the reason the texture has been omitted from a palette image, or OR_none if it has not.
|
| PalettePage * | get_page () const |
| | Returns the particular PalettePage on which the texture has been placed.
|
| double | get_placed_uv_area () const |
| | Returns the total area of the rectangle occupied by the UV minmax box, as it has been placed.
|
| int | get_placed_x () const |
| | Returns the X pixel at which the texture has been placed within its PaletteImage.
|
| int | get_placed_x_size () const |
| | Returns the size in the X dimension, in pixels, of the texture image as it has been placed within the palette.
|
| int | get_placed_y () const |
| | Returns the Y pixel at which the texture has been placed within its PaletteImage.
|
| int | get_placed_y_size () const |
| | Returns the size in the Y dimension, in pixels, of the texture image as it has been placed within the palette.
|
| const TextureProperties & | get_properties () const |
| | Returns the grouping properties of the image.
|
| TextureImage * | get_texture () const |
| | Returns the texture that this placement represents.
|
|
virtual TypeHandle | get_type () const |
| double | get_uv_area () const |
| | Returns the total area of the rectangle occupied by the UV minmax box, in UV coordinates.
|
| int | get_x_size () const |
| | Returns the size in the X dimension, in pixels, of the texture image as it must appear in the palette.
|
| int | get_y_size () const |
| | Returns the size in the Y dimension, in pixels, of the texture image as it must appear in the palette.
|
| bool | intersects (int x, int y, int x_size, int y_size) |
| | Returns true if the particular position this texture has been assigned to overlaps the rectangle whose top left corner is at x, y and whose size is given by x_size, y_size, or false otherwise.
|
| bool | is_filled () const |
| | Returns true if the texture has been filled (i.e.
|
| bool | is_placed () const |
| | Returns true if the texture has been placed on a palette image, false otherwise.
|
| bool | is_size_known () const |
| | Returns true if the texture's size is known, false otherwise.
|
| void | mark_eggs_stale () |
| | Marks all the egg files that reference this placement stale.
|
| void | mark_unfilled () |
| | Marks the texture as unfilled, so that it will need to be copied into the palette image again.
|
| void | not_solitary () |
| | Indicates that the texture, formerly indicated as solitary, is now no longer.
|
| void | omit_solitary () |
| | Sets the omit reason (returned by get_omit()) to OR_solitary, indicating that the palettized version of the texture should not be used because it is the only texture on a PaletteImage.
|
| void | place_at (PaletteImage *image, int x, int y) |
| | Assigns the texture to a particular position within the indicated PaletteImage.
|
| void | remove_egg (TextureReference *reference) |
| | Notes that a particular egg file is no longer using this particular TexturePlacement.
|
| void | set_dest (DestTextureImage *dest) |
| | Sets the DestTextureImage that corresponds to this texture as it was copied to the install directory.
|
| 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.
|
| void | write_placed (ostream &out, int indent_level=0) |
| | Writes the placement position information on a line by itself.
|
Static Public Member Functions |
|
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.
|
| static void | register_with_read_factory () |
| | Registers the current object as something that can be read from a Bam file.
|
Public Attributes |
|
TextureSwaps | _textureSwaps |
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 |
| static TypedWritable * | make_TexturePlacement (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.
|
Detailed Description
This corresponds to a particular assignment of a TextureImage with a PaletteGroup, and specifically describes which PaletteImage (if any), and where on the PaletteImage, the TextureImage has been assigned to.
Definition at line 45 of file texturePlacement.h.
Member Function Documentation
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 1127 of file texturePlacement.cxx.
Attempts to determine the appropriate size of the texture for the given placement.
This is based on the UV range of the egg files that reference the texture. Returns true on success, or false if the texture size cannot be determined (e.g. the texture file is unknown).
After this returns true, get_x_size() and get_y_size() may safely be called.
Definition at line 226 of file texturePlacement.cxx.
References force_replace(), TextureImage::get_coverage_threshold(), TextureReference::get_max_uv(), TextureReference::get_min_uv(), TextureImage::get_omit(), TextureImage::get_txa_wrap_u(), TextureImage::get_txa_wrap_v(), get_uv_area(), TextureReference::get_wrap_u(), TextureReference::get_wrap_v(), TextureReference::has_uvs(), PaletteGroup::is_none_texture_swap(), is_placed(), ImageFile::is_size_known(), and mark_eggs_stale().
Referenced by TextureImage::determine_placement_size(), and PaletteGroup::update_unknown_textures().
Fills in the rectangle of the palette image represented by the texture placement with the image pixels.
Definition at line 797 of file texturePlacement.cxx.
References compute_tex_matrix(), flag_error_image(), PNMImageHeader::get_maxval(), PNMImageHeader::get_num_channels(), ImageFile::get_x_size(), ImageFile::get_y_size(), PNMImageHeader::has_alpha(), is_placed(), PNMImage::is_valid(), PNMImage::quick_filter_from(), TextureImage::read_source_image(), TextureImage::release_source_image(), PNMImage::set_alpha(), and PNMImage::set_xel().
Referenced by PaletteImage::update_image().
Fills in the rectangle of the swapped palette image represented by the texture placement with the image pixels.
Definition at line 897 of file texturePlacement.cxx.
References compute_tex_matrix(), flag_error_image(), PNMImageHeader::get_maxval(), PNMImageHeader::get_num_channels(), ImageFile::get_x_size(), ImageFile::get_y_size(), PNMImageHeader::has_alpha(), is_placed(), PNMImage::is_valid(), PNMImage::quick_filter_from(), TextureImage::read_source_image(), TextureImage::release_source_image(), PNMImage::set_alpha(), and PNMImage::set_xel().
Referenced by PaletteImage::update_image().
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from TypedWritable.
Definition at line 141 of file texturePlacement.h.
Returns true if the particular position this texture has been assigned to overlaps the rectangle whose top left corner is at x, y and whose size is given by x_size, y_size, or false otherwise.
Definition at line 679 of file texturePlacement.cxx.
References is_placed().
Returns true if the texture has been placed on a palette image, false otherwise.
This will generally be true if get_omit_reason() returns OR_none or OR_solitary and false otherwise.
Definition at line 501 of file texturePlacement.cxx.
Referenced by compute_tex_matrix(), determine_size(), fill_image(), fill_swapped_image(), flag_error_image(), get_image(), get_page(), get_placed_uv_area(), get_placed_x(), get_placed_x_size(), get_placed_y(), get_placed_y_size(), intersects(), not_solitary(), omit_solitary(), PaletteImage::place(), place_at(), PalettePage::unplace(), PaletteImage::unplace(), PaletteGroup::unplace(), and write_placed().
The documentation for this class was generated from the following files:
| | |