00001 /* 00002 * GLRenderBase.h 00003 * 00004 * Created on: 14 paź 2015 00005 * Author: pmaciol 00006 */ 00007 00008 #ifndef MOD_FEM_VIEWER_FEMVIEWER_INC_GLRENDERBASE_H_ 00009 #define MOD_FEM_VIEWER_FEMVIEWER_INC_GLRENDERBASE_H_ 00010 00011 #include"fv_txt_utls.h" 00012 00013 00014 class GLcore; 00015 namespace FemViewer { 00016 00017 // Forward decl. 00018 class ViewManager; 00019 class GraphicsSettings; 00020 00021 class GLRenderBase { 00022 00023 template<typename> friend class RenderManager; 00024 00025 public: 00026 GLRenderBase(int type,bool visible=true); 00027 virtual ~GLRenderBase(); 00028 00029 virtual void Clear(); 00030 virtual bool Create(void* argPtr) = 0; 00031 00032 void Render(RenderParams* rparams); 00033 void Setup(const GraphicsSettings* gsettings); 00034 00035 int Type() { return m_type; } 00036 virtual bool IsEnabled() const = 0; 00037 //bool SetEnabled(bool state) { m_dirty = state; } 00038 bool IsVisible() { return m_visible; } 00039 void SetVisible(bool flag) { m_visible = flag; } 00040 00041 protected: 00042 00043 virtual void DoSetup(const GraphicsSettings* gsettings) = 0; 00044 virtual void DoRender(RenderParams* rparams) = 0; 00045 00046 GLCore& m_coreGL; 00047 //ViewManager& m_viewMgr; 00048 const int m_type; 00049 bool m_visible; 00050 GLuint m_vboId, m_iboId; 00051 GLuint m_vaoId; 00052 GLsizei m_count; 00053 00054 private: 00055 GLRenderBase(const GLRenderBase&); 00056 GLRenderBase& operator=(const GLRenderBase&); 00057 }; 00058 00059 00060 template< int RenderType> 00061 class RenderObject : public GLRenderBase { 00062 00063 public: 00064 RenderObject(); 00065 ~RenderObject(); 00066 00067 bool Create(void* arg_ptr) {}; 00068 00069 void Render(const RenderParams* rparams) {mfp_log_debug("Empty render");}; 00070 00071 00072 }; 00073 00074 00075 }// end namepsace FemViewer 00076 00077 #endif /* MOD_FEM_VIEWER_FEMVIEWER_INC_GLRENDERBASE_H_ */