Panda3D
|
00001 // Filename: texturePoolFilter.h 00002 // Created by: drose (27Jul06) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef TEXTUREPOOLFILTER_H 00016 #define TEXTUREPOOLFILTER_H 00017 00018 #include "pandabase.h" 00019 #include "texture.h" 00020 #include "pointerTo.h" 00021 #include "typedObject.h" 00022 00023 class LoaderOptions; 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Class : TexturePoolFilter 00027 // Description : This is an abstract base class, a placeholder for any 00028 // number of different classes that may wish to 00029 // implement an effect on every texture loaded from disk 00030 // via the TexturePool. 00031 // 00032 // In practice, as of the time of this writing, only the 00033 // TxaFileFilter (in pandatool) actually implements 00034 // this. But other kinds of filters are possible. 00035 // 00036 // This filter, once registered, will get a callback and 00037 // a chance to modify each texture as it is loaded from 00038 // disk the first time. If more than one filter is 00039 // registered, each will be called in sequence, in the 00040 // order in which they were registered. 00041 // 00042 // The filter does not get called again if the texture 00043 // is subsequently reloaded from disk. It is suggested 00044 // that filters for which this might be a problem should 00045 // call tex->set_keep_ram_image(true). 00046 //////////////////////////////////////////////////////////////////// 00047 class EXPCL_PANDA_GOBJ TexturePoolFilter : public TypedObject { 00048 public: 00049 virtual ~TexturePoolFilter(); 00050 00051 virtual PT(Texture) pre_load(const Filename &orig_filename, 00052 const Filename &orig_alpha_filename, 00053 int primary_file_num_channels, 00054 int alpha_file_channel, 00055 bool read_mipmaps, 00056 const LoaderOptions &options); 00057 virtual PT(Texture) post_load(Texture *tex); 00058 00059 virtual void output(ostream &out) const; 00060 00061 public: 00062 static TypeHandle get_class_type() { 00063 return _type_handle; 00064 } 00065 static void init_type() { 00066 TypedObject::init_type(); 00067 register_type(_type_handle, "TexturePoolFilter", 00068 TypedObject::get_class_type()); 00069 } 00070 virtual TypeHandle get_type() const { 00071 return get_class_type(); 00072 } 00073 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00074 00075 private: 00076 static TypeHandle _type_handle; 00077 }; 00078 00079 INLINE ostream &operator << (ostream &out, const TexturePoolFilter &filter) { 00080 filter.output(out); 00081 return out; 00082 } 00083 00084 #include "texturePoolFilter.I" 00085 00086 #endif