1 | #ifndef __global_h_ |
---|
2 | #define __global_h_ |
---|
3 | |
---|
4 | #include <assert.h> |
---|
5 | |
---|
6 | #include "glm.h" |
---|
7 | #include "camera.h" |
---|
8 | #include "mesh.h" |
---|
9 | #include "color.h" |
---|
10 | #include "change.h" |
---|
11 | |
---|
12 | // For progress update. |
---|
13 | #include "GeoMesh.h" |
---|
14 | |
---|
15 | #ifndef TRUE |
---|
16 | #define TRUE 1 |
---|
17 | #endif /* TRUE */ |
---|
18 | |
---|
19 | #ifndef FALSE |
---|
20 | #define FALSE 0 |
---|
21 | #endif /* FALSE */ |
---|
22 | |
---|
23 | #ifndef false |
---|
24 | #define false ((char) 0) |
---|
25 | #endif |
---|
26 | #ifndef true |
---|
27 | #define true ((char) 1) |
---|
28 | #endif |
---|
29 | |
---|
30 | #ifndef MAX |
---|
31 | #define MAX(a,b) ( (a) > (b) ? (a) : (b) ) |
---|
32 | #endif |
---|
33 | #ifndef MIN |
---|
34 | #define MIN(a,b) ( (a) < (b) ? (a) : (b) ) |
---|
35 | #endif |
---|
36 | #ifndef ABS |
---|
37 | #define ABS(a) ( (a) >= 0 ? (a) : (-(a)) ) |
---|
38 | #endif |
---|
39 | |
---|
40 | #define MAX_CHAR 256 |
---|
41 | |
---|
42 | //#define DEBUG |
---|
43 | |
---|
44 | // Geometry acceleration technique |
---|
45 | //#define IMMEDIATE_MODE |
---|
46 | //#define VERTEX_ARRAY_INTERLEAVE |
---|
47 | //#define VERTEX_ARRAY |
---|
48 | #define VERTEX_BUFFER_OBJECTS |
---|
49 | |
---|
50 | // Viewpoint metric |
---|
51 | //#define KL |
---|
52 | #define MI |
---|
53 | //#define HE |
---|
54 | //#define CS |
---|
55 | |
---|
56 | // Histogram technique |
---|
57 | //#define USE_OCCLUSION_QUERY |
---|
58 | #define HYBRID_HW_SW_HISTOGRAM |
---|
59 | |
---|
60 | //#define SALIENCY |
---|
61 | |
---|
62 | // Extension added into the filename |
---|
63 | #ifdef KL // Kullback-Leibler |
---|
64 | #define EXT "VKL" |
---|
65 | #endif |
---|
66 | #ifdef MI // Mutual Information |
---|
67 | #define EXT "VMI" |
---|
68 | #endif |
---|
69 | #ifdef HE // Hellinger |
---|
70 | #define EXT "VHE" |
---|
71 | #endif |
---|
72 | #ifdef CS // Chi-Square |
---|
73 | #define EXT "VCS" |
---|
74 | #endif |
---|
75 | |
---|
76 | //#define USE_EDGE_ADJACENCY |
---|
77 | |
---|
78 | #define CHECK_OPENGL_ERROR( cmd ) \ |
---|
79 | { GLenum error; \ |
---|
80 | while ( ( error = glGetError() ) != GL_NO_ERROR ) { \ |
---|
81 | printf( "[%s:%d] %sfailed with error %s\n", \ |
---|
82 | __FILE__, __LINE__, \ |
---|
83 | cmd, gluErrorString(error) ); \ |
---|
84 | } \ |
---|
85 | } |
---|
86 | |
---|
87 | #define CHECK_FRAMEBUFFER_STATUS() \ |
---|
88 | { \ |
---|
89 | GLenum status; \ |
---|
90 | status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); \ |
---|
91 | switch(status) { \ |
---|
92 | case GL_FRAMEBUFFER_COMPLETE_EXT: \ |
---|
93 | break; \ |
---|
94 | case GL_FRAMEBUFFER_UNSUPPORTED_EXT: \ |
---|
95 | /* choose different formats */ \ |
---|
96 | break; \ |
---|
97 | default: \ |
---|
98 | /* programming error; will fail on all hardware */ \ |
---|
99 | assert(0); \ |
---|
100 | } \ |
---|
101 | } |
---|
102 | |
---|
103 | namespace VMI |
---|
104 | { |
---|
105 | |
---|
106 | extern GLMmodel* pmodel; // Vertices start at position 1 |
---|
107 | |
---|
108 | extern GLubyte *pixels; |
---|
109 | |
---|
110 | extern Camera *cameras; |
---|
111 | extern GLuint numCameras; |
---|
112 | |
---|
113 | extern Color *colors; |
---|
114 | |
---|
115 | extern GLuint **histogram, |
---|
116 | *queries; |
---|
117 | |
---|
118 | extern Mesh *mesh; |
---|
119 | |
---|
120 | extern GLdouble *initialIs; |
---|
121 | |
---|
122 | extern GLdouble radius; |
---|
123 | extern GLdouble fov; |
---|
124 | extern GLuint numDemandedTriangles, |
---|
125 | cameraType; |
---|
126 | extern GLboolean bBeQuiet, |
---|
127 | bEnableOffScreen, |
---|
128 | bSaveLog, |
---|
129 | bLoadCamerasFromFile, |
---|
130 | bRemoveRedundantVertices; |
---|
131 | |
---|
132 | extern GLsizei width, height; |
---|
133 | |
---|
134 | extern int vmiWin; |
---|
135 | |
---|
136 | extern char filename[MAX_CHAR]; |
---|
137 | |
---|
138 | extern void init(void); |
---|
139 | |
---|
140 | extern void renderScene(GLuint **histogram, GLuint numCameras); |
---|
141 | extern void renderSceneWin(GLuint **histogram, GLuint numCameras, Change *c); |
---|
142 | |
---|
143 | extern void renderGeometry(void); |
---|
144 | |
---|
145 | extern void drawTexture(void); |
---|
146 | |
---|
147 | extern void display(void); |
---|
148 | |
---|
149 | extern void freeMemory(void); |
---|
150 | |
---|
151 | extern void applyHWAcceleration(void); |
---|
152 | extern void setOrthographicProjection(void); |
---|
153 | extern void resetPerspectiveProjection(void); |
---|
154 | extern void renderBitmapString(float x, float y, void *font, char *string); |
---|
155 | |
---|
156 | // For progress update |
---|
157 | extern Geometry::TIPOFUNC mUPB; |
---|
158 | |
---|
159 | } |
---|
160 | |
---|
161 | #endif |
---|
162 | |
---|