7 static void destroy(void);
8 static void start(void);
9 static void stop(void);
10 static void draw(long tm);
11 static void mbutton(int bn, int st, int x, int y);
12 static void mmotion(int x, int y);
15 static struct demo_part part = {
26 static float cam_theta, cam_phi, cam_dist = 8;
28 static int bnstate[8];
29 static int mouse_x, mouse_y;
31 static unsigned int sdr;
34 void reg_whitted(void)
42 if(!(sdr = create_program_load("sdr/whitted.v.glsl", "sdr/whitted.p.glsl"))) {
48 static void destroy(void)
52 static void start(void)
56 static void stop(void)
60 static void draw(long tm)
62 glMatrixMode(GL_MODELVIEW);
65 glTranslatef(0, 0, -cam_dist);
66 glRotatef(cam_phi, 1, 0, 0);
67 glRotatef(cam_theta, 0, 1, 0);
69 glRotatef(-cam_theta, 0, 1, 0);
70 glRotatef(-cam_phi, 1, 0, 0);
71 glTranslatef(0, 0, cam_dist);
87 static void mbutton(int bn, int st, int x, int y)
94 static void mmotion(int x, int y)
101 if(!(dx | dy)) return;
104 cam_theta += dx * 0.5;
106 if(cam_phi < -90) cam_phi = -90;
107 if(cam_phi > 90) cam_phi = 90;
110 cam_dist += dy * 0.1;
111 if(cam_dist < 0) cam_dist = 0;