X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fdnalogo.c;h=4e1bafcd854ce62c1cb70f5728aea064d2f1feb4;hb=6afd6db0ae9396cd7ff897ade597cd5483f49b0e;hp=1b192428deb070565135ed6ebe71cf54bb5f20b3;hpb=6f5482d73adb0165c0130bb47d852644ab0c4869;p=xscreensaver diff --git a/hacks/glx/dnalogo.c b/hacks/glx/dnalogo.c index 1b192428..4e1bafcd 100644 --- a/hacks/glx/dnalogo.c +++ b/hacks/glx/dnalogo.c @@ -1,4 +1,4 @@ -/* DNA Logo, Copyright (c) 2001-2011 Jamie Zawinski +/* DNA Logo, Copyright (c) 2001-2014 Jamie Zawinski * * DNA Lounge * @@ -55,6 +55,9 @@ #undef countof #define countof(x) (sizeof((x))/sizeof((*x))) +#undef LINEAR +#undef DXF_OUTPUT_HACK + #ifdef DXF_OUTPUT_HACK /* When this is defined, instead of rendering to the screen, we write a DXF CAD file to stdout. This is a kludge of shocking magnitude... @@ -1982,7 +1985,7 @@ init_logo (ModeInfo *mi) dc->color[3] = 1.0; } - dc->trackball = gltrackball_init (); + dc->trackball = gltrackball_init (False); dc->gasket_spinnerx.probability = 0.1; dc->gasket_spinnery.probability = 0.1; @@ -2119,39 +2122,10 @@ logo_handle_event (ModeInfo *mi, XEvent *event) { logo_configuration *dc = &dcs[MI_SCREEN(mi)]; - if (event->xany.type == ButtonPress && - event->xbutton.button == Button1) - { - dc->button_down_p = True; - gltrackball_start (dc->trackball, - event->xbutton.x, event->xbutton.y, - MI_WIDTH (mi), MI_HEIGHT (mi)); - return True; - } - else if (event->xany.type == ButtonRelease && - event->xbutton.button == Button1) - { - dc->button_down_p = False; - return True; - } - else if (event->xany.type == ButtonPress && - (event->xbutton.button == Button4 || - event->xbutton.button == Button5 || - event->xbutton.button == Button6 || - event->xbutton.button == Button7)) - { - gltrackball_mousewheel (dc->trackball, event->xbutton.button, 10, - !!event->xbutton.state); - return True; - } - else if (event->xany.type == MotionNotify && - dc->button_down_p) - { - gltrackball_track (dc->trackball, - event->xmotion.x, event->xmotion.y, - MI_WIDTH (mi), MI_HEIGHT (mi)); - return True; - } + if (gltrackball_event_handler (event, dc->trackball, + MI_WIDTH (mi), MI_HEIGHT (mi), + &dc->button_down_p)) + return True; return False; } @@ -2239,6 +2213,28 @@ draw_logo (ModeInfo *mi) tick_spinner (mi, &dc->frame_spinner); link_spinners (mi, &dc->scene_spinnerx, &dc->scene_spinnery); +# ifdef LINEAR + { + static double i = 0.0; + dc->anim_state = HELIX; + dc->wire_overlay = 0; + dc->gasket_spinnerx.spinning_p = 0; + dc->gasket_spinnery.spinning_p = 0; + dc->gasket_spinnerz.spinning_p = 0; + dc->helix_spinnerz.spinning_p = 0; + dc->pizza_spinnery.spinning_p = 0; + dc->pizza_spinnerz.spinning_p = 0; + dc->scene_spinnerx.spinning_p = 0; + dc->scene_spinnery.spinning_p = 0; + dc->frame_spinner.spinning_p = 0; + dc->frame_spinner.position = 0.3; + dc->gasket_spinnerz.position = i; + dc->helix_spinnerz.position = i; + i += 0.005; + if (i > 1) i = 0; + } +# endif /* LINEAR */ + switch (dc->anim_state) { case HELIX: @@ -2303,12 +2299,11 @@ draw_logo (ModeInfo *mi) glPushMatrix (); glRotatef(current_device_rotation(), 0, 0, 1); { - GLfloat scale = 0; - glScalef(3, 3, 3); - -# ifdef USE_IPHONE - glScalef (0.7, 0.7, 0.7); /* make room for the frame */ + GLfloat scale = 1.8; +# ifdef LINEAR + scale = 3.85; # endif + glScalef(scale, scale, scale); glColor3f(dc->color[0], dc->color[1], dc->color[2]); @@ -2353,14 +2348,20 @@ draw_logo (ModeInfo *mi) glRotatef(90, 1, 0, 0); glRotatef(90, 0, 0, 1); - glRotatef (360 * sin (M_PI/2 * dc->scene_spinnerx.position), 0, 1, 0); - glRotatef (360 * sin (M_PI/2 * dc->scene_spinnery.position), 0, 0, 1); +# ifdef LINEAR +# define SINIFY(I) (I) +# else +# define SINIFY(I) sin (M_PI/2 * (I)) +# endif + + glRotatef (360 * SINIFY (dc->scene_spinnerx.position), 0, 1, 0); + glRotatef (360 * SINIFY (dc->scene_spinnery.position), 0, 0, 1); glPushMatrix(); { - glRotatef (360 * sin (M_PI/2 * dc->gasket_spinnerx.position), 0, 1, 0); - glRotatef (360 * sin (M_PI/2 * dc->gasket_spinnery.position), 0, 0, 1); - glRotatef (360 * sin (M_PI/2 * dc->gasket_spinnerz.position), 1, 0, 0); + glRotatef (360 * SINIFY (dc->gasket_spinnerx.position), 0, 1, 0); + glRotatef (360 * SINIFY (dc->gasket_spinnery.position), 0, 0, 1); + glRotatef (360 * SINIFY (dc->gasket_spinnerz.position), 1, 0, 0); memcpy (gcolor, dc->color, sizeof (dc->color)); if (dc->wire_overlay != 0) @@ -2399,12 +2400,12 @@ draw_logo (ModeInfo *mi) if (pizza_p) { - glRotatef (360 * sin (M_PI/2 * dc->pizza_spinnery.position), 1, 0, 0); - glRotatef (360 * sin (M_PI/2 * dc->pizza_spinnerz.position), 0, 0, 1); + glRotatef (360 * SINIFY (dc->pizza_spinnery.position), 1, 0, 0); + glRotatef (360 * SINIFY (dc->pizza_spinnerz.position), 0, 0, 1); } else { - glRotatef (360 * sin (M_PI/2 * dc->helix_spinnerz.position), 0, 0, 1); + glRotatef (360 * SINIFY (dc->helix_spinnerz.position), 0, 0, 1); } scale = ((dc->anim_state == PIZZA_IN || dc->anim_state == HELIX_IN)