Panda3D
Public Member Functions | Static Public Member Functions | List of all members
PalettePage Class Reference

This is a particular collection of textures, within a PaletteGroup, that all share the same TextureProperties. More...

#include "palettePage.h"

Inheritance diagram for PalettePage:
TypedWritable Namable TypedObject MemoryBase MemoryBase

Public Member Functions

 PalettePage (PaletteGroup *group, const TextureProperties &properties)
 
void assign (TexturePlacement *placement)
 Adds the indicated texture to the list of textures to consider placing on the page. More...
 
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. More...
 
PaletteGroupget_group () const
 Returns the group this particular PalettePage belongs to. More...
 
const TexturePropertiesget_properties () const
 Returns the texture grouping properties that all textures in this page share. More...
 
virtual TypeHandle get_type () const
 
void optimal_resize ()
 Attempts to resize each PalettteImage down to its smallest possible size. More...
 
void place (TexturePlacement *placement)
 Assigns the particular TexturePlacement to a PaletteImage where it fits. More...
 
void place_all ()
 Assigns all the textures to their final home in a PaletteImage somewhere. More...
 
void reset_images ()
 Throws away all of the current PaletteImages, so that new ones may be created (and the packing made more optimal). More...
 
void setup_shadow_images ()
 Ensures that each PaletteImage's _shadow_image has the correct filename and image types, based on what was supplied on the command line and in the .txa file. More...
 
void unplace (TexturePlacement *placement)
 Removes the TexturePlacement from wherever it has been placed. More...
 
void update_images (bool redo_all)
 Regenerates each PaletteImage on this page that needs it. More...
 
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. More...
 
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, to the indicated output stream. More...
 
- Public Member Functions inherited from TypedWritable
 TypedWritable (const TypedWritable &copy)
 
virtual ReferenceCountas_reference_count ()
 Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. More...
 
vector_uchar encode_to_bam_stream () const
 Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object. More...
 
bool encode_to_bam_stream (vector_uchar &data, BamWriter *writer=nullptr) const
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More...
 
virtual void finalize (BamReader *manager)
 Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed. More...
 
virtual TypeHandle force_init_type ()
 
UpdateSeq get_bam_modified () const
 Returns the current bam_modified counter. More...
 
void mark_bam_modified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More...
 
void operator= (const TypedWritable &copy)
 
virtual bool require_fully_complete () const
 Some objects require all of their nested pointers to have been completed before the objects themselves can be completed. More...
 
virtual void update_bam_nested (BamWriter *manager)
 Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates. More...
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)=default
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
int get_best_parent_from_Set (const std::set< int > &) const
 
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly. More...
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type. More...
 
TypedObjectoperator= (const TypedObject &copy)=default
 
- Public Member Functions inherited from Namable
 Namable (const std::string &initial_name="")
 
void clear_name ()
 Resets the Namable's name to empty. More...
 
const std::string & get_name () const
 
bool has_name () const
 Returns true if the Namable has a nonempty name set, false if the name is empty. More...
 
void output (std::ostream &out) const
 Outputs the Namable. More...
 
void set_name (const std::string &name)
 

Static Public Member Functions

static TypeHandle get_class_type ()
 
static void init_type ()
 
static void register_with_read_factory ()
 Registers the current object as something that can be read from a Bam file. More...
 
- Static Public Member Functions inherited from TypedWritable
static bool decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, vector_uchar data, BamReader *reader=nullptr)
 Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts the single object on those bytes. More...
 
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedObject
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. More...
 
- Static Public Member Functions inherited from Namable
static TypeHandle get_class_type ()
 
static void init_type ()
 

Additional Inherited Members

- Public Attributes inherited from TypedObject
 get_type
 
- Public Attributes inherited from Namable
 get_name
 
 set_name
 
- Static Public Attributes inherited from TypedWritable
static TypedWritable *const Null = nullptr
 

Detailed Description

This is a particular collection of textures, within a PaletteGroup, that all share the same TextureProperties.

The textures on the same page may therefore all be placed on the same set of PaletteImages together.

Definition at line 33 of file palettePage.h.

Member Function Documentation

◆ assign()

void PalettePage::assign ( TexturePlacement placement)

Adds the indicated texture to the list of textures to consider placing on the page.

Definition at line 71 of file palettePage.cxx.

◆ complete_pointers()

int PalettePage::complete_pointers ( TypedWritable **  p_list,
BamReader manager 
)
virtual

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 248 of file palettePage.cxx.

◆ get_group()

PaletteGroup * PalettePage::get_group ( ) const

Returns the group this particular PalettePage belongs to.

Definition at line 53 of file palettePage.cxx.

◆ get_properties()

const TextureProperties & PalettePage::get_properties ( ) const

Returns the texture grouping properties that all textures in this page share.

Definition at line 62 of file palettePage.cxx.

◆ optimal_resize()

void PalettePage::optimal_resize ( )

Attempts to resize each PalettteImage down to its smallest possible size.

Definition at line 161 of file palettePage.cxx.

References PaletteImage::optimal_resize().

Referenced by PaletteGroup::optimal_resize().

◆ place()

void PalettePage::place ( TexturePlacement placement)

Assigns the particular TexturePlacement to a PaletteImage where it fits.

Definition at line 107 of file palettePage.cxx.

Referenced by place_all().

◆ place_all()

void PalettePage::place_all ( )

Assigns all the textures to their final home in a PaletteImage somewhere.

Definition at line 80 of file palettePage.cxx.

References PaletteImage::check_solitary(), and place().

◆ register_with_read_factory()

void PalettePage::register_with_read_factory ( )
static

Registers the current object as something that can be read from a Bam file.

Definition at line 215 of file palettePage.cxx.

References BamReader::get_factory().

Referenced by init_palettizer().

◆ reset_images()

void PalettePage::reset_images ( )

Throws away all of the current PaletteImages, so that new ones may be created (and the packing made more optimal).

Definition at line 174 of file palettePage.cxx.

References PaletteImage::reset_image().

Referenced by PaletteGroup::reset_images().

◆ setup_shadow_images()

void PalettePage::setup_shadow_images ( )

Ensures that each PaletteImage's _shadow_image has the correct filename and image types, based on what was supplied on the command line and in the .txa file.

Definition at line 191 of file palettePage.cxx.

References PaletteImage::setup_shadow_image().

Referenced by PaletteGroup::setup_shadow_images().

◆ unplace()

void PalettePage::unplace ( TexturePlacement placement)

Removes the TexturePlacement from wherever it has been placed.

Definition at line 134 of file palettePage.cxx.

◆ update_images()

void PalettePage::update_images ( bool  redo_all)

Regenerates each PaletteImage on this page that needs it.

Definition at line 203 of file palettePage.cxx.

References PaletteImage::update_image().

Referenced by PaletteGroup::update_images().

◆ write_datagram()

void PalettePage::write_datagram ( BamWriter writer,
Datagram datagram 
)
virtual

Fills the indicated datagram up with a binary representation of the current object, in preparation for writing to a Bam file.

Reimplemented from TypedWritable.

Definition at line 225 of file palettePage.cxx.

References Datagram::add_string(), Datagram::add_uint32(), TypedWritable::write_datagram(), TextureProperties::write_datagram(), and BamWriter::write_pointer().

◆ write_image_info()

void PalettePage::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, to the indicated output stream.

Definition at line 144 of file palettePage.cxx.

References indent(), PaletteImage::is_empty(), ImageFile::output_filename(), and PaletteImage::write_placements().

Referenced by PaletteGroup::write_image_info().


The documentation for this class was generated from the following files: