#include <stddef.h>
#include <stdlib.h>
#include <string.h>
-#include <libgen.h>
/* angles */
#define ZERO 0.0
#define DEFAULTS "*delay: 30000 \n" \
"*count: 30 \n" \
"*showFPS: False \n" \
- "*wireframe: False \n" \
- "*explode: " DEF_EXPLODE " \n" \
- "*angvel: " DEF_ANGVEL " \n" \
- "*accel: " DEF_ACCEL " \n" \
- "*statictime: " DEF_STATICTIME " \n" \
- "*yangvel: " DEF_YANGVEL " \n" \
- "*zangvel: " DEF_ZANGVEL " \n" \
- "*altcolour: " DEF_ALTCOLOUR " \n" \
- "*titles: True \n" \
"*labelfont: -*-times-bold-r-normal-*-180-*\n" \
- "*zoom: " DEF_ZOOM " \n" \
-
-
#undef countof
#define countof(x) (sizeof((x))/sizeof((*x)))
#include "xlockmore.h"
+#include "glxfonts.h"
static XrmOptionDescRec opts[] = {
{ "-explode", ".explode", XrmoptionSepArg, DEF_EXPLODE },
{ "-statictime", ".statictime", XrmoptionSepArg, DEF_STATICTIME },
{ "-yangvel", ".yangvel", XrmoptionSepArg, DEF_YANGVEL },
{ "-zangvel", ".zangvel", XrmoptionSepArg, DEF_ZANGVEL },
- { "-altcolour", ".altcolour", XrmoptionNoArg, (caddr_t) "True" },
- { "-no-altcolour", ".altcolour", XrmoptionNoArg, (caddr_t) "False" },
- { "-titles", ".titles", XrmoptionNoArg, (caddr_t) "True" },
- { "-no-titles", ".titles", XrmoptionNoArg, (caddr_t) "False" },
+ { "-altcolour", ".altcolour", XrmoptionNoArg, "True" },
+ { "-no-altcolour", ".altcolour", XrmoptionNoArg, "False" },
+ { "-titles", ".titles", XrmoptionNoArg, "True" },
+ { "-no-titles", ".titles", XrmoptionNoArg, "False" },
{ "-zoom", ".zoom", XrmoptionSepArg, DEF_ZOOM },
- { "-wireframe", ".wireframe", XrmoptionNoArg, (caddr_t) "true" },
- { "-no-wireframe", ".wireframe", XrmoptionNoArg, (caddr_t) "false" },
+ { "-wireframe", ".wireframe", XrmoptionNoArg, "true" },
+ { "-no-wireframe", ".wireframe", XrmoptionNoArg, "false" },
};
static argtype vars[] = {
- {(caddr_t *) &explode, "explode", "Explode", DEF_EXPLODE, t_Float},
- {(caddr_t *) &angvel, "angvel", "Angular Velocity", DEF_ANGVEL, t_Float},
- {(caddr_t *) &accel, "accel", "Acceleration", DEF_ACCEL, t_Float},
- {(caddr_t *) &statictime, "statictime", "Static Time", DEF_STATICTIME, t_Int},
- {(caddr_t *) &yangvel, "yangvel", "Angular Velocity about Y axis", DEF_YANGVEL, t_Float},
- {(caddr_t *) &zangvel, "zangvel", "Angular Velocity about X axis", DEF_ZANGVEL, t_Float},
- {(caddr_t *) &interactive, "interactive", "Interactive", DEF_INTERACTIVE, t_Bool},
- {(caddr_t *) &altcolour, "altcolour", "Alternate Colour Scheme", DEF_ALTCOLOUR, t_Bool},
- {(caddr_t *) &titles, "titles", "Titles", DEF_TITLES, t_Bool},
- {(caddr_t *) &zoom, "zoom", "Zoom", DEF_ZOOM, t_Float},
- {(caddr_t *) &wireframe, "wireframe", "Wireframe", DEF_WIREFRAME, t_Bool},
+ {&explode, "explode", "Explode", DEF_EXPLODE, t_Float},
+ {&angvel, "angvel", "Angular Velocity", DEF_ANGVEL, t_Float},
+ {&accel, "accel", "Acceleration", DEF_ACCEL, t_Float},
+ {&statictime, "statictime", "Static Time", DEF_STATICTIME, t_Int},
+ {&yangvel, "yangvel", "Angular Velocity about Y axis", DEF_YANGVEL, t_Float},
+ {&zangvel, "zangvel", "Angular Velocity about X axis", DEF_ZANGVEL, t_Float},
+ {&interactive, "interactive", "Interactive", DEF_INTERACTIVE, t_Bool},
+ {&altcolour, "altcolour", "Alternate Colour Scheme", DEF_ALTCOLOUR, t_Bool},
+ {&titles, "titles", "Titles", DEF_TITLES, t_Bool},
+ {&zoom, "zoom", "Zoom", DEF_ZOOM, t_Float},
+ {&wireframe, "wireframe", "Wireframe", DEF_WIREFRAME, t_Bool},
};
ModeSpecOpt sws_opts = {countof(opts), opts, countof(vars), vars, NULL};
#endif /* !HAVE_GETTIMEOFDAY */
}
-#ifndef HAVE_GLUT
-static void load_font(ModeInfo * mi, char * res, XFontStruct ** fontp, GLuint * dlistp) {
- const char * font = get_string_resource(res, "Font");
- XFontStruct * f;
- Font id;
- int first, last;
-
- if (!font)
- font = "-*-helvetica-medium-r-*-*-*-120-*";
-
- f = XLoadQueryFont(mi->dpy, font);
- if (!f)
- f = XLoadQueryFont(mi->dpy, "fixed");
-
- id = f->fid;
- first = f->min_char_or_byte2;
- last = f->max_char_or_byte2;
-
- clear_gl_error();
- *dlistp = glGenLists((GLuint) last + 1);
- check_gl_error("glGenLists");
- glXUseXFont(id, first, last - first + 1, *dlistp + first);
- check_gl_error("glXUseXFont");
-
- *fontp = f;
-}
-#endif
void start_morph(int model_index, int immediate);
/* set up a font for the labels */
#ifndef HAVE_GLUT
if (titles)
- load_font(mi, "labelfont", &bp->font, &bp->font_list);
+ load_font(mi->dpy, "labelfont", &bp->font, &bp->font_list);
#endif
/* build a solid display list */
{
char interactstr[] = "interactive";
char * s;
- int i = 0;
-#ifdef HAVE_GLUT
- int w;
-#endif
-
if (interactive)
s = interactstr;
else
s = model[glc->next_model].name;
-#ifdef HAVE_GLUT
- w = glutBitmapLength(GLUT_BITMAP_HELVETICA_12, (unsigned char *) s);
- glRasterPos2f(glc->width - w - 3, 4);
- while (s[i] != '\0')
- glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, s[i++]);
-#else
- glRasterPos2f(10, mi->xgwa.height - 10 - (bp->font->ascent + bp->font->descent));
- while (s[i] != '\0')
- glCallList(bp->font_list + (int)s[i++]);
-#endif
+
+ print_gl_string (mi->dpy, bp->font, bp->font_list,
+ mi->xgwa.width, mi->xgwa.height,
+ 10, mi->xgwa.height - 10,
+ s);
}
glPopMatrix();
glMatrixMode(GL_PROJECTION);
/* ang_diff / rot approaches 0, we want the complement */
retval = 1.0 - (ang_diff_max / rot_max);
/* protect against naan */
+
+/* Apparently some systems (Solaris) don't have isinf() */
+#undef isinf
+#define isinf(x) (((x) > 999999999999.9) || ((x) < -999999999999.9))
+
if (isnan(retval) || isinf(retval)) retval = 1.0;
}
/*printf("morph_pct = %f\n", retval);*/