Go to the documentation of this file.
43 Namable(properties.get_string()),
45 _properties(properties)
72 _assigned.push_back(placement);
85 Assigned::const_iterator ai;
86 for (ai = _assigned.begin(); ai != _assigned.end(); ++ai) {
97 for (ii = _images.begin(); ii != _images.end(); ++ii) {
112 for (ii = _images.begin(); ii != _images.end(); ++ii) {
114 if (image->
place(placement)) {
121 _images.push_back(image);
123 bool placed = image->
place(placement);
145 Images::const_iterator ii;
146 for (ii = _images.begin(); ii != _images.end(); ++ii) {
149 indent(out, indent_level);
163 for (ii = _images.begin(); ii != _images.end(); ++ii) {
176 for (ii = _images.begin(); ii != _images.end(); ++ii) {
193 for (ii = _images.begin(); ii != _images.end(); ++ii) {
205 for (ii = _images.begin(); ii != _images.end(); ++ii) {
217 register_factory(get_class_type(), make_PalettePage);
235 Images::const_iterator ii;
236 for (ii = _images.begin(); ii != _images.end(); ++ii) {
251 if (p_list[pi] !=
nullptr) {
252 DCAST_INTO_R(_group, p_list[pi], pi);
259 _images.reserve(_num_images);
260 for (i = 0; i < _num_images; i++) {
262 DCAST_INTO_R(image, p_list[pi++], pi);
263 _images.push_back(image);
281 me->fillin(scan, manager);
295 _properties.
fillin(scan, manager);
void unplace(TexturePlacement *placement)
Removes the texture from the image.
void optimal_resize()
Attempts to resize the palette image to as small as it can go.
std::string get_string()
Extracts a variable-length string.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
const TextureProperties & get_properties() const
Returns the texture grouping properties that all textures in this page share.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a single palette image, one of several within a PalettePage, which is in turn one of several ...
This is the highest level of grouping for TextureImages.
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...
void write_placements(std::ostream &out, int indent_level=0) const
Writes a list of the textures that have been placed on this image to the indicated output stream,...
A class to retrieve the individual data elements previously stored in a Datagram.
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
void output_filename(std::ostream &out) const
Writes the filename (or pair of filenames) to the indicated output stream.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
void setup_shadow_images()
Ensures that each PaletteImage's _shadow_image has the correct filename and image types,...
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void update_image(bool redo_all)
If the palette has changed since it was last written out, updates the image and writes out a new one.
bool is_empty() const
Returns true if there are no textures, or only one "solitary" texture, placed on the image.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
void check_solitary()
To be called after all textures have been placed on the image, this checks to see if there is only on...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void place_all()
Assigns all the textures to their final home in a PaletteImage somewhere.
Base class for objects that can be written to and read from Bam files.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void place(TexturePlacement *placement)
Assigns the particular TexturePlacement to a PaletteImage where it fits.
static void register_with_read_factory()
Registers the current object as something that can be read from a Bam file.
void add_string(const std::string &str)
Adds a variable-length string to the datagram.
TypeHandle is the identifier used to differentiate C++ class types.
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...
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void optimal_resize()
Attempts to resize each PalettteImage down to its smallest possible size.
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object,...
void read_pointers(DatagramIterator &scan, int count)
A convenience function to read a contiguous list of pointers.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
void update_images(bool redo_all)
Regenerates each PaletteImage on this page that needs it.
PaletteImage * get_image() const
Returns the particular PaletteImage on which the texture has been placed.
void unplace(TexturePlacement *placement)
Removes the TexturePlacement from wherever it has been placed.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
void fillin(DatagramIterator &scan, BamReader *manager)
Reads the binary data from the given datagram iterator, which was written by a previous call to write...
bool place(TexturePlacement *placement)
Attempts to place the indicated texture on the image.
void reset_images()
Throws away all of the current PaletteImages, so that new ones may be created (and the packing made m...
PaletteGroup * get_group() const
Returns the group this particular PalettePage belongs to.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a particular collection of textures, within a PaletteGroup, that all share the same TexturePr...
void setup_shadow_image()
Ensures the _shadow_image has the correct filename and image types, based on what was supplied on the...
void assign(TexturePlacement *placement)
Adds the indicated texture to the list of textures to consider placing on the page.
void reset_image()
Unpacks each texture that has been placed on this image, resetting the image to empty.
This is the set of characteristics of a texture that, if different from another texture,...
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object,...
void add_uint32(uint32_t value)
Adds an unsigned 32-bit integer to the datagram.
bool read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.
This corresponds to a particular assignment of a TextureImage with a PaletteGroup,...
A base class for all things which can have a name.
void write_image_info(std::ostream &out, int indent_level=0) const
Writes a list of the PaletteImages associated with this page, and all of their textures,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool is_placed() const
Returns true if the texture has been placed on a palette image, false otherwise.
uint32_t get_uint32()
Extracts an unsigned 32-bit integer.
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class's make_from_bam() method to read in all...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...