-
Notifications
You must be signed in to change notification settings - Fork 1
/
glCanvas.h
75 lines (57 loc) · 1.93 KB
/
glCanvas.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// ====================================================================
// GLCanvas class by Rob Jagnow.
// ====================================================================
#ifndef _GL_CANVAS_H_
#define _GL_CANVAS_H_
#include <cstdlib>
#include <cassert>
#include "vectors.h"
class ArgParser;
class Mesh;
class RayTracer;
class Radiosity;
class PhotonMapping;
// ====================================================================
// NOTE: All the methods and variables of this class are static
// ====================================================================
class GLCanvas {
public:
// Set up the canvas and enter the rendering loop
// Note that this function will not return but can be
// terminated by calling 'exit(0)'
static void initialize(ArgParser *_args, Mesh *_mesh,
RayTracer *_raytracer, Radiosity *_radiosity, PhotonMapping *_photon_mapping);
static void Render();
private:
static void InitLight();
// various static variables
static ArgParser *args;
static Mesh *mesh;
static RayTracer *raytracer;
static Radiosity *radiosity;
static PhotonMapping *photon_mapping;
static int display_list_index;
// state of the mouse cursor
static int mouseButton;
static int mouseX;
static int mouseY;
static bool shiftPressed;
static bool controlPressed;
static bool altPressed;
static int raytracing_x;
static int raytracing_y;
static int raytracing_skip;
// Callback functions for mouse and keyboard events
static void display(void);
static void reshape(int w, int h);
static void mouse(int button, int state, int x, int y);
static void motion(int x, int y);
static void keyboard(unsigned char key, int x, int y);
static void idle();
static int DrawPixel();
static Vec3f TraceRay(int i, int j);
};
// ====================================================================
int HandleGLError();
// ====================================================================
#endif