/* WMGlobe 1.3 - All the Earth on a WMaker Icon * copyright (C) 1998,99,2000,01 Jerome Dumonteil * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ***************************************************************************/ /* it uses some functions of : Xglobe, Xearth, wmgeneral, wmaker/wrlib ***************************************************************************/ #ifndef WMG_HEADER_H #define WMG_HEADER_H /* customization : see wmgoption.h */ #include #include #include #include #include #include #include #include /*toupper */ #include #include #include #include #include #include #include #include #include #include #include #include #include "wraster.h" #include "wmgoption.h" #define FALSE 0 #define TRUE 1 #define STRONG 2 #define MAX(x, y) ((x) < (y) ? (y) : (x)) #define MIN(x, y) ((x) > (y) ? (y) : (x)) #define ABS(a) ((a) < 0 ? -(a) : (a)) #define PTFIXED 1 #define PTSUN 2 #define PTRANDOM 3 #define PTMOON 4 #ifndef PI #define PI 3.141592653 #endif /* * wmglobe * variables globales */ /************/ /* Typedefs */ /************/ #define MAX_MOUSE_REGION (8) typedef struct { int enable; int top; int bottom; int left; int right; } MOUSE_REGION; MOUSE_REGION mouse_region[MAX_MOUSE_REGION]; typedef struct MPO { int r, g, b; } MPO; MPO *md[4], *mn[4]; double solu[DIAMETRE][DIAMETRE][3]; int tabsolu[DIAMETRE][DIAMETRE]; int solution; typedef struct { Pixmap pixmap; Pixmap mask; XpmAttributes attributes; } XpmIcon; Display *dpy; char *dayfile, *nightfile, *dpy_name; Pixmap pix, pixmask; XEvent Event; RImage *map, *small, *mapnight; XpmIcon screenpos, scrdate, scrdiv, numpix, txtpix, wmg; Window iconwin, win; int onlyshape, option_iw; GC NormalGC; /********* rendering********/ #if WITH_MARKERS double marker[MAX_MARKERS][3]; int nb_marker, sun_marker, moon_marker; RColor sun_col, moon_col; double moon_lat,moon_long; #endif double delay, time_multi; /* * struct timeval delta_tim, last_tim, next_tim, render_tim, base_tim, * vec_tim; * * time_t beg_time, ini_time,t1901; */ struct timeval tlast, tnext, trend, tdelay, tini, tbase; time_t tsunpos; int sens, fun, funx, funy, oknimap, mratiox, mratioy, gotoscr; int typecadre, p_type, use_nightmap, use_default_nightmap, use_nmap_ini, firstTime, stoprand, do_something, iop; double v_lat, v_long, old_dvlat, old_dvlong, dv_lat, dv_long; double dlat, dlong, addlat, addlong, ratiox, ratioy, dawn; double sun_lat; double sun_long; double fov; double radius; double proj_dist; /* distance to projection plane */ double center_dist; /* distance to center of earth */ double ambient_light; /* how dark is the dark side? */ double light_x, light_y, light_z; /* vector of sunlight with lengt 1 */ double c_coef, b_coef; double zoom; int radius_proj, aml; /* radius of sphere on screen */ RColor noir; #ifdef DEBUG double minhz; #endif int stable; /****************************************************************/ /* Function Prototypes */ /****************************************************************/ int main(int argc, char *argv[]); void AddMouseRegion(int index, int left, int top, int right, int bottom); int CheckMouseRegion(int x, int y); void RedrawWindowXYWH(int x, int y, int w, int h); void set_defaults(); void loadxpm(Window drawable); void cmdline(int argc, char *argv[]); void screen_back(); void rotation_terre(int x, int y, int lat_flag); void zooming(int facto); struct timeval diftimev(struct timeval t1, struct timeval t2); struct timeval addtimev(struct timeval t1, struct timeval t2); struct timeval getimev(); void setZoom(double z); void calcDistance(); void renderFrame(); void initmyconvert(); int myRConvertImage(RContext * context, RImage * image, Pixmap * pixmap); RContext *myRCreateContext (Display * dpy, int screen_number, RContextAttributes * attribs); void setTime(struct timeval t); void recalc(int calme); void sun_position(time_t ssue, double *lat, double *lon); void moon_position(time_t ssue, double *lat, double *lon); void transform_marker(int m); void setViewPos(double lat, double lon); int ripalpha(RImage * image); RImage* RScaleImage(RImage *image, unsigned new_width, unsigned new_height); void RReleaseImage(RImage *image); #endif