Panda3D
 All Classes Functions Variables Enumerations
txaFileFilter.h
1 // Filename: txaFileFilter.h
2 // Created by: drose (27Jul06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef TXAFILEFILTER_H
16 #define TXAFILEFILTER_H
17 
18 #include "pandatoolbase.h"
19 #include "texturePoolFilter.h"
20 #include "pt_EggTexture.h"
21 
22 class TxaFile;
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : TxaFileFilter
26 // Description : This is an abstract base class, a placeholder for any
27 // number of different classes that may wish to
28 // implement an effect on every texture loaded from disk
29 // via the TexturePool.
30 //
31 // In practice, as of the time of this writing, only the
32 // TxaFileFilter (in pandatool) actually implements
33 // this. But other kinds of filters are possible.
34 //
35 // This filter, once registered, will get a callback and
36 // a chance to modify each texture as it is loaded from
37 // disk the first time. If more than one filter is
38 // registered, each will be called in sequence, in the
39 // order in which they were registered.
40 //
41 // The filter does not get called again if the texture
42 // is subsequently reloaded from disk. It is suggested
43 // that filters for which this might be a problem should
44 // call tex->set_keep_ram_image(true).
45 ////////////////////////////////////////////////////////////////////
46 class EXPCL_MISC TxaFileFilter : public TexturePoolFilter {
47 public:
48  virtual PT(Texture) post_load(Texture *tex);
49 
50 private:
51  static void read_txa_file();
52 
53 private:
54  static TxaFile *_txa_file;
55  static bool _got_txa_file;
56 
57 public:
58  static TypeHandle get_class_type() {
59  return _type_handle;
60  }
61  static void init_type() {
62  TexturePoolFilter::init_type();
63  register_type(_type_handle, "TxaFileFilter",
64  TexturePoolFilter::get_class_type());
65  }
66  virtual TypeHandle get_type() const {
67  return get_class_type();
68  }
69  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
70 
71 private:
72  static TypeHandle _type_handle;
73 };
74 
75 #include "txaFileFilter.I"
76 
77 #endif
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition: texture.h:75
This is an abstract base class, a placeholder for any number of different classes that may wish to im...
Definition: txaFileFilter.h:46
This is an abstract base class, a placeholder for any number of different classes that may wish to im...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
This represents the .txa file (usually textures.txa) that contains the user instructions for resizing...
Definition: txaFile.h:33