X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fglx%2Flavalite.c;h=3178113e5d2ffe94cdce5455aaa506c880a3ad9c;hp=631c2e22b6d3e7bb77e1927007dd4c52971e939a;hb=ffd8c0873576a9e3065696a624dce6b766b77062;hpb=13dbc569cdc6e29019722c0ef9b932a925efbcad diff --git a/hacks/glx/lavalite.c b/hacks/glx/lavalite.c index 631c2e22..3178113e 100644 --- a/hacks/glx/lavalite.c +++ b/hacks/glx/lavalite.c @@ -1,6 +1,6 @@ /* lavalite --- 3D Simulation a Lava Lite, written by jwz. * - * This software Copyright (c) 2002 Jamie Zawinski + * This software Copyright (c) 2002-2004 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -93,18 +93,18 @@ extern XtAppContext app; #define DEF_BTEX "(none)" #define DEF_TTEX "(none)" -#define DEFAULTS "*delay: 10000 \n" \ +#define DEFAULTS "*delay: 30000 \n" \ "*showFPS: False \n" \ "*wireframe: False \n" \ + "*geometry: 600x900 \n" \ "*count: " DEF_COUNT " \n" \ "*style: " DEF_STYLE " \n" \ "*speed: " DEF_SPEED " \n" \ "*spin: " DEF_SPIN "\n" \ "*wander: " DEF_WANDER "\n" \ "*resolution: " DEF_RESOLUTION "\n" \ - "*smooth: " DEF_SMOOTH "\n" \ + "*smooth: " DEF_SMOOTH "\n" \ "*impatient: " DEF_IMPATIENT " \n" \ - "*geometry: 600x900\n" \ "*lavaColor: " DEF_LCOLOR "\n" \ "*fluidColor: " DEF_FCOLOR "\n" \ "*baseColor: " DEF_BCOLOR "\n" \ @@ -244,8 +244,6 @@ typedef struct { GLuint bottle_list; GLuint ball_list; - Bool spin_x, spin_y, spin_z; /* spin of the scene overall */ - int bottle_poly_count; /* polygons in the bottle only */ } lavalite_configuration; @@ -299,22 +297,22 @@ static XrmOptionDescRec opts[] = { }; static argtype vars[] = { - {(caddr_t *) &do_style, "style", "Style", DEF_STYLE, t_String}, - {(caddr_t *) &do_spin, "spin", "Spin", DEF_SPIN, t_String}, - {(caddr_t *) &do_wander, "wander", "Wander", DEF_WANDER, t_Bool}, - {(caddr_t *) &speed, "speed", "Speed", DEF_SPEED, t_Float}, - {(caddr_t *) &resolution, "resolution", "Resolution", DEF_RESOLUTION, t_Int}, - {(caddr_t *) &do_smooth, "smooth", "Smooth", DEF_SMOOTH, t_Bool}, - {(caddr_t *) &do_impatient, "impatient", "Impatient", DEF_IMPATIENT, t_Bool}, - - {(caddr_t *) &lava_color_str, "lavaColor", "LavaColor", DEF_LCOLOR,t_String}, - {(caddr_t *) &fluid_color_str,"fluidColor","FluidColor",DEF_FCOLOR,t_String}, - {(caddr_t *) &base_color_str, "baseColor", "BaseColor", DEF_BCOLOR,t_String}, - {(caddr_t *) &table_color_str,"tableColor","TableColor",DEF_TCOLOR,t_String}, - - {(caddr_t *) &fluid_tex, "fluidTexture", "FluidTexture", DEF_FTEX, t_String}, - {(caddr_t *) &base_tex, "baseTexture", "BaseTexture", DEF_BTEX, t_String}, - {(caddr_t *) &table_tex, "tableTexture", "BaseTexture", DEF_TTEX, t_String}, + {&do_style, "style", "Style", DEF_STYLE, t_String}, + {&do_spin, "spin", "Spin", DEF_SPIN, t_String}, + {&do_wander, "wander", "Wander", DEF_WANDER, t_Bool}, + {&speed, "speed", "Speed", DEF_SPEED, t_Float}, + {&resolution, "resolution", "Resolution", DEF_RESOLUTION, t_Int}, + {&do_smooth, "smooth", "Smooth", DEF_SMOOTH, t_Bool}, + {&do_impatient, "impatient", "Impatient", DEF_IMPATIENT, t_Bool}, + + {&lava_color_str, "lavaColor", "LavaColor", DEF_LCOLOR, t_String}, + {&fluid_color_str, "fluidColor", "FluidColor", DEF_FCOLOR, t_String}, + {&base_color_str, "baseColor", "BaseColor", DEF_BCOLOR, t_String}, + {&table_color_str, "tableColor", "TableColor", DEF_TCOLOR, t_String}, + + {&fluid_tex, "fluidTexture", "FluidTexture", DEF_FTEX, t_String}, + {&base_tex, "baseTexture", "BaseTexture", DEF_BTEX, t_String}, + {&table_tex, "tableTexture", "BaseTexture", DEF_TTEX, t_String}, }; ModeSpecOpt sws_opts = {countof(opts), opts, countof(vars), vars, NULL}; @@ -559,7 +557,7 @@ draw_wing (GLfloat w, GLfloat h, GLfloat d, Bool wire) int polys = 0; int maxx = coords[0][countof(coords[0])-1][0]; int maxy = coords[0][countof(coords[0])-1][1]; - int x; + unsigned int x; for (x = 1; x < countof(coords[0]); x++) { @@ -901,7 +899,7 @@ max_bottle_radius (lavalite_configuration *bp) static GLfloat bottle_radius_at (lavalite_configuration *bp, GLfloat z) { - GLfloat topz = -999, botz = -999, topr, botr; + GLfloat topz = -999, botz = -999, topr = 0, botr = 0; lamp_geometry *slice; GLfloat ratio; @@ -1239,7 +1237,10 @@ animate_lava (ModeInfo *mi) mi->polygon_count = 0; { - double s = 1.0/bp->grid_size; + double s; + if (bp->grid_size == 0) bp->grid_size = 1; /* first time through */ + s = 1.0/bp->grid_size; + glPushMatrix(); glTranslatef (-0.5, -0.5, 0); glScalef (s, s, s); @@ -1334,24 +1335,7 @@ init_lavalite (ModeInfo *mi) reshape_lavalite (mi, MI_WIDTH(mi), MI_HEIGHT(mi)); { - char *s = do_spin; - while (*s) - { - if (*s == ' ' || *s == '\t') ; - else if (*s == 'x' || *s == 'X') bp->spin_x = 1; - else if (*s == 'y' || *s == 'Y') bp->spin_y = 1; - else if (*s == 'z' || *s == 'Z') bp->spin_z = 1; - else - { - fprintf (stderr, - "%s: spin must contain only the characters X, Y, or Z (not \"%s\")\n", - progname, do_spin); - exit (1); - } - s++; - } - - s = do_style; + char *s = do_style; if (!s || !*s || !strcasecmp (s, "classic")) bp->style = CLASSIC; else if (!strcasecmp (s, "giant")) bp->style = GIANT; else if (!strcasecmp (s, "cone")) bp->style = CONE;