00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef TEXTURESTAGEPOOL_H
00016 #define TEXTURESTAGEPOOL_H
00017
00018 #include "pandabase.h"
00019 #include "textureStage.h"
00020 #include "pointerTo.h"
00021 #include "pmutex.h"
00022 #include "pset.h"
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class EXPCL_PANDA_GOBJ TextureStagePool {
00036 PUBLISHED:
00037 enum Mode {
00038 M_none,
00039 M_name,
00040 M_unique,
00041 };
00042
00043 INLINE static TextureStage *get_stage(TextureStage *temp);
00044 INLINE static void release_stage(TextureStage *temp);
00045 INLINE static void release_all_stages();
00046
00047 INLINE static void set_mode(Mode mode);
00048 INLINE static Mode get_mode();
00049
00050 INLINE static int garbage_collect();
00051 INLINE static void list_contents(ostream &out);
00052 static void write(ostream &out);
00053
00054 private:
00055 TextureStagePool();
00056
00057 TextureStage *ns_get_stage(TextureStage *temp);
00058 void ns_release_stage(TextureStage *temp);
00059 void ns_release_all_stages();
00060
00061 void ns_set_mode(Mode mode);
00062 Mode ns_get_mode();
00063
00064 int ns_garbage_collect();
00065 void ns_list_contents(ostream &out) const;
00066
00067 static TextureStagePool *get_global_ptr();
00068
00069 static TextureStagePool *_global_ptr;
00070
00071 Mutex _lock;
00072
00073
00074
00075
00076
00077 typedef pmap<CPT(TextureStage), PT(TextureStage), indirect_compare_to<const TextureStage *> > StagesByProperties;
00078 StagesByProperties _stages_by_properties;
00079
00080 typedef pmap<string, PT(TextureStage) > StagesByName;
00081 StagesByName _stages_by_name;
00082
00083 Mode _mode;
00084 };
00085
00086 EXPCL_PANDA_GOBJ ostream &operator << (ostream &out, TextureStagePool::Mode mode);
00087 EXPCL_PANDA_GOBJ istream &operator >> (istream &in, TextureStagePool::Mode &mode);
00088
00089 #include "textureStagePool.I"
00090
00091 #endif
00092
00093