-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrawp3d_fi.c
More file actions
executable file
·976 lines (893 loc) · 22.4 KB
/
drawp3d_fi.c
File metadata and controls
executable file
·976 lines (893 loc) · 22.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
/****************************************************************************
* drawp3d_fi.c
* Author Joel Welling
* Copyright 1990, Pittsburgh Supercomputing Center, Carnegie Mellon University
*
* Permission use, copy, and modify this software and its documentation
* without fee for personal use or use within your organization is hereby
* granted, provided that the above copyright notice is preserved in all
* copies and that that copyright and this permission notice appear in
* supporting documentation. Permission to redistribute this software to
* other organizations or individuals is not granted; that must be
* negotiated with the PSC. Neither the PSC nor Carnegie Mellon
* University make any representations about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*****************************************************************************/
/*
This module provides the Fortran interface to drawp3d.
*/
/* This module recognizes what type of machine it's on by the presence
of the symbol VMS, unix, CRAY, or ardent. The following makes the machine
assignment less ambiguous.
*/
#ifdef unix
#define USE_UNIX
#endif
#ifdef CRAY
#undef USE_UNIX
#endif
#ifdef ardent
#undef USE_UNIX
#endif
#ifdef __hpux
#undef USE_UNIX
#endif
#ifdef OSF1
#define USE_UNIX
#endif
#ifdef _IBMR2
#include <string.h>
#endif
#ifdef VMS
#include descrip
#endif
#ifdef CRAY
#include <string.h>
#include <fortran.h>
#endif
#ifdef USE_UNIX
#include <string.h>
#endif
#ifdef ardent
#include <string.h>
#endif
#ifdef __hpux
#include <string.h>
#endif
/* Interface to the p3dgen core routines */
#include "ge_error.h"
#include "p3dgen.h"
#include "pgen_objects.h"
/* Include defs files that allow linkage to Fortran on various systems */
#ifdef USE_UNIX
#include "fnames_.h"
#endif
#ifdef CRAY
#include "FNAMES.h"
#endif
#ifdef ardent
#include "FNAMES.h"
#endif
#ifdef _IBMR2
/* include nothing */
#endif
#ifdef __hpux
/* include nothing */
#endif
/* Maximum supported string length */
#define MAXSTRING 128
/* Set up interface to Fortran character string descriptors */
#ifdef VMS
typedef struct dsc$descriptor_s *string_descriptor;
#endif
#ifdef CRAY
typedef _fcd string_descriptor;
#endif
#ifdef USE_UNIX
typedef char *string_descriptor;
#define STRINGLENGTH ,stringlength
#define DEFSTRINGLENGTH int stringlength;
#define STRINGLENGTH2 ,stringlength2
#define DEFSTRINGLENGTH2 int stringlength2;
#define STRINGLENGTH3 ,stringlength3
#define DEFSTRINGLENGTH3 int stringlength3;
#define STRINGLENGTH4 ,stringlength4
#define DEFSTRINGLENGTH4 int stringlength4;
#endif
#ifdef _IBMR2
typedef char *string_descriptor;
#define STRINGLENGTH ,stringlength
#define DEFSTRINGLENGTH int stringlength;
#define STRINGLENGTH2 ,stringlength2
#define DEFSTRINGLENGTH2 int stringlength2;
#define STRINGLENGTH3 ,stringlength3
#define DEFSTRINGLENGTH3 int stringlength3;
#define STRINGLENGTH4 ,stringlength4
#define DEFSTRINGLENGTH4 int stringlength4;
#endif
#ifdef ardent
typedef struct { char *addr; int length; } *string_descriptor;
#endif
#ifdef __hpux
typedef char *string_descriptor;
#define STRINGLENGTH ,stringlength
#define DEFSTRINGLENGTH int stringlength;
#define STRINGLENGTH2 ,stringlength2
#define DEFSTRINGLENGTH2 int stringlength2;
#define STRINGLENGTH3 ,stringlength3
#define DEFSTRINGLENGTH3 int stringlength3;
#define STRINGLENGTH4 ,stringlength4
#define DEFSTRINGLENGTH4 int stringlength4;
#endif
/* Default definitions */
#ifndef STRINGLENGTH
#define STRINGLENGTH /* nothing */
#define DEFSTRINGLENGTH /* nothing */
#define STRINGLENGTH2 /* nothing */
#define DEFSTRINGLENGTH2 /* nothing */
#define STRINGLENGTH3 /* nothing */
#define DEFSTRINGLENGTH3 /* nothing */
#define STRINGLENGTH4 /* nothing */
#define DEFSTRINGLENGTH4 /* nothing */
#endif
static char *getstring(strdesc STRINGLENGTH)
string_descriptor strdesc;
DEFSTRINGLENGTH
/* This routine finds a string in the supplied descriptor */
{
static char stringcopy[MAXSTRING]="\0";
int ichar;
#ifdef VMS
/* Note that the VMS version of this routine truncates trailing blanks */
if (strdesc->dsc$b_class != DSC$K_CLASS_S)
{
ger_error(
" Wrong descriptor class in GETSTRING: %d",
strdesc->dsc$b_class);
stringcopy[0]= '\0';
};
if (strdesc->dsc$w_length >= MAXSTRING)
{
ger_error(" Long string truncated in GETSTRING.");
(void) strncpy(stringcopy,
strdesc->dsc$a_pointer,MAXSTRING-1);
stringcopy[MAXSTRING-1]='\0';
}
else
{
(void) strncpy(stringcopy,
strdesc->dsc$a_pointer,strdesc->dsc$w_length);
stringcopy[strdesc->dsc$w_length]='\0';
};
for (ichar= strlen(stringcopy)-1;(stringcopy[ichar]==' ')&&(ichar>=0);
ichar--) stringcopy[ichar]= '\0';
#endif
#ifdef CRAY
/* Note that the Cray version of this routine truncates trailing blanks */
if ( _fcdlen(strdesc) >= MAXSTRING )
{
ger_error(" Long string truncated in GETSTRING.");
(void) strncpy(stringcopy,_fcdtocp(strdesc),MAXSTRING-1);
stringcopy[MAXSTRING-1]='\0';
}
else
{
strncpy(stringcopy,_fcdtocp(strdesc),_fcdlen(strdesc));
stringcopy[_fcdlen(strdesc)]= '\0';
};
for (ichar= strlen(stringcopy)-1;(stringcopy[ichar]==' ')&&(ichar>=0);
ichar--) stringcopy[ichar]= '\0';
#endif
#ifdef USE_UNIX
/* For this version of getstring, the macro STRINGLENGTH translates to
* ",stringlength", which should contain the string length. Note that
* this version truncates trailing blanks.
*/
if (stringlength >= MAXSTRING)
{
ger_error(" Long string truncated in GETSTRING.");
(void) strncpy(stringcopy,strdesc,MAXSTRING-1);
stringcopy[MAXSTRING-1]='\0';
}
else
{
strncpy(stringcopy,strdesc,stringlength);
stringcopy[stringlength]= '\0';
};
for (ichar= strlen(stringcopy)-1;(stringcopy[ichar]==' ')&&(ichar>=0);
ichar--) stringcopy[ichar]= '\0';
#endif
#ifdef _IBMR2
/* For this version of getstring, the macro STRINGLENGTH translates to
* ",stringlength", which should contain the string length. Note that
* this version truncates trailing blanks.
*/
if (stringlength >= MAXSTRING)
{
ger_error(" Long string truncated in GETSTRING.");
(void) strncpy(stringcopy,strdesc,MAXSTRING-1);
stringcopy[MAXSTRING-1]='\0';
}
else
{
strncpy(stringcopy,strdesc,stringlength);
stringcopy[stringlength]= '\0';
};
for (ichar= strlen(stringcopy)-1;(stringcopy[ichar]==' ')&&(ichar>=0);
ichar--) stringcopy[ichar]= '\0';
#endif
#ifdef ardent
if ( strdesc->length >= MAXSTRING )
{
ger_error(" Long string truncated in GETSTRING.");
(void) strncpy(stringcopy,strdesc->addr,MAXSTRING-1);
stringcopy[MAXSTRING-1]= '\0';
}
else
{
(void) strcpy(stringcopy,strdesc->addr);
stringcopy[strdesc->length]= '\0';
};
#endif
#ifdef __hpux
/* For this version of getstring, the macro STRINGLENGTH translates to
* ",stringlength", which should contain the string length. Note that
* this version truncates trailing blanks.
*/
if (stringlength >= MAXSTRING)
{
ger_error(" Long string truncated in GETSTRING.");
(void) strncpy(stringcopy,strdesc,MAXSTRING-1);
stringcopy[MAXSTRING-1]='\0';
}
else
{
strncpy(stringcopy,strdesc,stringlength);
stringcopy[stringlength]= '\0';
};
for (ichar= strlen(stringcopy)-1;(stringcopy[ichar]==' ')&&(ichar>=0);
ichar--) stringcopy[ichar]= '\0';
#endif
ger_debug("getstring: returning <%s>.",stringcopy);
return(stringcopy);
}
int pintrn( name, renderer, device, datastr
STRINGLENGTH STRINGLENGTH2 STRINGLENGTH3 STRINGLENGTH4)
string_descriptor name, renderer, device, datastr;
DEFSTRINGLENGTH
DEFSTRINGLENGTH2
DEFSTRINGLENGTH3
DEFSTRINGLENGTH4
{
char nmstr[MAXSTRING], renstr[MAXSTRING], devstr[MAXSTRING];
char dtstr[MAXSTRING];
strcpy( nmstr, getstring(name STRINGLENGTH) );
strcpy( renstr, getstring(renderer STRINGLENGTH2) );
strcpy( devstr, getstring(device STRINGLENGTH3) );
strcpy( dtstr, getstring(datastr STRINGLENGTH4) );
return( pg_init_ren( nmstr, renstr, devstr, dtstr ) );
}
int popnrn( renderer STRINGLENGTH )
string_descriptor renderer;
DEFSTRINGLENGTH
{
return( pg_open_ren( getstring(renderer STRINGLENGTH) ) );
}
int pclsrn( renderer STRINGLENGTH )
string_descriptor renderer;
DEFSTRINGLENGTH
{
return( pg_close_ren( getstring(renderer STRINGLENGTH) ) );
}
int pshtrn( renderer STRINGLENGTH )
string_descriptor renderer;
DEFSTRINGLENGTH
{
return( pg_shutdown_ren( getstring(renderer STRINGLENGTH) ) );
}
int pshtdn()
{
return( pg_shutdown() );
}
int pprtrn( renderer STRINGLENGTH )
string_descriptor renderer;
DEFSTRINGLENGTH
{
return( pg_print_ren( getstring(renderer STRINGLENGTH) ) );
}
int popen( renderer STRINGLENGTH )
string_descriptor renderer;
DEFSTRINGLENGTH
{
return( pg_open( getstring(renderer STRINGLENGTH) ) );
}
int pclose()
{
return( pg_close() );
}
int pfree( renderer STRINGLENGTH )
string_descriptor renderer;
DEFSTRINGLENGTH
{
return( pg_free( getstring(renderer STRINGLENGTH) ) );
}
int piatt( attribute, value STRINGLENGTH )
string_descriptor attribute;
int *value;
DEFSTRINGLENGTH
{
return( pg_int_attr( getstring( attribute STRINGLENGTH ), *value ) );
}
int pblatt( attribute, value STRINGLENGTH )
string_descriptor attribute;
int *value;
DEFSTRINGLENGTH
{
return( pg_bool_attr( getstring( attribute STRINGLENGTH ), *value ) );
}
int pfatt( attribute, value STRINGLENGTH )
string_descriptor attribute;
float *value;
DEFSTRINGLENGTH
{
return( pg_float_attr( getstring( attribute STRINGLENGTH ), *value ) );
}
int pstatt( attribute, value STRINGLENGTH STRINGLENGTH2)
string_descriptor attribute;
string_descriptor value;
DEFSTRINGLENGTH
DEFSTRINGLENGTH2
{
char attrstr[MAXSTRING];
strcpy( attrstr, getstring( attribute STRINGLENGTH ) );
return( pg_string_attr( attrstr,
getstring( value STRINGLENGTH2 ) ) );
}
int pclatt( attribute, ctype, r, g, b, a STRINGLENGTH )
string_descriptor attribute;
int *ctype;
float *r, *g, *b, *a;
DEFSTRINGLENGTH
{
P_Color clr;
clr.ctype= *ctype;
clr.r= *r;
clr.g= *g;
clr.b= *b;
clr.a= *a;
return( pg_color_attr( getstring( attribute STRINGLENGTH ), &clr ) );
}
int pptatt( attribute, x, y, z STRINGLENGTH )
string_descriptor attribute;
float *x, *y, *z;
DEFSTRINGLENGTH
{
P_Point pt;
pt.x= *x;
pt.y= *y;
pt.z= *z;
return( pg_point_attr( getstring( attribute STRINGLENGTH ), &pt ) );
}
int pvcatt( attribute, x, y, z STRINGLENGTH )
string_descriptor attribute;
float *x, *y, *z;
DEFSTRINGLENGTH
{
P_Vector vec;
vec.x= *x;
vec.y= *y;
vec.z= *z;
return( pg_vector_attr( getstring( attribute STRINGLENGTH ), &vec ) );
}
int ptratt( attribute, val STRINGLENGTH )
string_descriptor attribute;
float *val;
DEFSTRINGLENGTH
{
P_Transform trans;
trans.d[0]= *val++;
trans.d[4]= *val++;
trans.d[8]= *val++;
trans.d[12]= *val++;
trans.d[1]= *val++;
trans.d[5]= *val++;
trans.d[9]= *val++;
trans.d[13]= *val++;
trans.d[2]= *val++;
trans.d[6]= *val++;
trans.d[10]= *val++;
trans.d[14]= *val++;
trans.d[3]= *val++;
trans.d[7]= *val++;
trans.d[11]= *val++;
trans.d[15]= *val++;
return( pg_trans_attr( getstring( attribute STRINGLENGTH ), &trans ) );
}
int pmtatt( attribute, val STRINGLENGTH )
string_descriptor attribute;
int *val;
DEFSTRINGLENGTH
{
P_Material *material;
switch (*val) {
case 0: material= p3d_default_material; break;
case 1: material= p3d_dull_material; break;
case 2: material= p3d_shiny_material; break;
case 3: material= p3d_metallic_material; break;
case 4: material= p3d_matte_material; break;
case 5: material= p3d_aluminum_material; break;
default:
ger_error("psmatt: unknown standard material ID %d, call ignored.\n",
*val);
return P3D_FAILURE;
}
return( pg_material_attr( getstring( attribute STRINGLENGTH ), material ) );
}
int pgbclr( ctype, r, g, b, a )
int *ctype;
float *r, *g, *b, *a;
{
P_Color clr;
clr.ctype= *ctype;
clr.r= *r;
clr.g= *g;
clr.b= *b;
clr.a= *a;
return( pg_gobcolor( &clr ) );
}
int ptxtht( value )
float *value;
{
return( pg_textheight( *value ) );
}
int pbkcul( value )
int *value;
{
return( pg_backcull( *value ) );
}
int pgbmat( val )
int *val;
{
P_Material *material;
switch (*val) {
case 0: material= p3d_default_material; break;
case 1: material= p3d_dull_material; break;
case 2: material= p3d_shiny_material; break;
case 3: material= p3d_metallic_material; break;
case 4: material= p3d_matte_material; break;
case 5: material= p3d_aluminum_material; break;
default:
ger_error("pgbsmt: unknown standard material ID %d, call ignored.\n",
*val);
return P3D_FAILURE;
}
return( pg_gobmaterial( material ) );
}
int ptnsfm( val )
float *val;
{
P_Transform trans,*tmp;
trans.d[0]= *val++;
trans.d[4]= *val++;
trans.d[8]= *val++;
trans.d[12]= *val++;
trans.d[1]= *val++;
trans.d[5]= *val++;
trans.d[9]= *val++;
trans.d[13]= *val++;
trans.d[2]= *val++;
trans.d[6]= *val++;
trans.d[10]= *val++;
trans.d[14]= *val++;
trans.d[3]= *val++;
trans.d[7]= *val++;
trans.d[11]= *val++;
trans.d[15]= *val++;
trans.type_front = allocate_trans_type();
trans.type_front->type = P3D_TRANSFORMATION;
tmp = duplicate_trans(&trans);
trans.type_front->trans = (P_Void_ptr)tmp;
trans.type_front->generators[0] = 0;
trans.type_front->generators[1] = 0;
trans.type_front->generators[2] = 0;
trans.type_front->generators[3] = 0;
trans.type_front->next = NULL;
return( pg_transform( &trans ) );
}
int ptrans( x, y, z )
float *x, *y, *z;
{
return( pg_translate( *x, *y, *z ) );
}
int protat( x, y, z, angle )
float *x, *y, *z, *angle;
{
P_Vector vec;
vec.x= *x;
vec.y= *y;
vec.z= *z;
return( pg_rotate( &vec, *angle ) );
}
int pscale( factor )
float *factor;
{
return( pg_scale(*factor) );
}
int pascal( x, y, z )
float *x, *y, *z;
{
return( pg_ascale( *x, *y, *z ) );
}
int pchild( name STRINGLENGTH )
string_descriptor name;
DEFSTRINGLENGTH
{
return( pg_child( getstring( name STRINGLENGTH ) ) );
}
int pprtgb( name STRINGLENGTH )
string_descriptor name;
DEFSTRINGLENGTH
{
return( pg_print_gob( getstring( name STRINGLENGTH ) ) );
}
int paxis( startf, endf, upf, startval, endval, numtics, label,
textht, prcsn STRINGLENGTH )
float *startf, *endf, *upf, *startval, *endval;
int *numtics;
string_descriptor label;
float *textht;
int *prcsn;
DEFSTRINGLENGTH
{
P_Point start, end;
P_Vector up;
start.x = *startf++;
start.y = *startf++;
start.z = *startf;
end.x = *endf++;
end.y = *endf++;
end.z = *endf;
up.x = *upf++;
up.y = *upf++;
up.z = *upf;
return( pg_axis( &start, &end, &up, (double) *startval, (double) *endval,
*numtics, getstring( label STRINGLENGTH ),
( double) *textht, *prcsn ) );
}
int pbndbx( cornera, cornerb)
float *cornera;
float *cornerb;
{
P_Point corner1, corner2;
corner1.x = *cornera++;
corner1.y = *cornera++;
corner1.z = *cornera;
corner2.x = *cornerb++;
corner2.y = *cornerb++;
corner2.z = *cornerb;
return( pg_boundbox( &corner1, &corner2 ) );
}
int pisosf( type, data, valdata, nx, ny, nz, value, corner1f, corner2f,
show_inside )
int *type;
float *data, *valdata;
int *nx, *ny, *nz;
float *value;
float *corner1f, *corner2f;
int *show_inside;
{
P_Point corner1, corner2;
double dblval;
dblval= *value;
corner1.x= *corner1f++;
corner1.y= *corner1f++;
corner1.z= *corner1f;
corner2.x= *corner2f++;
corner2.y= *corner2f++;
corner2.z= *corner2f;
return( pg_isosurface( *type, data, valdata, *nx, *ny, *nz, dblval,
&corner1, &corner2, *show_inside, 1 ) );
}
int pzsurf( vtxtype, zdata, valdata, nx, ny, corner1f, corner2f,
null_tfun, testfun )
int *vtxtype;
float *zdata, *valdata;
int *nx, *ny;
float *corner1f, *corner2f;
int *null_tfun;
void (*testfun)();
{
P_Point corner1, corner2;
corner1.x = *corner1f++;
corner1.y = *corner1f++;
corner1.z = *corner1f;
corner2.x = *corner2f++;
corner2.y = *corner2f++;
corner2.z = *corner2f;
if (*null_tfun)
testfun = 0;
return( pg_zsurface( *vtxtype, zdata, valdata, *nx, *ny, &corner1,
&corner2, testfun, 1 ) );
}
int prnzsf( vtxtype, ctype, npts, coords, colors, norms, null_tfun, testfun )
int *vtxtype;
int *ctype;
int *npts;
float *coords, *colors, *norms;
int *null_tfun;
void (*testfun)();
{
if (*null_tfun)
testfun= 0;
return( pg_rand_zsurf( po_create_mvlist( *vtxtype, *npts,
coords, colors, norms ),
testfun ) );
}
int prniso( vtxtype, ctype, npts, coords, colors, norms, ival, show_inside )
int *vtxtype;
int *ctype;
int *npts;
float *coords, *colors, *norms;
float *ival;
int *show_inside;
{
double dblval;
int retval;
P_Vlist* vlist= po_create_mvlist( *vtxtype, *npts, coords, colors, norms );
dblval= *ival;
retval= pg_rand_isosurf( vlist, dblval, *show_inside );
METHOD_RDY(vlist);
(*(vlist->destroy_self))();
return( retval );
}
int pirzsf( vtxtype, zdata, valdata, nx, ny, xyfun, null_tfun, tstfun )
int *vtxtype;
float *zdata, *valdata;
int *nx, *ny;
void (*xyfun)();
int *null_tfun;
void (*tstfun)();
{
if (*null_tfun) tstfun = 0;
return( pg_irreg_zsurf( *vtxtype, zdata, valdata, *nx, *ny,
xyfun, tstfun, 1 ) );
}
int piriso( type, data, valdata, nx, ny, nz, value, coordfun, show_inside )
int *type;
float *data;
float *valdata;
int *nx;
int *ny;
int *nz;
float *value;
void (*coordfun)();
int *show_inside;
{
double dblval;
dblval= *value;
return( pg_irreg_isosurf( *type, data, valdata, *nx, *ny, *nz, dblval,
coordfun, *show_inside, 1 ) );
}
int ptbmol( vtxtype, ctype, npts, coords, colors, cross, bres, cres )
int *vtxtype;
int *ctype;
int *npts;
float *coords, *colors;
int *cross;
int *bres;
int *cres;
{
int retval;
P_Vlist* vlist;
int mytype= *vtxtype;
if (mytype==P3D_CNVTX) mytype= P3D_CVTX;
if (mytype==P3D_CCNVTX) mytype= P3D_CCVTX;
if (mytype==P3D_CVNVTX) mytype= P3D_CVVTX;
vlist= po_create_mvlist( mytype, *npts, coords, colors, (float*)0 );
retval= pg_spline_tube( vlist, cross, *bres, *cres );
METHOD_RDY(vlist);
(*(vlist->destroy_self))();
return( retval );
}
int pcyl()
{
return( pg_cylinder() );
}
int psphr()
{
return( pg_sphere() );
}
int ptorus( major, minor )
float *major, *minor;
{
return( pg_torus( *major, *minor ) );
}
int pplymk( vtxtype, ctype, npts, coords, colors )
int *vtxtype;
int *ctype;
int *npts;
float *coords, *colors;
{
int mytype;
mytype= *vtxtype;
if (mytype==P3D_CNVTX) mytype= P3D_CVTX;
if (mytype==P3D_CCNVTX) mytype= P3D_CCVTX;
if (mytype==P3D_CVNVTX) mytype= P3D_CVVTX;
return( pg_polymarker(
po_create_mvlist(mytype, *npts, coords, colors, (float *)0) ) );
}
int pplyln( vtxtype, ctype, npts, coords, colors )
int *vtxtype;
int *ctype;
int *npts;
float *coords, *colors;
{
int mytype;
mytype= *vtxtype;
if (mytype==P3D_CNVTX) mytype= P3D_CVTX;
if (mytype==P3D_CCNVTX) mytype= P3D_CCVTX;
if (mytype==P3D_CVNVTX) mytype= P3D_CVVTX;
return( pg_polyline(
po_create_mvlist(mytype, *npts, coords, colors, (float *)0) ) );
}
int pplygn( vtxtype, ctype, npts, coords, colors, normals )
int *vtxtype;
int *ctype;
int *npts;
float *coords, *colors, *normals;
{
return( pg_polygon(
po_create_mvlist(*vtxtype, *npts, coords, colors, normals) ) );
}
int ptrist( vtxtype, ctype, npts, coords, colors, normals )
int *vtxtype;
int *ctype;
int *npts;
float *coords, *colors, *normals;
{
return( pg_tristrip(
po_create_mvlist(*vtxtype, *npts, coords, colors, normals) ) );
}
int pmesh( vtxtype, ctype, npts, coords, colors, normals, nfacets,
facet_lengths, vertices)
int *vtxtype;
int *ctype;
int *npts;
float *coords, *colors, *normals;
int *nfacets;
int *facet_lengths;
int *vertices;
{
return( pg_mesh( po_create_mvlist(*vtxtype, *npts, coords, colors, normals),
vertices, facet_lengths, *nfacets) );
}
int pbezp( vtxtype, ctype, coords, colors, normals )
int *vtxtype;
int *ctype;
float *coords, *colors, *normals;
{
return( pg_bezier(
po_create_mvlist(*vtxtype, 16, coords, colors, normals) ) );
}
int ptext( string, location, u, v STRINGLENGTH )
string_descriptor string;
float *location;
float *u;
float *v;
DEFSTRINGLENGTH
{
P_Point locpt;
P_Vector uvec, vvec;
locpt.x= *location;
locpt.y= *(location+1);
locpt.z= *(location+2);
uvec.x= *u;
uvec.y= *(u+1);
uvec.z= *(u+2);
vvec.x= *v;
vvec.y= *(v+1);
vvec.z= *(v+2);
return( pg_text( getstring(string STRINGLENGTH), &locpt, &uvec, &vvec ) );
}
int plight( location, ctype, color )
float *location;
int *ctype;
float *color;
{
P_Point locpt;
P_Color colval;
locpt.x= *location++;
locpt.y= *location++;
locpt.z= *location;
colval.ctype= *ctype;
colval.r= *color++;
colval.g= *color++;
colval.b= *color++;
colval.a= *color;
return( pg_light( &locpt, &colval ) );
}
int pamblt( ctype, color )
int *ctype;
float *color;
{
P_Color colval;
colval.ctype= *ctype;
colval.r= *color++;
colval.g= *color++;
colval.b= *color++;
colval.a= *color;
return( pg_ambient( &colval ) );
}
int pcamra( name, lookfrom, lookat, up, fovea, hither, yon STRINGLENGTH )
string_descriptor name;
float *lookfrom, *lookat, *up, *fovea, *hither, *yon;
DEFSTRINGLENGTH
{
P_Point frompt, atpt;
P_Vector upvec;
frompt.x= *lookfrom++;
frompt.y= *lookfrom++;
frompt.z= *lookfrom;
atpt.x= *lookat++;
atpt.y= *lookat++;
atpt.z= *lookat;
upvec.x= *up++;
upvec.y= *up++;
upvec.z= *up;
return( pg_camera( getstring(name STRINGLENGTH),
&frompt, &atpt, &upvec, *fovea, *hither, *yon ) );
}
int pprtcm( name STRINGLENGTH )
string_descriptor name;
DEFSTRINGLENGTH
{
return( pg_print_camera( getstring(name STRINGLENGTH) ) );
}
int pcmbkg( name, ctype, color STRINGLENGTH )
string_descriptor name;
int *ctype;
float *color;
DEFSTRINGLENGTH
{
P_Color colval;
colval.ctype= *ctype;
colval.r= *color++;
colval.g= *color++;
colval.b= *color++;
colval.a= *color;
return( pg_camera_background( getstring(name STRINGLENGTH), &colval ) );
}
int psnap( model, lights, camera STRINGLENGTH STRINGLENGTH2 STRINGLENGTH3 )
string_descriptor model;
string_descriptor lights;
string_descriptor camera;
DEFSTRINGLENGTH
DEFSTRINGLENGTH2
DEFSTRINGLENGTH3
{
char modelstr[MAXSTRING], lightstr[MAXSTRING], camstr[MAXSTRING];
strcpy( modelstr, getstring(model STRINGLENGTH) );
strcpy( lightstr, getstring(lights STRINGLENGTH2) );
strcpy( camstr, getstring(camera STRINGLENGTH3) );
return( pg_snap( modelstr, lightstr, camstr ) );
}
int pstcmp(min, max, fun)
float *min;
float *max;
void (*fun)();
{
return( pg_set_cmap( *min, *max, fun ) );
}
int psdcmp(min, max, which)
float *min;
float *max;
int *which;
{
return( pg_std_cmap( *min, *max, *which ) );
}
int pdebug()
{
ger_toggledebug();
return( P3D_SUCCESS );
}