/* flurry */
-#if !defined( lint ) && !defined( SABER )
+#if 0
static const char sccsid[] = "@(#)flurry.c 4.07 97/11/24 xlockmore";
-
#endif
-/*-
- * due to a Bug/feature in VMS X11/Intrinsic.h has to be placed before xlock.
- * otherwise caddr_t is not defined correctly
- */
-
-#define DEF_PRESET "classic"
+#define DEF_PRESET "random"
#define DEF_BRIGHTNESS "8"
-#include <X11/Intrinsic.h>
-
-# define PROGCLASS "Flurry"
-# define HACK_INIT init_flurry
-# define HACK_DRAW draw_flurry
-# define HACK_RESHAPE reshape_flurry
-# define HACK_HANDLE_EVENT flurry_handle_event
-# define EVENT_MASK PointerMotionMask
-# define flurry_opts xlockmore_opts
-# define DEFAULTS "*showFPS: False \n" \
- "*preset: " DEF_PRESET " \n"
+# define DEFAULTS "*delay: 10000 \n" \
+ "*showFPS: False \n"
+# define refresh_flurry 0
+# define flurry_handle_event 0
# include "xlockmore.h" /* from the xscreensaver distribution */
#ifdef USE_GL
-#include "rotator.h"
-#include "gltrackball.h"
-
static char *preset_str;
static XrmOptionDescRec opts[] = {
};
static argtype vars[] = {
- {(caddr_t *) &preset_str, "preset", "Preset", DEF_PRESET, t_String},
+ {&preset_str, "preset", "Preset", DEF_PRESET, t_String},
};
#define countof(x) (sizeof((x))/sizeof((*x)))
-ModeSpecOpt flurry_opts = {countof(opts), opts, countof(vars), vars, NULL};
+ENTRYPOINT ModeSpecOpt flurry_opts = {countof(opts), opts, countof(vars), vars, NULL};
#ifdef USE_MODULES
ModStruct flurry_description = {
#endif
-#include <sys/time.h>
-#include <sys/sysctl.h>
-
#include "flurry.h"
global_info_t *flurry_info = NULL;
static double gTimeCounter = 0.0;
+static
double currentTime(void) {
struct timeval tv;
-
- gettimeofday(&tv, NULL);
+# ifdef GETTIMEOFDAY_TWO_ARGS
+ struct timezone tzp;
+ gettimeofday(&tv, &tzp);
+# else
+ gettimeofday(&tv);
+# endif
return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0;
}
return currentTime() - gTimeCounter;
}
+#if 0
#ifdef __ppc__
static int IsAltiVecAvailable(void)
{
return 0;
}
#endif
+#endif
+
+static
void delete_flurry_info(flurry_info_t *flurry)
{
int i;
{
free(flurry->spark[i]);
}
- free(flurry);
+ /* free(flurry); */
}
+static
flurry_info_t *new_flurry_info(global_info_t *global, int streams, ColorModes colour, float thickness, float speed, double bf)
{
int i,k;
flurry->flurryRandomSeed = RandFlt(0.0, 300.0);
- flurry->fOldTime = TimeInSecondsSinceStart() + flurry->flurryRandomSeed;
+ flurry->fOldTime = 0;
+ flurry->fTime = TimeInSecondsSinceStart() + flurry->flurryRandomSeed;
+ flurry->fDeltaTime = flurry->fTime - flurry->fOldTime;
flurry->numStreams = streams;
flurry->streamExpansion = thickness;
return flurry;
}
+static
void GLSetupRC(global_info_t *global)
{
/* setup the defaults for OpenGL */
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+#if 0
#ifdef __ppc__
global->optMode = OPT_MODE_SCALAR_FRSQRTE;
#else
global->optMode = OPT_MODE_SCALAR_BASE;
#endif
+#endif /* 0 */
}
+static
void GLRenderScene(global_info_t *global, flurry_info_t *flurry, double b)
{
int i;
case OPT_MODE_SCALAR_BASE:
UpdateSmoke_ScalarBase(global, flurry, flurry->s);
break;
+#if 0
#ifdef __ppc__
case OPT_MODE_SCALAR_FRSQRTE:
UpdateSmoke_ScalarFrsqrte(global, flurry, flurry->s);
UpdateSmoke_VectorUnrolled(global, flurry, flurry->s);
break;
#endif
+#endif /* 0 */
+
default:
break;
}
switch(global->optMode) {
case OPT_MODE_SCALAR_BASE:
+#if 0
#ifdef __ppc__
case OPT_MODE_SCALAR_FRSQRTE:
#endif
+#endif /* 0 */
DrawSmoke_Scalar(global, flurry, flurry->s, b);
break;
+#if 0
#ifdef __VEC__
case OPT_MODE_VECTOR_SIMPLE:
case OPT_MODE_VECTOR_UNROLLED:
DrawSmoke_Vector(global, flurry, flurry->s, b);
break;
#endif
+#endif /* 0 */
default:
break;
}
glDisable(GL_TEXTURE_2D);
}
+static
void GLResize(global_info_t *global, float w, float h)
{
global->sys_glWidth = w;
}
/* new window size or exposure */
-void reshape_flurry(ModeInfo *mi, int width, int height)
+ENTRYPOINT void reshape_flurry(ModeInfo *mi, int width, int height)
{
global_info_t *global = flurry_info + MI_SCREEN(mi);
GLResize(global, (float)width, (float)height);
}
-Bool
-flurry_handle_event (ModeInfo *mi, XEvent *event)
-{
- global_info_t *global = flurry_info + MI_SCREEN(mi);
-
- if (event->xany.type == ButtonPress && event->xbutton.button & Button1) {
- global->button_down_p = True;
- gltrackball_start (global->trackball,
- event->xbutton.x, event->xbutton.y,
- MI_WIDTH (mi), MI_HEIGHT (mi));
- return True;
- }
- else if (event->xany.type == ButtonRelease && event->xbutton.button & Button1) {
- global->button_down_p = False;
- return True;
- }
- else if (event->xany.type == MotionNotify && global->button_down_p) {
- gltrackball_track (global->trackball,
- event->xmotion.x, event->xmotion.y,
- MI_WIDTH (mi), MI_HEIGHT (mi));
- return True;
- }
-
- return False;
-}
-
-void
+ENTRYPOINT void
init_flurry(ModeInfo * mi)
{
int screen = MI_SCREEN(mi);
global->window = MI_WINDOW(mi);
- global->rot = make_rotator(1, 1, 1, 1, 0, True);
- global->trackball = gltrackball_init();
-
global->flurry = NULL;
if (!preset_str || !*preset_str) preset_str = DEF_PRESET;
}
}
-void
+ENTRYPOINT void
draw_flurry(ModeInfo * mi)
{
static int first = 1;
glXSwapBuffers(display, window);
}
-void
+ENTRYPOINT void
release_flurry(ModeInfo * mi)
{
if (flurry_info != NULL) {
FreeAllGL(mi);
}
+XSCREENSAVER_MODULE ("Flurry", flurry)
+
#endif