Go to the documentation of this file.
14 #ifndef TEXTUREPLACEMENT_H
15 #define TEXTUREPLACEMENT_H
81 bool intersects(
int x,
int y,
int x_size,
int y_size);
85 void write_placed(std::ostream &out,
int indent_level = 0);
97 void compute_size_from_uvs(
const LTexCoordd &min_uv,
const LTexCoordd &max_uv);
130 int _num_textureSwaps;
136 static void init_type() {
137 TypedWritable::init_type();
139 TypedWritable::get_class_type());
142 return get_class_type();
bool is_size_known() const
Returns true if the texture's size is known, false otherwise.
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object,...
This is a single palette image, one of several within a PalettePage, which is in turn one of several ...
void set_dest(DestTextureImage *dest)
Sets the DestTextureImage that corresponds to this texture as it was copied to the install directory.
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the highest level of grouping for TextureImages.
void flag_error_image(PNMImage &image)
Sets the rectangle of the palette image represented by the texture placement to red,...
A class to retrieve the individual data elements previously stored in a Datagram.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
const std::string & get_name() const
Returns the name of the texture that this placement represents.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
void fill_swapped_image(PNMImage &image, int index)
Fills in the rectangle of the swapped palette image represented by the texture placement with the ima...
void force_replace()
Removes the texture from its particular PaletteImage, but does not remove it from the PaletteGroup.
void add_egg(TextureReference *reference)
Records the fact that a particular egg file is using this particular TexturePlacement.
const TextureProperties & get_properties() const
Returns the grouping properties of the image.
Base class for objects that can be written to and read from Bam files.
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
This represents a particular position of a texture within a 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...
OmitReason
This enumerates the reasons why a texture may not have been placed in a palette image.
TypeHandle is the identifier used to differentiate C++ class types.
double get_placed_uv_area() const
Returns the total area of the rectangle occupied by the UV minmax box, as it has been placed.
PalettePage * get_page() const
Returns the particular PalettePage on which the texture has been placed.
OmitReason get_omit_reason() const
Returns the reason the texture has been omitted from a palette image, or OR_none if it has not.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
PaletteImage * get_image() const
Returns the particular PaletteImage on which the texture has been placed.
void compute_tex_matrix(LMatrix3d &transform)
Stores in the indicated matrix the appropriate texture matrix transform for the new placement of the ...
static void register_with_read_factory()
Registers the current object as something that can be read from a Bam file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void place_at(PaletteImage *image, int x, int y)
Assigns the texture to a particular position within the indicated PaletteImage.
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 whos...
void mark_unfilled()
Marks the texture as unfilled, so that it will need to be copied into the palette image again.
This is a particular collection of textures, within a PaletteGroup, that all share the same TexturePr...
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...
void write_placed(std::ostream &out, int indent_level=0)
Writes the placement position information on a line by itself.
TextureImage * get_texture() const
Returns the texture that this placement represents.
void remove_egg(TextureReference *reference)
Notes that a particular egg file is no longer using this particular TexturePlacement.
This is the set of characteristics of a texture that, if different from another texture,...
int get_placed_x() const
Returns the X pixel at which the texture has been placed within its PaletteImage.
bool is_filled() const
Returns true if the texture has been filled (i.e.
This corresponds to a particular assignment of a TextureImage with a PaletteGroup,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the particular reference of a texture filename by an egg file.
PaletteGroup * get_group() const
Returns the group that this placement represents.
void fill_image(PNMImage &image)
Fills in the rectangle of the palette image represented by the texture placement with the image pixel...
double get_uv_area() const
Returns the total area of the rectangle occupied by the UV minmax box, in UV coordinates.
bool operator()(TexturePlacement *a, TexturePlacement *b) const
Compares two TexturePlacement objects and returns true if the first one is bigger than the second one...
DestTextureImage * get_dest() const
Returns the DestTextureImage that corresponds to this texture as it was copied to the install directo...
bool is_placed() const
Returns true if the texture has been placed on a palette image, false otherwise.
void mark_eggs_stale()
Marks all the egg files that reference this placement stale.
This represents a texture filename as it has been resized and copied to the map directory (e....
void omit_solitary()
Sets the omit reason (returned by get_omit()) to OR_solitary, indicating that the palettized version ...
int get_placed_y() const
Returns the Y pixel at which the texture has been placed within its PaletteImage.
void not_solitary()
Indicates that the texture, formerly indicated as solitary, is now no longer.
bool determine_size()
Attempts to determine the appropriate size of the texture for the given placement.
This represents a single source texture that is referenced by one or more egg files.