Panda3D
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions

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

List of all members.

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.
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.
PaletteGroupget_group () const
 Returns the group this particular PalettePage belongs to.
const TexturePropertiesget_properties () const
 Returns the texture grouping properties that all textures in this page share.
virtual TypeHandle get_type () const
void optimal_resize ()
 Attempts to resize each PalettteImage down to its smallest possible size.
void place (TexturePlacement *placement)
 Assigns the particular TexturePlacement to a PaletteImage where it fits.
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 more optimal).
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.
void unplace (TexturePlacement *placement)
 Removes the TexturePlacement from wherever it has been placed.
void update_images (bool redo_all)
 Regenerates each PaletteImage on this page that needs it.
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.
void write_image_info (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.

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.

Protected Member Functions

void fillin (DatagramIterator &scan, BamReader *manager)
 Reads the binary data from the given datagram iterator, which was written by a previous call to write_datagram().

Static Protected Member Functions

static TypedWritablemake_PalettePage (const FactoryParams &params)
 This method is called by the BamReader when an object of this type is encountered in a Bam file; it should allocate and return a new object with all the data read.

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 37 of file palettePage.h.


Member Function Documentation

void PalettePage::assign ( TexturePlacement placement)

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

Definition at line 84 of file palettePage.cxx.

Referenced by PaletteGroup::place_all().

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

References TextureProperties::complete_pointers().

void PalettePage::fillin ( DatagramIterator scan,
BamReader manager 
) [protected, virtual]

Reads the binary data from the given datagram iterator, which was written by a previous call to write_datagram().

Reimplemented from TypedWritable.

Definition at line 342 of file palettePage.cxx.

References TextureProperties::fillin(), DatagramIterator::get_string(), DatagramIterator::get_uint32(), BamReader::read_pointer(), and BamReader::read_pointers().

Referenced by make_PalettePage().

PaletteGroup * PalettePage::get_group ( ) const

Returns the group this particular PalettePage belongs to.

Definition at line 62 of file palettePage.cxx.

const TextureProperties & PalettePage::get_properties ( ) const

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

Definition at line 73 of file palettePage.cxx.

Referenced by PaletteGroup::finalize().

TypedWritable * PalettePage::make_PalettePage ( const FactoryParams params) [static, protected]

This method is called by the BamReader when an object of this type is encountered in a Bam file; it should allocate and return a new object with all the data read.

Definition at line 324 of file palettePage.cxx.

References fillin().

Referenced by register_with_read_factory().

void PalettePage::optimal_resize ( )

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

Definition at line 189 of file palettePage.cxx.

References PaletteImage::optimal_resize().

Referenced by PaletteGroup::optimal_resize().

void PalettePage::place ( TexturePlacement placement)

Assigns the particular TexturePlacement to a PaletteImage where it fits.

Definition at line 126 of file palettePage.cxx.

References TexturePlacement::get_omit_reason(), and PaletteImage::place().

Referenced by place_all().

void PalettePage::place_all ( )

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

Definition at line 96 of file palettePage.cxx.

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

Referenced by PaletteGroup::place_all().

void PalettePage::register_with_read_factory ( ) [static]

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

Definition at line 255 of file palettePage.cxx.

References BamReader::get_factory(), and make_PalettePage().

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

References PaletteImage::reset_image().

Referenced by PaletteGroup::reset_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 225 of file palettePage.cxx.

References PaletteImage::setup_shadow_image().

Referenced by PaletteGroup::setup_shadow_images().

void PalettePage::unplace ( TexturePlacement placement)

Removes the TexturePlacement from wherever it has been placed.

Definition at line 156 of file palettePage.cxx.

References TexturePlacement::get_image(), TexturePlacement::get_page(), TexturePlacement::is_placed(), and PaletteImage::unplace().

Referenced by PaletteGroup::unplace().

void PalettePage::update_images ( bool  redo_all)

Regenerates each PaletteImage on this page that needs it.

Definition at line 240 of file palettePage.cxx.

References PaletteImage::update_image().

Referenced by PaletteGroup::update_images().

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

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

void PalettePage::write_image_info ( 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 169 of file palettePage.cxx.

References 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:
 All Classes Functions Variables Enumerations