X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fsproingies.c;h=13974a79d08a71f1d00643f8f4444753b7793413;hb=4cecfc89e5e889c7232693897c06168fb378bd5c;hp=e48c639a806c60e5aedea09625517604bfe74331;hpb=f3e0240915ed9f9b3a61781f5c7002d587563fe0;p=xscreensaver diff --git a/hacks/glx/sproingies.c b/hacks/glx/sproingies.c index e48c639a..13974a79 100644 --- a/hacks/glx/sproingies.c +++ b/hacks/glx/sproingies.c @@ -1,10 +1,14 @@ -/* -*- Mode: C; tab-width: 4 -*- - * sproingies.c --- 3D sproingies - */ +/* -*- Mode: C; tab-width: 4 -*- */ +/* sproingies.c - 3D sproingies */ + #if !defined( lint ) && !defined( SABER ) -static const char sccsid[] = "@(#)sproingies.c 4.04 97/07/26 xlockmore"; +static const char sccsid[] = "@(#)sproingies.c 4.04 97/07/28 xlockmore"; + #endif -/* Copyright 1996 by Ed Mackey, 12/7/96 freely distributable. + +/*- + * sproingies.c - Copyright 1996 by Ed Mackey, freely distributable. + * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and that @@ -16,19 +20,22 @@ static const char sccsid[] = "@(#)sproingies.c 4.04 97/07/26 xlockmore"; * trade secrets or any patents by this file or any part thereof. In no * event will the author be liable for any lost revenue or profits or * other special, indirect and consequential damages. + * + * Revision History: + * See sproingiewrap.c */ #ifdef STANDALONE -# include "xlockmoreI.h" /* from the xscreensaver distribution */ -#else /* !STANDALONE */ -# include "xlock.h" /* from the xlockmore distribution */ +# include "xlockmoreI.h" /* from the xscreensaver distribution */ +#else /* !STANDALONE */ +# include "xlock.h" /* from the xlockmore distribution */ #endif /* !STANDALONE */ #ifdef USE_GL #include #include -#include "buildlwo.h" +#include "gllist.h" #define MAXSPROING 100 #define T_COUNT 40 @@ -43,7 +50,9 @@ typedef struct { int rotx, roty, dist, wireframe, flatshade, groundlevel, maxsproingies, mono; int sframe, target_rx, target_ry, target_dist, target_count; - GLuint sproingies[6], TopsSides, SproingieBoom; + struct gllist *sproingies[6]; + struct gllist *SproingieBoom; + GLuint TopsSides; struct sPosColor *positions; } sp_instance; @@ -52,8 +61,13 @@ static int active_screens = 0; void SproingieSwap(void); -extern struct lwo LWO_s1_1, LWO_s1_2, LWO_s1_3, LWO_s1_4; -extern struct lwo LWO_s1_5, LWO_s1_6, LWO_s1_b; +extern struct gllist *s1_1; +extern struct gllist *s1_2; +extern struct gllist *s1_3; +extern struct gllist *s1_4; +extern struct gllist *s1_5; +extern struct gllist *s1_6; +extern struct gllist *s1_b; static int myrand(int range) @@ -86,12 +100,13 @@ build_TopsSides(int wireframe) /* Surface: Sides */ glNewList(dl_num + 1, GL_COMPILE); - mat_color[0] = 0.156863; - mat_color[1] = 0.156863; - mat_color[2] = 0.392157; if (wireframe) glColor3fv(mat_color); else { + /* jwz: in wireframe mode, color tops and sides the same. */ + mat_color[0] = 0.156863; + mat_color[1] = 0.156863; + mat_color[2] = 0.392157; glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_color); } glEndList(); @@ -497,7 +512,8 @@ RenderSproingie(int t, sp_instance * si) clipplane[3] = ((GLdouble) (thisSproingie->frame) / 9.0) + (si->wireframe ? 0.0 : 0.1); glClipPlane(GL_CLIP_PLANE0, clipplane); - glCallList(si->sproingies[0]); +/** glCallList(si->sproingies[0]);*/ +/**/ renderList(si->sproingies[0]); glDisable(GL_CLIP_PLANE0); } else if (thisSproingie->frame >= BOOM_FRAME) { glTranslatef((GLfloat) (thisSproingie->x) + 0.5, @@ -516,7 +532,8 @@ RenderSproingie(int t, sp_instance * si) /*- * PURIFY 4.0.1 reports an unitialized memory read on the next line when using * MesaGL 2.2. This has been tracked to MesaGL 2.2 src/points.c line 313. */ - glCallList(si->SproingieBoom); +/** glCallList(si->SproingieBoom);*/ +/**/ renderList(si->SproingieBoom); glPointSize(1.0); if (!si->wireframe) { glEnable(GL_LIGHTING); @@ -525,11 +542,13 @@ RenderSproingie(int t, sp_instance * si) glTranslatef((GLfloat) (thisSproingie->x + 1), (GLfloat) (thisSproingie->y - 1), (GLfloat) (thisSproingie->z - 1)); glRotatef((GLfloat) - 90.0, 0.0, 1.0, 0.0); - glCallList(si->sproingies[thisSproingie->frame - 6]); +/** glCallList(si->sproingies[thisSproingie->frame - 6]);*/ +/**/ renderList(si->sproingies[thisSproingie->frame - 6]); } else { glTranslatef((GLfloat) (thisSproingie->x), (GLfloat) (thisSproingie->y), (GLfloat) (thisSproingie->z)); - glCallList(si->sproingies[thisSproingie->frame]); +/** glCallList(si->sproingies[thisSproingie->frame]);*/ +/**/ renderList(si->sproingies[thisSproingie->frame]); } glPopMatrix(); @@ -589,7 +608,7 @@ ComputeGround(sp_instance * si) } void -DisplaySproingies(int screen) +DisplaySproingies(int screen,int pause) { sp_instance *si = &si_list[screen]; int t; @@ -644,13 +663,13 @@ DisplaySproingies(int screen) } void -NextSproingieDisplay(int screen) +NextSproingieDisplay(int screen,int pause) { NextSproingie(screen); - DisplaySproingies(screen); + if (pause) usleep(pause); + DisplaySproingies(screen,pause); } -#if 0 void ReshapeSproingies(int w, int h) { @@ -662,14 +681,12 @@ ReshapeSproingies(int w, int h) glLoadIdentity(); } -#endif - void CleanupSproingies(int screen) { sp_instance *si = &si_list[screen]; +/* int t; - if (si->SproingieBoom) { for (t = 0; t < 6; ++t) glDeleteLists(si->sproingies[t], 1); @@ -680,6 +697,10 @@ CleanupSproingies(int screen) --active_screens; si->SproingieBoom = 0; } +*/ + if (si->TopsSides) { + glDeleteLists(si->TopsSides, 2); + } if (si->positions) { (void) free((void *) (si->positions)); si->positions = NULL; @@ -768,7 +789,7 @@ InitSproingies(int wfmode, int grnd, int mspr, int screen, int numscreens, if (!(si->TopsSides = build_TopsSides(si->wireframe))) (void) fprintf(stderr, "build_TopsSides\n"); - +/* if (!(si->sproingies[0] = BuildLWO(si->wireframe, &LWO_s1_1))) (void) fprintf(stderr, "BuildLWO - 1\n"); if (!(si->sproingies[1] = BuildLWO(si->wireframe, &LWO_s1_2))) @@ -784,6 +805,14 @@ InitSproingies(int wfmode, int grnd, int mspr, int screen, int numscreens, if (!(si->SproingieBoom = BuildLWO(si->wireframe, &LWO_s1_b))) (void) fprintf(stderr, "BuildLWO - b\n"); +*/ + si->sproingies[0]=s1_1; + si->sproingies[1]=s1_2; + si->sproingies[2]=s1_3; + si->sproingies[3]=s1_4; + si->sproingies[4]=s1_5; + si->sproingies[5]=s1_6; + si->SproingieBoom=s1_b; if (si->wireframe) { glShadeModel(GL_FLAT);