Panda3D
textureMemoryCounter.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file textureMemoryCounter.h
10  * @author drose
11  * @date 2000-12-19
12  */
13 
14 #ifndef TEXTUREMEMORYCOUNTER_H
15 #define TEXTUREMEMORYCOUNTER_H
16 
17 #include "pandatoolbase.h"
18 
19 class ImageFile;
20 class PaletteImage;
21 class TextureImage;
22 class DestTextureImage;
23 class TexturePlacement;
24 
25 #include "pmap.h"
26 #include "pset.h"
27 
28 /**
29  * This class is used to gather statistics on texture memory usage, etc. It
30  * adds up the total texture memory required by a number of image files, and
31  * reports it at the end.
32  */
34 public:
36 
37  void reset();
38  void add_placement(TexturePlacement *placement);
39 
40  void report(std::ostream &out, int indent_level);
41 
42 private:
43  static std::ostream &format_memory_fraction(std::ostream &out, int fraction_bytes,
44  int palette_bytes);
45  void add_palette(PaletteImage *image);
46  void add_texture(TextureImage *texture, int bytes);
47  int count_bytes(ImageFile *image);
48  int count_bytes(ImageFile *image, int x_size, int y_size);
49 
50  int _num_textures;
51  int _num_placed;
52  int _num_unplaced;
53  int _num_palettes;
54 
55  int _bytes;
56  int _unused_bytes;
57  int _duplicate_bytes;
58  int _coverage_bytes;
59 
61  Textures _textures;
62 
64  Palettes _palettes;
65 };
66 
67 #endif
void reset()
Resets the count to zero.
This represents a texture filename as it has been resized and copied to the map directory (e....
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void report(std::ostream &out, int indent_level)
Reports the measured texture memory usage.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the base class of both TextureImage and PaletteImage.
Definition: imageFile.h:33
void add_placement(TexturePlacement *placement)
Adds the indicated TexturePlacement to the counter.
This corresponds to a particular assignment of a TextureImage with a PaletteGroup,...
This class is used to gather statistics on texture memory usage, etc.
This is a single palette image, one of several within a PalettePage, which is in turn one of several ...
Definition: paletteImage.h:32
This represents a single source texture that is referenced by one or more egg files.
Definition: textureImage.h:46