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