Logo ROOT  
Reference Guide
x3d.h
Go to the documentation of this file.
1/* @(#)root/x3d:$Id$ */
2/* Author: Mark Spychalla*/
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_x3d
13#define ROOT_x3d
14
15/*
16 Copyright 1992 Mark Spychalla
17
18 Permission to use, copy, modify, distribute, and sell this software and
19 its documentation for any purpose is hereby granted without fee,
20 provided that the above copyright notice appear in all copies and that
21 both that copyright notice and this permission notice appear in
22 supporting documentation, and that the name of Mark Spychalla not be used
23 in advertising or publicity pertaining to distribution of the software
24 without specific, written prior permission. Mark Spychalla makes no
25 representations about the suitability of this software for any purpose.
26 It is provided "as is" without express or implied warranty.
27
28 Mark Spychalla disclaims all warranties with regard to this software,
29 including all implied warranties of merchantability and fitness, in no
30 event shall Mark Spychalla be liable for any special, indirect or
31 consequential damages or any damages whatsoever resulting from loss of use,
32 data or profits, whether in an action of contract, negligence or other
33 tortious action, arising out of or in connection with the use or performance
34 of this software.
35*/
36
37#include "X3DDefs.h"
38
39#include <X11/Xlib.h>
40
41
42/* Constants */
43
44#define RClipWithRight 6
45#define RClipWithLeft 5
46#define PointBehind 4
47#define BClipWithRight 3
48#define BClipWithLeft 2
49#define ClipWithRight 3
50#define ClipWithLeft 2
51#define ClipWithBottom 1
52#define ClipWithTop 0
53
54#define RRight (1 << RClipWithRight)
55#define RLeft (1 << RClipWithLeft)
56#define Behind (1 << PointBehind)
57#define BRight (1 << BClipWithRight)
58#define BLeft (1 << BClipWithLeft)
59#define Right (1 << ClipWithRight)
60#define Left (1 << ClipWithLeft)
61#define Bottom (1 << ClipWithBottom)
62#define Top (1 << ClipWithTop)
63#define Bmask (~BRight & ~BLeft)
64#define Rmask (~RRight & ~RLeft)
65#define RBmask (Rmask & Bmask)
66#define RLeftRight (RRight | RLeft)
67#define ALLmask (RRight | RLeft | Behind | BRight | BLeft | Bottom | Top )
68
69#define NUMBOUNDS 8
70#define NUMSTIPPLES 17
71#define MAXVALUE 6
72#define VALUESCALE 51
73#define MAXCOLORDIST (443.40501)
74#define STIPPLESIZE 4
75#define BITSPERBYTE 8
76#define MAXCOLORS 256
77#define MAXLINE 8192
78#define MAXOPTIONLEN 256
79#define TMPSTRLEN 16
80#define SMALLMOVEMENT 40000
81#define POINTERRATIO 0.007
82#define MARGIN 30
83#define TWOPI 6.2831853
84#define REQUESTFACTOR 3
85#define EIGHTBIT 8
86#define POSTSCRIPT 1
87#define HPGL 0
88#define HELPLINES 40
89
90#define MAXSTACK 100
91#define STOP 10
92
93#define EOK 0
94#define ERROR -1
95
96#define FONT "9x15"
97#define TITLEFONT "12x24"
98#define BOLDFONT "9x15bold"
99#define FIXED "fixed"
100
101#define LONGESTSTRING " ROTATE OBJECT ABOUT Z Horizontal "
102
103/* Color Modes */
104
105#define BW 1
106#define STEREO 2
107#define COLOR 3
108
109/* Rendering modes */
110
111#define WIREFRAME 1
112#define HIDDENLINE 2
113#define SOLID 3
114
115/* Supported Depths */
116
117#define ONE 1
118#define EIGHT 8
119
120/* Double buffering constants */
121
122#define MAX_COLORS 232
123#define BUFFER_CMAP 11
124#define BUFFER0 240
125#define BUFFER1 15
126
127/* Segment intersection constants */
128
129#define ENDS_INTERSECT 3
130#define SAME 2
131#define ABOVE 1
132#define INTERSECT 0
133#define BELOW -1
134
135/* x3d macros */
136
137
138#define clipWithBottom(x,y,dx,dy,V) { x -= ((dx * (V+y)) / dy); y = -V; }
139#define clipWithTop(x,y,dx,dy,V) { x += ((dx * (V-y)) / dy); y = V; }
140#define clipWithLeftSide(x,y,dx,dy,H) { y -= ((dy * (H+x)) / dx); x = -H; }
141#define clipWithRightSide(x,y,dx,dy,H) { y += ((dy * (H-x)) / dx); x = H; }
142
143#define FONTHEIGHT(font) (font->ascent + font->descent)
144
145#define HelpPrint(g, x, y, string){ \
146 XDrawString(g->dpy, g->helpWin, g->helpGc, x, y, string, strlen(string)); \
147 y += FONTHEIGHT(g->font); \
148}
149
150#define swapPtrs(ptr1, ptr2) \
151 ptr1 = (polygon **)((long)ptr1 ^ (long)ptr2); \
152 ptr2 = (polygon **)((long)ptr2 ^ (long)ptr1); \
153 ptr1 = (polygon **)((long)ptr1 ^ (long)ptr2);
154
155#define median5(v1,v2,v3,v4,v5) \
156 if((*v1)->dist < (*v2)->dist){ \
157 swapPtrs(v1,v2) \
158 } \
159 if((*v3)->dist < (*v4)->dist){ \
160 swapPtrs(v3,v4) \
161 } \
162 if((*v1)->dist < (*v3)->dist){ \
163 swapPtrs(v1,v3) \
164 swapPtrs(v2,v4) \
165 } \
166 if((*v2)->dist < (*v5)->dist){ \
167 swapPtrs(v2,v5) \
168 } \
169 if((*v2)->dist < (*v3)->dist){ \
170 swapPtrs(v2,v3) \
171 swapPtrs(v4,v5) \
172 } \
173 if((*v3)->dist < (*v5)->dist){ \
174 swapPtrs(v3,v5) \
175 }
176
177
178
179/* Types */
180
181
182
186
187
188typedef struct XSEGMENT{
191
192
193typedef struct ANGLEPOINT{
194 double x, y, z;
196
197typedef struct OINFO{
198
199/* Geometry information */
200
205
206/* Clipping information */
207
215
217
218/* Position information */
219
220float tX, tY, tZ, dtX, dtY, dtZ;
221float oX, oY, oZ, doX, doY, doZ;
222double X, Y, Z,dX, dY, dZ;
225
227
228typedef struct GINFO{
229
230/* Position variables */
231
235
236/* Font variables */
237
238XFontStruct *font, *titleFont, *boldFont;
239
240/* flags */
241
244
245/* Color variables */
246
250
251/* X window variables */
252
259
262
264Display *dpy;
268long red, blue, mask;
269XColor cmapColors[3][256];
270XColor wireframeColors[2][256];
274
275
276#endif
XID Colormap
Definition TGX11.h:37
XID Window
Definition TGX11.h:38
XID Drawable
Definition TGX11.h:35
struct COLOR_ Color
Definition X3DDefs.h:33
struct POLYGON polygon
Definition X3DDefs.h:32
struct SEGMENT segment
Definition X3DDefs.h:31
struct POINT point
Definition X3DDefs.h:30
double y
Definition x3d.h:194
double x
Definition x3d.h:194
double z
Definition x3d.h:194
Definition x3d.h:228
Display * dpy
Definition x3d.h:264
int dpyY
Definition x3d.h:232
int helpWinX
Definition x3d.h:233
int numColors
Definition x3d.h:248
Window win
Definition x3d.h:263
polygon * freeList
Definition x3d.h:261
long Blue
Definition x3d.h:258
long white
Definition x3d.h:258
Window helpWin
Definition x3d.h:263
long Purple
Definition x3d.h:258
int winH
Definition x3d.h:255
XFontStruct * boldFont
Definition x3d.h:238
XColor cmapColors[3][256]
Definition x3d.h:269
int Block
Definition x3d.h:243
long blue
Definition x3d.h:268
int Relative
Definition x3d.h:243
long stereoBlack
Definition x3d.h:249
XColor wireframeColors[2][256]
Definition x3d.h:270
int stereoBlue
Definition x3d.h:242
int requestSize
Definition x3d.h:257
int numberRed
Definition x3d.h:255
int oldPointerX
Definition x3d.h:234
int renderMode
Definition x3d.h:242
long redMask
Definition x3d.h:249
Drawable dest
Definition x3d.h:265
char * DisplayName
Definition x3d.h:271
GC helpGc
Definition x3d.h:266
Colormap colormap
Definition x3d.h:267
XSegment * redSegments
Definition x3d.h:253
long * redColors
Definition x3d.h:254
XFontStruct * font
Definition x3d.h:238
int winY
Definition x3d.h:233
GC gc
Definition x3d.h:266
int depth
Definition x3d.h:242
int oldPointerY
Definition x3d.h:234
int dpyX
Definition x3d.h:232
long blueMask
Definition x3d.h:249
XFontStruct * titleFont
Definition x3d.h:238
long black
Definition x3d.h:258
Pixmap stipple[NUMSTIPPLES]
Definition x3d.h:272
int helpMenu
Definition x3d.h:243
Pixmap pix
Definition x3d.h:272
polygon * edgeList
Definition x3d.h:260
int stereo
Definition x3d.h:242
int helpWinY
Definition x3d.h:233
long Red
Definition x3d.h:258
int winX
Definition x3d.h:233
int modeChanged
Definition x3d.h:243
long Black
Definition x3d.h:258
int numRedColors
Definition x3d.h:256
int mono
Definition x3d.h:242
XSegment * blueSegments
Definition x3d.h:253
char * Geometry
Definition x3d.h:271
long red
Definition x3d.h:268
int ColorSelect
Definition x3d.h:243
int buffer
Definition x3d.h:242
int winV
Definition x3d.h:255
long mask
Definition x3d.h:268
Color * colors
Definition x3d.h:247
int numberBlue
Definition x3d.h:255
Definition x3d.h:197
polygon * polys
Definition x3d.h:203
double X
Definition x3d.h:222
float tX
Definition x3d.h:220
int copyHeight
Definition x3d.h:213
int Hmin2
Definition x3d.h:212
int objClip
Definition x3d.h:209
segment * segs
Definition x3d.h:202
double Y
Definition x3d.h:222
point * bounds
Definition x3d.h:208
double dY
Definition x3d.h:222
int Vmin2
Definition x3d.h:212
double Z
Definition x3d.h:222
int Hmax
Definition x3d.h:210
int Hmin
Definition x3d.h:210
int Vmax2
Definition x3d.h:212
int numPoints
Definition x3d.h:216
float tZ
Definition x3d.h:220
int copyY
Definition x3d.h:213
float dtZ
Definition x3d.h:220
int copyX
Definition x3d.h:213
double dX
Definition x3d.h:222
int numPolys
Definition x3d.h:216
float oX
Definition x3d.h:221
float doX
Definition x3d.h:221
int numSegs
Definition x3d.h:216
float dtY
Definition x3d.h:220
int fillWidth
Definition x3d.h:214
int Vmax
Definition x3d.h:210
int fillHeight
Definition x3d.h:214
float oY
Definition x3d.h:221
float oZ
Definition x3d.h:221
double scale
Definition x3d.h:223
polygon ** list
Definition x3d.h:204
int Vmax1
Definition x3d.h:211
float BViewpointX
Definition x3d.h:224
double dZ
Definition x3d.h:222
double focus
Definition x3d.h:223
int fillY
Definition x3d.h:214
int Hmax2
Definition x3d.h:212
int copyWidth
Definition x3d.h:213
float doY
Definition x3d.h:221
float dtX
Definition x3d.h:220
float tY
Definition x3d.h:220
int Vmin
Definition x3d.h:210
float doZ
Definition x3d.h:221
int fillX
Definition x3d.h:214
float viewpointY
Definition x3d.h:224
int Hmin1
Definition x3d.h:211
int Hmax1
Definition x3d.h:211
double dscale
Definition x3d.h:223
point * points
Definition x3d.h:201
int Vmin1
Definition x3d.h:211
int start
Definition x3d.h:184
int end
Definition x3d.h:184
_XPoint Q
Definition x3d.h:189
_XPoint P
Definition x3d.h:189
struct XSEGMENT xsegment
struct STACKELEMENT StackElement
struct OINFO Oinfo
#define NUMSTIPPLES
Definition x3d.h:70
struct GINFO Ginfo
struct ANGLEPOINT anglePoint