#include <math.h>
#ifdef STANDALONE
-# ifdef HAVE_COCOA
-# include <OpenGL/gl.h>
-# include <OpenGL/glu.h>
-# else
+# 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"
};
/*=================== Vector normalization ==================================*/
-static void normalize(cvPoint *V)
+static void
+normalize(cvPoint *V)
{
float d;
}
/*=================== 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;
#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;
// 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;
/*=================== 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;
}
else
{
- path1 = st->path;
+ if (!path1) path1 = st->path;
path2 = (tnPath *)malloc(sizeof(tnPath));
path1->next = path2;
path1 = path2;
/*=================== Tunnel Initialization ================================*/
struct tunnel_state *
-InitTunnel(void)
+atunnel_InitTunnel(void)
{
struct tunnel_state *st = (struct tunnel_state *) calloc (1, sizeof(*st));
LoadPath(st);
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];
/* End of tunnel */
st->ModeX = 1.0;
st->ModeXFlag = 0;
+ glEnd();
return;
}
cvCatmullRom(p4, t, &op);
/* 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;
}
/* =================== 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)
}
}
-void FreeTunnel(struct tunnel_state *st)
+void
+atunnel_FreeTunnel(struct tunnel_state *st)
{
free (st);
}