X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fsproingiewrap.c;h=d00197d77c4663d01bb3b658e10ffb7a327ef2ce;hb=4cecfc89e5e889c7232693897c06168fb378bd5c;hp=ad11a1b7426b12a1469dec98fe9dc8ec441f307c;hpb=6bb727f03bff0389fbb1349d7df4c9d8d7532959;p=xscreensaver diff --git a/hacks/glx/sproingiewrap.c b/hacks/glx/sproingiewrap.c index ad11a1b7..d00197d7 100644 --- a/hacks/glx/sproingiewrap.c +++ b/hacks/glx/sproingiewrap.c @@ -22,10 +22,15 @@ static const char sccsid[] = "@(#)sproingiewrap.c 4.07 97/11/24 xlockmore"; * other special, indirect and consequential damages. * * Programming: Ed Mackey, http://www.netaxs.com/~emackey/ + * Gordon Wrigley, gdw33@student.canterbury.ac.nz * Sproingie 3D objects modeled by: Al Mackey, al@iam.com * (using MetaNURBS in NewTek's Lightwave 3D v5). * * Revision History: + * 13-Dec-02: Changed triangle normals into vertex normals to give a smooth + apperance and moved the sproingies from Display Lists to + Vertex Arrays, still need to do this for the TopsSides. + (gordon) * 26-Apr-97: Added glPointSize() calls around explosions, plus other fixes. * 28-Mar-97: Added size support. * 22-Mar-97: Updated to use glX interface instead of xmesa one. @@ -57,11 +62,14 @@ static const char sccsid[] = "@(#)sproingiewrap.c 4.07 97/11/24 xlockmore"; # define PROGCLASS "Sproingies" # define HACK_INIT init_sproingies # define HACK_DRAW draw_sproingies +# define HACK_RESHAPE reshape_sproingies # define sproingies_opts xlockmore_opts -# define DEFAULTS "*delay: 100 \n" \ +# define DEFAULTS "*delay: 25000 \n" \ "*count: 5 \n" \ "*cycles: 0 \n" \ "*size: 0 \n" \ + "*showFPS: False \n" \ + "*fpsTop: True \n" \ "*wireframe: False \n" # include "xlockmore.h" /* from the xscreensaver distribution */ #else /* !STANDALONE */ @@ -70,14 +78,14 @@ static const char sccsid[] = "@(#)sproingiewrap.c 4.07 97/11/24 xlockmore"; #ifdef USE_GL -ModeSpecOpt sproingies_opts = { - 0, NULL, 0, NULL, NULL }; +ModeSpecOpt sproingies_opts = +{0, NULL, 0, NULL, NULL}; #ifdef USE_MODULES ModStruct sproingies_description = {"sproingies", "init_sproingies", "draw_sproingies", "release_sproingies", "refresh_sproingies", "init_sproingies", NULL, &sproingies_opts, - 1000, 5, 0, 400, 1.0, "", + 1000, 5, 0, 400, 4, 1.0, "", "Shows Sproingies! Nontoxic. Safe for pets and small children", 0, NULL}; #endif @@ -88,13 +96,9 @@ ModStruct sproingies_description = #include void NextSproingie(int screen); -void NextSproingieDisplay(int screen); -void DisplaySproingies(int screen); - -#if 0 +void NextSproingieDisplay(int screen,int pause); +void DisplaySproingies(int screen,int pause); void ReshapeSproingies(int w, int h); - -#endif void CleanupSproingies(int screen); void InitSproingies(int wfmode, int grnd, int mspr, int screen, int numscreens, int mono); @@ -114,9 +118,13 @@ static sproingiesstruct *sproingies = NULL; static Display *swap_display; static Window swap_window; +static ModeInfo *global_mi_kludge; + void SproingieSwap(void) { + ModeInfo *mi = global_mi_kludge; + if (mi->fps_p) do_fps (mi); glFinish(); glXSwapBuffers(swap_display, swap_window); } @@ -130,12 +138,14 @@ init_sproingies(ModeInfo * mi) int screen = MI_SCREEN(mi); int cycles = MI_CYCLES(mi); - int batchcount = MI_BATCHCOUNT(mi); + int count = MI_COUNT(mi); int size = MI_SIZE(mi); sproingiesstruct *sp; int wfmode = 0, grnd, mspr, w, h; + global_mi_kludge = mi; + if (sproingies == NULL) { if ((sproingies = (sproingiesstruct *) calloc(MI_NUM_SCREENS(mi), sizeof (sproingiesstruct))) == NULL) @@ -143,17 +153,17 @@ init_sproingies(ModeInfo * mi) } sp = &sproingies[screen]; - sp->mono = (MI_WIN_IS_MONO(mi) ? 1 : 0); + sp->mono = (MI_IS_MONO(mi) ? 1 : 0); sp->window = window; if ((sp->glx_context = init_GL(mi)) != NULL) { - if ((cycles & 1) || MI_WIN_IS_WIREFRAME(mi)) + if ((cycles & 1) || MI_IS_WIREFRAME(mi)) wfmode = 1; grnd = (cycles >> 1); if (grnd > 2) grnd = 2; - mspr = batchcount; + mspr = count; if (mspr > 100) mspr = 100; @@ -162,17 +172,17 @@ init_sproingies(ModeInfo * mi) /* Viewport is specified size if size >= MINSIZE && size < screensize */ if (size == 0) { - w = MI_WIN_WIDTH(mi); - h = MI_WIN_HEIGHT(mi); + w = MI_WIDTH(mi); + h = MI_HEIGHT(mi); } else if (size < MINSIZE) { w = MINSIZE; h = MINSIZE; } else { - w = (size > MI_WIN_WIDTH(mi)) ? MI_WIN_WIDTH(mi) : size; - h = (size > MI_WIN_HEIGHT(mi)) ? MI_WIN_HEIGHT(mi) : size; + w = (size > MI_WIDTH(mi)) ? MI_WIDTH(mi) : size; + h = (size > MI_HEIGHT(mi)) ? MI_HEIGHT(mi) : size; } - glViewport((MI_WIN_WIDTH(mi) - w) / 2, (MI_WIN_HEIGHT(mi) - h) / 2, w, h); + glViewport((MI_WIDTH(mi) - w) / 2, (MI_HEIGHT(mi) - h) / 2, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(65.0, (GLfloat) w / (GLfloat) h, 0.1, 2000.0); /* was 200000.0 */ @@ -181,7 +191,7 @@ init_sproingies(ModeInfo * mi) swap_display = display; swap_window = window; - DisplaySproingies(MI_SCREEN(mi)); + DisplaySproingies(MI_SCREEN(mi),mi->pause); } else { MI_CLEARWINDOW(mi); } @@ -204,7 +214,7 @@ draw_sproingies(ModeInfo * mi) swap_display = display; swap_window = window; - NextSproingieDisplay(MI_SCREEN(mi)); /* It will swap. */ + NextSproingieDisplay(MI_SCREEN(mi),mi->pause); /* It will swap. */ } void @@ -217,6 +227,13 @@ refresh_sproingies(ModeInfo * mi) */ } +void +reshape_sproingies (ModeInfo *mi, int w, int h) +{ + ReshapeSproingies(w, h); +} + + void release_sproingies(ModeInfo * mi) {