-/* DNA Logo, Copyright (c) 2001-2011 Jamie Zawinski <jwz@jwz.org>
+/* DNA Logo, Copyright (c) 2001-2014 Jamie Zawinski <jwz@jwz.org>
*
* DNA Lounge
*
#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...
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;
{
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;
}
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:
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]);
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)
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)