X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fatlantis.c;h=4b13c3217b1cb734c82911fce578ebdc2402318d;hb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;hp=9e4a449d7052d883cf1c371e6414c61cfcf1963e;hpb=e4fa2ac140f7bc56571373a7b7eb585fa4500e38;p=xscreensaver diff --git a/hacks/glx/atlantis.c b/hacks/glx/atlantis.c index 9e4a449d..4b13c321 100644 --- a/hacks/glx/atlantis.c +++ b/hacks/glx/atlantis.c @@ -29,7 +29,7 @@ static const char sccsid[] = "@(#)atlantis.c 5.08 2003/04/09 xlockmore"; * Thanks goes also to Brian Paul for making it possible and inexpensive * to use OpenGL at home. * - * My e-mail address is lassauge@mail.dotcom.fr + * My e-mail address is lassauge@users.sourceforge.net * * Eric Lassauge (May-13-1998) * @@ -57,7 +57,6 @@ static const char sccsid[] = "@(#)atlantis.c 5.08 2003/04/09 xlockmore"; * Add support for -/+ wireframe (t'was so easy to do!) * * TODO : - * - add a sort of background image or random bg color * - better handling of sizes and speeds * - test standalone and module modes * - purify it (!) @@ -103,34 +102,26 @@ static const char sccsid[] = "@(#)atlantis.c 5.08 2003/04/09 xlockmore"; */ #define DEF_TEXTURE "True" -#define DEF_GRADIENT "False" +#define DEF_GRADIENT "True" #define DEF_WHALESPEED "250" #ifdef STANDALONE -# define PROGCLASS "Atlantis" -# define HACK_INIT init_atlantis -# define HACK_DRAW draw_atlantis -# define HACK_RESHAPE reshape_atlantis -# define atlantis_opts xlockmore_opts # define DEFAULTS "*delay: 25000 \n" \ "*count: 4 \n" \ "*showFPS: False \n" \ "*cycles: 100 \n" \ "*size: 6000 \n" \ - "*wireframe: False \n" \ - "*texture: " DEF_TEXTURE " \n" \ - "*gradient: " DEF_GRADIENT " \n" \ - "*whalespeed: " DEF_WHALESPEED " \n" + "*wireframe: False \n" +# define atlantis_handle_event 0 # include "xlockmore.h" /* from the xscreensaver distribution */ #else /* !STANDALONE */ # include "xlock.h" /* from the xlockmore distribution */ -#include "vis.h" +# include "vis.h" #endif /* !STANDALONE */ #ifdef USE_GL #include "atlantis.h" -#include static int whalespeed; @@ -138,11 +129,11 @@ static int do_texture; static int do_gradient; static XrmOptionDescRec opts[] = { - {"-whalespeed", ".atlantis.whalespeed", XrmoptionSepArg, (caddr_t) NULL}, - {"-texture", ".atlantis.texture", XrmoptionNoArg, (caddr_t)"true"}, - {"+texture", ".atlantis.texture", XrmoptionNoArg, (caddr_t)"false"}, - {"-gradient", ".atlantis.gradient", XrmoptionNoArg, (caddr_t)"true"}, - {"+gradient", ".atlantis.gradient", XrmoptionNoArg, (caddr_t)"false"}, + {"-whalespeed", ".atlantis.whalespeed", XrmoptionSepArg, 0}, + {"-texture", ".atlantis.texture", XrmoptionNoArg, "true"}, + {"+texture", ".atlantis.texture", XrmoptionNoArg, "false"}, + {"-gradient", ".atlantis.gradient", XrmoptionNoArg, "true"}, + {"+gradient", ".atlantis.gradient", XrmoptionNoArg, "false"}, }; static argtype vars[] = @@ -155,10 +146,11 @@ static argtype vars[] = static OptionStruct desc[] = { {"-whalespeed num", "speed of whales and the dolphin"}, - {"-texture num", "whether to introduce water-like distortion"} + {"-texture", "whether to introduce water-like distortion"}, + {"-gradient", "whether to introduce gradient-filled background"}, }; -ModeSpecOpt atlantis_opts = +ENTRYPOINT ModeSpecOpt atlantis_opts = {sizeof opts / sizeof opts[0], opts, sizeof vars / sizeof vars[0], vars, desc}; #ifdef USE_MODULES @@ -230,24 +222,16 @@ Init(ModeInfo *mi) { atlantisstruct *ap = &atlantis[MI_SCREEN(mi)]; - static float ambient[] = - {0.1, 0.1, 0.1, 1.0}; - static float diffuse[] = - {1.0, 1.0, 1.0, 1.0}; - static float position[] = - {0.0, 1.0, 0.0, 0.0}; - static float mat_shininess[] = - {90.0}; - static float mat_specular[] = - {0.8, 0.8, 0.8, 1.0}; - static float mat_diffuse[] = - {0.46, 0.66, 0.795, 1.0}; - static float mat_ambient[] = - {0.0, 0.1, 0.2, 1.0}; - static float lmodel_ambient[] = - {0.4, 0.4, 0.4, 1.0}; - static float lmodel_localviewer[] = - {0.0}; + static const float ambient[] = {0.1, 0.1, 0.1, 1.0}; + static const float diffuse[] = {1.0, 1.0, 1.0, 1.0}; + static const float position[] = {0.0, 1.0, 0.0, 0.0}; + static const float mat_shininess[] = {90.0}; + static const float mat_specular[] = {0.8, 0.8, 0.8, 1.0}; + static const float mat_diffuse[] = {0.46, 0.66, 0.795, 1.0}; + static const float mat_ambient[] = {0.0, 0.1, 0.2, 1.0}; + static const float lmodel_ambient[] = {0.4, 0.4, 0.4, 1.0}; + static const float lmodel_localviewer[] = {0.0}; + float fblue = 0.0, fgreen; glFrontFace(GL_CCW); @@ -331,7 +315,7 @@ Init(ModeInfo *mi) glClearColor(0.0, fgreen, fblue, 0.0); } -void +ENTRYPOINT void reshape_atlantis(ModeInfo * mi, int width, int height) { atlantisstruct *ap = &atlantis[MI_SCREEN(mi)]; @@ -460,7 +444,7 @@ AllDisplay(atlantisstruct * ap) *----------------------------------------------------------------------------- */ -void +ENTRYPOINT void init_atlantis(ModeInfo * mi) { int screen = MI_SCREEN(mi); @@ -520,7 +504,7 @@ init_atlantis(ModeInfo * mi) * Called by the mainline code periodically to update the display. *----------------------------------------------------------------------------- */ -void +ENTRYPOINT void draw_atlantis(ModeInfo * mi) { atlantisstruct *ap = &atlantis[MI_SCREEN(mi)]; @@ -553,7 +537,7 @@ draw_atlantis(ModeInfo * mi) *----------------------------------------------------------------------------- */ -void +ENTRYPOINT void release_atlantis(ModeInfo * mi) { int screen; @@ -571,12 +555,13 @@ release_atlantis(ModeInfo * mi) FreeAllGL(mi); } -void +ENTRYPOINT void refresh_atlantis(ModeInfo * mi) { } -void +#ifndef STANDALONE +ENTRYPOINT void change_atlantis(ModeInfo * mi) { atlantisstruct *ap = &atlantis[MI_SCREEN(mi)]; @@ -587,5 +572,8 @@ change_atlantis(ModeInfo * mi) glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(ap->glx_context)); Init(mi); } +#endif /* !STANDALONE */ + +XSCREENSAVER_MODULE ("Atlantis", atlantis) #endif /* USE_GL */