Resources.h
Go to the documentation of this file.
00001 
00002 #ifndef __RESOURCES_H__
00003 #define __RESOURCES_H__
00004 
00005 #include <blort/Tracker/headers.h>
00006 #include <blort/Tracker/Singleton.h>
00007 #include <blort/Tracker/ImageProcessor.h>
00008 #include <blort/Tracker/TrackerModel.h>
00009 #include <blort/Tracker/ModelLoader.h>
00010 #include <blort/Tracker/Texture.h>
00011 #include <blort/Tracker/Shader.h>
00012 
00013 #ifndef FN_LEN
00014 #define FN_LEN 256
00015 #endif
00016 
00017 #define g_Resources Resources::GetInstance()
00018 
00019 namespace Tracking{
00020 
00021 typedef std::vector<Shader*> ShaderList;
00022 typedef std::vector<char*> NameList;
00023 
00024 
00025 class Resources : public Singleton <Resources>
00026 {
00027 friend class Singleton <Resources>;
00028 private:
00029         Resources();
00030         
00031         // Singleton Resources (one instance in programm)
00032         CvCapture*                      m_capture;
00033         IplImage*                       m_image;
00034         ImageProcessor*         m_ip;
00035         
00036         // Resources lists
00037         ShaderList              m_shaderList;
00038         
00039         // Name lists
00040         NameList                m_shaderNameList;
00041         
00042         char                    m_shaderPath[FN_LEN];
00043         
00044         bool                    m_showlog;
00045         
00046         int                             SearchName(NameList* list, const char* filename);
00047 
00048 public:
00049         ~Resources();
00050         static Resources* GetInstance(){
00051                 return Singleton <Resources>::GetInstance ();
00052         }
00053         
00054         // Initialisation
00055         IplImage*                               InitCapture(const char* file);
00056         IplImage*                               InitCapture(float width=640.0, float height=480.0, int camID = CV_CAP_ANY);
00057         ImageProcessor*                 InitImageProcessor(int width, int height);
00058 
00059     // Release-functions
00060         void ReleaseCapture();
00061         void ReleaseImageProcessor();
00062     
00063     // Set-function
00064         void    SetShaderPath(const char* path){ sprintf(m_shaderPath, "%s", path); }
00065         void    ShowLog(bool b){ m_showlog = b; }
00066 
00067         // Get-functions
00068         IplImage*                       GetNewImage();
00069         IplImage*                       GetImage();
00070         ImageProcessor*         GetImageProcessor();
00071         
00072         Shader*                                 GetShader(int id);
00073         
00074         // Add-functions
00075         int             AddShader(      const char* shadername,
00076                                                 const char* vertex_file = NULL,
00077                                                 const char* fragment_file = NULL,
00078                                                 const char* header = NULL);
00079         
00080         // Release-functions
00081         void ReleaseShader();
00082         void ReleaseShader(int id);
00083         
00084         // Search-functions
00085         int     SearchShaderName(const char* filename);
00086 };
00087 
00088 } // namespace Tracking
00089 
00090 #endif


blort
Author(s): Michael Zillich, Thomas Mörwald, Johann Prankl, Andreas Richtsfeld, Bence Magyar (ROS version)
autogenerated on Thu Jan 2 2014 11:38:25