96 lines
2.5 KiB
Plaintext
96 lines
2.5 KiB
Plaintext
// Copyright (C) 2010, Guy Barrand. All rights reserved.
|
|
// See the file tools.license for terms.
|
|
|
|
#ifndef tools_sg_gl2ps_manager
|
|
#define tools_sg_gl2ps_manager
|
|
|
|
#include "render_manager"
|
|
|
|
#include <map>
|
|
|
|
namespace tools {
|
|
namespace sg {
|
|
|
|
class gl2ps_manager : public virtual render_manager {
|
|
typedef render_manager parent;
|
|
public:
|
|
TOOLS_SCLASS(tools::sg::gl2ps_manager)
|
|
virtual void* cast(const std::string& a_class) const {
|
|
if(void* p = cmp_cast<gl2ps_manager>(this,a_class)) {return p;}
|
|
else return 0;
|
|
}
|
|
public:
|
|
virtual bool begin_render(int,int,unsigned int,unsigned int,float,float,float,float,bool = true) {return true;}
|
|
virtual void end_render() {}
|
|
|
|
virtual unsigned int create_texture(const img_byte& a_img,bool /*a_NEAREST*/) {
|
|
m_gen_id++; //never return 0.
|
|
m_gstos[m_gen_id] = a_img;
|
|
return m_gen_id;
|
|
}
|
|
|
|
virtual unsigned int create_gsto_from_data(size_t,const float*) {return 0;}
|
|
|
|
virtual bool is_gsto_id_valid(unsigned int a_id) const {
|
|
gstos_t::const_iterator it = m_gstos.find(a_id);
|
|
if(it==m_gstos.end()) return false;
|
|
return true;
|
|
}
|
|
virtual void delete_gsto(unsigned int a_id) {
|
|
gstos_t::iterator it = m_gstos.find(a_id);
|
|
if(it!=m_gstos.end()) m_gstos.erase(it);
|
|
}
|
|
|
|
virtual gsto_mode get_gsto_mode() const {return gsto_memory;}
|
|
virtual void set_gsto_mode(gsto_mode) {}
|
|
virtual void available_gsto_modes(std::vector<std::string>& a_v) {a_v.clear();}
|
|
virtual void available_not_memory_gsto_mode(std::string& a_s) const {a_s.clear();}
|
|
virtual size_t used_texture_memory() const {return 0;}
|
|
virtual size_t gstos_size() const {return 0;}
|
|
public:
|
|
gl2ps_manager():m_gen_id(0){
|
|
#ifdef TOOLS_MEM
|
|
mem::increment(s_class().c_str());
|
|
#endif
|
|
}
|
|
virtual ~gl2ps_manager(){
|
|
m_gstos.clear();
|
|
#ifdef TOOLS_MEM
|
|
mem::decrement(s_class().c_str());
|
|
#endif
|
|
}
|
|
public:
|
|
gl2ps_manager(const gl2ps_manager& a_from)
|
|
:parent(a_from)
|
|
,m_gen_id(0)
|
|
,m_gstos()
|
|
{
|
|
#ifdef TOOLS_MEM
|
|
mem::increment(s_class().c_str());
|
|
#endif
|
|
}
|
|
gl2ps_manager& operator=(const gl2ps_manager& a_from){
|
|
if(&a_from==this) return *this;
|
|
m_gen_id = 0;
|
|
m_gstos.clear();
|
|
return *this;
|
|
}
|
|
public:
|
|
bool find(unsigned int a_id,img_byte& a_img) {
|
|
gstos_t::iterator it = m_gstos.find(a_id);
|
|
if(it==m_gstos.end()) return false;
|
|
a_img = (*it).second;
|
|
return true;
|
|
}
|
|
//void cleanup() {}
|
|
void delete_gstos() {m_gstos.clear();}
|
|
protected:
|
|
unsigned int m_gen_id;
|
|
typedef std::map<unsigned int,img_byte> gstos_t;
|
|
gstos_t m_gstos; //only textures for the moment.
|
|
};
|
|
|
|
}}
|
|
|
|
#endif
|