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