00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_x3d
00013 #define ROOT_x3d
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include "X3DDefs.h"
00038
00039 #include <X11/Xlib.h>
00040
00041
00042
00043
00044 #define RClipWithRight 6
00045 #define RClipWithLeft 5
00046 #define PointBehind 4
00047 #define BClipWithRight 3
00048 #define BClipWithLeft 2
00049 #define ClipWithRight 3
00050 #define ClipWithLeft 2
00051 #define ClipWithBottom 1
00052 #define ClipWithTop 0
00053
00054 #define RRight (1 << RClipWithRight)
00055 #define RLeft (1 << RClipWithLeft)
00056 #define Behind (1 << PointBehind)
00057 #define BRight (1 << BClipWithRight)
00058 #define BLeft (1 << BClipWithLeft)
00059 #define Right (1 << ClipWithRight)
00060 #define Left (1 << ClipWithLeft)
00061 #define Bottom (1 << ClipWithBottom)
00062 #define Top (1 << ClipWithTop)
00063 #define Bmask (~BRight & ~BLeft)
00064 #define Rmask (~RRight & ~RLeft)
00065 #define RBmask (Rmask & Bmask)
00066 #define RLeftRight (RRight | RLeft)
00067 #define ALLmask (RRight | RLeft | Behind | BRight | BLeft | Bottom | Top )
00068
00069 #define NUMBOUNDS 8
00070 #define NUMSTIPPLES 17
00071 #define MAXVALUE 6
00072 #define VALUESCALE 51
00073 #define MAXCOLORDIST (443.40501)
00074 #define STIPPLESIZE 4
00075 #define BITSPERBYTE 8
00076 #define MAXCOLORS 256
00077 #define MAXLINE 8192
00078 #define MAXOPTIONLEN 256
00079 #define TMPSTRLEN 16
00080 #define SMALLMOVEMENT 40000
00081 #define POINTERRATIO 0.007
00082 #define MARGIN 30
00083 #define TWOPI 6.2831853
00084 #define REQUESTFACTOR 3
00085 #define EIGHTBIT 8
00086 #define POSTSCRIPT 1
00087 #define HPGL 0
00088 #define HELPLINES 40
00089
00090 #define MAXSTACK 100
00091 #define STOP 10
00092
00093 #define EOK 0
00094 #define ERROR -1
00095
00096 #define FONT "9x15"
00097 #define TITLEFONT "12x24"
00098 #define BOLDFONT "9x15bold"
00099 #define FIXED "fixed"
00100
00101 #define LONGESTSTRING " ROTATE OBJECT ABOUT Z Horizontal "
00102
00103
00104
00105 #define BW 1
00106 #define STEREO 2
00107 #define COLOR 3
00108
00109
00110
00111 #define WIREFRAME 1
00112 #define HIDDENLINE 2
00113 #define SOLID 3
00114
00115
00116
00117 #define ONE 1
00118 #define EIGHT 8
00119
00120
00121
00122 #define MAX_COLORS 232
00123 #define BUFFER_CMAP 11
00124 #define BUFFER0 240
00125 #define BUFFER1 15
00126
00127
00128
00129 #define ENDS_INTERSECT 3
00130 #define SAME 2
00131 #define ABOVE 1
00132 #define INTERSECT 0
00133 #define BELOW -1
00134
00135
00136
00137
00138 #define clipWithBottom(x,y,dx,dy,V) { x -= ((dx * (V+y)) / dy); y = -V; }
00139 #define clipWithTop(x,y,dx,dy,V) { x += ((dx * (V-y)) / dy); y = V; }
00140 #define clipWithLeftSide(x,y,dx,dy,H) { y -= ((dy * (H+x)) / dx); x = -H; }
00141 #define clipWithRightSide(x,y,dx,dy,H) { y += ((dy * (H-x)) / dx); x = H; }
00142
00143 #define FONTHEIGHT(font) (font->ascent + font->descent)
00144
00145 #define HelpPrint(g, x, y, string){ \
00146 XDrawString(g->dpy, g->helpWin, g->helpGc, x, y, string, strlen(string)); \
00147 y += FONTHEIGHT(g->font); \
00148 }
00149
00150 #define swapPtrs(ptr1, ptr2) \
00151 ptr1 = (polygon **)((long)ptr1 ^ (long)ptr2); \
00152 ptr2 = (polygon **)((long)ptr2 ^ (long)ptr1); \
00153 ptr1 = (polygon **)((long)ptr1 ^ (long)ptr2);
00154
00155 #define median5(v1,v2,v3,v4,v5) \
00156 if((*v1)->dist < (*v2)->dist){ \
00157 swapPtrs(v1,v2) \
00158 } \
00159 if((*v3)->dist < (*v4)->dist){ \
00160 swapPtrs(v3,v4) \
00161 } \
00162 if((*v1)->dist < (*v3)->dist){ \
00163 swapPtrs(v1,v3) \
00164 swapPtrs(v2,v4) \
00165 } \
00166 if((*v2)->dist < (*v5)->dist){ \
00167 swapPtrs(v2,v5) \
00168 } \
00169 if((*v2)->dist < (*v3)->dist){ \
00170 swapPtrs(v2,v3) \
00171 swapPtrs(v4,v5) \
00172 } \
00173 if((*v3)->dist < (*v5)->dist){ \
00174 swapPtrs(v3,v5) \
00175 }
00176
00177
00178
00179
00180
00181
00182
00183 typedef struct STACKELEMENT{
00184 int start, end;
00185 } StackElement;
00186
00187
00188 typedef struct XSEGMENT{
00189 _XPoint P, Q;
00190 } xsegment;
00191
00192
00193 typedef struct ANGLEPOINT{
00194 double x, y, z;
00195 } anglePoint;
00196
00197 typedef struct OINFO{
00198
00199
00200
00201 point *points;
00202 segment *segs;
00203 polygon *polys;
00204 polygon **list;
00205
00206
00207
00208 point *bounds;
00209 int objClip;
00210 int Hmin, Vmin, Hmax, Vmax;
00211 int Hmin1, Vmin1, Hmax1, Vmax1;
00212 int Hmin2, Vmin2, Hmax2, Vmax2;
00213 int copyX, copyY, copyWidth, copyHeight;
00214 int fillX, fillY, fillWidth, fillHeight;
00215
00216 int numPoints, numSegs, numPolys;
00217
00218
00219
00220 float tX, tY, tZ, dtX, dtY, dtZ;
00221 float oX, oY, oZ, doX, doY, doZ;
00222 double X, Y, Z,dX, dY, dZ;
00223 double focus, scale, dscale;
00224 float BViewpointX, viewpointY;
00225
00226 } Oinfo;
00227
00228 typedef struct GINFO{
00229
00230
00231
00232 int dpyX, dpyY;
00233 int winX, winY, helpWinX, helpWinY;
00234 int oldPointerX, oldPointerY;
00235
00236
00237
00238 XFontStruct *font, *titleFont, *boldFont;
00239
00240
00241
00242 int depth, renderMode, buffer, mono, stereo, stereoBlue;
00243 int ColorSelect, Block, Relative, helpMenu, modeChanged;
00244
00245
00246
00247 Color *colors;
00248 int numColors;
00249 long stereoBlack, redMask, blueMask;
00250
00251
00252
00253 XSegment *redSegments, *blueSegments;
00254 long *redColors;
00255 int numberBlue, numberRed, winH, winV;
00256 int numRedColors;
00257 int requestSize;
00258 long black, white, Black, Red, Blue, Purple;
00259
00260 polygon *edgeList;
00261 polygon *freeList;
00262
00263 Window win, helpWin;
00264 Display *dpy;
00265 Drawable dest;
00266 GC gc, helpGc;
00267 Colormap colormap;
00268 long red, blue, mask;
00269 XColor cmapColors[3][256];
00270 XColor wireframeColors[2][256];
00271 char *DisplayName, *Geometry;
00272 Pixmap stipple[NUMSTIPPLES], pix;
00273 } Ginfo;
00274
00275
00276 #endif