1 #ifndef _COMMON_H 2 #define _COMMON_H 3 4 #define forall(i,n) for ((i)=0; (i)<(n); (i)++) 5 #define scalarprod(a,b) ((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[2]) 6 7 #define PROGNAME "Quat" 8 /* Define VERSION through configure.in */ 9 #ifdef VERSION 10 #define PROGVERSION VERSION 11 #else 12 /* WARNING: The following string MUST have 4 characters!!! */ 13 /* (So use "1.20" instead of "1.2" !! ) */ 14 #define PROGVERSION "1.20" 15 #endif 16 #define PROGSUBVERSION "" 17 /*#define PROGSTATE " development\n(Build: " __DATE__ ", " __TIME__ ")"*/ 18 #define PROGSTATE "" 19 /*#define COMMENT "Development version - Please do not distribute."*/ 20 #define COMMENT "" 21 22 /* define codes for "mode" in DoParamSave (win2.c) WriteINI (quat.c) */ 23 #define PS_OBJ 1 24 #define PS_VIEW 2 25 #define PS_COL 4 26 #define PS_OTHER 8 27 #define PS_USEFILE 128 28 29 typedef double vec3[3]; /* vector in 3d */ 30 struct basestruct /* origin and 3 base vectors */ 31 { 32 vec3 O, x, y, z; 33 }; 34 35 typedef double point[4]; /* point in 4d quaternion space */ 36 37 /* intersection objects definitions (only planes for now) */ 38 /* every structure in this section must have */ 39 /* a char "cut_type" as first element */ 40 #define CUT_TERMINATOR 0 41 #define CUT_PLANE 1 42 /* End of intersection objects definitions */ 43 44 struct frac_struct 45 { 46 point c; 47 double bailout; 48 int maxiter; 49 double lvalue; 50 int formula; 51 point p[4]; 52 } ; 53 54 struct view_struct 55 { 56 vec3 s, up, light; 57 double Mov[2]; 58 double LXR; 59 int xres, yres, zres; 60 double interocular; 61 double phongmax, phongsharp, ambient; 62 int antialiasing; 63 }; 64 65 struct iter_struct; 66 67 struct calc_struct 68 { 69 point xp, xs, xq, xcalc; 70 struct view_struct v; 71 struct frac_struct f; 72 struct basestruct sbase, base, aabase; 73 double absx, absy, absz; 74 double *cutbuf; 75 int (*iterate) (struct iter_struct*); 76 int (*iternorm) (point xstart, point c, point norm, double bailout, int maxiter); 77 } ; 78 79 struct col_struct 80 { 81 double weight; /* Weight in a palette from 0.0 to 1.0 */ 82 /* 0 ... single color */ 83 /* >0 ... smoothly shaded to next color in */ 84 /* palette, the higher weight, the slower */ 85 double col1[3]; /* Red, green, blue from 0.0 to 1.0 */ 86 double col2[3]; /* dto. */ 87 } ; 88 89 struct rgbcol_struct 90 { 91 short int r, g, b; 92 }; 93 94 struct realpal_struct 95 { 96 struct col_struct cols[30]; 97 int colnum; 98 }; 99 100 struct disppal_struct 101 { 102 struct rgbcol_struct cols[256]; 103 int colnum, brightnum; /* maxcol = colnum*brightnum */ 104 int maxcol; 105 double btoc; /* "brights":colors */ 106 int rdepth, gdepth, bdepth; /* Used by FindNearestColor. Should be filled if this is used. */ 107 }; 108 109 struct vidinfo_struct 110 { 111 int maxcol; 112 int rdepth, gdepth, bdepth; 113 double rgam, ggam, bgam; 114 }; 115 116 #ifdef __cplusplus 117 extern "C" { 118 #endif 119 120 int IsStereo(struct view_struct *view); 121 float colorizepoint(/*float diffr, int closest_iteration,*/ struct calc_struct *c); 122 123 #ifdef __cplusplus 124 } 125 #endif 126 #endif 127