X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Ftunnel_draw.c;h=333161bb5d50ef3e71187288f6783efebfb78627;hb=6f5482d73adb0165c0130bb47d852644ab0c4869;hp=8230ca08a84c8fa154fd7e5a5152016fee940b87;hpb=50be9bb40dc60130c99ffa568e6677779904ff70;p=xscreensaver diff --git a/hacks/glx/tunnel_draw.c b/hacks/glx/tunnel_draw.c index 8230ca08..333161bb 100644 --- a/hacks/glx/tunnel_draw.c +++ b/hacks/glx/tunnel_draw.c @@ -45,10 +45,7 @@ static const char sccsid[] = "@(#)tunnel_draw.c 5.13 2004/05/25 xlockmore"; #include #ifdef STANDALONE -# ifdef HAVE_COCOA -# include -# include -# else +# ifndef HAVE_COCOA # include # include # endif @@ -114,7 +111,8 @@ struct tunnel_state { }; /*=================== Vector normalization ==================================*/ -static void normalize(cvPoint *V) +static void +normalize(cvPoint *V) { float d; @@ -128,7 +126,8 @@ static void normalize(cvPoint *V) } /*=================== C = A x B (Vector multiply) ==========================*/ #if 0 -static void vect_mult(cvPoint *A, cvPoint *B, cvPoint *C) +static void +vect_mult(cvPoint *A, cvPoint *B, cvPoint *C) { /* Vector multiply */ C->x = A->y*B->z - A->z*B->y; @@ -138,7 +137,8 @@ static void vect_mult(cvPoint *A, cvPoint *B, cvPoint *C) #endif /* Catmull-Rom Curve calculations */ -static void cvCatmullRom(cvPoint *p, float t, cvPoint *outp) +static void +cvCatmullRom(cvPoint *p, float t, cvPoint *outp) { float t2, t3, t1; @@ -159,7 +159,8 @@ static void cvCatmullRom(cvPoint *p, float t, cvPoint *outp) // outp - output point //========================================================================== */ -static void RotateAroundLine(cvPoint *p, cvPoint *pp, cvPoint *pl, float a, cvPoint *outp) +static void +RotateAroundLine(cvPoint *p, cvPoint *pp, cvPoint *pl, float a, cvPoint *outp) { cvPoint p1, p2; float l, m, n, ca, sa; @@ -186,7 +187,8 @@ static void RotateAroundLine(cvPoint *p, cvPoint *pp, cvPoint *pl, float a, cvPo /*=================== Load camera and tunnel path ==========================*/ -static void LoadPath(struct tunnel_state *st) +static void +LoadPath(struct tunnel_state *st) { float x, y, z; tnPath *path1=NULL, *path2=NULL; @@ -207,7 +209,7 @@ static void LoadPath(struct tunnel_state *st) } else { - path1 = st->path; + if (!path1) path1 = st->path; path2 = (tnPath *)malloc(sizeof(tnPath)); path1->next = path2; path1 = path2; @@ -225,7 +227,7 @@ static void LoadPath(struct tunnel_state *st) /*=================== Tunnel Initialization ================================*/ struct tunnel_state * -InitTunnel(void) +atunnel_InitTunnel(void) { struct tunnel_state *st = (struct tunnel_state *) calloc (1, sizeof(*st)); LoadPath(st); @@ -233,7 +235,8 @@ InitTunnel(void) return st; } -void DrawTunnel(struct tunnel_state *st, +void +atunnel_DrawTunnel(struct tunnel_state *st, int do_texture, int do_light, GLuint *textures) { tnPath *p, *p1, *cmpos; @@ -345,6 +348,7 @@ void DrawTunnel(struct tunnel_state *st, /* End of tunnel */ st->ModeX = 1.0; st->ModeXFlag = 0; + glEnd(); return; } cvCatmullRom(p4, t, &op); @@ -377,6 +381,7 @@ void DrawTunnel(struct tunnel_state *st, /* End of tunnel */ st->ModeX = 1.0; st->ModeXFlag = 0; + glEnd(); return; } @@ -439,7 +444,8 @@ void DrawTunnel(struct tunnel_state *st, } /* =================== Show splash screen =================================== */ -void SplashScreen(struct tunnel_state *st, +void +atunnel_SplashScreen(struct tunnel_state *st, int do_wire, int do_texture, int do_light) { if (st->ModeX > 0) @@ -497,7 +503,8 @@ void SplashScreen(struct tunnel_state *st, } } -void FreeTunnel(struct tunnel_state *st) +void +atunnel_FreeTunnel(struct tunnel_state *st) { free (st); }