X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=progs%2Fdemos%2Ftunnel2.c;h=75a199af5d3e1977c8783afd75997b80a2eca4f7;hb=8e247d52e34793e195e8164c0a461fb428c171af;hp=436f01b3e49099cc273b245025a4204f182d6f2b;hpb=e9e98405e720845f06f7a375585491e938f4dacd;p=mesa.git diff --git a/progs/demos/tunnel2.c b/progs/demos/tunnel2.c index 436f01b3e49..75a199af5d3 100644 --- a/progs/demos/tunnel2.c +++ b/progs/demos/tunnel2.c @@ -12,14 +12,14 @@ #include #include #include -#include +#include #ifdef WIN32 #include #endif #include -#include "readtex.c" +#include "readtex.h" #include "tunneldat.h" #ifdef FX @@ -51,11 +51,11 @@ static GLint Frames = 0; static float obs[3] = { 1000.0, 0.0, 2.0 }; static float dir[3]; -static float v = 0.5; +static float v = 30.; static float alpha = 90.0; static float beta = 90.0; -static int fog = 0; +static int fog = 1; static int bfcull = 1; static int usetex = 1; static int cstrip = 0; @@ -97,7 +97,7 @@ inittextures(void) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_LINEAR_MIPMAP_NEAREST); + GL_LINEAR_MIPMAP_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); @@ -158,6 +158,13 @@ drawobjs(const int *l, const float *f) static void calcposobs(void) { + static double t0 = -1.; + double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0; + if (t0 < 0.0) + t0 = t; + dt = t - t0; + t0 = t; + dir[0] = sin(alpha * M_PI / 180.0); dir[1] = cos(alpha * M_PI / 180.0) * sin(beta * M_PI / 180.0); dir[2] = cos(beta * M_PI / 180.0); @@ -169,9 +176,9 @@ calcposobs(void) if (dir[2] < 1.0e-5 && dir[2] > -1.0e-5) dir[2] = 0; - obs[0] += v * dir[0]; - obs[1] += v * dir[1]; - obs[2] += v * dir[2]; + obs[0] += v * dir[0] * dt; + obs[1] += v * dir[1] * dt; + obs[2] += v * dir[2] * dt; } static void @@ -202,10 +209,10 @@ key(unsigned char k, int x, int y) break; case 'a': - v += 0.01; + v += 5.; break; case 'z': - v -= 0.01; + v -= 5.; break; #ifdef XMESA @@ -317,15 +324,15 @@ printhelp(void) printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help"); glRasterPos2i(60, 390); - printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Togle Help"); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Toggle Help"); glRasterPos2i(60, 360); - printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Togle Textures"); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Toggle Textures"); glRasterPos2i(60, 330); - printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Togle Fog"); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Toggle Fog"); glRasterPos2i(60, 300); - printstring(GLUT_BITMAP_TIMES_ROMAN_24, "m - Togle strips"); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "m - Toggle strips"); glRasterPos2i(60, 270); - printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Togle Back face culling"); + printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Toggle Back face culling"); glRasterPos2i(60, 240); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate"); glRasterPos2i(60, 210); @@ -336,7 +343,7 @@ printhelp(void) glRasterPos2i(60, 150); if (joyavailable) printstring(GLUT_BITMAP_TIMES_ROMAN_24, - "j - Togle jostick control (Joystick control available)"); + "j - Toggle jostick control (Joystick control available)"); else printstring(GLUT_BITMAP_TIMES_ROMAN_24, "(No Joystick control available)");