X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fvoronoi.c;h=ea700c303a176a97f31fb4ae474bf8aa3dd08262;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hp=9680182931677a960a7694199c126f35e122f121;hpb=488f2fa8fbdbc77e91a70da2962d73af49e6cace;p=xscreensaver diff --git a/hacks/glx/voronoi.c b/hacks/glx/voronoi.c index 96801829..ea700c30 100644 --- a/hacks/glx/voronoi.c +++ b/hacks/glx/voronoi.c @@ -1,4 +1,4 @@ -/* voronoi, Copyright (c) 2007 Jamie Zawinski +/* voronoi, Copyright (c) 2007, 2008 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -11,7 +11,7 @@ #define DEFAULTS "*delay: 20000 \n" \ "*showFPS: False \n" \ - + "*suppressRotationAnimation: True\n" \ # define refresh_voronoi 0 # define release_voronoi 0 @@ -28,9 +28,9 @@ #define DEF_POINTS "25" #define DEF_POINT_SIZE "9" -#define DEF_POINT_SPEED "1" +#define DEF_POINT_SPEED "1.0" #define DEF_POINT_DELAY "0.05" -#define DEF_ZOOM_SPEED "1" +#define DEF_ZOOM_SPEED "1.0" #define DEF_ZOOM_DELAY "15" typedef struct node { @@ -142,31 +142,20 @@ cone (void) int i; int faces = 64; GLfloat step = M_PI * 2 / faces; - GLfloat s2 = step/2; - GLfloat th; - GLfloat x, y, x0, y0; - - glBegin(GL_TRIANGLES); - - th = 0; - x = 1; - y = 0; - x0 = cos (s2); - y0 = sin (s2); + GLfloat th = 0; + GLfloat x = 1; + GLfloat y = 0; + glBegin(GL_TRIANGLE_FAN); + glVertex3f (0, 0, 1); for (i = 0; i < faces; i++) { - glVertex3f(0, 0, 1); - glVertex3f(x, y, 0); - + glVertex3f (x, y, 0); th += step; - x0 = cos (th + s2); - y0 = sin (th + s2); - x = cos (th); - y = sin (th); - - glVertex3f(x, y, 0); + x = cos (th); + y = sin (th); } + glVertex3f (1, 0, 0); glEnd(); return faces; } @@ -310,6 +299,25 @@ draw_cells (ModeInfo *mi) glPopMatrix(); } } + +#if 0 + glPushMatrix(); + glColor3f(1,1,1); + glBegin(GL_LINE_LOOP); + glVertex3f(0,0,0); + glVertex3f(1,0,0); + glVertex3f(1,1,0); + glVertex3f(0,1,0); + glEnd(); + glScalef(0.25, 0.25, 1); + glBegin(GL_LINE_LOOP); + glVertex3f(0,0,0); + glVertex3f(1,0,0); + glVertex3f(1,1,0); + glVertex3f(0,1,0); + glEnd(); + glPopMatrix(); +#endif } @@ -326,6 +334,27 @@ reshape_voronoi (ModeInfo *mi, int width, int height) glLoadIdentity(); glOrtho (0, 1, 1, 0, -1, 1); +# ifdef HAVE_MOBILE /* So much WTF */ + { + int rot = current_device_rotation(); + + glTranslatef (0.5, 0.5, 0); + // glScalef(0.19, 0.19, 0.19); + + if (rot == 180 || rot == -180) { + glTranslatef (1, 1, 0); + } else if (rot == 90 || rot == -270) { + glRotatef (180, 0, 0, 1); + glTranslatef (0, 1, 0); + } else if (rot == -90 || rot == 270) { + glRotatef (180, 0, 0, 1); + glTranslatef (1, 0, 0); + } + + glTranslatef(-0.5, -0.5, 0); + } +# endif + glMatrixMode(GL_MODELVIEW); glLoadIdentity(); @@ -456,8 +485,6 @@ init_voronoi (ModeInfo *mi) fprintf(stderr, "%s: out of memory\n", progname); exit(1); } - - vp = &vps[MI_SCREEN(mi)]; } vp = &vps[MI_SCREEN(mi)];