dbf-udg
diff src/udg.cc @ 8:f0a47f46ee45
lalala
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 18 Feb 2013 06:53:44 +0200 |
parents | 603656331514 |
children | 7056437a361b |
line diff
1.1 --- a/src/udg.cc Mon Feb 18 05:44:17 2013 +0200 1.2 +++ b/src/udg.cc Mon Feb 18 06:53:44 2013 +0200 1.3 @@ -36,12 +36,13 @@ 1.4 void destroy_rtarg(struct render_target *rt); 1.5 1.6 int xsz, ysz; 1.7 -float cam_theta, cam_phi = 25, cam_dist = 9; 1.8 +float cam_theta, cam_phi = 25, cam_dist = 11; 1.9 unsigned int dither_tex; 1.10 struct render_target *rtarg; 1.11 unsigned int post_prog, phong_prog; 1.12 1.13 int opt_highres, opt_regular_render; 1.14 +bool opt_autorot = true; 1.15 1.16 1.17 int main(int argc, char **argv) 1.18 @@ -130,6 +131,7 @@ 1.19 glEnable(GL_DEPTH_TEST); 1.20 glEnable(GL_LIGHTING); 1.21 glEnable(GL_LIGHT0); 1.22 + glEnable(GL_LIGHT1); 1.23 glEnable(GL_NORMALIZE); 1.24 1.25 return true; 1.26 @@ -168,7 +170,13 @@ 1.27 void disp() 1.28 { 1.29 float ldir[] = {-1, 1, 2, 0}; 1.30 + float ldir2[] = {0.0, 0.35, -0.9, 0}; 1.31 + 1.32 + float lcol[] = {1, 1, 1, 1}; 1.33 + float lcol2[] = {0.35, 0.3, 0.15, 1}; 1.34 + 1.35 int xres, yres; 1.36 + float auto_angle = glutGet(GLUT_ELAPSED_TIME) / 100.0; 1.37 1.38 if(opt_highres) { 1.39 xres = xsz; 1.40 @@ -198,11 +206,15 @@ 1.41 glMatrixMode(GL_MODELVIEW); 1.42 glLoadIdentity(); 1.43 1.44 - glTranslatef(0, 0, -cam_dist); 1.45 + glTranslatef(0, 0.8, -cam_dist); 1.46 glRotatef(cam_phi, 1, 0, 0); 1.47 - glRotatef(cam_theta, 0, 1, 0); 1.48 + glRotatef(opt_autorot ? auto_angle : cam_theta, 0, 1, 0); 1.49 1.50 glLightfv(GL_LIGHT0, GL_POSITION, ldir); 1.51 + glLightfv(GL_LIGHT0, GL_DIFFUSE, lcol); 1.52 + 1.53 + glLightfv(GL_LIGHT1, GL_POSITION, ldir2); 1.54 + glLightfv(GL_LIGHT1, GL_DIFFUSE, lcol2); 1.55 1.56 const float blue[] = {0.4, 0.45, 1.0, 1}; 1.57 const float white[] = {1, 1, 1, 1}; 1.58 @@ -298,6 +310,10 @@ 1.59 case 27: 1.60 exit(0); 1.61 1.62 + case 'a': 1.63 + opt_autorot = !opt_autorot; 1.64 + break; 1.65 + 1.66 case 'f': 1.67 { 1.68 static bool fullscreen;