Warning, /include/Geant4/tools/sg/gl2ps_manager is written in an unsupported language. File is not indexed.
0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003
0004 #ifndef tools_sg_gl2ps_manager
0005 #define tools_sg_gl2ps_manager
0006
0007 #include "render_manager"
0008
0009 #include <map>
0010
0011 namespace tools {
0012 namespace sg {
0013
0014 class gl2ps_manager : public virtual render_manager {
0015 typedef render_manager parent;
0016 public:
0017 TOOLS_SCLASS(tools::sg::gl2ps_manager)
0018 virtual void* cast(const std::string& a_class) const {
0019 if(void* p = cmp_cast<gl2ps_manager>(this,a_class)) {return p;}
0020 else return 0;
0021 }
0022 public:
0023 virtual bool begin_render(int,int,unsigned int,unsigned int,float,float,float,float,bool = true) {return true;}
0024 virtual void end_render() {}
0025
0026 virtual unsigned int create_texture(const img_byte& a_img,bool /*a_NEAREST*/) {
0027 m_gen_id++; //never return 0.
0028 m_gstos[m_gen_id] = a_img;
0029 return m_gen_id;
0030 }
0031
0032 virtual unsigned int create_gsto_from_data(size_t,const float*) {return 0;}
0033
0034 virtual bool is_gsto_id_valid(unsigned int a_id) const {
0035 gstos_t::const_iterator it = m_gstos.find(a_id);
0036 if(it==m_gstos.end()) return false;
0037 return true;
0038 }
0039 virtual void delete_gsto(unsigned int a_id) {
0040 gstos_t::iterator it = m_gstos.find(a_id);
0041 if(it!=m_gstos.end()) m_gstos.erase(it);
0042 }
0043
0044 virtual gsto_mode get_gsto_mode() const {return gsto_memory;}
0045 virtual void set_gsto_mode(gsto_mode) {}
0046 virtual void available_gsto_modes(std::vector<std::string>& a_v) {a_v.clear();}
0047 virtual void available_not_memory_gsto_mode(std::string& a_s) const {a_s.clear();}
0048 virtual size_t used_texture_memory() const {return 0;}
0049 virtual size_t gstos_size() const {return 0;}
0050 public:
0051 gl2ps_manager():m_gen_id(0){
0052 #ifdef TOOLS_MEM
0053 mem::increment(s_class().c_str());
0054 #endif
0055 }
0056 virtual ~gl2ps_manager(){
0057 m_gstos.clear();
0058 #ifdef TOOLS_MEM
0059 mem::decrement(s_class().c_str());
0060 #endif
0061 }
0062 public:
0063 gl2ps_manager(const gl2ps_manager& a_from)
0064 :parent(a_from)
0065 ,m_gen_id(0)
0066 ,m_gstos()
0067 {
0068 #ifdef TOOLS_MEM
0069 mem::increment(s_class().c_str());
0070 #endif
0071 }
0072 gl2ps_manager& operator=(const gl2ps_manager& a_from){
0073 if(&a_from==this) return *this;
0074 m_gen_id = 0;
0075 m_gstos.clear();
0076 return *this;
0077 }
0078 public:
0079 bool find(unsigned int a_id,img_byte& a_img) {
0080 gstos_t::iterator it = m_gstos.find(a_id);
0081 if(it==m_gstos.end()) return false;
0082 a_img = (*it).second;
0083 return true;
0084 }
0085 //void cleanup() {}
0086 void delete_gstos() {m_gstos.clear();}
0087 protected:
0088 unsigned int m_gen_id;
0089 typedef std::map<unsigned int,img_byte> gstos_t;
0090 gstos_t m_gstos; //only textures for the moment.
0091 };
0092
0093 }}
0094
0095 #endif