X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Ftunnel_draw.c;h=8a87c7673d5bc142b764802b3adc920595020a0f;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hp=8230ca08a84c8fa154fd7e5a5152016fee940b87;hpb=50be9bb40dc60130c99ffa568e6677779904ff70;p=xscreensaver diff --git a/hacks/glx/tunnel_draw.c b/hacks/glx/tunnel_draw.c index 8230ca08..8a87c767 100644 --- a/hacks/glx/tunnel_draw.c +++ b/hacks/glx/tunnel_draw.c @@ -45,14 +45,15 @@ static const char sccsid[] = "@(#)tunnel_draw.c 5.13 2004/05/25 xlockmore"; #include #ifdef STANDALONE -# ifdef HAVE_COCOA -# include -# include -# else +# ifndef HAVE_JWXYZ # include # include # endif #endif +#ifdef HAVE_ANDROID +#include +#endif + #include "tunnel_draw.h" @@ -114,7 +115,8 @@ struct tunnel_state { }; /*=================== Vector normalization ==================================*/ -static void normalize(cvPoint *V) +static void +normalize(cvPoint *V) { float d; @@ -128,7 +130,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 +141,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 +163,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 +191,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 +213,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 +231,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,11 +239,12 @@ 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; - cvPoint op, p4[4], T, ppp, ppp1, op1, op2; + cvPoint op, p4[4], T, ppp, op1, op2; float t; int i, j, k, flag; cvPoint points[10]; @@ -345,6 +352,7 @@ void DrawTunnel(struct tunnel_state *st, /* End of tunnel */ st->ModeX = 1.0; st->ModeXFlag = 0; + glEnd(); return; } cvCatmullRom(p4, t, &op); @@ -377,15 +385,12 @@ void DrawTunnel(struct tunnel_state *st, /* End of tunnel */ st->ModeX = 1.0; st->ModeXFlag = 0; + glEnd(); return; } cvCatmullRom(p4, t, &op1); - ppp1.x = op1.x; - ppp1.y = op1.y; - ppp1.z = op1.z + 0.25; - T.x = op1.x - op.x; T.y = op1.y - op.y; T.z = op1.z - op.z; @@ -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); }