Geant4 Cross Reference |
1 // Copyright (C) 2010, Guy Barrand. All rights 2 // See the file tools.license for terms. 3 4 #ifndef tools_sg_gl2ps_manager 5 #define tools_sg_gl2ps_manager 6 7 #include "render_manager" 8 9 #include <map> 10 11 namespace tools { 12 namespace sg { 13 14 class gl2ps_manager : public virtual render_ma 15 typedef render_manager parent; 16 public: 17 TOOLS_SCLASS(tools::sg::gl2ps_manager) 18 virtual void* cast(const std::string& a_clas 19 if(void* p = cmp_cast<gl2ps_manager>(this, 20 else return 0; 21 } 22 public: 23 virtual bool begin_render(int,int,unsigned i 24 virtual void end_render() {} 25 26 virtual unsigned int create_texture(const im 27 m_gen_id++; //never return 0. 28 m_gstos[m_gen_id] = a_img; 29 return m_gen_id; 30 } 31 32 virtual unsigned int create_gsto_from_data(s 33 34 virtual bool is_gsto_id_valid(unsigned int a 35 gstos_t::const_iterator it = m_gstos.find( 36 if(it==m_gstos.end()) return false; 37 return true; 38 } 39 virtual void delete_gsto(unsigned int a_id) 40 gstos_t::iterator it = m_gstos.find(a_id); 41 if(it!=m_gstos.end()) m_gstos.erase(it); 42 } 43 44 virtual gsto_mode get_gsto_mode() const {ret 45 virtual void set_gsto_mode(gsto_mode) {} 46 virtual void available_gsto_modes(std::vecto 47 virtual void available_not_memory_gsto_mode( 48 virtual size_t used_texture_memory() const { 49 virtual size_t gstos_size() const {return 0; 50 public: 51 gl2ps_manager():m_gen_id(0){ 52 #ifdef TOOLS_MEM 53 mem::increment(s_class().c_str()); 54 #endif 55 } 56 virtual ~gl2ps_manager(){ 57 m_gstos.clear(); 58 #ifdef TOOLS_MEM 59 mem::decrement(s_class().c_str()); 60 #endif 61 } 62 public: 63 gl2ps_manager(const gl2ps_manager& a_from) 64 :parent(a_from) 65 ,m_gen_id(0) 66 ,m_gstos() 67 { 68 #ifdef TOOLS_MEM 69 mem::increment(s_class().c_str()); 70 #endif 71 } 72 gl2ps_manager& operator=(const gl2ps_manager 73 if(&a_from==this) return *this; 74 m_gen_id = 0; 75 m_gstos.clear(); 76 return *this; 77 } 78 public: 79 bool find(unsigned int a_id,img_byte& a_img) 80 gstos_t::iterator it = m_gstos.find(a_id); 81 if(it==m_gstos.end()) return false; 82 a_img = (*it).second; 83 return true; 84 } 85 //void cleanup() {} 86 void delete_gstos() {m_gstos.clear();} 87 protected: 88 unsigned int m_gen_id; 89 typedef std::map<unsigned int,img_byte> gsto 90 gstos_t m_gstos; //only textures for the mom 91 }; 92 93 }} 94 95 #endif