From http://www.jwz.org/xscreensaver/xscreensaver-5.35.tar.gz
[xscreensaver] / hacks / glx / tunnel_draw.c
index 54132fbee12616defe3ff295b12845c7617f8121..8a87c7673d5bc142b764802b3adc920595020a0f 100644 (file)
@@ -45,11 +45,15 @@ static const char sccsid[] = "@(#)tunnel_draw.c     5.13 2004/05/25 xlockmore";
 #include <math.h>
 
 #ifdef STANDALONE
-# ifndef HAVE_COCOA
+# ifndef HAVE_JWXYZ
 #  include <GL/gl.h>
 #  include <GL/glu.h>
 # endif
 #endif
+#ifdef HAVE_ANDROID
+#include <GLES/gl.h>
+#endif
+
 
 #include "tunnel_draw.h"
 
@@ -111,7 +115,8 @@ struct tunnel_state {
 };
 
 /*=================== Vector normalization ==================================*/
-static void normalize(cvPoint *V)
+static void
+normalize(cvPoint *V)
 {
   float d;
 
@@ -125,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;
@@ -135,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;
 
@@ -156,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;
@@ -183,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;
@@ -222,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);
@@ -230,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];
@@ -381,10 +391,6 @@ void DrawTunnel(struct tunnel_state *st,
                        
                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;
@@ -438,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)
@@ -496,7 +503,8 @@ void SplashScreen(struct tunnel_state *st,
        }
 }
 
-void FreeTunnel(struct tunnel_state *st)
+void
+atunnel_FreeTunnel(struct tunnel_state *st)
 {
   free (st);
 }