Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TextureMemoryCounter Class Reference

This class is used to gather statistics on texture memory usage, etc. More...

#include <textureMemoryCounter.h>

List of all members.

Public Member Functions

 TextureMemoryCounter ()
void reset ()
 Resets the count to zero.

void add_placement (TexturePlacement *placement)
 Adds the indicated TexturePlacement to the counter.

void report (ostream &out, int indent_level)
 Reports the measured texture memory usage.


Private Types

typedef pmap< TextureImage *,
int
Textures
typedef pset< PaletteImage * > Palettes

Private Member Functions

void add_palette (PaletteImage *image)
 Adds the indicated PaletteImage to the count.

void add_texture (TextureImage *texture, int bytes)
 Adds the given TextureImage to the counter.

int count_bytes (ImageFile *image)
 Attempts to estimate the number of bytes the given image file will use in texture memory.

int count_bytes (ImageFile *image, int x_size, int y_size)
 Attempts to estimate the number of bytes the given image file will use in texture memory.


Static Private Member Functions

ostream & format_memory_fraction (ostream &out, int fraction_bytes, int palette_bytes)
 Writes to the indicated ostream an indication of the fraction of the total memory usage that is represented by fraction_bytes.


Private Attributes

int _num_textures
int _num_placed
int _num_unplaced
int _num_palettes
int _bytes
int _unused_bytes
int _duplicate_bytes
int _coverage_bytes
Textures _textures
Palettes _palettes


Detailed Description

This class is used to gather statistics on texture memory usage, etc.

It adds up the total texture memory required by a number of image files, and reports it at the end.

Definition at line 49 of file textureMemoryCounter.h.


Member Typedef Documentation

typedef pset<PaletteImage *> TextureMemoryCounter::Palettes [private]
 

Definition at line 79 of file textureMemoryCounter.h.

typedef pmap<TextureImage *, int> TextureMemoryCounter::Textures [private]
 

Definition at line 76 of file textureMemoryCounter.h.


Constructor & Destructor Documentation

TextureMemoryCounter::TextureMemoryCounter  ) 
 

Definition at line 40 of file textureMemoryCounter.cxx.

References _bytes, _num_palettes, _num_placed, _num_textures, _num_unplaced, and _unused_bytes.


Member Function Documentation

void TextureMemoryCounter::add_palette PaletteImage image  )  [private]
 

Adds the indicated PaletteImage to the count.

If this is called twice for a given PaletteImage it does nothing.

Definition at line 178 of file textureMemoryCounter.cxx.

References _duplicate_bytes, _num_textures, and _textures.

void TextureMemoryCounter::add_placement TexturePlacement placement  ) 
 

Adds the indicated TexturePlacement to the counter.

Definition at line 76 of file textureMemoryCounter.cxx.

References _num_placed.

Referenced by Palettizer::test_palette_group().

void TextureMemoryCounter::add_texture TextureImage texture,
int  bytes
[private]
 

Adds the given TextureImage to the counter.

If the texture image has already been added, this counts the smaller of the two as duplicate bytes.

Definition at line 209 of file textureMemoryCounter.cxx.

References TextureProperties::_format, EggTexture::F_rgb, EggTexture::F_rgb12, EggTexture::F_rgba, EggTexture::F_rgba12, EggTexture::F_rgba8, EggTexture::F_rgbm, and ImageFile::get_properties().

int TextureMemoryCounter::count_bytes ImageFile image,
int  x_size,
int  y_size
[private]
 

Attempts to estimate the number of bytes the given image file will use in texture memory.

Definition at line 251 of file textureMemoryCounter.cxx.

References EggTexture::F_alpha, and EggTexture::F_luminance.

int TextureMemoryCounter::count_bytes ImageFile image  )  [private]
 

Attempts to estimate the number of bytes the given image file will use in texture memory.

Definition at line 236 of file textureMemoryCounter.cxx.

References EggTexture::F_blue, EggTexture::F_green, EggTexture::F_luminance_alpha, EggTexture::F_luminance_alphamask, EggTexture::F_red, EggTexture::F_rgb332, EggTexture::F_rgb5, EggTexture::F_rgb8, EggTexture::F_rgba4, and EggTexture::F_rgba5.

ostream & TextureMemoryCounter::format_memory_fraction ostream &  out,
int  fraction_bytes,
int  palette_bytes
[static, private]
 

Writes to the indicated ostream an indication of the fraction of the total memory usage that is represented by fraction_bytes.

Definition at line 159 of file textureMemoryCounter.cxx.

void TextureMemoryCounter::report ostream &  out,
int  indent_level
 

Reports the measured texture memory usage.

Definition at line 111 of file textureMemoryCounter.cxx.

Referenced by Palettizer::test_palette_group().

void TextureMemoryCounter::reset  ) 
 

Resets the count to zero.

Definition at line 53 of file textureMemoryCounter.cxx.

References _coverage_bytes, _duplicate_bytes, _palettes, and _textures.


Member Data Documentation

int TextureMemoryCounter::_bytes [private]
 

Definition at line 71 of file textureMemoryCounter.h.

Referenced by TextureMemoryCounter().

int TextureMemoryCounter::_coverage_bytes [private]
 

Definition at line 74 of file textureMemoryCounter.h.

Referenced by reset().

int TextureMemoryCounter::_duplicate_bytes [private]
 

Definition at line 73 of file textureMemoryCounter.h.

Referenced by add_palette(), and reset().

int TextureMemoryCounter::_num_palettes [private]
 

Definition at line 69 of file textureMemoryCounter.h.

Referenced by TextureMemoryCounter().

int TextureMemoryCounter::_num_placed [private]
 

Definition at line 67 of file textureMemoryCounter.h.

Referenced by add_placement(), and TextureMemoryCounter().

int TextureMemoryCounter::_num_textures [private]
 

Definition at line 66 of file textureMemoryCounter.h.

Referenced by add_palette(), and TextureMemoryCounter().

int TextureMemoryCounter::_num_unplaced [private]
 

Definition at line 68 of file textureMemoryCounter.h.

Referenced by TextureMemoryCounter().

Palettes TextureMemoryCounter::_palettes [private]
 

Definition at line 80 of file textureMemoryCounter.h.

Referenced by reset().

Textures TextureMemoryCounter::_textures [private]
 

Definition at line 77 of file textureMemoryCounter.h.

Referenced by add_palette(), and reset().

int TextureMemoryCounter::_unused_bytes [private]
 

Definition at line 72 of file textureMemoryCounter.h.

Referenced by TextureMemoryCounter().


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