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

pandatool/src/egg-palettize/textureMemoryCounter.h

Go to the documentation of this file.
00001 // Filename: textureMemoryCounter.h
00002 // Created by:  drose (19Dec00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef TEXTUREMEMORYCOUNTER_H
00020 #define TEXTUREMEMORYCOUNTER_H
00021 
00022 #include <pandatoolbase.h>
00023 
00024 class ImageFile;
00025 class PaletteImage;
00026 class TextureImage;
00027 class DestTextureImage;
00028 class TexturePlacement;
00029 
00030 #include "pmap.h"
00031 #include "pset.h"
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //       Class : TextureMemoryCounter
00035 // Description : This class is used to gather statistics on texture
00036 //               memory usage, etc.  It adds up the total texture
00037 //               memory required by a number of image files, and
00038 //               reports it at the end.
00039 ////////////////////////////////////////////////////////////////////
00040 class TextureMemoryCounter {
00041 public:
00042   TextureMemoryCounter();
00043 
00044   void reset();
00045   void add_placement(TexturePlacement *placement);
00046 
00047   void report(ostream &out, int indent_level);
00048 
00049 private:
00050   static ostream &format_memory_fraction(ostream &out, int fraction_bytes,
00051                                          int palette_bytes);
00052   void add_palette(PaletteImage *image);
00053   void add_texture(TextureImage *texture, int bytes);
00054   int count_bytes(ImageFile *image);
00055   int count_bytes(ImageFile *image, int x_size, int y_size);
00056 
00057   int _num_textures;
00058   int _num_placed;
00059   int _num_unplaced;
00060   int _num_palettes;
00061 
00062   int _bytes;
00063   int _unused_bytes;
00064   int _duplicate_bytes;
00065   int _coverage_bytes;
00066 
00067   typedef pmap<TextureImage *, int> Textures;
00068   Textures _textures;
00069 
00070   typedef pset<PaletteImage *> Palettes;
00071   Palettes _palettes;
00072 };
00073 
00074 #endif

Generated on Fri May 2 03:18:11 2003 for Panda-Tool by doxygen1.3