Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File 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 List of all members.

Public Member Functions

 PalettePage (PaletteGroup *group, const TextureProperties &properties)
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.

void assign (TexturePlacement *placement)
 Adds the indicated texture to the list of textures to consider placing on the page.

void place_all ()
 Assigns all the textures to their final home in a PaletteImage somewhere.

void place (TexturePlacement *placement)
 Assigns the particular TexturePlacement to a PaletteImage where it fits.

void unplace (TexturePlacement *placement)
 Removes the TexturePlacement from wherever it has been placed.

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.

void optimal_resize ()
 Attempts to resize each PalettteImage down to its smallest possible size.

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 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.

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.

virtual TypeHandle get_type () const
virtual void finalize ()
virtual TypeHandle force_init_type (void)
int get_type_index () const
bool is_of_type (TypeHandle handle) const
bool is_exact_type (TypeHandle handle) const
void set_name (const string &name)
void clear_name ()
bool has_name () const
const string & get_name () const
void output (ostream &out) const

Static Public Member Functions

void register_with_read_factory ()
 Registers the current object as something that can be read from a Bam file.

TypeHandle get_class_type ()
void init_type ()

Static Public Attributes

TypedWritable *const Null

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

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.


Protected Attributes

string _name

Private Types

typedef pvector< TexturePlacement * > Assigned
typedef pvector< PaletteImage * > Images

Private Member Functions

 PalettePage ()
 The default constructor is only for the convenience of the Bam reader.


Private Attributes

PaletteGroup_group
TextureProperties _properties
Assigned _assigned
Images _images
int _num_images

Static Private Attributes

TypeHandle _type_handle

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


Member Typedef Documentation

typedef pvector<TexturePlacement *> PalettePage::Assigned [private]
 

Definition at line 76 of file palettePage.h.

typedef pvector<PaletteImage *> PalettePage::Images [private]
 

Definition at line 79 of file palettePage.h.


Constructor & Destructor Documentation

PalettePage::PalettePage  )  [private]
 

The default constructor is only for the convenience of the Bam reader.

Definition at line 49 of file palettePage.cxx.

PalettePage::PalettePage PaletteGroup group,
const TextureProperties properties
 

Definition at line 61 of file palettePage.cxx.

References _group.


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

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

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

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

Referenced by register_with_read_factory().

TypeHandle PalettePage::get_class_type void   )  [inline, static]
 

Reimplemented from Namable.

Definition at line 99 of file palettePage.h.

Referenced by reset_images().

PaletteGroup * PalettePage::get_group  )  const
 

Returns the group this particular PalettePage belongs to.

Definition at line 79 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 94 of file palettePage.cxx.

References _assigned, and place().

virtual TypeHandle PalettePage::get_type void   )  const [inline, virtual]
 

Reimplemented from TypedWritable.

Definition at line 109 of file palettePage.h.

void PalettePage::init_type void   )  [inline, static]
 

Reimplemented from Namable.

Definition at line 102 of file palettePage.h.

References _type_handle.

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

Referenced by reset_images().

void PalettePage::optimal_resize  ) 
 

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

Definition at line 235 of file palettePage.cxx.

void PalettePage::place TexturePlacement placement  ) 
 

Assigns the particular TexturePlacement to a PaletteImage where it fits.

Definition at line 159 of file palettePage.cxx.

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

Referenced by get_properties().

void PalettePage::place_all  ) 
 

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

Definition at line 125 of file palettePage.cxx.

References _images, TexturePlacement::get_omit_reason(), nassertv, OR_working, and PaletteImage::place().

void PalettePage::register_with_read_factory void   )  [static]
 

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

Definition at line 320 of file palettePage.cxx.

References fillin(), params, and parse_params().

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

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

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

References _images, and writer().

void PalettePage::unplace TexturePlacement placement  ) 
 

Removes the TexturePlacement from wherever it has been placed.

Definition at line 193 of file palettePage.cxx.

References _images, and PaletteImage::optimal_resize().

Referenced by PaletteGroup::get_dependency_order().

void PalettePage::update_images bool  redo_all  ) 
 

Regenerates each PaletteImage on this page that needs it.

Definition at line 301 of file palettePage.cxx.

References _group, DCAST_INTO_R, and NULL.

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

References _num_images, _properties, TextureProperties::fillin(), TypedWritable::fillin(), DatagramIterator::get_string(), DatagramIterator::get_uint32(), BamReader::read_pointer(), BamReader::read_pointers(), and Namable::set_name().

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

References _images.

Referenced by PaletteGroup::increment_egg_count().


Member Data Documentation

Assigned PalettePage::_assigned [private]
 

Definition at line 77 of file palettePage.h.

Referenced by get_properties().

PaletteGroup* PalettePage::_group [private]
 

Definition at line 73 of file palettePage.h.

Referenced by PalettePage(), and update_images().

Images PalettePage::_images [private]
 

Definition at line 80 of file palettePage.h.

Referenced by place_all(), setup_shadow_images(), unplace(), and write_image_info().

int PalettePage::_num_images [private]
 

Definition at line 96 of file palettePage.h.

Referenced by write_datagram().

TextureProperties PalettePage::_properties [private]
 

Definition at line 74 of file palettePage.h.

Referenced by write_datagram().

TypeHandle PalettePage::_type_handle [static, private]
 

Reimplemented from Namable.

Definition at line 36 of file palettePage.cxx.

Referenced by init_type().


The documentation for this class was generated from the following files:
Generated on Fri May 2 03:27:45 2003 for Panda-Tool by doxygen1.3