X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fb_lockglue.c;h=4f24c53f117c32e3913ef373b6646b45ea333386;hb=3f438031d610c7e15fd33876a879b97e290e05fb;hp=d0bc7229fc93f488c56a2497419bc2dafdd65ad6;hpb=96a411663168b0ba5432b407a83be55f3df0c802;p=xscreensaver diff --git a/hacks/glx/b_lockglue.c b/hacks/glx/b_lockglue.c index d0bc7229..4f24c53f 100644 --- a/hacks/glx/b_lockglue.c +++ b/hacks/glx/b_lockglue.c @@ -14,22 +14,23 @@ static const char sccsid[] = "@(#)b_lockglue.c 4.11 98/06/16 xlockmore"; */ struct glb_config glb_config = { + 0, /* transparent_p */ #if GLB_SLOW_GL 2, /* subdivision_depth */ #else 3, /* subdivision_depth */ #endif 5, /* nr_nudge_axes */ - 0.3, /* nudge_angle_factor */ - 0.15, /* nudge_factor */ + 0.01, /* nudge_angle_factor */ + 0.20, /* nudge_factor */ 0.1, /* rotation_factor */ 8, /* create_bubbles_every */ 8, /* max_bubbles */ {0.7, 0.8, 0.9, 1.0}, /* p_bubble_group */ 0.5, /* max_size */ 0.1, /* min_size */ - 0.1, /* max_speed */ - 0.03, /* min_speed */ + 0.03, /* max_speed */ + 0.005, /* min_speed */ 1.5, /* scale_factor */ -4, /* screen_bottom */ 4, /* screen_top */ @@ -55,6 +56,9 @@ struct glb_config glb_config = # define DEFAULTS "*delay: 10000 \n" \ "*showFPS: False \n" +#define DEF_TRANSPARENT "False" +#define DEF_COLOR "random" + #include "xlockmore.h" #else #include "xlock.h" @@ -63,8 +67,24 @@ struct glb_config glb_config = #ifdef USE_GL -ModeSpecOpt bubble3d_opts = -{0, NULL, 0, NULL, NULL}; +static Bool transparent_p; +static char *bubble_color_str; + +#undef countof +#define countof(x) (sizeof((x))/sizeof((*x))) + +static XrmOptionDescRec opts[] = { + { "-transparent", ".transparent", XrmoptionNoArg, "True" }, + { "+transparent", ".transparent", XrmoptionNoArg, "False" }, + { "-color", ".bubble3d.bubblecolor", XrmoptionSepArg, 0 }, +}; + +static argtype vars[] = { + {&transparent_p, "transparent", "Transparent", DEF_TRANSPARENT, t_Bool}, + {&bubble_color_str, "bubblecolor", "BubbleColor", DEF_COLOR, t_String}, +}; + +ModeSpecOpt bubble3d_opts = {countof(opts), opts, countof(vars), vars, NULL}; #ifdef USE_MODULES ModStruct bubbles3d_description = @@ -91,9 +111,40 @@ struct context { static struct context *contexts = 0; +static void +parse_color (ModeInfo *mi, const char *name, const char *s, GLfloat *a) +{ + XColor c; + + if (! XParseColor (MI_DISPLAY(mi), MI_COLORMAP(mi), s, &c)) + { + fprintf (stderr, "%s: can't parse %s color %s", progname, name, s); + exit (1); + } + a[0] = c.red / 65536.0; + a[1] = c.green / 65536.0; + a[2] = c.blue / 65536.0; +} + +static void +init_colors(ModeInfo *mi) +{ + if (strncasecmp(bubble_color_str, "auto", strlen("auto")) == 0) { + glb_config.bubble_colour[0] = ((float) (NRAND(100)) / 100.0); + glb_config.bubble_colour[1] = ((float) (NRAND(100)) / 100.0); + /* I keep more blue */ + glb_config.bubble_colour[2] = ((float) (NRAND(50)) / 100.0) + 0.50; + } else if (strncasecmp(bubble_color_str, "random", strlen("random")) == 0) { + glb_config.bubble_colour[0] = -1.0; + } else { + parse_color(mi, "bubble", bubble_color_str, glb_config.bubble_colour); + } +} + static void init(struct context *c) { + glb_config.transparent_p = transparent_p; glb_sphere_init(); c->draw_context = glb_draw_init(); } @@ -132,6 +183,7 @@ init_bubble3d(ModeInfo * mi) } c = &contexts[screen]; c->glx_context = init_GL(mi); + init_colors(mi); if (c->glx_context != 0) { init(c); reshape_bubble3d(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); @@ -156,7 +208,9 @@ draw_bubble3d(ModeInfo * mi) glXMakeCurrent(display, window, *(c->glx_context)); + glb_config.polygon_count = 0; do_display(c); + mi->polygon_count = glb_config.polygon_count; if (mi->fps_p) do_fps (mi); glFinish();