+/*
+** Three different functions for calculating texture coordinates
+** which modify how the texture triangle moves over the source image.
+** Choose one.
+*/
+
+#if 0
+/* the classic equilateral triangle rotating around centre */
+static void
+calculate_texture_coords(ModeInfo *mi, texture *texture, vector2f t[3]) {
+
+ gleidestruct *gp = &gleidescope[MI_SCREEN(mi)];
+ GLfloat centre_x = 0.5;
+ GLfloat centre_y = 0.5;
+ GLfloat radius_x = (texture->max_tx - texture->min_tx) / 2;
+ GLfloat radius_y = (texture->max_ty - texture->min_ty) / 2;
+ GLfloat tangle2;
+ t[0].x = centre_x;
+ t[0].y = centre_y;
+
+ /* t[1] */
+ t[1].x = centre_x + .95 * radius_x * cos((gp->ymouse * 2 * M_PI) + (gp->tangle * RADIANS));
+ t[1].y = centre_y + .95 * radius_y * sin((gp->ymouse * 2 * M_PI) + (gp->tangle * RADIANS));
+
+ /* t[2] is always 60' further around than t2 */
+ tangle2 = (gp->ymouse * 2 * M_PI) + (gp->tangle * RADIANS) + (M_PI * 2 / 6);
+ t[2].x = centre_x + .95 * radius_x * cos(tangle2);
+ t[2].y = centre_y + .95 * radius_y * sin(tangle2);
+#if 0
+ printf("texcoords:[%f,%f]->[%f,%f](%f,%f)\n", t[0].x, t[0].y, t[1].x, t[1].y, texture->max_tx, texture->max_ty);
+#endif
+}
+#endif
+
+#if 1
+/* new lissajous movement pattern */
+static void
+calculate_texture_coords(ModeInfo *mi, texture *texture, vector2f t[3]) {
+
+ /* equilateral triangle rotating around centre */
+ gleidestruct *gp = &gleidescope[MI_SCREEN(mi)];
+ GLfloat width = texture->max_tx - texture->min_tx;
+ GLfloat height = texture->max_ty - texture->min_ty;
+ /* centre */
+ GLfloat centre_x = texture->min_tx + (width * .5);
+ GLfloat centre_y = texture->min_ty + (height * .5);
+ /* m radius and t radius should be = .5 */
+ /* triangle radius is 30% available space */
+ GLfloat t_radius_x = width * .3;
+ GLfloat t_radius_y = height * .3;
+ /* movement radius is 30% available space */
+ GLfloat m_radius_x = width * .2;
+ GLfloat m_radius_y = height * .2;
+ GLfloat angle2;
+
+ /* centre of triangle */
+ GLfloat angle = (gp->ymouse * 2 * M_PI) + (gp->tangle * RADIANS); /* to radians */
+ GLfloat t_centre_x = centre_x + m_radius_x * cos(texture->x_period * angle + texture->x_phase);
+ GLfloat t_centre_y = centre_y + m_radius_y * sin(texture->y_period * angle + texture->y_phase);
+
+#if 0
+ printf("WH: %f, %f - tWH: %f, %f\n", width, height, texture->width, texture->height);
+ printf("size: (%f, %f)\n", width, height);
+ printf("centre: (%f, %f)\n", centre_x, centre_y);
+#endif
+
+ angle2 = texture->r_period * angle + texture->r_phase;
+ t[0].x = t_centre_x + t_radius_x * cos(angle2);
+ t[0].y = t_centre_y + t_radius_y * sin(angle2);
+ t[1].x = t_centre_x + t_radius_x * cos(angle2 + ANGLE_120);
+ t[1].y = t_centre_y + t_radius_y * sin(angle2 + ANGLE_120);
+ t[2].x = t_centre_x + t_radius_x * cos(angle2 + ANGLE_240);
+ t[2].y = t_centre_y + t_radius_y * sin(angle2 + ANGLE_240);
+
+#if 0
+ printf("texcoords:[%f,%f]->[%f,%f](%f,%f)\n", t[0].x, t[0].y, t[1].x, t[1].y, texture->max_tx, texture->max_ty);
+#endif
+}
+#endif
+
+#if 0
+/* corners into corners - meant to maximise coverage */