TrackerModel.h
Go to the documentation of this file.
00001 
00002 #ifndef __TRACKER_MODEL_H__
00003 #define __TRACKER_MODEL_H__
00004 
00005 namespace Tracking{
00006         class TrackerModel;
00007 }
00008 #include <blort/Tracker/headers.h>
00009 #include <blort/TomGine/tgModel.h>
00010 #include <blort/Tracker/Texture.h>
00011 #include <blort/Tracker/Shader.h>
00012 #include <blort/TomGine/tgMathlib.h>
00013 #include <blort/TomGine/tgPose.h>
00014 #include <blort/TomGine/tgCamera.h>
00015 
00016 #ifndef FN_LEN
00017 #define FN_LEN 256
00018 #endif
00019 
00020 namespace Tracking{
00021 
00022 
00024 class TrackerModel : public TomGine::tgModel
00025 {
00026 private:
00027         TrackerModel(const TrackerModel& m);
00028         
00029         TrackerModel& operator=(const TomGine::tgModel& m);             // no implementation (should not be used)
00030 
00031 public:
00032         TrackerModel();
00033         TrackerModel(const TomGine::tgModel& m);
00034         ~TrackerModel();
00035         
00036         TrackerModel& operator=(const TrackerModel& m);
00037         
00038         void releasePassList();
00039         
00040         struct Pass {                                                                                           // Renderpass
00041                 std::vector<unsigned> f;                                                                // Faces to draw with this pass
00042                 mat4 modelviewprojection;                                       // Modelview and projection matrix for texCoords
00043                 float x,y,w,h;                                                                          // Bounding box of SubTexture
00044                 Texture* texture;                                                                       // Texture to use
00045                 Pass(){ texture = new(Texture); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); }
00046                 ~Pass(){ delete(texture);}
00047         };
00048         
00049         typedef std::vector<Pass*>      PassList;
00050         
00051         // Variables
00052         PassList                                m_passlist;
00053         std::vector<int>                m_facepixellist;
00054         
00055         Texture* m_tex_original;                // original texture of model (not modified by tracker)
00056         Texture*        m_texture;                              // texture of model modified by tracker (edge-texture)
00057         bool m_textured;
00058         
00059         // computes, updates
00060         void computeEdges();
00061         void computeBoundingSphere();
00062         void Update();
00063         
00064         // draws
00065         virtual void Print() const;
00066         virtual void drawNormals();
00067         virtual void drawFaces(bool colorful=false);
00068         void drawFace(int i);
00069         void drawEdges();
00070         void drawTexturedFaces();
00071         void drawUntexturedFaces();
00072         void drawPass(bool colorful=false);
00073         void drawCoordinates();
00074         
00075         
00076         std::vector<unsigned> getFaceUpdateList(TomGine::tgPose& p_max, vec3 view, float minTexGrabAngle=3.0*PI/4.0, bool use_num_pixels=true);
00077         
00078         void getBoundingBox2D( int width, int height, TomGine::tgPose& p_max, TomGine::tgCamera* m_cam,
00079                                                         int &minX, int &maxX, int &minY, int &maxY );
00080         
00082         void textureFromImage(  Texture* image,
00083                                                         int width, int height,
00084                                                         TomGine::tgPose& p_max,
00085                                                         vec3 view,
00086                                                         float minTexGrabAngle,
00087                                                         std::vector<unsigned> faceUpdateList,
00088                                                         std::vector<TomGine::tgVertex> &vertices,
00089                                                         TomGine::tgCamera* m_cam);
00090         
00091         void useTexCoords(bool useTC);
00092         void unwarpTexturesBox_hacky(const char* name);
00093 
00094                 // gets
00095         bool                    getTextured(){ return m_textured; }
00096         Texture*        getTexture(){ return m_texture; }
00097         Texture*        getOriginalTexture(){ return m_tex_original; }
00098         float                   getBoundingSphereRadius(){ return m_boundingSphereRadius; }
00099         
00100         // sets
00101         void setBFC(bool bfc){ m_bfc = bfc; }
00102         void setTexture(Texture* tex){ m_texture = tex; }
00103         void setOriginalTexture(Texture* tex){ m_tex_original = tex; }
00104         void restoreTexture(){ m_texture=m_tex_original; }
00105         
00106                 // generate display lists
00107         void genListTexturedFaces();
00108         void genListUntexturedFaces();
00109         void genListPass(bool colorful=false);
00110         void genListFaces(bool colorful=false);
00111         void genListEdges();
00112         void genListNormals(float normal_length);
00113         
00114 protected:
00115         GLint m_dlTexturedFaces;
00116         GLint m_dlUntexturedFaces;
00117         GLint m_dlPass;
00118         GLint m_dlFaces;
00119         GLint m_dlEdges;
00120         GLint m_dlNormals;
00121         
00122         Shader* m_shadeTexturing;
00123         int m_shadeTexturingID;
00124         bool m_bfc;
00125         float m_boundingSphereRadius;
00126 
00127         // Functions
00128         bool isRedundant(TomGine::tgLine* e1);
00129         void UpdateDisplayLists();
00130 };
00131 
00132 } // namespace Tracking
00133 
00134 #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:26