0
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1993 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
XWorkstation subclass:#GLXWorkstation
|
12
|
14 |
instanceVariableNames:'activeWindow'
|
0
|
15 |
classVariableNames: ''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Interface-Graphics'
|
|
18 |
!
|
|
19 |
|
|
20 |
GLXWorkstation comment:'
|
|
21 |
|
|
22 |
COPYRIGHT (c) 1993 by Claus Gittinger
|
|
23 |
All Rights Reserved
|
|
24 |
|
24
|
25 |
$Header: /cvs/stx/stx/libview/GLXWorkstation.st,v 1.6 1994-01-08 17:16:42 claus Exp $
|
|
26 |
written dec 93 by claus
|
0
|
27 |
'!
|
|
28 |
|
|
29 |
%{
|
24
|
30 |
/*
|
|
31 |
* on SGI, this class is compiled with -DGLX, while
|
|
32 |
* for simulation, this is compiled with -DVGL
|
|
33 |
*/
|
0
|
34 |
/*
|
|
35 |
* this is stupid, GLX defines String, which is also defined here ...
|
|
36 |
*/
|
24
|
37 |
#define String GLX_String
|
|
38 |
|
|
39 |
#ifdef GLX
|
0
|
40 |
# include <gl/glws.h>
|
12
|
41 |
# include <gl/sphere.h>
|
24
|
42 |
#else
|
|
43 |
# include <vogl.h>
|
|
44 |
# include <X11/Xlib.h>
|
|
45 |
#endif
|
0
|
46 |
|
|
47 |
typedef enum {
|
|
48 |
GLXcolorIndexSingleBuffer,
|
|
49 |
GLXcolorIndexDoubleBuffer,
|
|
50 |
GLXrgbSingleBuffer,
|
|
51 |
GLXrgbDoubleBuffer
|
|
52 |
} GLXWindowType;
|
|
53 |
|
|
54 |
extern Window GLXCreateWindow(Display*,Window,int,int,int,int,int,GLXWindowType);
|
24
|
55 |
|
0
|
56 |
#undef String
|
|
57 |
|
|
58 |
/*
|
|
59 |
* some defines - tired of typing ...
|
|
60 |
*/
|
|
61 |
#define MKDPY(o) (Display *)(_intVal(o))
|
|
62 |
#define MKWIN(o) (Window)(_intVal(o))
|
|
63 |
#define MKGC(o) (GC)(_intVal(o))
|
|
64 |
#define MKCURS(o) (Cursor)(_intVal(o))
|
|
65 |
#define MKFONT(o) (XFontStruct *)(_intVal(o))
|
|
66 |
#define MKDPSContext(o) (DPSContext)(_intVal(o))
|
|
67 |
|
|
68 |
#define myDpy MKDPY(_INST(displayId))
|
|
69 |
|
12
|
70 |
#define SETWIN(aGLXWindowId) \
|
|
71 |
if (_INST(activeWindow) != aGLXWindowId) { \
|
|
72 |
if (GLXwinset(myDpy, MKWIN(aGLXWindowId)) < 0) { \
|
|
73 |
RETURN (false); \
|
|
74 |
} \
|
|
75 |
_INST(activeWindow) = aGLXWindowId; \
|
|
76 |
}
|
|
77 |
|
0
|
78 |
#define _COORD_(arg, dst) \
|
|
79 |
if (_isFloat(arg)) \
|
|
80 |
dst = (Coord)(_floatVal(arg)); \
|
|
81 |
else if (_isSmallInteger(arg)) \
|
|
82 |
dst = (Coord)(_intVal(arg)); \
|
|
83 |
else break;
|
|
84 |
|
|
85 |
#define _FLOAT_(arg, dst) \
|
|
86 |
if (_isFloat(arg)) \
|
|
87 |
dst = (float)(_floatVal(arg)); \
|
|
88 |
else if (_isSmallInteger(arg)) \
|
|
89 |
dst = (float)(_intVal(arg)); \
|
24
|
90 |
else if (_isFraction(arg) \
|
|
91 |
&& _isSmallInteger(_FractionInstPtr(arg)->f_numerator) \
|
|
92 |
&& _isSmallInteger(_FractionInstPtr(arg)->f_denominator)) { \
|
|
93 |
float n, d; \
|
|
94 |
n = (float)(_intVal(_FractionInstPtr(arg)->f_numerator)); \
|
|
95 |
d = (float)(_intVal(_FractionInstPtr(arg)->f_denominator)); \
|
|
96 |
dst = n / d; \
|
|
97 |
} else break;
|
0
|
98 |
|
|
99 |
#define _ANGLE_(arg, dst) \
|
|
100 |
if (_isSmallInteger(arg)) \
|
|
101 |
dst = (Angle)(_intVal(arg)); \
|
|
102 |
else break;
|
|
103 |
|
|
104 |
#define _INT_(arg, dst) \
|
|
105 |
if (_isSmallInteger(arg)) \
|
|
106 |
dst = (int)(_intVal(arg)); \
|
|
107 |
else break;
|
|
108 |
|
24
|
109 |
/*
|
|
110 |
* helper to fetch count floats from the object obj
|
|
111 |
* space is provided in vec.
|
|
112 |
* returns a pointer to the floats,
|
|
113 |
* which is obj itself, if it is a FloatArray
|
|
114 |
* the object may be a FloatArray, DoubleArray or an array of
|
|
115 |
* floats/smallintegers
|
|
116 |
*/
|
12
|
117 |
static float *
|
|
118 |
getFloatsFromInto(obj, vec, count)
|
|
119 |
OBJ obj;
|
|
120 |
float *vec;
|
|
121 |
{
|
|
122 |
OBJ cls;
|
|
123 |
int nByte;
|
|
124 |
OBJ o;
|
|
125 |
int i, ninstVars, nInstBytes;
|
|
126 |
char *pElem;
|
|
127 |
|
|
128 |
if (! _isNonNilObject(obj)) return (float *)0;
|
|
129 |
|
|
130 |
cls = _qClass(obj);
|
|
131 |
ninstVars = _intVal(_ClassInstPtr(cls)->c_ninstvars);
|
|
132 |
nInstBytes = OHDR_SIZE + ninstVars * sizeof(OBJ);
|
|
133 |
nByte = _qSize(obj) - nInstBytes;
|
|
134 |
pElem = (char *)(_InstPtr(obj)) + nInstBytes;
|
|
135 |
|
|
136 |
switch (_intVal(_ClassInstPtr(cls)->c_flags) & ARRAYMASK) {
|
|
137 |
case FLOATARRAY:
|
24
|
138 |
/*
|
|
139 |
* best speed for float array
|
|
140 |
* - the data is already as we want it
|
|
141 |
*/
|
12
|
142 |
if (nByte < (count * sizeof(float))) return (float *)0;
|
|
143 |
return (float *)pElem;
|
|
144 |
|
|
145 |
case DOUBLEARRAY:
|
24
|
146 |
/*
|
|
147 |
* for double array, have to copy-and-cast
|
|
148 |
*/
|
12
|
149 |
if (nByte < (count * sizeof(double))) return (float *)0;
|
|
150 |
for (i=0; i<count; i++) {
|
|
151 |
vec[i] = *((double *)pElem);
|
|
152 |
pElem += sizeof(double);
|
|
153 |
}
|
|
154 |
return vec;
|
|
155 |
|
|
156 |
case POINTERARRAY:
|
24
|
157 |
/*
|
|
158 |
* for other array, have to fetch, check and store
|
|
159 |
* the elements can be floats, smallintegers or fractions
|
|
160 |
*/
|
12
|
161 |
if (nByte < (count * sizeof(OBJ))) return (float *)0;
|
|
162 |
/* get elements one-by-one */
|
|
163 |
for (i=0; i<count; i++) {
|
|
164 |
o = *(OBJ *)pElem;
|
24
|
165 |
if (_isFloat(o)) {
|
|
166 |
vec[i] = _floatVal(o);
|
|
167 |
} else if (_isSmallInteger(o)) {
|
|
168 |
vec[i] = (float)(_intVal(o));
|
|
169 |
} else if (_isFraction(o)
|
|
170 |
&& _isSmallInteger(_FractionInstPtr(o)->f_numerator)
|
|
171 |
&& _isSmallInteger(_FractionInstPtr(o)->f_denominator)) {
|
|
172 |
float n, d;
|
|
173 |
|
|
174 |
n = (float)(_intVal(_FractionInstPtr(o)->f_numerator));
|
|
175 |
d = (float)(_intVal(_FractionInstPtr(o)->f_denominator));
|
|
176 |
vec[i] = n / d;
|
|
177 |
} else
|
|
178 |
return 0;
|
12
|
179 |
pElem += sizeof(OBJ);
|
|
180 |
}
|
|
181 |
return vec;
|
|
182 |
}
|
|
183 |
return (float *)0;
|
|
184 |
}
|
|
185 |
|
|
186 |
static
|
|
187 |
putFloatsFromInto(vec, obj, count)
|
|
188 |
OBJ obj;
|
|
189 |
float *vec;
|
|
190 |
{
|
|
191 |
OBJ cls;
|
|
192 |
int nByte;
|
|
193 |
OBJ o;
|
|
194 |
int i, ninstVars, nInstBytes;
|
|
195 |
char *pElem;
|
|
196 |
|
|
197 |
if (! _isNonNilObject(obj)) return 0;
|
|
198 |
|
|
199 |
cls = _qClass(obj);
|
|
200 |
ninstVars = _intVal(_ClassInstPtr(cls)->c_ninstvars);
|
|
201 |
nInstBytes = OHDR_SIZE + ninstVars * sizeof(OBJ);
|
|
202 |
nByte = _qSize(obj) - nInstBytes;
|
|
203 |
pElem = (char *)(_InstPtr(obj)) + nInstBytes;
|
|
204 |
|
|
205 |
switch (_intVal(_ClassInstPtr(cls)->c_flags) & ARRAYMASK) {
|
|
206 |
case FLOATARRAY:
|
|
207 |
if (nByte < (count * sizeof(float))) return 0;
|
|
208 |
for (i=0; i<count; i++) {
|
|
209 |
*(float *)pElem = vec[i];
|
|
210 |
pElem += sizeof(float);
|
|
211 |
}
|
|
212 |
return 1;
|
|
213 |
|
|
214 |
case DOUBLEARRAY:
|
|
215 |
if (nByte < (count * sizeof(float))) return 0;
|
|
216 |
for (i=0; i<count; i++) {
|
|
217 |
*(double *)pElem = vec[i];
|
|
218 |
pElem += sizeof(double);
|
|
219 |
}
|
|
220 |
return 1;
|
|
221 |
}
|
|
222 |
/* not implemented for others */
|
|
223 |
|
|
224 |
return 0;
|
|
225 |
}
|
|
226 |
|
24
|
227 |
/*
|
|
228 |
* helper to fetch a matrix with 16 floats from an object
|
|
229 |
*/
|
12
|
230 |
static Matrix*
|
|
231 |
getFloatsFromMatrixInto(obj, mp)
|
|
232 |
OBJ obj;
|
|
233 |
Matrix *mp;
|
|
234 |
{
|
|
235 |
OBJ cls;
|
|
236 |
extern OBJ FloatArray, DoubleArray, Array;
|
|
237 |
int nByte;
|
|
238 |
OBJ o;
|
|
239 |
|
|
240 |
if (! _isNonNilObject(obj)) return (Matrix *)0;
|
|
241 |
|
|
242 |
cls = _qClass(obj);
|
|
243 |
nByte = _qSize(obj) - OHDR_SIZE;
|
|
244 |
|
|
245 |
if (cls == FloatArray) {
|
|
246 |
int x = 0;
|
|
247 |
int i,j;
|
|
248 |
|
|
249 |
if (nByte < (16 * sizeof(float))) return (Matrix *)0;
|
|
250 |
return (Matrix *) _FloatArrayInstPtr(obj)->f_element;
|
|
251 |
}
|
|
252 |
|
|
253 |
if (cls == DoubleArray) {
|
|
254 |
int x = 0;
|
|
255 |
int i,j;
|
|
256 |
|
|
257 |
if (nByte < (16 * sizeof(double))) return (Matrix *)0;
|
|
258 |
for (i=0; i<4; i++) {
|
|
259 |
for (j=0; j<4; j++) {
|
|
260 |
(*mp)[i][j] = _DoubleArrayInstPtr(obj)->d_element[x];
|
|
261 |
x++;
|
|
262 |
}
|
|
263 |
}
|
|
264 |
return mp;
|
|
265 |
}
|
|
266 |
|
|
267 |
if (cls == Array) {
|
|
268 |
int x = 0;
|
|
269 |
int i,j;
|
|
270 |
|
|
271 |
if (nByte < (16 * sizeof(OBJ))) return (Matrix *)0;
|
|
272 |
/* get elements one-by-one */
|
|
273 |
for (i=0; i<4; i++) {
|
|
274 |
for (j=0; j<4; j++) {
|
|
275 |
o = _ArrayInstPtr(obj)->a_element[x];
|
24
|
276 |
if (_isFloat(o)) {
|
|
277 |
(*mp)[i][j] = _floatVal(o);
|
|
278 |
} else if (_isSmallInteger(o)) {
|
|
279 |
(*mp)[i][j] = (float)(_intVal(o));
|
|
280 |
} else if (_isFraction(o)
|
|
281 |
&& _isSmallInteger(_FractionInstPtr(o)->f_numerator)
|
|
282 |
&& _isSmallInteger(_FractionInstPtr(o)->f_denominator)) {
|
|
283 |
float n, d;
|
|
284 |
|
|
285 |
n = (float)(_intVal(_FractionInstPtr(o)->f_numerator));
|
|
286 |
d = (float)(_intVal(_FractionInstPtr(o)->f_denominator));
|
|
287 |
(*mp)[i][j] = n / d;
|
|
288 |
} else {
|
|
289 |
return (Matrix *)0;
|
|
290 |
}
|
12
|
291 |
x++;
|
|
292 |
}
|
|
293 |
}
|
|
294 |
return mp;
|
|
295 |
}
|
|
296 |
return (Matrix *)0;
|
|
297 |
}
|
|
298 |
|
24
|
299 |
/*
|
|
300 |
* helper for rotation
|
|
301 |
*/
|
|
302 |
static OBJ
|
|
303 |
doRotate(angle, axis)
|
|
304 |
OBJ angle;
|
|
305 |
char axis;
|
|
306 |
{
|
|
307 |
Angle a_angle;
|
|
308 |
float f_angle;
|
|
309 |
|
|
310 |
if (_isFloat(angle)) {
|
|
311 |
f_angle = (float)(_floatVal(angle));
|
|
312 |
rot(f_angle, axis);
|
|
313 |
return (true);
|
|
314 |
}
|
|
315 |
if (_isFraction(angle)
|
|
316 |
&& _isSmallInteger(_FractionInstPtr(angle)->f_numerator)
|
|
317 |
&& _isSmallInteger(_FractionInstPtr(angle)->f_denominator)) {
|
|
318 |
float n, d;
|
|
319 |
|
|
320 |
n = (float)(_intVal(_FractionInstPtr(angle)->f_numerator));
|
|
321 |
d = (float)(_intVal(_FractionInstPtr(angle)->f_denominator));
|
|
322 |
f_angle = n / d;
|
|
323 |
rot(f_angle, axis);
|
|
324 |
return (true);
|
|
325 |
}
|
|
326 |
if (_isSmallInteger(angle)) {
|
|
327 |
a_angle = (Angle)(_intVal(angle));
|
|
328 |
rotate(a_angle, axis);
|
|
329 |
return (true);
|
|
330 |
}
|
|
331 |
return false;
|
|
332 |
}
|
|
333 |
|
0
|
334 |
%}
|
|
335 |
|
24
|
336 |
!GLXWorkstation methodsFor:'queries'!
|
|
337 |
|
|
338 |
supportsRGB
|
|
339 |
"return true, if this gl workstation supports rgb
|
|
340 |
(in addition to indexed) colors."
|
|
341 |
|
|
342 |
%{ /* NOCONTEXT */
|
|
343 |
|
|
344 |
#ifdef VGL
|
|
345 |
RETURN ( false );
|
|
346 |
#endif
|
|
347 |
#ifdef GLX
|
|
348 |
RETURN ( true );
|
|
349 |
#endif
|
|
350 |
%}
|
|
351 |
! !
|
|
352 |
|
0
|
353 |
!GLXWorkstation methodsFor:'window creation'!
|
|
354 |
|
12
|
355 |
createGLXWindowFor:aView left:xpos top:ypos width:wwidth height:wheight type:glxType
|
0
|
356 |
|ext minWidth minHeight maxWidth maxHeight
|
|
357 |
bWidth bColor viewBg viewBgId wsuperView wsuperViewId wcreateOnTop
|
|
358 |
winputOnly wlabel wcursor wcursorId wicon wiconId windowId
|
|
359 |
weventMask wiconView wiconViewId bitGravity viewGravity vBgColor
|
|
360 |
vBgForm deepForm|
|
|
361 |
|
12
|
362 |
"{ Symbol: colorIndexSingleBuffer }"
|
|
363 |
"{ Symbol: colorIndexDoubleBuffer }"
|
|
364 |
"{ Symbol: rgbSingleBuffer }"
|
|
365 |
"{ Symbol: rgbDoubleBuffer }"
|
|
366 |
|
0
|
367 |
wsuperView := aView superView.
|
|
368 |
wsuperView notNil ifTrue:[
|
|
369 |
wsuperViewId := wsuperView id
|
|
370 |
].
|
|
371 |
|
|
372 |
%{
|
|
373 |
Display *dpy = myDpy;
|
|
374 |
int screen = _intVal(_INST(screen));
|
|
375 |
Window newWindow, parentWindow;
|
|
376 |
extern Window GLXCreateWindow();
|
12
|
377 |
int t;
|
0
|
378 |
|
|
379 |
if (_isSmallInteger(xpos) && _isSmallInteger(ypos)
|
|
380 |
&& _isSmallInteger(wwidth) && _isSmallInteger(wheight)) {
|
|
381 |
if (_isSmallInteger(wsuperViewId)) {
|
|
382 |
parentWindow = MKWIN(wsuperViewId);
|
|
383 |
} else {
|
|
384 |
parentWindow = RootWindow(dpy, screen);
|
|
385 |
}
|
|
386 |
|
12
|
387 |
if (glxType == _colorIndexSingleBuffer)
|
|
388 |
t = GLXcolorIndexSingleBuffer;
|
|
389 |
else if (glxType == _colorIndexDoubleBuffer)
|
|
390 |
t = GLXcolorIndexDoubleBuffer;
|
|
391 |
else if (glxType == _rgbSingleBuffer)
|
|
392 |
t = GLXrgbSingleBuffer;
|
|
393 |
else if (glxType == _rgbDoubleBuffer)
|
|
394 |
t = GLXrgbDoubleBuffer;
|
|
395 |
else {
|
|
396 |
RETURN ( nil );
|
|
397 |
}
|
|
398 |
|
0
|
399 |
newWindow = GLXCreateWindow(dpy, parentWindow,
|
12
|
400 |
_intVal(xpos), _intVal(ypos),
|
|
401 |
_intVal(wwidth), _intVal(wheight),
|
|
402 |
0, t);
|
0
|
403 |
|
|
404 |
if (! newWindow) {
|
|
405 |
RETURN ( nil );
|
|
406 |
}
|
|
407 |
|
|
408 |
windowId = MKOBJ(newWindow);
|
|
409 |
}
|
|
410 |
%}
|
|
411 |
.
|
|
412 |
windowId notNil ifTrue:[
|
|
413 |
self addKnownView:aView withId:windowId.
|
|
414 |
].
|
|
415 |
^ windowId
|
20
|
416 |
!
|
|
417 |
|
|
418 |
unlinkGLXView:aGLXWindowId
|
|
419 |
"remove X/GLX link"
|
|
420 |
%{
|
|
421 |
if (_isSmallInteger(aGLXWindowId))
|
|
422 |
GLXUnlinkWindow(myDpy, MKWIN(aGLXWindowId));
|
|
423 |
%}
|
0
|
424 |
! !
|
|
425 |
|
|
426 |
!GLXWorkstation methodsFor:'glx access'!
|
|
427 |
|
24
|
428 |
glxPerspectiveFovy:fovy aspect:aspect near:near far:far in:aGLXWindowId
|
0
|
429 |
"define perspective projection"
|
|
430 |
|
|
431 |
%{ /* NOCONTEXT */
|
|
432 |
|
|
433 |
Angle a_fovy;
|
|
434 |
Coord c_near, c_far;
|
|
435 |
float f_aspect;
|
|
436 |
|
|
437 |
do {
|
|
438 |
_ANGLE_ (fovy, a_fovy);
|
|
439 |
_FLOAT_ (aspect, f_aspect);
|
|
440 |
_COORD_ (near, c_near);
|
|
441 |
_COORD_ (far, c_far);
|
12
|
442 |
SETWIN(aGLXWindowId)
|
0
|
443 |
perspective(a_fovy, f_aspect, c_near, c_far);
|
24
|
444 |
RETURN (true);
|
|
445 |
} while(0);
|
|
446 |
%}
|
|
447 |
.
|
|
448 |
^ false
|
|
449 |
!
|
|
450 |
|
|
451 |
glxWindowLeft:left right:right top:top bottom:bottom near:near far:far in:aGLXWindowId
|
|
452 |
"define perspective viewing pyramid"
|
|
453 |
|
|
454 |
%{ /* NOCONTEXT */
|
|
455 |
Coord c_left, c_right, c_top, c_bot, c_near, c_far;
|
|
456 |
|
|
457 |
do {
|
|
458 |
_COORD_ (left, c_left);
|
|
459 |
_COORD_ (right, c_right);
|
|
460 |
_COORD_ (top, c_top);
|
|
461 |
_COORD_ (bottom, c_bot);
|
|
462 |
_COORD_ (near, c_near);
|
|
463 |
_COORD_ (far, c_far);
|
|
464 |
SETWIN(aGLXWindowId)
|
|
465 |
window(c_left, c_right, c_bot, c_top, c_near, c_far);
|
0
|
466 |
|
|
467 |
RETURN (true);
|
|
468 |
} while(0);
|
|
469 |
%}
|
|
470 |
.
|
|
471 |
^ false
|
|
472 |
!
|
|
473 |
|
12
|
474 |
glxTranslateX:x y:y z:z in:aGLXWindowId
|
0
|
475 |
"translate current matrix"
|
|
476 |
|
|
477 |
%{ /* NOCONTEXT */
|
|
478 |
|
|
479 |
Coord c_x, c_y, c_z;
|
|
480 |
|
|
481 |
do {
|
|
482 |
_COORD_ (x, c_x);
|
|
483 |
_COORD_ (y, c_y);
|
|
484 |
_COORD_ (z, c_z);
|
12
|
485 |
SETWIN(aGLXWindowId)
|
0
|
486 |
translate(c_x, c_y, c_z);
|
|
487 |
RETURN (true);
|
|
488 |
} while(0);
|
|
489 |
%}
|
|
490 |
.
|
|
491 |
^ false
|
|
492 |
!
|
|
493 |
|
12
|
494 |
glxScaleX:x y:y z:z in:aGLXWindowId
|
0
|
495 |
"scale & mirror current matrix"
|
|
496 |
|
|
497 |
%{ /* NOCONTEXT */
|
|
498 |
|
|
499 |
float f_x, f_y, f_z;
|
|
500 |
|
|
501 |
do {
|
|
502 |
_FLOAT_ (x, f_x);
|
|
503 |
_FLOAT_ (y, f_y);
|
|
504 |
_FLOAT_ (z, f_z);
|
12
|
505 |
SETWIN(aGLXWindowId)
|
0
|
506 |
scale(f_x, f_y, f_z);
|
|
507 |
RETURN (true);
|
|
508 |
} while(0);
|
24
|
509 |
%}
|
|
510 |
.
|
|
511 |
^ false
|
|
512 |
!
|
|
513 |
|
|
514 |
glxRotateX:angle in:aGLXWindowId
|
|
515 |
"rotate the current matrix on x axis"
|
|
516 |
|
|
517 |
%{ /* NOCONTEXT */
|
|
518 |
|
|
519 |
SETWIN(aGLXWindowId)
|
|
520 |
RETURN (doRotate(angle, 'x'));
|
|
521 |
%}
|
|
522 |
.
|
|
523 |
^ false
|
|
524 |
!
|
|
525 |
|
|
526 |
glxRotateY:angle in:aGLXWindowId
|
|
527 |
"rotate the current matrix on y axis"
|
|
528 |
|
|
529 |
%{ /* NOCONTEXT */
|
|
530 |
|
|
531 |
SETWIN(aGLXWindowId)
|
|
532 |
RETURN (doRotate(angle, 'y'));
|
|
533 |
%}
|
|
534 |
.
|
|
535 |
^ false
|
|
536 |
!
|
|
537 |
|
|
538 |
glxRotateZ:angle in:aGLXWindowId
|
|
539 |
"rotate the current matrix on z axis"
|
|
540 |
|
|
541 |
%{ /* NOCONTEXT */
|
|
542 |
|
|
543 |
SETWIN(aGLXWindowId)
|
|
544 |
RETURN (doRotate(angle, 'z'));
|
0
|
545 |
%}
|
|
546 |
.
|
|
547 |
^ false
|
|
548 |
!
|
|
549 |
|
12
|
550 |
glxRotate:angle axis:axis in:aGLXWindowId
|
0
|
551 |
"rotate the current matrix"
|
|
552 |
|
|
553 |
"{ Symbol: x }"
|
|
554 |
"{ Symbol: y }"
|
|
555 |
"{ Symbol: z }"
|
|
556 |
|
|
557 |
%{ /* NOCONTEXT */
|
|
558 |
|
|
559 |
char c_axis;
|
|
560 |
|
|
561 |
do {
|
|
562 |
if (axis == _x)
|
|
563 |
c_axis = 'x';
|
|
564 |
else if (axis == _y)
|
|
565 |
c_axis = 'y';
|
|
566 |
else if (axis == _z)
|
|
567 |
c_axis = 'z';
|
|
568 |
else break;
|
|
569 |
|
12
|
570 |
SETWIN(aGLXWindowId)
|
24
|
571 |
RETURN ( doRotate(angle, c_axis) );
|
0
|
572 |
} while(0);
|
|
573 |
%}
|
|
574 |
.
|
|
575 |
^ false
|
|
576 |
!
|
|
577 |
|
24
|
578 |
glxRotateX:xAngle y:yAngle z:zAngle in:aGLXWindowId
|
|
579 |
"rotate the current matrix on all axis"
|
|
580 |
|
|
581 |
%{ /* NOCONTEXT */
|
|
582 |
|
|
583 |
SETWIN(aGLXWindowId)
|
|
584 |
if ( doRotate(xAngle, 'x') == true) {
|
|
585 |
if ( doRotate(yAngle, 'y') == true) {
|
|
586 |
RETURN (doRotate(zAngle, 'z'));
|
|
587 |
}
|
|
588 |
}
|
|
589 |
%}
|
|
590 |
.
|
|
591 |
^ false
|
|
592 |
!
|
|
593 |
|
|
594 |
glxLookatVx:vx vy:vy vz:vz px:px py:py pz:pz twist:twist in:aGLXWindowId
|
0
|
595 |
"define viewing transformation"
|
|
596 |
|
|
597 |
%{ /* NOCONTEXT */
|
|
598 |
|
|
599 |
Coord f_vx, f_vy, f_vz, f_px, f_py, f_pz;
|
|
600 |
Angle a_twist;
|
|
601 |
|
|
602 |
do {
|
|
603 |
_COORD_ (vx, f_vx);
|
|
604 |
_COORD_ (vy, f_vy);
|
|
605 |
_COORD_ (vz, f_vz);
|
|
606 |
_COORD_ (px, f_px);
|
|
607 |
_COORD_ (py, f_py);
|
|
608 |
_COORD_ (pz, f_pz);
|
|
609 |
_ANGLE_ (twist, a_twist);
|
12
|
610 |
SETWIN(aGLXWindowId)
|
0
|
611 |
lookat(f_vx, f_vy, f_vz, f_px, f_py, f_pz, a_twist);
|
|
612 |
RETURN (true);
|
|
613 |
} while(0);
|
|
614 |
%}
|
|
615 |
.
|
|
616 |
^ false
|
|
617 |
!
|
|
618 |
|
12
|
619 |
glxLmdef:what index:index np:np props:props in:aGLXWindowId
|
0
|
620 |
"define a material, light source or lighting model;
|
|
621 |
props must be a FloatArray"
|
|
622 |
|
|
623 |
"{ Symbol: material }"
|
|
624 |
"{ Symbol: light }"
|
|
625 |
"{ Symbol: lightModel }"
|
|
626 |
|
|
627 |
%{ /* NOCONTEXT */
|
|
628 |
#ifdef GLX
|
|
629 |
short defType;
|
|
630 |
short i_index, i_np;
|
|
631 |
extern OBJ FloatArray;
|
|
632 |
float *fp;
|
|
633 |
|
|
634 |
do {
|
|
635 |
if (what == _material)
|
|
636 |
defType = DEFMATERIAL;
|
|
637 |
else if (what == _light)
|
|
638 |
defType = DEFLIGHT;
|
|
639 |
else if (what == _lightModel)
|
|
640 |
defType = DEFLMODEL;
|
|
641 |
else break;
|
|
642 |
|
|
643 |
_INT_ (index, i_index);
|
|
644 |
_INT_ (np, i_np);
|
|
645 |
|
|
646 |
if (props == nil) fp = NULL;
|
|
647 |
else if (_Class(props) == FloatArray)
|
|
648 |
fp = _FloatArrayInstPtr(props)->f_element;
|
|
649 |
else break;
|
|
650 |
|
12
|
651 |
SETWIN(aGLXWindowId)
|
0
|
652 |
lmdef(defType, i_index, i_np, fp);
|
|
653 |
RETURN (true);
|
|
654 |
} while(0);
|
|
655 |
#endif
|
|
656 |
%}
|
|
657 |
.
|
|
658 |
^ false
|
|
659 |
!
|
|
660 |
|
12
|
661 |
glxLmbind:target index:index in:aGLXWindowId
|
0
|
662 |
"select a material, lighyt or lighting model"
|
|
663 |
|
|
664 |
"{ Symbol: material }"
|
|
665 |
"{ Symbol: backMaterial }"
|
|
666 |
"{ Symbol: light0 }"
|
|
667 |
"{ Symbol: light1 }"
|
|
668 |
"{ Symbol: light2 }"
|
|
669 |
"{ Symbol: light3 }"
|
|
670 |
"{ Symbol: light4 }"
|
|
671 |
"{ Symbol: light5 }"
|
|
672 |
"{ Symbol: light6 }"
|
|
673 |
"{ Symbol: light7 }"
|
|
674 |
"{ Symbol: lightModel }"
|
|
675 |
|
|
676 |
%{ /* NOCONTEXT */
|
|
677 |
#ifdef GLX
|
|
678 |
short defType;
|
|
679 |
short i_index;
|
|
680 |
|
|
681 |
do {
|
|
682 |
if (target == _material)
|
|
683 |
defType = MATERIAL;
|
|
684 |
else if (target == _backMaterial)
|
|
685 |
defType = BACKMATERIAL;
|
|
686 |
else if (target == _light0)
|
|
687 |
defType = LIGHT0;
|
|
688 |
else if (target == _light1)
|
|
689 |
defType = LIGHT1;
|
|
690 |
else if (target == _light2)
|
|
691 |
defType = LIGHT2;
|
|
692 |
else if (target == _light3)
|
|
693 |
defType = LIGHT3;
|
|
694 |
else if (target == _light4)
|
|
695 |
defType = LIGHT4;
|
|
696 |
else if (target == _light5)
|
|
697 |
defType = LIGHT5;
|
|
698 |
else if (target == _light6)
|
|
699 |
defType = LIGHT6;
|
|
700 |
else if (target == _light7)
|
|
701 |
defType = LIGHT7;
|
|
702 |
else if (target == _lightModel)
|
|
703 |
defType = LMODEL;
|
|
704 |
else break;
|
|
705 |
|
|
706 |
_INT_ (index, i_index);
|
12
|
707 |
SETWIN(aGLXWindowId)
|
0
|
708 |
lmbind(defType, i_index);
|
|
709 |
RETURN (true);
|
|
710 |
} while(0);
|
|
711 |
#endif
|
|
712 |
%}
|
|
713 |
.
|
|
714 |
^ false
|
|
715 |
!
|
|
716 |
|
12
|
717 |
glxColor:index in:aGLXWindowId
|
0
|
718 |
"set color, for non gouraud shading, we dont care if the
|
|
719 |
argument is integer or float; otherwise, better results are
|
|
720 |
expected with float values."
|
|
721 |
|
|
722 |
%{ /* NOCONTEXT */
|
|
723 |
|
12
|
724 |
SETWIN(aGLXWindowId)
|
0
|
725 |
if (_isSmallInteger(index)) {
|
|
726 |
color((Colorindex)(_intVal(index)));
|
|
727 |
RETURN (true);
|
|
728 |
}
|
|
729 |
if (_isFloat(index)) {
|
|
730 |
colorf((float)(_floatVal(index)));
|
|
731 |
RETURN (true);
|
|
732 |
}
|
|
733 |
%}
|
|
734 |
.
|
|
735 |
^ false
|
|
736 |
!
|
|
737 |
|
12
|
738 |
glxColorRed:r green:g blue:b in:aGLXWindowId
|
|
739 |
"set color, args must be integer values"
|
|
740 |
|
|
741 |
%{ /* NOCONTEXT */
|
|
742 |
#ifdef GLX
|
|
743 |
short s_r, s_g, s_b;
|
|
744 |
|
|
745 |
do {
|
|
746 |
_INT_(r, s_r);
|
|
747 |
_INT_(g, s_g);
|
|
748 |
_INT_(b, s_b);
|
|
749 |
SETWIN(aGLXWindowId)
|
|
750 |
RGBcolor(s_r, s_g, s_b);
|
|
751 |
RETURN (true);
|
|
752 |
} while(0);
|
|
753 |
#endif
|
|
754 |
%}
|
|
755 |
.
|
|
756 |
^ false
|
|
757 |
!
|
|
758 |
|
|
759 |
glxClearIn:aGLXWindowId
|
0
|
760 |
"clear to current color"
|
|
761 |
|
|
762 |
%{ /* NOCONTEXT */
|
12
|
763 |
SETWIN(aGLXWindowId)
|
0
|
764 |
clear();
|
|
765 |
RETURN (true);
|
|
766 |
%}
|
|
767 |
.
|
|
768 |
^ false
|
|
769 |
!
|
|
770 |
|
12
|
771 |
glxZClearIn:aGLXWindowId
|
0
|
772 |
"clear z buffer"
|
|
773 |
|
|
774 |
%{ /* NOCONTEXT */
|
|
775 |
#ifdef GLX
|
12
|
776 |
SETWIN(aGLXWindowId)
|
0
|
777 |
zclear();
|
|
778 |
RETURN (true);
|
|
779 |
#endif
|
|
780 |
%}
|
|
781 |
.
|
|
782 |
^ false
|
|
783 |
!
|
|
784 |
|
12
|
785 |
glxPushmatrixIn:aGLXWindowId
|
0
|
786 |
"push down transformation stack"
|
|
787 |
|
|
788 |
%{ /* NOCONTEXT */
|
12
|
789 |
SETWIN(aGLXWindowId)
|
0
|
790 |
pushmatrix();
|
|
791 |
RETURN (true);
|
|
792 |
%}
|
|
793 |
.
|
|
794 |
^ false
|
|
795 |
!
|
|
796 |
|
12
|
797 |
glxPopmatrixIn:aGLXWindowId
|
0
|
798 |
"pop transformation stack"
|
|
799 |
|
|
800 |
%{ /* NOCONTEXT */
|
12
|
801 |
SETWIN(aGLXWindowId)
|
0
|
802 |
popmatrix();
|
|
803 |
RETURN (true);
|
|
804 |
%}
|
|
805 |
.
|
|
806 |
^ false
|
|
807 |
!
|
|
808 |
|
12
|
809 |
glxSwapBuffersIn:aGLXWindowId
|
0
|
810 |
"swap double buffers"
|
|
811 |
|
|
812 |
%{ /* NOCONTEXT */
|
12
|
813 |
SETWIN(aGLXWindowId)
|
0
|
814 |
swapbuffers();
|
|
815 |
RETURN (true);
|
24
|
816 |
%}
|
|
817 |
.
|
|
818 |
^ false
|
|
819 |
!
|
|
820 |
|
|
821 |
glxFrontBufferIn:aGLXWindowId
|
|
822 |
"switch to front buffer"
|
|
823 |
|
|
824 |
%{ /* NOCONTEXT */
|
|
825 |
SETWIN(aGLXWindowId)
|
|
826 |
#ifdef GLX
|
|
827 |
backbuffer(FALSE);
|
0
|
828 |
#endif
|
24
|
829 |
frontbuffer(TRUE);
|
|
830 |
RETURN (true);
|
|
831 |
%}
|
|
832 |
.
|
|
833 |
^ false
|
|
834 |
!
|
|
835 |
|
|
836 |
glxBackBufferIn:aGLXWindowId
|
|
837 |
"switch to back buffer"
|
|
838 |
|
|
839 |
%{ /* NOCONTEXT */
|
|
840 |
SETWIN(aGLXWindowId)
|
|
841 |
#ifdef GLX
|
|
842 |
frontbuffer(FALSE);
|
|
843 |
#endif
|
|
844 |
backbuffer(TRUE);
|
|
845 |
RETURN (true);
|
0
|
846 |
%}
|
|
847 |
.
|
|
848 |
^ false
|
|
849 |
!
|
|
850 |
|
12
|
851 |
glxRGBmodeIn:aGLXWindowId
|
0
|
852 |
"set true color mode (no colormap)"
|
|
853 |
|
|
854 |
%{ /* NOCONTEXT */
|
|
855 |
#ifdef GLX
|
12
|
856 |
SETWIN(aGLXWindowId)
|
0
|
857 |
RGBmode();
|
|
858 |
RETURN (true);
|
|
859 |
#endif
|
|
860 |
%}
|
|
861 |
.
|
|
862 |
^ false
|
|
863 |
!
|
|
864 |
|
12
|
865 |
glxDoubleBufferIn:aGLXWindowId
|
0
|
866 |
"set double buffer mode"
|
|
867 |
|
|
868 |
%{ /* NOCONTEXT */
|
12
|
869 |
SETWIN(aGLXWindowId)
|
0
|
870 |
doublebuffer();
|
|
871 |
RETURN (true);
|
|
872 |
%}
|
|
873 |
.
|
|
874 |
^ false
|
|
875 |
!
|
|
876 |
|
12
|
877 |
glxGconfigIn:aGLXWindowId
|
0
|
878 |
"must be sent after RGBmode, doubleBuffer etc. to have these
|
|
879 |
changes really take effect. See GLX manual"
|
|
880 |
|
|
881 |
%{ /* NOCONTEXT */
|
12
|
882 |
SETWIN(aGLXWindowId)
|
0
|
883 |
gconfig();
|
|
884 |
RETURN (true);
|
|
885 |
%}
|
|
886 |
.
|
|
887 |
^ false
|
|
888 |
!
|
|
889 |
|
12
|
890 |
glxZbuffer:aBoolean in:aGLXWindowId
|
0
|
891 |
"enable/disable z-buffer operation"
|
|
892 |
|
|
893 |
%{ /* NOCONTEXT */
|
|
894 |
#ifdef GLX
|
12
|
895 |
SETWIN(aGLXWindowId)
|
0
|
896 |
zbuffer(aBoolean == false ? FALSE : TRUE);
|
|
897 |
RETURN (true);
|
|
898 |
#endif
|
|
899 |
%}
|
|
900 |
.
|
|
901 |
^ false
|
|
902 |
!
|
|
903 |
|
24
|
904 |
glxBackFace:aBoolean in:aGLXWindowId
|
12
|
905 |
"enable/disable backface"
|
|
906 |
|
|
907 |
%{ /* NOCONTEXT */
|
24
|
908 |
SETWIN(aGLXWindowId)
|
12
|
909 |
backface(aBoolean == false ? FALSE : TRUE);
|
|
910 |
RETURN (true);
|
|
911 |
%}
|
|
912 |
.
|
|
913 |
^ false
|
|
914 |
!
|
|
915 |
|
|
916 |
glxNmode:aSymbol in:aGLXWindowId
|
|
917 |
"set normalize mode: #auto, #normalize"
|
|
918 |
|
|
919 |
"{ Symbol: auto }"
|
|
920 |
"{ Symbol: normalize }"
|
|
921 |
|
|
922 |
%{ /* NOCONTEXT */
|
|
923 |
#ifdef GLX
|
|
924 |
if (aSymbol == _auto) {
|
|
925 |
nmode(NAUTO);
|
|
926 |
RETURN (true);
|
|
927 |
}
|
|
928 |
if (aSymbol == _normalize) {
|
|
929 |
nmode(NNORMALIZE);
|
|
930 |
RETURN (true);
|
|
931 |
}
|
|
932 |
#endif
|
|
933 |
%}
|
|
934 |
.
|
|
935 |
^ false
|
|
936 |
!
|
|
937 |
|
|
938 |
glxMmode:aSymbol in:aGLXWindowId
|
0
|
939 |
"set matrix mode: #single, #viewing, #projection or #texture"
|
|
940 |
|
|
941 |
"{ Symbol: single }"
|
|
942 |
"{ Symbol: viewing }"
|
|
943 |
"{ Symbol: projection }"
|
|
944 |
"{ Symbol: texture }"
|
|
945 |
|
|
946 |
%{ /* NOCONTEXT */
|
|
947 |
#ifdef GLX
|
|
948 |
if (aSymbol == _single) {
|
|
949 |
mmode(MSINGLE);
|
|
950 |
RETURN (true);
|
|
951 |
}
|
|
952 |
if (aSymbol == _viewing) {
|
|
953 |
mmode(MVIEWING);
|
|
954 |
RETURN (true);
|
|
955 |
}
|
|
956 |
if (aSymbol == _projection) {
|
|
957 |
mmode(MPROJECTION);
|
|
958 |
RETURN (true);
|
|
959 |
}
|
|
960 |
if (aSymbol == _texture) {
|
|
961 |
mmode(MTEXTURE);
|
|
962 |
RETURN (true);
|
|
963 |
}
|
|
964 |
#endif
|
|
965 |
%}
|
|
966 |
.
|
|
967 |
^ false
|
|
968 |
!
|
|
969 |
|
12
|
970 |
glxBeginPolygonIn:aGLXWindowId
|
|
971 |
"start a polygon"
|
0
|
972 |
|
|
973 |
%{ /* NOCONTEXT */
|
12
|
974 |
SETWIN(aGLXWindowId)
|
0
|
975 |
bgnpolygon();
|
|
976 |
RETURN (true);
|
|
977 |
%}
|
|
978 |
.
|
|
979 |
^ false
|
|
980 |
!
|
|
981 |
|
12
|
982 |
glxEndPolygonIn:aGLXWindowId
|
|
983 |
"end a polygon"
|
0
|
984 |
|
|
985 |
%{ /* NOCONTEXT */
|
12
|
986 |
SETWIN(aGLXWindowId)
|
0
|
987 |
endpolygon();
|
|
988 |
RETURN (true);
|
|
989 |
%}
|
|
990 |
.
|
|
991 |
^ false
|
|
992 |
!
|
|
993 |
|
12
|
994 |
glxBeginPointIn:aGLXWindowId
|
|
995 |
"start a point-group"
|
|
996 |
|
|
997 |
%{ /* NOCONTEXT */
|
|
998 |
SETWIN(aGLXWindowId)
|
|
999 |
bgnpoint();
|
|
1000 |
RETURN (true);
|
|
1001 |
%}
|
|
1002 |
.
|
|
1003 |
^ false
|
|
1004 |
!
|
|
1005 |
|
|
1006 |
glxEndPointIn:aGLXWindowId
|
|
1007 |
"end a point group"
|
|
1008 |
|
|
1009 |
%{ /* NOCONTEXT */
|
|
1010 |
SETWIN(aGLXWindowId)
|
|
1011 |
endpoint();
|
|
1012 |
RETURN (true);
|
|
1013 |
%}
|
|
1014 |
.
|
|
1015 |
^ false
|
|
1016 |
!
|
|
1017 |
|
24
|
1018 |
glxBeginClosedLineIn:aGLXWindowId
|
12
|
1019 |
"start a closed line"
|
|
1020 |
|
|
1021 |
%{ /* NOCONTEXT */
|
|
1022 |
SETWIN(aGLXWindowId)
|
|
1023 |
bgnclosedline();
|
|
1024 |
RETURN (true);
|
|
1025 |
%}
|
|
1026 |
.
|
|
1027 |
^ false
|
|
1028 |
!
|
|
1029 |
|
|
1030 |
glxEndClosedLineIn:aGLXWindowId
|
|
1031 |
"end a closed line"
|
|
1032 |
|
|
1033 |
%{ /* NOCONTEXT */
|
|
1034 |
SETWIN(aGLXWindowId)
|
|
1035 |
endclosedline();
|
|
1036 |
RETURN (true);
|
|
1037 |
%}
|
|
1038 |
.
|
|
1039 |
^ false
|
|
1040 |
!
|
|
1041 |
|
|
1042 |
glxBeginLineIn:aGLXWindowId
|
|
1043 |
"start a line group"
|
|
1044 |
|
|
1045 |
%{ /* NOCONTEXT */
|
|
1046 |
SETWIN(aGLXWindowId)
|
|
1047 |
bgnline();
|
|
1048 |
RETURN (true);
|
|
1049 |
%}
|
|
1050 |
.
|
|
1051 |
^ false
|
|
1052 |
!
|
|
1053 |
|
|
1054 |
glxEndLineIn:aGLXWindowId
|
|
1055 |
"end a line group"
|
|
1056 |
|
|
1057 |
%{ /* NOCONTEXT */
|
|
1058 |
SETWIN(aGLXWindowId)
|
|
1059 |
endline();
|
|
1060 |
RETURN (true);
|
|
1061 |
%}
|
|
1062 |
.
|
|
1063 |
^ false
|
|
1064 |
!
|
|
1065 |
|
|
1066 |
glxBeginTriangleMeshIn:aGLXWindowId
|
|
1067 |
"start a triangle mesh"
|
0
|
1068 |
|
|
1069 |
%{ /* NOCONTEXT */
|
12
|
1070 |
SETWIN(aGLXWindowId)
|
|
1071 |
bgntmesh();
|
|
1072 |
RETURN (true);
|
|
1073 |
%}
|
|
1074 |
.
|
|
1075 |
^ false
|
|
1076 |
!
|
0
|
1077 |
|
12
|
1078 |
glxEndTriangleMeshIn:aGLXWindowId
|
|
1079 |
"end a triangle mesh"
|
0
|
1080 |
|
12
|
1081 |
%{ /* NOCONTEXT */
|
|
1082 |
SETWIN(aGLXWindowId)
|
|
1083 |
endtmesh();
|
|
1084 |
RETURN (true);
|
|
1085 |
%}
|
|
1086 |
.
|
|
1087 |
^ false
|
|
1088 |
!
|
0
|
1089 |
|
12
|
1090 |
glxBeginSurfaceIn:aGLXWindowId
|
|
1091 |
"start a NURBS surface def"
|
|
1092 |
|
|
1093 |
%{ /* NOCONTEXT */
|
|
1094 |
#ifdef GLX
|
|
1095 |
SETWIN(aGLXWindowId)
|
|
1096 |
bgnsurface();
|
|
1097 |
RETURN (true);
|
|
1098 |
#endif
|
|
1099 |
%}
|
|
1100 |
.
|
|
1101 |
^ false
|
|
1102 |
!
|
|
1103 |
|
|
1104 |
glxEndSurfaceIn:aGLXWindowId
|
|
1105 |
"end a NURBS surface def"
|
|
1106 |
|
|
1107 |
%{ /* NOCONTEXT */
|
|
1108 |
#ifdef GLX
|
|
1109 |
SETWIN(aGLXWindowId)
|
|
1110 |
endsurface();
|
|
1111 |
RETURN (true);
|
|
1112 |
#endif
|
|
1113 |
%}
|
|
1114 |
.
|
|
1115 |
^ false
|
|
1116 |
!
|
0
|
1117 |
|
12
|
1118 |
glxBeginQuadrilateralStripIn:aGLXWindowId
|
|
1119 |
"start a quadrilateral strip"
|
|
1120 |
|
|
1121 |
%{ /* NOCONTEXT */
|
|
1122 |
SETWIN(aGLXWindowId)
|
|
1123 |
bgnqstrip();
|
|
1124 |
RETURN (true);
|
|
1125 |
%}
|
|
1126 |
.
|
|
1127 |
^ false
|
|
1128 |
!
|
|
1129 |
|
|
1130 |
glxEndQuadrilateralStripIn:aGLXWindowId
|
|
1131 |
"end a quadrilateral strip"
|
0
|
1132 |
|
12
|
1133 |
%{ /* NOCONTEXT */
|
|
1134 |
SETWIN(aGLXWindowId)
|
|
1135 |
endqstrip();
|
|
1136 |
RETURN (true);
|
|
1137 |
%}
|
|
1138 |
.
|
|
1139 |
^ false
|
|
1140 |
!
|
|
1141 |
|
|
1142 |
glxBeginCurveIn:aGLXWindowId
|
|
1143 |
"start a NURBS curve def"
|
|
1144 |
|
|
1145 |
%{ /* NOCONTEXT */
|
|
1146 |
#ifdef GLX
|
|
1147 |
SETWIN(aGLXWindowId)
|
|
1148 |
bgncurve();
|
|
1149 |
RETURN (true);
|
|
1150 |
#endif
|
|
1151 |
%}
|
|
1152 |
.
|
|
1153 |
^ false
|
|
1154 |
!
|
|
1155 |
|
|
1156 |
glxEndCurveIn:aGLXWindowId
|
|
1157 |
"end a NURBS curve def"
|
|
1158 |
|
|
1159 |
%{ /* NOCONTEXT */
|
|
1160 |
#ifdef GLX
|
|
1161 |
SETWIN(aGLXWindowId)
|
|
1162 |
endcurve();
|
|
1163 |
RETURN (true);
|
0
|
1164 |
#endif
|
|
1165 |
%}
|
|
1166 |
.
|
|
1167 |
^ false
|
|
1168 |
!
|
|
1169 |
|
24
|
1170 |
glxMoveX:x y:y z:z in:aGLXWindowId
|
|
1171 |
"arguments must specify a point"
|
|
1172 |
|
|
1173 |
%{ /* NOCONTEXT */
|
|
1174 |
if (_isFloat(x) && _isFloat(y) && _isFloat(z)) {
|
|
1175 |
SETWIN(aGLXWindowId)
|
|
1176 |
move( (float)_floatVal(x), (float)_floatVal(y), (float)_floatVal(z) );
|
|
1177 |
RETURN (true);
|
|
1178 |
}
|
|
1179 |
%}
|
|
1180 |
.
|
|
1181 |
^ false
|
|
1182 |
!
|
|
1183 |
|
|
1184 |
glxMove:arrayOf3Floats in:aGLXWindowId
|
|
1185 |
"argument must be an array of 3 floats containing the point"
|
|
1186 |
|
|
1187 |
%{ /* NOCONTEXT */
|
|
1188 |
float vec[3], *v;
|
|
1189 |
|
|
1190 |
if (! (v = getFloatsFromInto(arrayOf3Floats, vec, 3))) RETURN(false);
|
|
1191 |
SETWIN(aGLXWindowId)
|
|
1192 |
move( v[0], v[1], v[2] );
|
|
1193 |
RETURN (true);
|
|
1194 |
%}
|
|
1195 |
.
|
|
1196 |
^ false
|
|
1197 |
!
|
|
1198 |
|
|
1199 |
glxDrawX:x y:y z:z in:aGLXWindowId
|
|
1200 |
"arguments must specify a point"
|
|
1201 |
|
|
1202 |
%{ /* NOCONTEXT */
|
|
1203 |
|
|
1204 |
if (_isFloat(x) && _isFloat(y) && _isFloat(z)) {
|
|
1205 |
SETWIN(aGLXWindowId)
|
|
1206 |
draw( (float)_floatVal(x), (float)_floatVal(y), (float)_floatVal(z) );
|
|
1207 |
RETURN (true);
|
|
1208 |
}
|
|
1209 |
%}
|
|
1210 |
.
|
|
1211 |
^ false
|
|
1212 |
!
|
|
1213 |
|
|
1214 |
glxDraw:arrayOf3Floats in:aGLXWindowId
|
|
1215 |
"argument must be an array of 3 floats containing the point"
|
|
1216 |
|
|
1217 |
%{ /* NOCONTEXT */
|
|
1218 |
float vec[3], *v;
|
|
1219 |
|
|
1220 |
if (! (v = getFloatsFromInto(arrayOf3Floats, vec, 3))) RETURN(false);
|
|
1221 |
SETWIN(aGLXWindowId)
|
|
1222 |
draw( v[0], v[1], v[2]);
|
|
1223 |
RETURN (true);
|
|
1224 |
%}
|
|
1225 |
.
|
|
1226 |
^ false
|
|
1227 |
!
|
|
1228 |
|
|
1229 |
glxRectX1:x1 y1:y1 x2:x2 y2:y2 in:aGLXWindowId
|
|
1230 |
"arguments must specify 2 opposite corners of the rectangle"
|
|
1231 |
|
|
1232 |
%{ /* NOCONTEXT */
|
|
1233 |
float f_x1, f_x2, f_y1, f_y2;
|
|
1234 |
|
|
1235 |
if (_isFloat(x1) && _isFloat(x2) && _isFloat(y1) && _isFloat(y2)) {
|
|
1236 |
SETWIN(aGLXWindowId)
|
|
1237 |
rect( (float)_floatVal(x1), (float)_floatVal(y1), (float)_floatVal(x2), (float)_floatVal(y2) );
|
|
1238 |
RETURN (true);
|
|
1239 |
}
|
|
1240 |
%}
|
|
1241 |
.
|
|
1242 |
^ false
|
|
1243 |
!
|
|
1244 |
|
|
1245 |
glxRectFX1:x1 y1:y1 x2:x2 y2:y2 in:aGLXWindowId
|
|
1246 |
"arguments must specify 2 opposite corners of the filled rectangle"
|
|
1247 |
|
|
1248 |
%{ /* NOCONTEXT */
|
|
1249 |
float f_x1, f_x2, f_y1, f_y2;
|
|
1250 |
|
|
1251 |
if (_isFloat(x1) && _isFloat(x2) && _isFloat(y1) && _isFloat(y2)) {
|
|
1252 |
SETWIN(aGLXWindowId)
|
|
1253 |
rectf( (float)_floatVal(x1), (float)_floatVal(y1), (float)_floatVal(x2), (float)_floatVal(y2) );
|
|
1254 |
RETURN (true);
|
|
1255 |
}
|
|
1256 |
%}
|
|
1257 |
.
|
|
1258 |
^ false
|
|
1259 |
!
|
|
1260 |
|
12
|
1261 |
glxSphDraw:arrayOf4Floats in:aGLXWindowId
|
|
1262 |
"argument must be an array(a matrix) of 4 floats containing the
|
|
1263 |
sphere"
|
0
|
1264 |
|
|
1265 |
%{ /* NOCONTEXT */
|
|
1266 |
#ifdef GLX
|
12
|
1267 |
float vec[4], *v;
|
|
1268 |
|
|
1269 |
if (! (v = getFloatsFromInto(arrayOf4Floats, vec, 4))) RETURN(false);
|
|
1270 |
SETWIN(aGLXWindowId)
|
|
1271 |
sphdraw(v);
|
|
1272 |
RETURN (true);
|
|
1273 |
#endif
|
|
1274 |
%}
|
|
1275 |
.
|
|
1276 |
^ false
|
|
1277 |
!
|
0
|
1278 |
|
12
|
1279 |
glxDefBasis:id mat:aMatrix in:aGLXWindowId
|
|
1280 |
"define the basis"
|
24
|
1281 |
|
12
|
1282 |
%{ /* NOCONTEXT */
|
|
1283 |
Matrix matrix;
|
|
1284 |
Matrix *m;
|
|
1285 |
|
|
1286 |
if (! (m = getFloatsFromMatrixInto(aMatrix, &matrix))) RETURN (false);
|
|
1287 |
if (_isSmallInteger(id)) {
|
|
1288 |
SETWIN(aGLXWindowId)
|
|
1289 |
defbasis((short)(_intVal(id)), *m);
|
|
1290 |
RETURN (true);
|
|
1291 |
}
|
|
1292 |
%}
|
|
1293 |
.
|
|
1294 |
^ false
|
|
1295 |
!
|
0
|
1296 |
|
12
|
1297 |
glxPatchCurvesU:u v:v in:aGLXWindowId
|
|
1298 |
"set the number of curves in a patch"
|
24
|
1299 |
|
12
|
1300 |
%{ /* NOCONTEXT */
|
|
1301 |
if (_isSmallInteger(u) && _isSmallInteger(v)) {
|
|
1302 |
SETWIN(aGLXWindowId)
|
|
1303 |
patchcurves((long)_intVal(u), (long)_intVal(v));
|
|
1304 |
RETURN (true);
|
|
1305 |
}
|
|
1306 |
%}
|
|
1307 |
.
|
|
1308 |
^ false
|
|
1309 |
!
|
|
1310 |
|
|
1311 |
glxPatchPrecisionU:u v:v in:aGLXWindowId
|
|
1312 |
"set the patch precision"
|
24
|
1313 |
|
12
|
1314 |
%{ /* NOCONTEXT */
|
|
1315 |
if (_isSmallInteger(u) && _isSmallInteger(v)) {
|
|
1316 |
SETWIN(aGLXWindowId)
|
|
1317 |
patchprecision((long)_intVal(u), (long)_intVal(v));
|
|
1318 |
RETURN (true);
|
|
1319 |
}
|
|
1320 |
%}
|
|
1321 |
.
|
|
1322 |
^ false
|
|
1323 |
!
|
|
1324 |
|
|
1325 |
glxPatchBasisU:u v:v in:aGLXWindowId
|
|
1326 |
"set the current basis matrices"
|
24
|
1327 |
|
12
|
1328 |
%{ /* NOCONTEXT */
|
|
1329 |
if (_isSmallInteger(u) && _isSmallInteger(v)) {
|
|
1330 |
SETWIN(aGLXWindowId)
|
|
1331 |
patchbasis((long)_intVal(u), (long)_intVal(v));
|
|
1332 |
RETURN (true);
|
|
1333 |
}
|
|
1334 |
%}
|
|
1335 |
.
|
|
1336 |
^ false
|
|
1337 |
!
|
|
1338 |
|
|
1339 |
glxPatchX:arrayOf16XFloats y:arrayOf16YFloats z:arrayOf16ZFloats in:aGLXWindowId
|
|
1340 |
"arguments must be arrays of 16 floats containing the patch"
|
|
1341 |
|
|
1342 |
%{ /* NOCONTEXT */
|
|
1343 |
Matrix matrixX, matrixY, matrixZ;
|
|
1344 |
Matrix *mX, *mY, *mZ;
|
|
1345 |
|
|
1346 |
if (! (mX = getFloatsFromMatrixInto(arrayOf16XFloats, &matrixX))) RETURN (false);
|
|
1347 |
if (! (mY = getFloatsFromMatrixInto(arrayOf16YFloats, &matrixY))) RETURN (false);
|
|
1348 |
if (! (mZ = getFloatsFromMatrixInto(arrayOf16ZFloats, &matrixZ))) RETURN (false);
|
|
1349 |
SETWIN(aGLXWindowId)
|
|
1350 |
patch(*mX, *mY, *mZ);
|
|
1351 |
RETURN (true);
|
0
|
1352 |
%}
|
|
1353 |
.
|
|
1354 |
^ false
|
|
1355 |
!
|
|
1356 |
|
12
|
1357 |
glxGetMatrix:arrayOf16Floats in:aGLXWindowId
|
|
1358 |
"argument must be an array(a matrix) of 16 floats containing the
|
|
1359 |
matrix"
|
0
|
1360 |
|
|
1361 |
%{ /* NOCONTEXT */
|
12
|
1362 |
Matrix matrix;
|
0
|
1363 |
|
12
|
1364 |
SETWIN(aGLXWindowId)
|
|
1365 |
getmatrix(matrix);
|
|
1366 |
if (! putFloatsFromInto(matrix, arrayOf16Floats, 16)) RETURN(false);
|
|
1367 |
RETURN (true);
|
|
1368 |
%}
|
|
1369 |
.
|
|
1370 |
^ false
|
|
1371 |
!
|
0
|
1372 |
|
12
|
1373 |
glxLoadMatrix:arrayOf16Floats in:aGLXWindowId
|
|
1374 |
"argument must be an array(a matrix) of 16 floats containing the
|
|
1375 |
transformation matrix"
|
|
1376 |
|
|
1377 |
%{ /* NOCONTEXT */
|
|
1378 |
Matrix matrix;
|
|
1379 |
Matrix *m;
|
|
1380 |
|
|
1381 |
if (! (m = getFloatsFromMatrixInto(arrayOf16Floats, &matrix))) RETURN (false);
|
|
1382 |
SETWIN(aGLXWindowId)
|
|
1383 |
loadmatrix(*m);
|
|
1384 |
RETURN (true);
|
0
|
1385 |
%}
|
|
1386 |
.
|
|
1387 |
^ false
|
|
1388 |
!
|
|
1389 |
|
12
|
1390 |
glxMultMatrix:arrayOf16Floats in:aGLXWindowId
|
|
1391 |
"argument must be an array(a matrix) of 16 floats containing the
|
|
1392 |
matrix"
|
|
1393 |
|
|
1394 |
%{ /* NOCONTEXT */
|
|
1395 |
Matrix matrix;
|
|
1396 |
Matrix *m;
|
|
1397 |
|
|
1398 |
if (! (m = getFloatsFromMatrixInto(arrayOf16Floats, &matrix))) RETURN (false);
|
|
1399 |
SETWIN(aGLXWindowId)
|
|
1400 |
multmatrix(*m);
|
|
1401 |
RETURN (true);
|
24
|
1402 |
%}
|
|
1403 |
.
|
|
1404 |
^ false
|
|
1405 |
!
|
|
1406 |
|
|
1407 |
glxMakeObject:id in:aGLXWindowId
|
|
1408 |
"start object definition"
|
|
1409 |
|
|
1410 |
%{ /* NOCONTEXT */
|
|
1411 |
|
|
1412 |
if (_isSmallInteger(id)) {
|
|
1413 |
SETWIN(aGLXWindowId)
|
|
1414 |
makeobj(_intVal(id));
|
|
1415 |
RETURN (true);
|
|
1416 |
}
|
12
|
1417 |
%}
|
|
1418 |
.
|
|
1419 |
^ false
|
|
1420 |
!
|
|
1421 |
|
24
|
1422 |
glxCloseObjectIn:aGLXWindowId
|
|
1423 |
"end object defnition"
|
|
1424 |
|
|
1425 |
%{ /* NOCONTEXT */
|
|
1426 |
|
|
1427 |
SETWIN(aGLXWindowId)
|
|
1428 |
closeobj();
|
|
1429 |
RETURN (true);
|
|
1430 |
%}
|
|
1431 |
.
|
|
1432 |
^ false
|
|
1433 |
!
|
|
1434 |
|
|
1435 |
glxCallObject:id in:aGLXWindowId
|
|
1436 |
"do objects definition"
|
|
1437 |
|
|
1438 |
%{ /* NOCONTEXT */
|
|
1439 |
|
|
1440 |
if (_isSmallInteger(id)) {
|
|
1441 |
SETWIN(aGLXWindowId)
|
|
1442 |
callobj(_intVal(id));
|
|
1443 |
RETURN (true);
|
|
1444 |
}
|
|
1445 |
%}
|
|
1446 |
.
|
|
1447 |
^ false
|
|
1448 |
!
|
|
1449 |
|
12
|
1450 |
glxN3f:arrayOf3Floats in:aGLXWindowId
|
24
|
1451 |
"argument must be an indexable object with 3 floats,
|
|
1452 |
containing the current vertex normal"
|
12
|
1453 |
|
|
1454 |
%{ /* NOCONTEXT */
|
|
1455 |
#ifdef GLX
|
|
1456 |
float vec[3], *v;
|
|
1457 |
|
|
1458 |
if (! (v = getFloatsFromInto(arrayOf3Floats, vec, 3))) RETURN(false);
|
|
1459 |
SETWIN(aGLXWindowId)
|
|
1460 |
n3f(v);
|
|
1461 |
RETURN (true);
|
|
1462 |
#endif
|
|
1463 |
%}
|
|
1464 |
.
|
|
1465 |
^ false
|
|
1466 |
!
|
|
1467 |
|
|
1468 |
glxC3f:arrayOf3Floats in:aGLXWindowId
|
24
|
1469 |
"argument must be an indexable object with 3 floats,
|
|
1470 |
containing the color"
|
12
|
1471 |
|
|
1472 |
%{ /* NOCONTEXT */
|
|
1473 |
#ifdef GLX
|
|
1474 |
float vec[3], *v;
|
|
1475 |
|
|
1476 |
if (! (v = getFloatsFromInto(arrayOf3Floats, vec, 3))) RETURN(false);
|
|
1477 |
SETWIN(aGLXWindowId)
|
|
1478 |
c3f(v);
|
|
1479 |
RETURN (true);
|
|
1480 |
#endif
|
|
1481 |
%}
|
|
1482 |
.
|
|
1483 |
^ false
|
|
1484 |
!
|
|
1485 |
|
|
1486 |
glxV3f:arrayOf3Floats in:aGLXWindowId
|
24
|
1487 |
"argument must be an indexable object with 3 floats,
|
|
1488 |
containing the vertex"
|
0
|
1489 |
|
|
1490 |
%{ /* NOCONTEXT */
|
12
|
1491 |
float vec[3], *v;
|
0
|
1492 |
|
12
|
1493 |
if (! (v = getFloatsFromInto(arrayOf3Floats, vec, 3))) RETURN(false);
|
|
1494 |
SETWIN(aGLXWindowId)
|
|
1495 |
v3f(v);
|
|
1496 |
RETURN (true);
|
0
|
1497 |
%}
|
|
1498 |
.
|
|
1499 |
^ false
|
|
1500 |
! !
|