1 #ifndef ALIGNSET_H
2 #define ALIGNSET_H
3 
4 
5 #include <QString>
6 #include <QImage>
7 #include <QGLFramebufferObject>
8 
9 // local headers
10 #include "common/meshmodel.h"
11 
12 // VCG headers
13 #include <vcg/math/shot.h>
14 
15 
16 class QGLFramebufferObject;
17 
18 class Correspondence
19 {
20 public:
21 	vcg::Point3f Point3D;
22 	vcg::Point2f Point2D;
23 	int index;
24 	double error;
25 };
26 
27 
28 class AlignSet {
29   //typedef vcg::Camera<float> Camera;
30   //typedef vcg::Shot<float> Shot;
31   //typedef vcg::Box3<float> Box;
32 
33  public:
34 
35   int wt,ht;
36   CMeshO* mesh;
37   QImage* image;
38   double imageRatio;
39   vcg::Shot<float> shot;
40   vcg::Box3<float> box;
41   std::vector<Correspondence> correspList; //List that includes corresponces involving the model
42   double error; //alignment error in px
43 
44   GLuint vbo, nbo, cbo, ibo;  // vertex buffer object (vertices, normals, colors indices)
45 
46   GLint programs[6];
47 
48   enum RenderingMode {COMBINE=0, NORMALMAP=1, COLOR=2, SPECULAR=3, SILHOUETTE=4, SPECAMB = 5};
49   RenderingMode mode;
50 
51   unsigned char *target, *render; //buffers for rendered images
52 
53   AlignSet();
54   ~AlignSet();
55 
56   void initializeGL();
57 
width()58   int width() { return wt; }
height()59   int height() { return ht; }
60   void resize(int max_side); // resize the fbo and the images so that the longest side is max_side
61   double focal();
62   bool setFocal(double f); //return false if unchanged
63   void setPixelSizeMm(double ccdWidth);
64 
65   void renderScene(vcg::Shot<float> &shot, int component);
66   void readRender(int component);
67 
68   void drawMeshPoints();
69   void drawImagePoints();
70 
71   void undistortImage();
72 
73   void resetAlign();
74 
75  private:
76 
77 
78 
79   GLuint createShaderFromFiles(QString basename); // converted into shader/basename.vert .frag
80   GLuint createShaders(const char *vert, const char *frag);
81 
82 };
83 
84 
85 #endif
86