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);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool is_empty() const
Returns true if there are no textures, or only one "solitary" texture, placed on the image.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PaletteImage * get_image() const
Returns the particular PaletteImage on which the texture has been placed.
Base class for objects that can be written to and read from Bam files.
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 output_filename(std::ostream &out) const
Writes the filename (or pair of filenames) to the indicated output stream.
void place_all()
Assigns all the textures to their final home in a PaletteImage somewhere.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object,...
void setup_shadow_images()
Ensures that each PaletteImage's _shadow_image has the correct filename and image types,...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
void place(TexturePlacement *placement)
Assigns the particular TexturePlacement to a PaletteImage where it fits.
This is a particular collection of textures, within a PaletteGroup, that all share the same TexturePr...
std::string get_string()
Extracts a variable-length string.
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...
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 add_uint32(uint32_t value)
Adds an unsigned 32-bit integer to the datagram.
bool place(TexturePlacement *placement)
Attempts to place the indicated texture on the image.
void unplace(TexturePlacement *placement)
Removes the TexturePlacement from wherever it has been placed.
void optimal_resize()
Attempts to resize the palette image to as small as it can go.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
A base class for all things which can have a name.
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.
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().
void update_images(bool redo_all)
Regenerates each PaletteImage on this page that needs it.
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,...
static void register_with_read_factory()
Registers the current object as something that can be read from a Bam file.
void reset_image()
Unpacks each texture that has been placed on this image, resetting the image to empty.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
PaletteGroup * get_group() const
Returns the group this particular PalettePage belongs to.
void read_pointers(DatagramIterator &scan, int count)
A convenience function to read a contiguous list of pointers.
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object,...
void assign(TexturePlacement *placement)
Adds the indicated texture to the list of textures to consider placing on the page.
void add_string(const std::string &str)
Adds a variable-length string to the datagram.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
uint32_t get_uint32()
Extracts an unsigned 32-bit integer.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PalettePage * get_page() const
Returns the particular PalettePage on which the texture has been placed.
void optimal_resize()
Attempts to resize each PalettteImage down to its smallest possible size.
This corresponds to a particular assignment of a TextureImage with a PaletteGroup,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
OmitReason get_omit_reason() const
Returns the reason the texture has been omitted from a palette image, or OR_none if it has not.
void fillin(DatagramIterator &scan, BamReader *manager)
Reads the binary data from the given datagram iterator, which was written by a previous call to write...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
void reset_images()
Throws away all of the current PaletteImages, so that new ones may be created (and the packing made m...
bool read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.
void setup_shadow_image()
Ensures the _shadow_image has the correct filename and image types, based on what was supplied on the...
This is a single palette image, one of several within a PalettePage, which is in turn one of several ...
void unplace(TexturePlacement *placement)
Removes the texture from the image.
A class to retrieve the individual data elements previously stored in a Datagram.
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.
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,...
TypeHandle is the identifier used to differentiate C++ class types.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.
const TextureProperties & get_properties() const
Returns the texture grouping properties that all textures in this page share.
This is the set of characteristics of a texture that, if different from another texture,...