X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fblocktube.c;h=7219a9ab5a18b2fa83c68093bbf11687d4b746ad;hb=447db08c956099b3b183886729108bf5b364c4b8;hp=f32c7b1e4a0d56241beebc06351f5f02eef381c3;hpb=bbd0773f2adde4927a6196361d4061e70bf48cd9;p=xscreensaver diff --git a/hacks/glx/blocktube.c b/hacks/glx/blocktube.c index f32c7b1e..7219a9ab 100644 --- a/hacks/glx/blocktube.c +++ b/hacks/glx/blocktube.c @@ -30,12 +30,8 @@ extern XtAppContext app; #define DEF_TEXTURE "True" #define DEF_FOG "True" -#define DEFAULTS "*delay: 10000 \n" \ - "*holdtime: " DEF_HOLDTIME "\n" \ - "*changetime: " DEF_CHANGETIME "\n" \ - "*wireframe: False \n" \ - "*texture: " DEF_TEXTURE "\n" \ - "*fog: " DEF_FOG "\n" \ +#define DEFAULTS "*delay: 40000 \n" \ + "*wireframe: False \n" \ "*showFPS: False \n" \ #undef countof @@ -50,7 +46,7 @@ extern XtAppContext app; #include -#if defined( USE_XPM ) || defined( USE_XPMINC ) || defined( HAVE_XPM ) +#if defined(USE_XPM) || defined(USE_XPMINC) || defined(HAVE_XPM) || defined (HAVE_GDK_PIXBUF) /* USE_XPM & USE_XPMINC in xlock mode ; HAVE_XPM in xscreensaver mode */ #include "xpm-ximage.h" #define I_HAVE_XPM @@ -98,18 +94,18 @@ GLfloat tunnelWidth=5; static XrmOptionDescRec opts[] = { { "-holdtime", ".holdtime", XrmoptionSepArg, 0 }, { "-changetime", ".changetime", XrmoptionSepArg, 0 }, - {"-texture", ".texture", XrmoptionNoArg, (caddr_t) "True" }, - {"+texture", ".texture", XrmoptionNoArg, (caddr_t) "False" }, - {"-fog", ".fog", XrmoptionNoArg, (caddr_t) "True" }, - {"+fog", ".fog", XrmoptionNoArg, (caddr_t) "False" }, + {"-texture", ".texture", XrmoptionNoArg, "True" }, + {"+texture", ".texture", XrmoptionNoArg, "False" }, + {"-fog", ".fog", XrmoptionNoArg, "True" }, + {"+fog", ".fog", XrmoptionNoArg, "False" }, }; static argtype vars[] = { - {(caddr_t *) &holdtime, "holdtime", "Hold Time", DEF_HOLDTIME, t_Int}, - {(caddr_t *) &changetime, "changetime", "Change Time", DEF_CHANGETIME, \ + {&holdtime, "holdtime", "Hold Time", DEF_HOLDTIME, t_Int}, + {&changetime, "changetime", "Change Time", DEF_CHANGETIME, \ t_Int}, - {(caddr_t *) &do_texture, "texture", "Texture", DEF_TEXTURE, t_Bool}, - {(caddr_t *) &do_fog, "fog", "Fog", DEF_FOG, t_Bool}, + {&do_texture, "texture", "Texture", DEF_TEXTURE, t_Bool}, + {&do_fog, "fog", "Fog", DEF_FOG, t_Bool}, }; static OptionStruct desc[] = { @@ -123,7 +119,7 @@ ModeSpecOpt blocktube_opts = {countof(opts), opts, countof(vars), vars, desc}; ModStruct blocktube_description = {"blocktube", "init_blocktube", "draw_blocktube", "release_blocktube", "draw_blocktube", "init_blocktube", (char *)NULL, &blocktube_opts, - 10000, 30, 1, 1, 64, 1.0, "", + 40000, 30, 1, 1, 64, 1.0, "", "A shifting tunnel of reflective blocks", 0, NULL}; #endif /* USE_MODULES */ @@ -154,12 +150,17 @@ static Bool LoadGLTextures(ModeInfo *mi) static void newTargetColor(void) { - targetR = random() % 256; - targetG = random() % 256; - targetB = random() % 256; - deltaR = (targetR - currentR) / changetime; - deltaG = (targetG - currentG) / changetime; - deltaB = (targetB - currentB) / changetime; + int luminance = 0; + + while (luminance <= 150) { + targetR = random() % 256; + targetG = random() % 256; + targetB = random() % 256; + deltaR = (targetR - currentR) / changetime; + deltaG = (targetG - currentG) / changetime; + deltaB = (targetB - currentB) / changetime; + luminance = 0.3 * targetR + 0.59 * targetG + 0.11 * targetB; + } } static void randomize_entity (entity *ent)