home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / cdactual / demobin / share / program / VBasic / VLIB20.ZIP / VISUALIB.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-14  |  28.4 KB  |  771 lines

  1. /*****************************************************************************
  2.  
  3.                     Visualib Header File
  4.                     Copyright (c) 1993
  5.                     Visual Technology International, Co.
  6.                     P.O.Box 901-413
  7.                     Kansas City, MO 64190
  8.  
  9. *****************************************************************************/
  10.  
  11. /*****************************************************************************
  12.  
  13.                     Constants, types, and Macros
  14.  
  15. *****************************************************************************/
  16.  
  17. //#define real   float
  18. typedef float    real;
  19.  
  20. #define VOIDED  void far pascal
  21. #define DOUBLE  double far pascal
  22. #define FLOAT   float far pascal
  23. #define SHORT   short far pascal
  24. #define REAL    real far pascal
  25. #define BINARY  BOOL far pascal
  26.  
  27. typedef float huge    *hpfloat;
  28. typedef double far  *lpdouble;
  29. typedef float far   *lpfloat;
  30. typedef real far    *lpreal;
  31. typedef real        COORD;
  32. typedef COORD        COORD2[2];
  33. typedef COORD        COORD3[3];
  34. typedef COORD        COORD4[4];
  35. typedef COORD far    *LPCOORD;
  36. typedef COORD2 far    *LPCOORD2;
  37. typedef COORD3 far    *LPCOORD3;
  38. typedef COORD4 far    *LPCOORD4;
  39.  
  40. typedef real far    *VECTOR;
  41. typedef real far    *MATRIX;
  42.  
  43. typedef real    VECTOR2[2];
  44. typedef real    VECTOR3[3];
  45. typedef real    VECTOR4[4];
  46. typedef real    MATRIX2D[9];
  47. typedef real    MATRIX3D[16];
  48. typedef VECTOR2    far    *LPVECT2;
  49. typedef VECTOR3    far    *LPVECT3;
  50. typedef    VECTOR4 far    *LPVECT4;
  51. typedef VECTOR far *LPVECTOR;
  52.  
  53. typedef struct _tagPOINT2D {    /* 2D point coordinates */
  54.     real    x, y;
  55. } POINT2D, far *LPPOINT2D;
  56.  
  57. typedef struct _tagPOINT2H {    /* 2D homogeneous point coordinates */
  58.     real    x, y, w;
  59. } POINT2H, far *LPPOINT2H;
  60.  
  61. typedef struct _tagPOINT3D {    /* 3D point coordinates */
  62.     real    x, y, z;
  63. } POINT3D, far *LPPOINT3D;
  64.  
  65. typedef struct _tagPOINT3H {    /* 3D homogeneous point coordinates */
  66.     real    x, y, z, w;
  67. } POINT3H, far *LPPOINT3H;
  68.  
  69. typedef struct _tagBOX2D {
  70.     real    xmin, xmax, ymin, ymax;
  71. } BOX2D, far *LPBOX2D;
  72.  
  73. typedef struct _tagBOX3D {
  74.     real    xmin, xmax, ymin, ymax, zmin, zmax;
  75. } BOX3D, far *LPBOX3D;
  76.  
  77. typedef MATRIX3D far    *LPMTRX3D;
  78. typedef MATRIX2D far    *LPMTRX2D;
  79.  
  80. #define EPSILON (real) 1e-5
  81. #define QUTRPI  (real) 0.78539816
  82. #define HALFPI  (real) 1.57079633
  83. #define PI      (real) 3.14159265
  84. #define TWOPI   (real) 6.2831853
  85. #define DTOR    (real) 0.0174532
  86. #define ATOR    (real) 1.7453293e-3
  87. #define RTOD    (real) 57.295779
  88. #define    SQRT2    (real)1.414214
  89. #define    SQRT3    (real)1.732051
  90.  
  91. /* coordinate type */
  92. #define    VL_2D    0x1000
  93. #define    VL_3D    0x2000
  94. #define    VL_2H    0x0400
  95. #define    VL_3H    0x0800
  96.  
  97. /* viewer status flag */
  98. #define    VL_TWOD            8
  99. #define    VL_THREED        16
  100. #define    VL_CURRENT        128
  101.  
  102. /* light coordinate mode */
  103. #define    VL_WORLDLIGHT        0x0001
  104. #define    VL_CAMERALIGHT        0x0002
  105. #define    VL_OBJECTLIGHT        0x0004
  106.  
  107. /* light type */
  108. #define    VL_POINTLIGHT            0x0100
  109. #define    VL_DISTLIGHT            0x0200
  110. #define    VL_SPOTLIGHT            0x0400
  111. #define VL_AREALIGHT            0x0800
  112.  
  113. /* color type */
  114. #define    VL_MATERIALAMBIENT    0x0001
  115. #define    VL_MATERIALDIFFUSE    0x0002
  116. #define    VL_MATERIALSPECULAR    0x0003
  117. #define    VL_MATERIALEMISSION    0x0004
  118. #define    VL_AMBIENTREFLECT    0x0005
  119. #define    VL_DIFFUSEREFLECT    0x0006
  120. #define    VL_SPECULARREFLECT    0x0007
  121. #define    VL_EMISSIONSTRENGTH    0x0008
  122. #define    VL_SHININESS        0x0009
  123.  
  124. #define    VL_LIGHTCOLOR        0x0010
  125. #define    VL_AMBIENTCONTRIB    0x0020
  126. #define    VL_LIGHTLOCATION    0x0030
  127. #define    VL_LIGHTDIRECTION    0x0040
  128. #define    VL_LIGHTINTENSITY    0x0050
  129. #define    VL_SPOTLIGHTANGLE    0x0060
  130. #define    VL_SPOTLIGHTSPREAD    0x0070
  131.  
  132. #define    VL_ATTENUATION        0x0100
  133. #define    VL_GLOBALAMBIENT    0x0200
  134. #define    VL_BACKGROUNDCOLOR    0x0300
  135. #define    VL_SHADINGMETHOD    0x0400
  136. #define    VL_SHADINGMODEL        0x0500
  137. #define    VL_LOCALVIEWER        0x0600
  138. #define    VL_COUNTCLOCKWISE    0x0700
  139. #define    VL_TWOSIDESHADE        0x0800
  140. #define    VL_DEPTHBUFFER        0x0900
  141. #define    VL_BACKFACEREMOVAL    0x0A00
  142. #define    VL_PERTURBMATERIAL    0x0B00
  143. #define VL_PERTURBNORMAL    0x0C00
  144. #define    VL_PERTURBPIXEL        0x0D00
  145. #define VL_PERTURBFACET        0x0E00
  146. #define    VL_ENVIRONMENT        0x0F00
  147.  
  148. #define VL_INQUIRE            -1
  149.  
  150. /* projection mode */
  151. #define VL_PROJECTIONMODE  0x03
  152. #define VL_PERSPECTIVE     0x01
  153. #define VL_ORTHOGONAL      0x02
  154.  
  155. /* Viewport Mapping Mode */
  156. /*
  157. #define    VL_HORIZONTALFIT    1
  158. #define    VL_VERTICALFIT        2
  159. #define    VL_AUTOFIT            3
  160. #define    VL_VIEWPORTFIT        4
  161. */
  162. /* standard pen and brush color */
  163. #define    VL_NONE             0
  164. #define VL_RED           1
  165. #define VL_GREEN         2
  166. #define VL_BLUE          3
  167. #define VL_BROWN         4
  168. #define VL_MAGENTA       5
  169. #define VL_CYAN          6
  170. #define VL_WHITE         7
  171. #define VL_GRAY          8
  172. #define VL_LIGHTRED      9
  173. #define VL_LIGHTGREEN    10
  174. #define VL_LIGHTBLUE     11
  175. #define VL_YELLOW        12
  176. #define VL_LIGHTMAGENTA  13
  177. #define VL_LIGHTCYAN     14
  178. #define VL_LIGHTGRAY     15
  179. #define VL_BLACK         16
  180.  
  181. /* shading method */
  182. #define    VL_WIREFRAME            0x0001
  183. #define    VL_SOLIDFILL            0x0002
  184. #define    VL_CONTOURSHADE            0x0004
  185. #define    VL_GOURAUDSHADE            0x0008
  186. #define    VL_PHONGSHADE            0x0010
  187. #define    VL_FLATSHADE            0x0020
  188.  
  189. /* shading model */
  190. #define    VL_PHONGMODEL            0x0100
  191. #define    VL_SPECULARMODEL        0x0200
  192.  
  193. /* mark type */
  194. #define    VL_NULLMARK            0x0000
  195. #define    VL_CIRCLEMARK        0x0001
  196. #define    VL_CROSSMARK        0x0002
  197. #define    VL_XMARK            0x0004
  198. #define    VL_TRIANGLEMARK        0x0008
  199. #define    VL_BOXMARK            0x0010
  200. #define    VL_DIAMONDMARK        0x0020
  201. #define    VL_HEXAGONMARK        0x0040
  202. #define    VL_OCTAGONMARK        0x0080
  203.  
  204. /* arrow head type */
  205. #define    VL_NULLARROW        0x0000
  206. #define    VL_OPENARROW        0X0100
  207. #define    VL_CLOSEDARROW        0X0200
  208.  
  209. /* position mark type */
  210. #define    VL_CROSSHAIR    1
  211. #define    VL_ORIGIN        2
  212.  
  213. /* solid texture flag */
  214. #define    VL_MARBLE        0x0001
  215. #define    VL_WOODGRAIN    0x0002
  216. #define    VL_GRANITE        0x0004
  217.  
  218. /* Useful Macros */
  219. #define ABS(x)      (((x)>0)?(x):-(x))
  220. #define TRUNC(x)    ((int) (x))
  221. //#define ROUND(x)    (int)((x)+0.5f)
  222. #define    FLOOR(x)    (((x)>0) ? (int)(x) : -(int)(-(x)+1))
  223. #define    CEILING(x)    ((x)==(int)(x)?(x):(((x)>0)?1+(int)(x):-(1+(int)(-(x)))))
  224. #define    ROUND(x)    ((x)>0 ? (int)(x+0.5f) : -(int)(0.5f-x))
  225. #define SQR(x)          ((x)*(x))
  226. #define SQR2(x,y)       ((real)(SQR(x)+SQR(y)))
  227. #define SQR3(x,y,z)     ((real)(SQR(x)+SQR(y)+SQR(z)))
  228.  
  229. #define MAX(a,b)    (((a) > (b)) ? (a) : (b))
  230. #define MIN(a,b)    (((a) < (b)) ? (a) : (b))
  231. #define    SWAP(a,b)    { a^=b; b^=a; a^=b; }
  232. #define MIDVAL(a,b)     (((a)+(b))*0.5f)
  233. #define    LERP(a,l,h)    ((l)+(((h)-(l))*(a)))
  234. #define    CLAMP(v,l,h)    ((v)<(l) ? (l) : (v)>(h) ? (h) : (v))
  235. #define    STEP(v,s)    ((v)<(s) ? 0 : 1)
  236. #define    SIGN(x)        (((x)<0) ? -1 : (x)>0 ? 1 : 0)
  237.  
  238. #define    NEWLIST(type,n)    (type far *)_fmalloc (sizeof (type) * (n))
  239. #define    NEWITEM(type)    (type far *)_fmalloc (sizeof (type))
  240.  
  241. #define DIST2(x,y)      ((real)sqrt(SQR2(x,y)))
  242. #define DIST3(x,y,z)    ((real)sqrt(SQR3(x,y,z)))
  243. #define DETERM2(a,b,c,d)    ((a)*(d)-(b)*(c))
  244. #define DETERM3(a,b,c,d,e,f,g,h,i) ((a)*DETERM2(e,f,h,i)+(b)*DETERM2(f,d,i,g)+(c)*DETERM2(d,e,g,h))
  245.  
  246. #define VSET2(v,x,y)        ((v)[0]=(real)(x),(v)[1]=(real)(y))
  247. #define VSET3(v,x,y,z)        ((v)[0]=(real)(x),(v)[1]=(real)(y),(v)[2]=(real)(z))
  248. #define VSET4(v,x,y,z,w)    ((v)[0]=(real)(x),(v)[1]=(real)(y),(v)[2]=(real)(z),(v)[3]=(real)(w))
  249. #define    VGET2(v,x,y)        (x=(v)[0],y=(v)[1])
  250. #define    VGET3(v,x,y,z)        (x=(v)[0],y=(v)[1],z=(v)[2])
  251. #define    VGET4(v,x,y,z,w)    (x=(v)[0],y=(v)[1],z=(v)[2],w=(v)[3])
  252.  
  253. /*****************************************************************************
  254.  
  255.                     Function Prototypes
  256.  
  257. *****************************************************************************/
  258.  
  259. /*****************************************************************************
  260.  
  261.                     Basic Functions
  262.  
  263. *****************************************************************************/
  264.  
  265. BINARY    InitializeVisualib (void);
  266. VOIDED  ExitVisualib (void);
  267. VOIDED    AboutVisualib (void);
  268. VOIDED    LicenseInfo (void);
  269.  
  270. /* utility functions */
  271. BINARY  MessageOn (int flag);
  272. VOIDED  ErrorMessage (LPSTR msg);
  273. VOIDED    Message (LPSTR msg);
  274. COLORREF WINAPI    SelectColor (COLORREF color);
  275.  
  276. SHORT   NumViewer (void);
  277. VOIDED  SetPoint2D (LPPOINT2D point, real x, real y);
  278. VOIDED  SetPoint3D (LPPOINT3D point, real x, real y, real z);
  279. VOIDED  SetPoint2H (LPPOINT2H point, real x, real y, real w);
  280. VOIDED  SetPoint3H (LPPOINT3H point, real x, real y, real z, real w);
  281. VOIDED  SetBox2D (LPBOX2D box, real xmin, real xmax, real ymin, real ymax);
  282. VOIDED  SetBox3D (LPBOX3D box, real xmin, real xmax, real ymin, real ymax, real zmin, real zmax);
  283.  
  284. VOIDED    PenColor (HDC hdc, int color_index);
  285. VOIDED    BrushColor (HDC hdc, int color_index);
  286. VOIDED    TextColor (HDC hdc, int tcolor, int bcolor, int mode);
  287. VOIDED    PaintColor (HDC hdc, int pen, int brush, int mode);
  288.  
  289. SHORT    CreateViewer (LPSTR name, RECT port, BYTE type, BYTE mode);
  290. BINARY    DeleteViewer (int vid);
  291.  
  292. SHORT    ViewerMappingMode (int vid, int mode);
  293. BINARY    CopyViewer (int vid1, int vid2);
  294. BINARY    ResetViewer (int vid);
  295. SHORT    SelectViewer (int vid);
  296. BINARY    SetViewerName (int vid, LPSTR name);
  297. BINARY    GetViewerName (int vid, LPSTR name);
  298. BINARY    SetViewport (int vid, RECT port);
  299. BINARY    GetViewport (int vid, LPRECT port);
  300.  
  301. BINARY    ClearViewer (HDC hdc, int vid, int color);
  302. BINARY    DisplayViewerFrame (HDC hdc, int vid);
  303. BINARY    DisplayViewerName (HDC hdc, int vid, int top);
  304.  
  305. BINARY    BeginDoubleBuffer (HDC far *hdc, int viewid);
  306. BINARY    EndDoubleBuffer (HDC far *hdc, int viewid);
  307. BINARY    UpdateDoubleBuffer (HDC hdc, int viewid);
  308.  
  309. /*****************************************************************************
  310.  
  311.                         2D Functions
  312.  
  313. *****************************************************************************/
  314.  
  315. VOIDED  Translate2D (real x, real y);
  316. VOIDED    TranslateTo2D (real x, real y);
  317. VOIDED  Scale2D (real x, real y);
  318. VOIDED    PointScale2D (real x, real y, real sx, real sy);
  319. VOIDED    TranScale2D (real x, real y, real sx, real sy);
  320. VOIDED    Shear2D (real f, real x, real y, real a);
  321. VOIDED    Stretch2D (real f, real x, real y, real a);
  322. VOIDED    Mirror2D (real x, real y, real z);
  323. VOIDED  Rotate2D (real angle);
  324. VOIDED    PointRotate2D (real angle, real x, real y);
  325. BINARY    ViewerField2D (int vid,
  326.             lpreal left, lpreal bottom, lpreal right, lpreal top);
  327.  
  328. BINARY    PushTransformation2D (MATRIX m);
  329. BINARY    PopTransformation2D (MATRIX m);
  330. VOIDED    ConcatTransformation2D (MATRIX m, BOOL post);
  331. VOIDED    LoadTransformation2D (MATRIX m);
  332.  
  333. BINARY    SetProjection2D (int vid,
  334.             real left, real bottom, real right, real top);
  335. BINARY    SetView2D (int vid, real x, real y, real a);
  336. BINARY    SetWindow2D (int vid, real left, real bottom, real right, real top);
  337.  
  338. BINARY    MoveViewer2D (int vid, real horizontal, real vertical, BOOL local);
  339. BINARY    RotateViewer2D (int vid, real angle, BOOL local);
  340. BINARY    ZoomViewer2D (int vid, real zoom);
  341.  
  342. VOIDED  MoveTo2D (HDC hdc, real x, real y);
  343. VOIDED  RMoveTo2D (HDC hdc, real x, real y);
  344. VOIDED  LineTo2D (HDC hdc, real x, real y);
  345. VOIDED  RLineTo2D (HDC hdc, real x, real y);
  346. VOIDED  Line2D (HDC hdc, real x1, real y1, real x2, real y2);
  347. VOIDED  RLine2D (HDC hdc, real x, real y, real dx, real dy);
  348. VOIDED    Label2D (HDC hdc, real x, real y, LPSTR label);
  349. VOIDED    MoveTo2H (HDC hdc, real x, real y, real w);
  350. VOIDED    LineTo2H (HDC hdc, real x, real y, real w);
  351. VOIDED    Line2H (HDC hdc, real x1, real y1, real w1,
  352.             real x2, real y2, real w2);
  353.  
  354. VOIDED  Polygon2D (HDC hdc, int type, LPCOORD vertex, int count);
  355. VOIDED  PolyPolygon2D (HDC hdc, int type, LPCOORD vertex,
  356.             LPINT polycount, int count);
  357. VOIDED  Polyline2D (HDC hdc, int type, LPCOORD point, int count);
  358. VOIDED  ClosedPolyline2D (HDC hdc, int type, LPCOORD point, int count);
  359. VOIDED    Mark2D (HDC hdc, real x, real y, int hsize, int vsize, int head);
  360. VOIDED    PolyMark2D (HDC hdc, int type, LPCOORD point, int n,
  361.             int hsize, int vsize, int head);
  362. VOIDED    Pointer2D (HDC hdc, real x1, real y1, real x2, real y2,
  363.             real l, real w, int type);
  364. VOIDED    Arrow2D (HDC hdc, real x, real y, real u, real v, real r, real l, 
  365.             real w, int type);
  366. VOIDED    Net2D (HDC hdc, int type, LPCOORD point, int m, int n);
  367. VOIDED    MarkPosition2D (HDC hdc, real x, real y, real size, int type);
  368.  
  369. /*****************************************************************************
  370.  
  371.                         3D Functions
  372.  
  373. *****************************************************************************/
  374.  
  375. SHORT    ProjectionMode (int vid, int mode);
  376.  
  377. VOIDED  Translate3D (real x, real y, real z);
  378. VOIDED  TranslateTo3D (real x, real y, real z);
  379. VOIDED  Scale3D (real sx, real sy, real sz);
  380. VOIDED    PointScale3D (real x, real y, real z, real sx, real sy, real sz);
  381. VOIDED  Rotate3D (real angle, char axis);
  382. VOIDED    AxleRotate3D (real angle, VECTOR point, VECTOR direction);
  383. VOIDED    Stretch3D (real f, VECTOR point, VECTOR direction);
  384. VOIDED    Shear3D (real f, VECTOR normal, VECTOR point, VECTOR direction);
  385. VOIDED    Mirror3D (VECTOR point, VECTOR direction);
  386.  
  387. BINARY    PushTransformation3D (MATRIX m);
  388. BINARY    PopTransformation3D (MATRIX m);
  389. VOIDED    ConcatTransformation3D (MATRIX m, BOOL post);
  390. VOIDED    LoadTransformation3D (MATRIX m);
  391.  
  392. BINARY    ResetProjection3D (int vid);
  393. BINARY    SetProjection3D (int vid, real left, real bottom, real right,
  394.             real top, real front, real back, BYTE mode);
  395. BINARY    SetPerspective (int vid, real fovy, real aspect,
  396.             real zmin, real zmax);
  397. BINARY    SetView3D (int vid, real ex, real ey, real ez,
  398.             real ax, real ay, real az, real twist);
  399. BINARY    SetPolarView (int vid, real ax, real ay, real az,
  400.             real dist, real azim, real inc, real twist);
  401.  
  402. BINARY    ViewerLocation (int vid, lpreal x, lpreal y, lpreal z);
  403. BINARY    ViewerDirection (int vid, lpreal x, lpreal y, lpreal z);
  404. BINARY    ViewerField3D (int vid, lpreal left, lpreal bottom,
  405.             lpreal right, lpreal top, lpreal front, lpreal back);
  406.  
  407. BINARY    MoveViewer3D (int vid, real horizontal, real vertical, real backforth,
  408.             BOOL local);
  409. BINARY    RotateViewer3D (int vid, real angle, char axis, BOOL local);
  410. BINARY    ZoomViewer3D (int vid, real zoom);
  411.  
  412. VOIDED  MoveTo3D (HDC hdc, real x, real y, real z);
  413. VOIDED  LineTo3D (HDC hdc, real x, real y, real z);
  414. VOIDED  RMoveTo3D (HDC hdc, real x, real y, real z);
  415. VOIDED  RLineTo3D (HDC hdc, real x, real y, real z);
  416. VOIDED  MoveTo3H (HDC hdc, real x, real y, real z, real w);
  417. VOIDED  LineTo3H (HDC hdc, real x, real y, real z, real w);
  418.  
  419. VOIDED  Line3D (HDC hdc, real x1, real y1, real z1,
  420.             real x2, real y2, real z2);
  421. VOIDED  RLine3D (HDC hdc, real x, real y, real z, real dx, real dy, real dz);
  422.  
  423. VOIDED    PolyArrow3D (HDC hdc, int type, LPCOORD poly, LPVECT3 dir, int n,
  424.             real r, real l, real w, int htype);
  425. VOIDED    Label3D (HDC hdc, real x, real y, real z, LPSTR label);
  426. BINARY    Mark3D (HDC hdc, real x, real y, real z,
  427.             int hsize, int vsize, int type);
  428. VOIDED     PolyMark3D (HDC hdc, int type, LPCOORD point, int n,
  429.             int hsize, int vsize, int htype);
  430.  
  431.  
  432. VOIDED    Polygon3D (HDC hdc, int type, LPCOORD vertex, int count);
  433. VOIDED    PolyPolygon3D (HDC hdc, int type, LPCOORD vertex,
  434.             LPINT polycount, int count);
  435. VOIDED    Polyline3D (HDC hdc, int type, LPCOORD point, int count);
  436. VOIDED  ClosedPolyline3D (HDC hdc, int type, LPCOORD point, int count);
  437. VOIDED    MarkPosition3D (HDC hdc, real x, real y, real z, real size, int type);
  438. VOIDED    Pointer3D (HDC hdc, real x1, real y1, real z1, real x2, real y2,
  439.             real z2, real l, real w, int type);
  440. VOIDED    Arrow3D (HDC hdc, real x, real y, real z, real u, real v, real w,
  441.             real r, real l, real t, int type);
  442. VOIDED    Net3D (HDC hdc, int type, LPCOORD point, int m, int n);
  443.  
  444. /*****************************************************************************
  445.  
  446.                         Shading Functions
  447.  
  448. *****************************************************************************/
  449.  
  450. VOIDED    ResetShader (void);
  451.  
  452. /* depth buffer functions */
  453. BINARY    SetDepthBuffer (int hview);
  454. BINARY    SelectDepthBuffer (int hview);
  455. BINARY    FreeDepthBuffer (int hview);
  456. VOIDED    ClearDepthBuffer (WORD val);
  457.  
  458. /* light functions */
  459. BINARY    CopyLight (int lid1, int lid2);
  460. BINARY    ResetLight (int lid);
  461. SHORT    CreateLight (LPSTR name, int type);
  462. VOIDED    DeleteLight (int lid);
  463. SHORT    SelectLight (int lid);
  464. BINARY    CopyLModel (int lmid1, int lmid2);
  465. SHORT    CreateLModel (LPSTR name);
  466. VOIDED    DeleteLModel (int lmid);
  467. SHORT    SelectLModel (int lmid);
  468. SHORT    GetLightType (int lid);
  469. BINARY    SwitchLight (int lid, int status);
  470. BINARY    SetLightCoordinateType (int lid, int type);
  471.  
  472. /* material functions */
  473. SHORT    CreateMaterial (LPSTR name);
  474. VOIDED    DeleteMaterial (int mid);
  475. SHORT    SelectMaterial (int mid);
  476. BINARY    CopyMaterial (int mid1, int mid2);
  477. BINARY    ResetMaterial (int mid);
  478.  
  479. /* shading parameter functions */
  480. SHORT    ShadingOption (int id, int opt, int status);
  481. COLORREF WINAPI    _ShadingColor (int id, int type, COLORREF color);
  482. #define    ShadingColor(id,type,color)    _ShadingColor (id, type, (COLORREF) color)
  483. FLOAT    ShadingFactor (int id, int type, float f);
  484. BINARY    ShadingParameter (int id, int type, BOOL inquire, VECTOR param);
  485.  
  486. HPALETTE WINAPI    SetRGBPalette (void);
  487.  
  488. /* shading primitive functions */
  489. BINARY    _ShadeFacet (HDC hdc, VECTOR normal, int type, LPCOORD vertex, int count, LPVECT3 param);
  490. #define    ShadeFacet(hdc, normal, type, vertex, count, param)    \
  491. _ShadeFacet (hdc, normal, type, (LPCOORD) vertex, count, param)
  492. BINARY    _ShadePolygon (HDC hdc, VECTOR normal, int type, LPCOORD point, int count);
  493. #define    ShadePolygon(hdc, normal, type, point, count)    \
  494. _ShadePolygon(hdc, normal, type, (LPCOORD) point, count)
  495. BINARY    _ShadePolyPolygon (HDC hdc, VECTOR normal, int type, LPCOORD vertex, LPINT pcount, int count);
  496. #define    ShadePolyPolygon(hdc, normal, type, vertex, pcount, count)    \
  497. _ShadePolyPolygon (hdc, normal, type, (LPCOORD) vertex, pcount, count)
  498.  
  499. BINARY    ShadingPreview (HDC hdc, LPRECT rect, real r, real d);
  500.  
  501. /* programmable shader functions */
  502. VOIDED    GetPixelPosition (LPINT x, LPINT y);
  503. VOIDED    GetPixelViewNormal (VECTOR normal);
  504. VOIDED    GetPixelWorldNormal (VECTOR normal);
  505. VOIDED    GetPixelObjectNormal (VECTOR normal);
  506. VOIDED    GetPixelViewCoordinate (VECTOR coord);
  507. VOIDED    GetPixelWorldCoordinate (VECTOR coord);
  508. VOIDED    GetPixelObjectCoordinate (VECTOR coord);
  509. VOIDED    GetPixelViewCameraAxis (VECTOR vaxis);
  510. VOIDED    GetPixelWorldCameraAxis (VECTOR vaxis);
  511. VOIDED    GetPixelObjectCameraAxis (VECTOR vaxis);
  512.  
  513. VOIDED    SetPerturbation (int type, FARPROC proc);
  514. BINARY    SolidTexture (int type);
  515.  
  516. /*****************************************************************************
  517.  
  518.                 Image Mapping and Printing Functions
  519.  
  520. *****************************************************************************/
  521.  
  522. typedef int (WINAPI *DRAWPROC)(HDC);
  523.  
  524. #define    VL_FLUSHTOP        0x0001
  525. #define    VL_FLUSHBOTTOM    0x0002
  526. #define    VL_FLUSHLEFT    0x0004
  527. #define    VL_FLUSHRIGHT    0x0008
  528.  
  529. #define    VL_HORZFIT        0x0010
  530. #define    VL_VERTFIT        0x0020
  531. #define    VL_ALLFIT        0x0030
  532. #define    VL_HORZCENTER    0x0040
  533. #define    VL_VERTCENTER    0x0080
  534.  
  535. #define    VL_HORZSCALED    0x0100
  536. #define    VL_VERTSCALED    0x0200
  537. #define    VL_BESTFIT        0x0400
  538. #define    VL_USE31APIS    0x0800
  539.  
  540. #define    VL_MILLIMETER    0x1000
  541. #define    VL_CENTIMETER    0x2000
  542. #define    VL_MARKCORNER    0x4000
  543. #define    VL_MARKPAGE        0x8000
  544.  
  545. BINARY    ReadDIBFile (LPSTR fname, LPHANDLE hdib);
  546. HANDLE    WINAPI    ScreenToDIB (LPRECT rect);
  547. BINARY    WriteDIBFile (LPSTR fname, HANDLE hdib);
  548. BINARY    SetPrintRect (HDC hdc, LPRECT rect, int mode, double x, double y,
  549.             double w, double h, int bw, int bh);
  550. VOIDED    GetScreenRect (HWND hwnd, BOOL withframe, LPRECT rect);
  551. BINARY    PrintImage (HANDLE hdib, WORD mode, real x, real y, real w, real h);
  552. BINARY    PrintDrawing (DRAWPROC draw, WORD mode,
  553.             real x, real y, real w, real h);
  554. BINARY    ImageMap2D (HDC hdc, HGLOBAL hdib, int type, LPCOORD vertex);
  555. BINARY    ImageMap3D (HDC hdc, HGLOBAL hdib, int type, LPCOORD vertex);
  556.  
  557.  
  558. /* text parameter */
  559. #define    VL_TEXT_HEIGHT            0x0001
  560. #define    VL_TEXT_ASPECT            0x0002
  561. #define    VL_TEXT_THICKNESS        0x0004
  562.  
  563. FLOAT    TextParameter (int type, float param);
  564. BINARY    SelectFont (void);
  565. BINARY    SetFont (const LPLOGFONT lplf);
  566. BINARY    Text2D (HDC hdc, real x, real y, real a, LPSTR text);
  567. BINARY    Text3D (HDC hdc, real x, real y, real a, LPSTR text);
  568. BINARY    SolidText (HDC hdc, LPSTR text);
  569.  
  570. /*****************************************************************************
  571.  
  572.                     2D Curve Functions
  573.  
  574. *****************************************************************************/
  575.  
  576. VOIDED  QBezierCurve2D (HDC hdc, int type, LPCOORD poly);
  577. VOIDED  QBSplineCurve2D (HDC hdc, int type, LPCOORD poly, int n);
  578. VOIDED  QNURBSCurve2D (HDC hdc, int type, LPCOORD poly, int n, VECTOR knot);
  579.  
  580. VOIDED  BezierCurve2D (HDC hdc, int type, LPCOORD poly);
  581. VOIDED  HermitCurve2D (HDC hdc, int type, LPCOORD poly);
  582. VOIDED  BSplineCurve2D (HDC hdc, int type, LPCOORD poly, int n);
  583. VOIDED  NURBSCurve2D (HDC hdc, int type, LPCOORD poly, int n, VECTOR knot);
  584. VOIDED  SplineInterp2D (HDC hdc, int type, LPCOORD poly, int n);
  585.  
  586. VOIDED  BSplineCurveClosed2D (HDC hdc, int type, LPCOORD poly, int n);
  587. VOIDED  NURBSCurveClosed2D (HDC hdc, int type, LPCOORD poly,
  588.             int n, VECTOR knot);
  589.  
  590. VOIDED    CatmullRomSpline2D (HDC hdc, int type, LPCOORD poly, int n);
  591.  
  592.  
  593. /*****************************************************************************
  594.  
  595.                     3D Curve Functions
  596.  
  597. *****************************************************************************/
  598.  
  599. VOIDED  QBezierCurve3D (HDC hdc, int type, LPCOORD poly);
  600. VOIDED  QBSplineCurve3D (HDC hdc, int type, LPCOORD poly, int n);
  601. VOIDED  QNURBSCurve3D (HDC hdc, int type, LPCOORD poly, int n, VECTOR knot);
  602. VOIDED  BezierCurve3D (HDC hdc, int type, LPCOORD poly);
  603. VOIDED    HermitCurve3D (HDC hdc, int type, LPCOORD poly);
  604. VOIDED  BSplineCurve3D (HDC hdc, int type, LPCOORD poly, int n);
  605. VOIDED  NURBSCurve3D (HDC hdc, int type, LPCOORD poly, int n, VECTOR knot);
  606. VOIDED  SplineInterp3D (HDC hdc, int type, LPCOORD poly, int n);
  607. VOIDED  BSplineCurveClosed3D (HDC hdc, int type, LPCOORD poly, int n);
  608. VOIDED  NURBSCurveClosed3D (HDC hdc, int type, LPCOORD poly,
  609.             int n, VECTOR knot);
  610. VOIDED    CatmullRomSpline3D (HDC hdc, int type, LPCOORD poly, int n);
  611. VOIDED    Spring (HDC hdc, int n, real radius, real height);
  612.  
  613. /*****************************************************************************
  614.  
  615.                         Vertex Functions
  616.  
  617. *****************************************************************************/
  618.  
  619. SHORT   CircleSide (short side);
  620. VOIDED    TransfVertex (int type, real x, real y, real a,
  621.             real sx, real sy, lpreal vertex, int n);
  622. SHORT    RectangleVertex (int type, real x1, real y1, real x2, real y2,
  623.             lpreal vertex);
  624. SHORT    BoxVertex (int type, real x, real y, real t, real sx, real sy,
  625.             lpreal vertex);
  626. SHORT   NgonVertex (int type, real x, real y, real t, real rx, real ry,
  627.             int n, lpreal vertex);
  628. SHORT    FlowerVertex (int type, real x, real y, real t, real rx, real ry,
  629.             int n, real r, lpreal vertex);
  630. SHORT    StarVertex (int type, real x, real y, real t, real rx, real ry,
  631.             int n, lpreal vertex);
  632. SHORT    ArcVertex (int type, real x, real y, real t, real rx, real ry,
  633.             int n, real a, real b, lpreal vertex);
  634. SHORT    WedgeVertex (int type, real x, real y, real t, real rx, real ry,
  635.             int n, real a, real b, lpreal vertex);
  636. SHORT    RingVertex (int type, real x, real y, real t, real rx, real ry,
  637.             int n, real a, real b, real w, lpreal vertex);
  638. SHORT    RoseVertex (int type, real x, real y, real a, real r, int m,
  639.             int n, lpreal vertex);
  640.  
  641. /*****************************************************************************
  642.  
  643.                 2D Primitive Functions
  644.  
  645. *****************************************************************************/
  646.  
  647. VOIDED  Rectangle2D (HDC hdc, real x1, real y1, real x2, real y2);
  648. VOIDED    Box2D (HDC hdc, real x, real y, real t, real w, real h);
  649. VOIDED  Disk2D (HDC hdc, real x, real y, real t, real rx, real ry);
  650. VOIDED  Wedge2D (HDC hdc, real x, real y, real t,
  651.             real rx, real ry, real a, real b);
  652. VOIDED  Ring2D (HDC hdc, real x, real y, real t,
  653.             real rx, real ry, real a, real b, real w);
  654. VOIDED    Bow2D (HDC hdc, real x, real y, real t,
  655.             real rx, real ry, real a, real b);
  656. VOIDED  Ngon2D (HDC hdc, real x, real y, real t, real rx, real ry, int n);
  657. VOIDED  Flower2D (HDC hdc, real x, real y, real t,
  658.             real rx, real ry, int n, real ratio);
  659. VOIDED  Star2D (HDC hdc, real x, real y, real t, real rx, real ry, int n);
  660. VOIDED  Arc2D (HDC hdc, real x, real y, real t,
  661.             real rx, real ry, real a, real b);
  662. VOIDED    Rose2D (HDC hdc, real x, real y, real t, real r, int m, int n);
  663.  
  664. VOIDED    Spiral2D (HDC hdc, real x, real y, real a, real b, real r, real dr);
  665.  
  666.  
  667. /*****************************************************************************
  668.  
  669.                 3D Primitive Functions
  670.  
  671. *****************************************************************************/
  672.  
  673. VOIDED  Rectangle3D (HDC hdc, real x1, real y1, real x2, real y2);
  674. VOIDED  Box3D (HDC hdc, real x, real y, real t, real sx, real sy);
  675. VOIDED    Ring3D (HDC hdc, real x, real y, real t,
  676.             real rx, real ry, real a, real b, real w);
  677. VOIDED  Disk3D (HDC hdc, real x, real y, real t, real rx, real ry);
  678. VOIDED  Wedge3D (HDC hdc, real x, real y, real t,
  679.             real rx, real ry, real a, real b);
  680. VOIDED  Bow3D (HDC hdc, real x, real y, real t,
  681.             real rx, real ry, real a, real b);
  682. VOIDED  Ngon3D (HDC hdc, real x, real y, real t, real rx, real ry, int n);
  683. VOIDED  Flower3D (HDC hdc, real x, real y, real t,
  684.             real rx, real ry, int n, real r);
  685. VOIDED  Star3D (HDC hdc, real x, real y, real t, real rx, real ry, int n);
  686.  
  687. VOIDED  Arc3D (HDC hdc, real x, real y, real t,
  688.             real rx, real ry, real a, real b);
  689. VOIDED    Rose3D (HDC hdc, real x, real y, real t, real r, int m, int n);
  690.  
  691. VOIDED  Spiral3D (HDC hdc, real a, real b, real r, real dr, real h);
  692. VOIDED    Spring3D (HDC hdc, real a, real b, real r, real h);
  693.  
  694.  
  695. /*****************************************************************************
  696.  
  697.                 3D Surface Functions
  698.  
  699. *****************************************************************************/
  700.  
  701. BINARY    BezierSurface (HDC hdc, int type, LPCOORD poly, int ns, int nt);
  702. BINARY    HermitSurface (HDC hdc, int type, LPCOORD poly, int ns, int nt);
  703. BINARY    BSplineSurface (HDC hdc, int type, LPCOORD poly,
  704.             int Sc, int Tc, int ns, int nt);
  705. BINARY    NURBSSurface (HDC hdc, int type, LPCOORD poly,
  706.             int Sc, int Tc, VECTOR Skn, VECTOR Tkn, int ns, int nt);
  707.  
  708. BINARY    CoonsPatch (HDC hdc, int type, LPCOORD point, int nu, int nv);
  709.  
  710. /*****************************************************************************
  711.  
  712.                             Solid Primitive Functions
  713.  
  714. *****************************************************************************/
  715.  
  716. BINARY    Cube (HDC hdc, real w, real l, real h);
  717. BINARY    Cylinder (HDC hDC, real rx, real ry, real h);
  718. BINARY    Cone (HDC hDC, real rx, real ry, real h);
  719. BINARY    Ellipsoid (HDC hdc, real a, real b, real c);
  720. BINARY    Sphere (HDC hdc, real r);
  721. BINARY    HemiSphere (HDC hdc, real r, real h);
  722. BINARY    SolidStar (HDC hdc, int n, real rx, real ry, real h);
  723. BINARY    SolidFlower (HDC hdc, int n, real r, real rx, real ry, real h);
  724. BINARY    Wedge (HDC hdc, real rx, real ry, real h, real a, real b);
  725. BINARY    Frustum (HDC hdc, real bw, real bl, real tw, real tl, real h);
  726. BINARY    Ridge (HDC hdc, real w, real l, real h, real r);
  727. BINARY    Prism (HDC hdc, int type, LPCOORD base, int n, real h);
  728. BINARY    Pyramid (HDC hdc, LPPOINT3D base, int n, LPPOINT3D tip);
  729. BINARY    WedgedCone (HDC hdc, real rx, real ry, real h, real a, real b);
  730. BINARY    WedgedCylinder (HDC hdc, real rx, real ry, real h,
  731.             real tr, real a, real b);
  732. BINARY    WedgedSphere (HDC hdc, real rx, real ry, real rz,
  733.             real a1, real a2, real b1, real b2);
  734. BINARY    WedgedTorus (HDC hdc, real r1, real r2,
  735.             real a1, real a2, real b1, real b2);
  736.  
  737. BINARY    Torus (HDC hdc, real r1, real r2);
  738.  
  739. BINARY    Ring (HDC hdc, real rtop, real rbot, real t, real h, real a, real b, real ratio);
  740. BINARY    Tube (HDC hdc, real rtop, real rbot, real t, real h);
  741. BINARY    Tetrahedron (HDC hdc, real r);
  742. BINARY    Octahedron (HDC hdc, real r);
  743. BINARY    Dodecahedron (HDC hdc, real r);
  744. BINARY  Icosahedron (HDC hdc, real r);
  745.  
  746. /*****************************************************************************
  747.  
  748.                             Object Array Functions
  749.  
  750. *****************************************************************************/
  751.  
  752. typedef    BOOL (WINAPI *RectArrayProc)(HDC hdc, int row, int col);
  753. typedef BOOL (WINAPI *CubicArrayProc)(HDC hdc, int row, int col, int lev);
  754. typedef    BOOL (WINAPI *PolarArrayProc)(HDC hdc, int row, int col);
  755. typedef    BOOL (WINAPI *CylindricArrayProc)(HDC hdc, int row, int col, int lev);
  756. typedef BOOL (WINAPI *SphericArrayProc)(HDC hdc, int row, int col, int lev);
  757.  
  758. BINARY    RectangularArray (HDC hdc, int m, int n,
  759.             real xinc, real yinc, RectArrayProc fp);
  760. BINARY    CubicArray (HDC hdc, int m, int n, int l,
  761.             real xinc, real yinc, real zinc, CubicArrayProc fp);
  762. BINARY    PolarArray (HDC hdc, int m, int n,
  763.             real roff, real ainc, real rinc, PolarArrayProc);
  764. BINARY    CylindricArray (HDC hdc, int m, int n, int l,
  765.             real roff, real ainc, real rinc, real zinc,
  766.             CylindricArrayProc fp);
  767. BINARY    SphericArray (HDC hdc, int m, int n, int l,
  768.             real roff, real toff, real ainc, real rinc, real tinc,
  769.             SphericArrayProc fp);
  770.  
  771.