home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_tools / v_lib205 / visualib.h < prev    next >
C/C++ Source or Header  |  1994-03-20  |  30KB  |  791 lines

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