home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / extensions / server / PEX / include / ddpex3.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-15  |  30.3 KB  |  1,079 lines

  1. /* $XConsortium: ddpex3.h,v 5.1 91/02/16 09:57:37 rws Exp $ */
  2.  
  3. /***********************************************************
  4. Copyright 1989, 1990, 1991 by Sun Microsystems, Inc. and the X Consortium.
  5.  
  6.                         All Rights Reserved
  7.  
  8. Permission to use, copy, modify, and distribute this software and its 
  9. documentation for any purpose and without fee is hereby granted, 
  10. provided that the above copyright notice appear in all copies and that
  11. both that copyright notice and this permission notice appear in 
  12. supporting documentation, and that the names of Sun Microsystems,
  13. the X Consortium, and MIT not be used in advertising or publicity 
  14. pertaining to distribution of the software without specific, written 
  15. prior permission.  
  16.  
  17. SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
  18. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT 
  19. SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
  20. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  22. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  23. SOFTWARE.
  24.  
  25. ******************************************************************/
  26.  
  27. #include "ddpex.h"
  28.  
  29. #ifndef DDPEX3_H
  30. #define DDPEX3_H
  31.  
  32. /* just a reminder of what colours there are
  33.         IndexedColour
  34.         Rgb8Colour
  35.         Rgb16Colour
  36.         RgbFloatColour
  37.         HsvColour
  38.         HlsColour
  39.         CieColour
  40. */
  41.  
  42. /* First, some basic point type definitions */
  43. /* #define        DDPT_FLOAT        (0<<0) */
  44. #define        DDPT_SHORT        (1<<0)
  45. #define        DDPT_2D            (1<<1)
  46. #define        DDPT_3D            (2<<1)
  47. #define        DDPT_4D            (3<<1)
  48. #define        DDPT_NORMAL        (1<<3)
  49. #define        DDPT_EDGE        (1<<4)
  50. #define        DDPT_COLOUR        (7<<5)
  51. #define        DDPT_INDEXEDCOLOUR    (1<<5)
  52. #define        DDPT_RGB8COLOUR     (2<<5)
  53. #define        DDPT_RGB16COLOUR     (3<<5)
  54. #define        DDPT_RGBFLOATCOLOUR     (4<<5)
  55. #define        DDPT_HSVCOLOUR         (5<<5)
  56. #define        DDPT_HLSCOLOUR         (6<<5)
  57. #define        DDPT_CIECOLOUR         (7<<5)
  58.  
  59. /* 
  60.  * Now, some access macros 
  61.  * It is strongly recommended that these macros be used instead
  62.  * of accessing the fields directly.
  63.  */
  64. #define    DD_IsVertFloat(type)    (!((type) & DDPT_SHORT))
  65. #define DD_IsVertShort(type)    ((type) & DDPT_SHORT)
  66. #define DD_IsVert2D(type)    (((type) & DDPT_4D) == DDPT_2D)
  67. #define DD_IsVert3D(type)    (((type) & DDPT_4D) == DDPT_3D)
  68. #define DD_IsVert4D(type)    (((type) & DDPT_4D) == DDPT_4D)
  69. #define DD_IsVertNormal(type)    ((type) & DDPT_NORMAL)
  70. #define DD_IsVertEdge(type)    ((type) & DDPT_EDGE)
  71. #define DD_IsVertColour(type)    ((type) & DDPT_COLOUR)
  72. #define DD_IsVertIndexed(type)    (((type) & DDPT_COLOUR) == DDPT_INDEXEDCOLOUR)
  73. #define DD_IsVertRGB8(type)    (((type) & DDPT_COLOUR) == DDPT_RGB8COLOUR)
  74. #define DD_IsVertRGB16(type)    (((type) & DDPT_COLOUR) == DDPT_RGB16COLOUR)
  75. #define DD_IsVertRGBFLOAT(type)    (((type)&DDPT_COLOUR) == DDPT_RGBFLOATCOLOUR)
  76. #define DD_IsVertHSV(type)    (((type) & DDPT_COLOUR) == DDPT_HSVCOLOUR)
  77. #define DD_IsVertHLS(type)    (((type) & DDPT_COLOUR) == DDPT_HLSCOLOUR)
  78. #define DD_IsVertCIE(type)    (((type) & DDPT_COLOUR) == DDPT_CIECOLOUR)
  79.  
  80. #define DD_IsVertCoordsOnly(type)                     \
  81.     !((type & DDPT_COLOUR) || (type & DDPT_EDGE) || (type & DDPT_NORMAL)) 
  82.  
  83. /*
  84.  * These macros are used to change a vertex type
  85.  */
  86. #define    DD_SetVertFloat(type)    ((type) &= ~DDPT_SHORT)
  87. #define DD_SetVertShort(type)    ((type) |= DDPT_SHORT)
  88. #define DD_SetVert2D(type)    ((type) = (((type) & ~DDPT_4D) | DDPT_2D))
  89. #define DD_SetVert3D(type)    ((type) = (((type) & ~DDPT_4D) | DDPT_3D))
  90. #define DD_SetVert4D(type)    ((type) = (((type) & ~DDPT_4D) | DDPT_4D))
  91. #define DD_SetVertNormal(type)    ((type) |= DDPT_NORMAL)
  92. #define DD_SetVertEdge(type)    ((type) |= DDPT_EDGE)
  93. #define DD_SetVertIndexed(type)    ((type)=(((type) & ~DDPT_COLOUR) | DDPT_INDEXEDCOLOUR))
  94. #define DD_SetVertRGB8(type)    ((type)=(((type) & ~DDPT_COLOUR) | DDPT_RGB8COLOUR))
  95. #define DD_SetVertRGB16(type)    ((type)=(((type) & ~DDPT_COLOUR) | DDPT_RGB16COLOUR))
  96. #define DD_SetVertRGBFLOAT(type) ((type)=(((type) & ~DDPT_COLOUR) | DDPT_RGBFLOATCOLOUR))
  97. #define DD_SetVertHSV(type)    ((type)=(((type) & ~DDPT_COLOUR) | DDPT_HSVCOLOUR))
  98. #define DD_SetVertHLS(type)    ((type)=(((type) & ~DDPT_COLOUR) | DDPT_HLSCOLOUR))
  99. #define DD_SetVertCIE(type)    ((type)=(((type) & ~DDPT_COLOUR) | DDPT_CIECOLOUR))
  100.  
  101. #define    DD_UnSetVertFloat(type)        ((type) |= DDPT_SHORT)
  102. #define DD_UnSetVertShort(type)        ((type) &= ~DDPT_SHORT)
  103. #define DD_UnSetVert2D(type)        ((type) &= ~DDPT_4D)
  104. #define DD_UnSetVert3D(type)        ((type) &= ~DDPT_4D)
  105. #define DD_UnSetVert4D(type)        ((type) &= ~DDPT_4D)
  106. #define DD_UnSetVertCoord(type)        ((type) &= ~(DDPT_4D | DDPT_SHORT))
  107. #define DD_UnSetVertNormal(type)     ((type) &= ~DDPT_NORMAL)
  108. #define DD_UnSetVertEdge(type)        ((type) &= ~DDPT_EDGE)
  109. #define DD_UnSetColour(type)        ((type) &= ~DDPT_COLOUR)
  110. #define DD_UnSetVertIndexed(type)     ((type) &= ~DDPT_COLOUR)
  111. #define DD_UnSetVertRGB8(type)        ((type) &= ~DDPT_COLOUR)
  112. #define DD_UnSetVertRGB16(type)        ((type) &= ~DDPT_COLOUR)
  113. #define DD_UnSetVertRGBFLOAT(type)     ((type) &= ~DDPT_COLOUR)
  114. #define DD_UnSetVertHSV(type)        ((type) &= ~DDPT_COLOUR)
  115. #define DD_UnSetVertHLS(type)        ((type) &= ~DDPT_COLOUR)
  116. #define DD_UnSetVertCIE(type)        ((type) &= ~DDPT_COLOUR)
  117.  
  118.  
  119. /*
  120.  * A macro to compute the point size - very usefull when
  121.  * walking through a list of points and one isn't concerned
  122.  * about the actual details of the point data
  123.  */
  124. #define DD_VertPointSize(type, size)                    \
  125.        {                                \
  126.     if (DD_IsVertFloat(type)) {                    \
  127.       if (DD_IsVert2D(type)) size = sizeof(ddCoord2D);        \
  128.       else if (DD_IsVert3D(type)) size = sizeof(ddCoord3D);        \
  129.       else size = sizeof(ddCoord4D);                \
  130.     } else {                            \
  131.       if (DD_IsVert2D(type)) size = sizeof(ddCoord2DS);        \
  132.       else size = sizeof(ddCoord3DS);                \
  133.     }                                 \
  134.     if (DD_IsVertNormal(type)) size += sizeof(ddVector3D);        \
  135.     if (DD_IsVertColour(type)) {                    \
  136.       if (DD_IsVertIndexed(type)) size += sizeof(ddIndexedColour);    \
  137.       else if (DD_IsVertRGB8(type)) size += sizeof(ddRgb8Colour);    \
  138.       else if (DD_IsVertRGB16(type)) size += sizeof(ddRgb16Colour);    \
  139.       else size += sizeof(ddRgbFloatColour);            \
  140.     }                                 \
  141.     if (DD_IsVertEdge(type)) size += sizeof(ddULONG);        \
  142.        }
  143. /*
  144.  * The following macros find offets from the start
  145.  * of a structure in bytes to the desired vertex component.
  146.  * again, very usefull macros for routines that wish
  147.  * to access individual vertex components without necessarily
  148.  * knowing all the details of the vertex. Offset is set to -1 
  149.  * if the component does not exist in the vertex.
  150.  */
  151.  
  152. /* 
  153.  * Note that the color is always the first component following
  154.  * the vertex data.
  155.  */
  156. #define DD_VertOffsetColor(type, offset)                \
  157.     {                                \
  158.      if (!DD_IsVertColour((type))) (offset) = -1;            \
  159.      else                                 \
  160.        DD_VertPointSize(((type) & (DDPT_4D | DDPT_SHORT)),(offset));\
  161.     }
  162.  
  163. /*
  164.  * Note that the edge flag is always the last component in
  165.  * a vertex. Thus the offset is the size of the point minus
  166.  * the size of the edge field (a ddULONG).
  167.  */
  168. #define DD_VertOffsetEdge(type, offset)                    \
  169.     {                                \
  170.      if (!DD_IsVertEdge((type))) (offset) = -1;            \
  171.      else {                             \
  172.        DD_VertPointSize((type), (offset));                \
  173.        (offset) -= sizeof(ddULONG);                    \
  174.      }                                \
  175.     }
  176.  
  177. /*
  178.  * This one is the most complex as the normal is last unless
  179.  * there is an edge in which case it preceeds the edge flag.
  180.  */
  181. #define DD_VertOffsetNormal(type, offset)                \
  182.     {                                \
  183.      if (!DD_IsVertNormal((type))) (offset) = -1;            \
  184.      else {                             \
  185.        DD_VertPointSize((type), (offset));                \
  186.        if (DD_IsVertEdge((type))) (offset) -= sizeof(ddULONG);    \
  187.        (offset) -= sizeof(ddVector3D);                \
  188.      }                                \
  189.     }
  190.  
  191. /* Now create the point types */
  192. #define  DD_2DS_POINT           (DDPT_SHORT | DDPT_2D)
  193. #define  DD_2D_POINT            (DDPT_2D)
  194. #define  DD_3DS_POINT           (DDPT_SHORT | DDPT_3D)
  195. #define  DD_3D_POINT            (DDPT_3D)
  196. #define  DD_INDEX_POINT          (DDPT_3D | DDPT_INDEXEDCOLOUR)
  197. #define  DD_INDEX_POINT4D          (DDPT_4D | DDPT_INDEXEDCOLOUR)
  198. #define  DD_RGB8_POINT          (DDPT_3D | DDPT_RGB8COLOUR)
  199. #define  DD_RGB8_POINT4D          (DDPT_4D | DDPT_RGB8COLOUR)
  200. #define  DD_RGB16_POINT          (DDPT_3D | DDPT_RGB16COLOUR)
  201. #define  DD_RGB16_POINT4D          (DDPT_4D | DDPT_RGB16COLOUR)
  202. #define  DD_RGBFLOAT_POINT2DS          (DDPT_SHORT | DDPT_2D | DDPT_RGBFLOATCOLOUR)
  203. #define  DD_RGBFLOAT_POINT          (DDPT_3D | DDPT_RGBFLOATCOLOUR)
  204. #define  DD_RGBFLOAT_POINT4D          (DDPT_4D | DDPT_RGBFLOATCOLOUR)
  205. #define  DD_HSV_POINT2DS          (DDPT_SHORT | DDPT_2D | DDPT_HSVCOLOUR)
  206. #define  DD_HSV_POINT              (DDPT_3D | DDPT_HSVCOLOUR)
  207. #define  DD_HSV_POINT4D          (DDPT_4D | DDPT_HSVCOLOUR)
  208. #define  DD_HLS_POINT2DS          (DDPT_SHORT | DDPT_2D | DDPT_HLSCOLOUR)
  209. #define  DD_HLS_POINT              (DDPT_3D | DDPT_HLSCOLOUR)
  210. #define  DD_HLS_POINT4D          (DDPT_4D | DDPT_HLSCOLOUR)
  211. #define  DD_CIE_POINT2DS          (DDPT_SHORT | DDPT_2D | DDPT_CIECOLOUR)
  212. #define  DD_CIE_POINT              (DDPT_3D | DDPT_CIECOLOUR)
  213. #define  DD_CIE_POINT4D          (DDPT_4D | DDPT_CIECOLOUR)
  214. #define  DD_NORM_POINT2DS          (DDPT_SHORT | DDPT_2D | DDPT_NORMAL)
  215. #define  DD_NORM_POINT          (DDPT_3D | DDPT_NORMAL)
  216. #define  DD_NORM_POINT4D          (DDPT_4D | DDPT_NORMAL)
  217. #define  DD_EDGE_POINT2DS          (DDPT_SHORT | DDPT_2D | DDPT_EDGE)
  218. #define  DD_EDGE_POINT          (DDPT_3D | DDPT_EDGE)
  219. #define  DD_EDGE_POINT4D          (DDPT_4D | DDPT_EDGE)
  220. #define  DD_INDEX_NORM_POINT          (DDPT_3D | DDPT_NORMAL | DDPT_INDEXEDCOLOUR)
  221. #define  DD_INDEX_NORM_POINT4D      (DDPT_4D | DDPT_NORMAL | DDPT_INDEXEDCOLOUR)
  222. #define  DD_RGB8_NORM_POINT          (DDPT_3D | DDPT_NORMAL | DDPT_RGB8COLOUR)
  223. #define  DD_RGB8_NORM_POINT4D          (DDPT_4D | DDPT_NORMAL | DDPT_RGB8COLOUR)
  224. #define  DD_RGB16_NORM_POINT           (DDPT_3D | DDPT_NORMAL | DDPT_RGB16COLOUR)
  225. #define  DD_RGB16_NORM_POINT4D       (DDPT_4D | DDPT_NORMAL | DDPT_RGB16COLOUR)
  226. #define  DD_RGBFLOAT_NORM_POINT2DS       (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_RGBFLOATCOLOUR)
  227. #define  DD_RGBFLOAT_NORM_POINT       (DDPT_3D | DDPT_NORMAL | DDPT_RGBFLOATCOLOUR)
  228. #define  DD_RGBFLOAT_NORM_POINT4D       (DDPT_4D | DDPT_NORMAL | DDPT_RGBFLOATCOLOUR)
  229. #define  DD_HSV_NORM_POINT2DS          (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_HSVCOLOUR)
  230. #define  DD_HSV_NORM_POINT          (DDPT_3D | DDPT_NORMAL | DDPT_HSVCOLOUR)
  231. #define  DD_HSV_NORM_POINT4D          (DDPT_4D | DDPT_NORMAL | DDPT_HSVCOLOUR)
  232. #define  DD_HLS_NORM_POINT2DS          (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_HLSCOLOUR)
  233. #define  DD_HLS_NORM_POINT          (DDPT_3D | DDPT_NORMAL | DDPT_HLSCOLOUR)
  234. #define  DD_HLS_NORM_POINT4D          (DDPT_4D | DDPT_NORMAL | DDPT_HLSCOLOUR)
  235. #define  DD_CIE_NORM_POINT2DS          (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_CIECOLOUR)
  236. #define  DD_CIE_NORM_POINT          (DDPT_3D | DDPT_NORMAL | DDPT_CIECOLOUR)
  237. #define  DD_CIE_NORM_POINT4D          (DDPT_4D | DDPT_NORMAL | DDPT_CIECOLOUR)
  238. #define  DD_INDEX_EDGE_POINT          (DDPT_3D | DDPT_EDGE | DDPT_INDEXEDCOLOUR)
  239. #define  DD_INDEX_EDGE_POINT4D      (DDPT_4D | DDPT_EDGE | DDPT_INDEXEDCOLOUR)
  240. #define  DD_RGB8_EDGE_POINT          (DDPT_3D | DDPT_EDGE | DDPT_RGB8COLOUR)
  241. #define  DD_RGB8_EDGE_POINT4D          (DDPT_4D | DDPT_EDGE | DDPT_RGB8COLOUR)
  242. #define  DD_RGB16_EDGE_POINT          (DDPT_3D | DDPT_EDGE | DDPT_RGB16COLOUR)
  243. #define  DD_RGB16_EDGE_POINT4D      (DDPT_4D | DDPT_EDGE | DDPT_RGB16COLOUR)
  244. #define  DD_RGBFLOAT_EDGE_POINT2DS       (DDPT_SHORT | DDPT_2D | DDPT_EDGE | DDPT_RGBFLOATCOLOUR)
  245. #define  DD_RGBFLOAT_EDGE_POINT       (DDPT_3D | DDPT_EDGE | DDPT_RGBFLOATCOLOUR)
  246. #define  DD_RGBFLOAT_EDGE_POINT4D       (DDPT_4D | DDPT_EDGE | DDPT_RGBFLOATCOLOUR)
  247. #define  DD_HSV_EDGE_POINT2DS          (DDPT_SHORT | DDPT_2D | DDPT_EDGE | DDPT_HSVCOLOUR)
  248. #define  DD_HSV_EDGE_POINT          (DDPT_3D | DDPT_EDGE | DDPT_HSVCOLOUR)
  249. #define  DD_HSV_EDGE_POINT4D          (DDPT_4D | DDPT_EDGE | DDPT_HSVCOLOUR)
  250. #define  DD_HLS_EDGE_POINT2DS          (DDPT_SHORT | DDPT_2D | DDPT_EDGE | DDPT_HLSCOLOUR)
  251. #define  DD_HLS_EDGE_POINT          (DDPT_3D | DDPT_EDGE | DDPT_HLSCOLOUR)
  252. #define  DD_HLS_EDGE_POINT4D          (DDPT_4D | DDPT_EDGE | DDPT_HLSCOLOUR)
  253. #define  DD_CIE_EDGE_POINT2DS          (DDPT_SHORT | DDPT_2D | DDPT_EDGE | DDPT_CIECOLOUR)
  254. #define  DD_CIE_EDGE_POINT          (DDPT_3D | DDPT_EDGE | DDPT_CIECOLOUR)
  255. #define  DD_CIE_EDGE_POINT4D          (DDPT_4D | DDPT_EDGE | DDPT_CIECOLOUR)
  256. #define  DD_NORM_EDGE_POINT2DS      (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_EDGE )
  257. #define  DD_NORM_EDGE_POINT          (DDPT_3D | DDPT_NORMAL | DDPT_EDGE )
  258. #define  DD_NORM_EDGE_POINT4D          (DDPT_4D | DDPT_NORMAL | DDPT_EDGE )
  259. #define  DD_INDEX_NORM_EDGE_POINT      (DDPT_3D | DDPT_NORMAL | DDPT_EDGE | DDPT_INDEXEDCOLOUR)
  260. #define  DD_INDEX_NORM_EDGE_POINT4D      (DDPT_4D | DDPT_NORMAL | DDPT_EDGE | DDPT_INDEXEDCOLOUR)
  261. #define  DD_RGB8_NORM_EDGE_POINT      (DDPT_3D | DDPT_NORMAL | DDPT_EDGE | DDPT_RGB8COLOUR)
  262. #define  DD_RGB8_NORM_EDGE_POINT4D      (DDPT_4D | DDPT_NORMAL | DDPT_EDGE | DDPT_RGB8COLOUR)
  263. #define  DD_RGB16_NORM_EDGE_POINT      (DDPT_3D | DDPT_NORMAL | DDPT_EDGE | DDPT_RGB16COLOUR)
  264. #define  DD_RGB16_NORM_EDGE_POINT4D      (DDPT_4D | DDPT_NORMAL | DDPT_EDGE | DDPT_RGB16COLOUR)
  265. #define  DD_RGBFLOAT_NORM_EDGE_POINT2DS      (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_EDGE | DDPT_RGBFLOATCOLOUR)
  266. #define  DD_RGBFLOAT_NORM_EDGE_POINT      (DDPT_3D | DDPT_NORMAL | DDPT_EDGE | DDPT_RGBFLOATCOLOUR)
  267. #define  DD_RGBFLOAT_NORM_EDGE_POINT4D     (DDPT_4D | DDPT_NORMAL | DDPT_EDGE | DDPT_RGBFLOATCOLOUR)
  268. #define  DD_HSV_NORM_EDGE_POINT2DS       (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_EDGE | DDPT_HSVCOLOUR)
  269. #define  DD_HSV_NORM_EDGE_POINT       (DDPT_3D | DDPT_NORMAL | DDPT_EDGE | DDPT_HSVCOLOUR)
  270. #define  DD_HSV_NORM_EDGE_POINT4D       (DDPT_4D | DDPT_NORMAL | DDPT_EDGE | DDPT_HSVCOLOUR)
  271. #define  DD_HLS_NORM_EDGE_POINT2DS       (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_EDGE | DDPT_HLSCOLOUR)
  272. #define  DD_HLS_NORM_EDGE_POINT       (DDPT_3D | DDPT_NORMAL | DDPT_EDGE | DDPT_HLSCOLOUR)
  273. #define  DD_HLS_NORM_EDGE_POINT4D       (DDPT_4D | DDPT_NORMAL | DDPT_EDGE | DDPT_HLSCOLOUR)
  274. #define  DD_CIE_NORM_EDGE_POINT2DS       (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_EDGE | DDPT_CIECOLOUR)
  275. #define  DD_CIE_NORM_EDGE_POINT       (DDPT_3D | DDPT_NORMAL | DDPT_EDGE | DDPT_CIECOLOUR)
  276. #define  DD_CIE_NORM_EDGE_POINT4D       (DDPT_4D | DDPT_NORMAL | DDPT_EDGE | DDPT_CIECOLOUR)
  277. #define  DD_HOMOGENOUS_POINT          (DDPT_4D)
  278.  
  279. typedef ddUSHORT ddPointType;
  280.  
  281. /* 
  282.  * The point types correspond to the point types in the PEX protocol 
  283.  */
  284. typedef struct {
  285.     ddCoord3D    pt;
  286.     ddIndexedColour    colour;
  287. } ddIndexPoint;
  288.  
  289. typedef struct {
  290.     ddCoord3D    pt;
  291.     ddRgb8Colour    colour;
  292. } ddRgb8Point;
  293.  
  294. typedef struct {
  295.     ddCoord3D    pt;
  296.     ddRgb16Colour    colour;
  297. } ddRgb16Point;
  298.  
  299. typedef struct {
  300.     ddCoord2DS    pt;
  301.     ddRgbFloatColour    colour;
  302. } ddRgbFloatPoint2DS;
  303.  
  304. typedef struct {
  305.     ddCoord3D    pt;
  306.     ddRgbFloatColour    colour;
  307. } ddRgbFloatPoint;
  308.  
  309. typedef struct {
  310.     ddCoord2DS    pt;
  311.     ddHsvColour    colour;
  312. } ddHsvPoint2DS;
  313.  
  314. typedef struct {
  315.     ddCoord3D    pt;
  316.     ddHsvColour    colour;
  317. } ddHsvPoint;
  318.  
  319. typedef struct {
  320.     ddCoord2DS    pt;
  321.     ddHlsColour    colour;
  322. } ddHlsPoint2DS;
  323.  
  324. typedef struct {
  325.     ddCoord3D    pt;
  326.     ddHlsColour    colour;
  327. } ddHlsPoint;
  328.  
  329. typedef struct {
  330.     ddCoord2DS    pt;
  331.     ddCieColour    colour;
  332. } ddCiePoint2DS;
  333.  
  334. typedef struct {
  335.     ddCoord3D    pt;
  336.     ddCieColour    colour;
  337. } ddCiePoint;
  338.  
  339. typedef struct {
  340.     ddCoord2DS    pt;
  341.     ddVector3D    normal;
  342. } ddNormalPoint2DS;
  343.  
  344. typedef struct {
  345.     ddCoord3D    pt;
  346.     ddVector3D    normal;
  347. } ddNormalPoint;
  348.  
  349. typedef struct {
  350.     ddCoord2DS    pt;
  351.     ddULONG        edge;
  352. } ddEdgePoint2DS;
  353.  
  354. typedef struct {
  355.     ddCoord3D    pt;
  356.     ddULONG        edge;
  357. } ddEdgePoint;
  358.  
  359. typedef struct {
  360.     ddCoord3D    pt;
  361.     ddIndexedColour    colour;
  362.     ddVector3D    normal;
  363. } ddIndexNormalPoint;
  364.  
  365. typedef struct {
  366.     ddCoord3D    pt;
  367.     ddRgb8Colour    colour;
  368.     ddVector3D    normal;
  369. } ddRgb8NormalPoint;
  370.  
  371. typedef struct {
  372.     ddCoord3D    pt;
  373.     ddRgb16Colour    colour;
  374.     ddVector3D    normal;
  375. } ddRgb16NormalPoint;
  376.  
  377. typedef struct {
  378.     ddCoord2DS    pt;
  379.     ddRgbFloatColour    colour;
  380.     ddVector3D    normal;
  381. } ddRgbFloatNormalPoint2DS;
  382.  
  383. typedef struct {
  384.     ddCoord3D    pt;
  385.     ddRgbFloatColour    colour;
  386.     ddVector3D    normal;
  387. } ddRgbFloatNormalPoint;
  388.  
  389. typedef struct {
  390.     ddCoord2DS    pt;
  391.     ddHsvColour    colour;
  392.     ddVector3D    normal;
  393. } ddHsvNormalPoint2DS;
  394.  
  395. typedef struct {
  396.     ddCoord3D    pt;
  397.     ddHsvColour    colour;
  398.     ddVector3D    normal;
  399. } ddHsvNormalPoint;
  400.  
  401. typedef struct {
  402.     ddCoord2DS    pt;
  403.     ddHlsColour    colour;
  404.     ddVector3D    normal;
  405. } ddHlsNormalPoint2DS;
  406.  
  407. typedef struct {
  408.     ddCoord3D    pt;
  409.     ddHlsColour    colour;
  410.     ddVector3D    normal;
  411. } ddHlsNormalPoint;
  412.  
  413. typedef struct {
  414.     ddCoord2DS    pt;
  415.     ddCieColour    colour;
  416.     ddVector3D    normal;
  417. } ddCieNormalPoint2DS;
  418.  
  419. typedef struct {
  420.     ddCoord3D    pt;
  421.     ddCieColour    colour;
  422.     ddVector3D    normal;
  423. } ddCieNormalPoint;
  424.  
  425. typedef struct {
  426.     ddCoord3D    pt;
  427.     ddIndexedColour    colour;
  428.     ddULONG        edge;
  429. } ddIndexEdgePoint;
  430.  
  431. typedef struct {
  432.     ddCoord3D    pt;
  433.     ddRgb8Colour    colour;
  434.     ddULONG        edge;
  435. } ddRgb8EdgePoint;
  436.  
  437. typedef struct {
  438.     ddCoord3D    pt;
  439.     ddRgb16Colour    colour;
  440.     ddULONG        edge;
  441. } ddRgb16EdgePoint;
  442.  
  443. typedef struct {
  444.     ddCoord2DS    pt;
  445.     ddRgbFloatColour    colour;
  446.     ddULONG        edge;
  447. } ddRgbFloatEdgePoint2DS;
  448.  
  449. typedef struct {
  450.     ddCoord3D    pt;
  451.     ddRgbFloatColour    colour;
  452.     ddULONG        edge;
  453. } ddRgbFloatEdgePoint;
  454.  
  455. typedef struct {
  456.     ddCoord2DS    pt;
  457.     ddHsvColour    colour;
  458.     ddULONG        edge;
  459. } ddHsvEdgePoint2DS;
  460.  
  461. typedef struct {
  462.     ddCoord3D    pt;
  463.     ddHsvColour    colour;
  464.     ddULONG        edge;
  465. } ddHsvEdgePoint;
  466.  
  467. typedef struct {
  468.     ddCoord2DS    pt;
  469.     ddHlsColour    colour;
  470.     ddULONG        edge;
  471. } ddHlsEdgePoint2DS;
  472.  
  473. typedef struct {
  474.     ddCoord3D    pt;
  475.     ddHlsColour    colour;
  476.     ddULONG        edge;
  477. } ddHlsEdgePoint;
  478.  
  479. typedef struct {
  480.     ddCoord2DS    pt;
  481.     ddCieColour    colour;
  482.     ddULONG        edge;
  483. } ddCieEdgePoint2DS;
  484.  
  485. typedef struct {
  486.     ddCoord3D    pt;
  487.     ddCieColour    colour;
  488.     ddULONG        edge;
  489. } ddCieEdgePoint;
  490.  
  491. typedef struct {
  492.     ddCoord2DS       pt;
  493.     ddVector3D    normal;
  494.     ddULONG        edge;
  495. } ddNormEdgePoint2DS;
  496.  
  497. typedef struct {
  498.     ddCoord3D       pt;
  499.     ddVector3D    normal;
  500.     ddULONG        edge;
  501. } ddNormEdgePoint;
  502.  
  503. typedef struct {
  504.     ddCoord3D    pt;
  505.     ddIndexedColour    colour;
  506.     ddVector3D    normal;
  507.     ddULONG        edge;
  508. } ddIndexNormEdgePoint;
  509.  
  510. typedef struct {
  511.     ddCoord3D    pt;
  512.     ddRgb8Colour    colour;
  513.     ddVector3D    normal;
  514.     ddULONG        edge;
  515. } ddRgb8NormEdgePoint;
  516.  
  517. typedef struct {
  518.     ddCoord3D    pt;
  519.     ddRgb16Colour    colour;
  520.     ddVector3D    normal;
  521.     ddULONG        edge;
  522. } ddRgb16NormEdgePoint;
  523.  
  524. typedef struct {
  525.     ddCoord2DS    pt;
  526.     ddRgbFloatColour    colour;
  527.     ddVector3D    normal;
  528.     ddULONG        edge;
  529. } ddRgbFloatNormEdgePoint2DS;
  530.  
  531. typedef struct {
  532.     ddCoord3D    pt;
  533.     ddRgbFloatColour    colour;
  534.     ddVector3D    normal;
  535.     ddULONG        edge;
  536. } ddRgbFloatNormEdgePoint;
  537.  
  538. typedef struct {
  539.     ddCoord2DS    pt;
  540.     ddHsvColour    colour;
  541.     ddVector3D    normal;
  542.     ddULONG        edge;
  543. } ddHsvNormEdgePoint2DS;
  544.  
  545. typedef struct {
  546.     ddCoord3D    pt;
  547.     ddHsvColour    colour;
  548.     ddVector3D    normal;
  549.     ddULONG        edge;
  550. } ddHsvNormEdgePoint;
  551.  
  552. typedef struct {
  553.     ddCoord2DS    pt;
  554.     ddHlsColour    colour;
  555.     ddVector3D    normal;
  556.     ddULONG        edge;
  557. } ddHlsNormEdgePoint2DS;
  558.  
  559. typedef struct {
  560.     ddCoord3D    pt;
  561.     ddHlsColour    colour;
  562.     ddVector3D    normal;
  563.     ddULONG        edge;
  564. } ddHlsNormEdgePoint;
  565.  
  566. typedef struct {
  567.     ddCoord2DS    pt;
  568.     ddCieColour    colour;
  569.     ddVector3D    normal;
  570.     ddULONG        edge;
  571. } ddCieNormEdgePoint2DS;
  572.  
  573. typedef struct {
  574.     ddCoord3D    pt;
  575.     ddCieColour    colour;
  576.     ddVector3D    normal;
  577.     ddULONG        edge;
  578. } ddCieNormEdgePoint;
  579.  
  580. /* 
  581.  * The point types are internal point types only.
  582.  */
  583.  
  584. typedef struct {
  585.     ddCoord4D    pt;
  586.     ddIndexedColour    colour;
  587. } ddIndexPoint4D;
  588.  
  589. typedef struct {
  590.     ddCoord4D    pt;
  591.     ddRgb8Colour    colour;
  592. } ddRgb8Point4D;
  593.  
  594. typedef struct {
  595.     ddCoord4D    pt;
  596.     ddRgb16Colour    colour;
  597. } ddRgb16Point4D;
  598.  
  599. typedef struct {
  600.     ddCoord4D    pt;
  601.     ddRgbFloatColour    colour;
  602. } ddRgbFloatPoint4D;
  603.  
  604. typedef struct {
  605.     ddCoord4D    pt;
  606.     ddHsvColour    colour;
  607. } ddHsvPoint4D;
  608.  
  609. typedef struct {
  610.     ddCoord4D    pt;
  611.     ddHlsColour    colour;
  612. } ddHlsPoint4D;
  613.  
  614. typedef struct {
  615.     ddCoord4D    pt;
  616.     ddCieColour    colour;
  617. } ddCiePoint4D;
  618.  
  619. typedef struct {
  620.     ddCoord4D    pt;
  621.     ddVector3D    normal;
  622. } ddNormalPoint4D;
  623.  
  624. typedef struct {
  625.     ddCoord4D    pt;
  626.     ddULONG        edge;
  627. } ddEdgePoint4D;
  628.  
  629. typedef struct {
  630.     ddCoord4D    pt;
  631.     ddIndexedColour    colour;
  632.     ddVector3D    normal;
  633. } ddIndexNormalPoint4D;
  634.  
  635. typedef struct {
  636.     ddCoord4D    pt;
  637.     ddRgb8Colour    colour;
  638.     ddVector3D    normal;
  639. } ddRgb8NormalPoint4D;
  640.  
  641. typedef struct {
  642.     ddCoord4D    pt;
  643.     ddRgb16Colour    colour;
  644.     ddVector3D    normal;
  645. } ddRgb16NormalPoint4D;
  646.  
  647. typedef struct {
  648.     ddCoord4D    pt;
  649.     ddRgbFloatColour    colour;
  650.     ddVector3D    normal;
  651. } ddRgbFloatNormalPoint4D;
  652.  
  653. typedef struct {
  654.     ddCoord4D    pt;
  655.     ddHsvColour    colour;
  656.     ddVector3D    normal;
  657. } ddHsvNormalPoint4D;
  658.  
  659. typedef struct {
  660.     ddCoord4D    pt;
  661.     ddHlsColour    colour;
  662.     ddVector3D    normal;
  663. } ddHlsNormalPoint4D;
  664.  
  665. typedef struct {
  666.     ddCoord4D    pt;
  667.     ddCieColour    colour;
  668.     ddVector3D    normal;
  669. } ddCieNormalPoint4D;
  670.  
  671. typedef struct {
  672.     ddCoord4D    pt;
  673.     ddIndexedColour    colour;
  674.     ddULONG        edge;
  675. } ddIndexEdgePoint4D;
  676.  
  677. typedef struct {
  678.     ddCoord4D    pt;
  679.     ddRgb8Colour    colour;
  680.     ddULONG        edge;
  681. } ddRgb8EdgePoint4D;
  682.  
  683. typedef struct {
  684.     ddCoord4D    pt;
  685.     ddRgb16Colour    colour;
  686.     ddULONG        edge;
  687. } ddRgb16EdgePoint4D;
  688.  
  689. typedef struct {
  690.     ddCoord4D    pt;
  691.     ddRgbFloatColour    colour;
  692.     ddULONG        edge;
  693. } ddRgbFloatEdgePoint4D;
  694.  
  695. typedef struct {
  696.     ddCoord4D    pt;
  697.     ddHsvColour    colour;
  698.     ddULONG        edge;
  699. } ddHsvEdgePoint4D;
  700.  
  701. typedef struct {
  702.     ddCoord4D    pt;
  703.     ddHlsColour    colour;
  704.     ddULONG        edge;
  705. } ddHlsEdgePoint4D;
  706.  
  707. typedef struct {
  708.     ddCoord4D    pt;
  709.     ddCieColour    colour;
  710.     ddULONG        edge;
  711. } ddCieEdgePoint4D;
  712.  
  713. typedef struct {
  714.     ddCoord4D       pt;
  715.     ddVector3D    normal;
  716.     ddULONG        edge;
  717. } ddNormEdgePoint4D;
  718.  
  719. typedef struct {
  720.     ddCoord4D    pt;
  721.     ddIndexedColour    colour;
  722.     ddVector3D    normal;
  723.     ddULONG        edge;
  724. } ddIndexNormEdgePoint4D;
  725.  
  726. typedef struct {
  727.     ddCoord4D    pt;
  728.     ddRgb8Colour    colour;
  729.     ddVector3D    normal;
  730.     ddULONG        edge;
  731. } ddRgb8NormEdgePoint4D;
  732.  
  733. typedef struct {
  734.     ddCoord4D    pt;
  735.     ddRgb16Colour    colour;
  736.     ddVector3D    normal;
  737.     ddULONG        edge;
  738. } ddRgb16NormEdgePoint4D;
  739.  
  740. typedef struct {
  741.     ddCoord4D    pt;
  742.     ddRgbFloatColour    colour;
  743.     ddVector3D    normal;
  744.     ddULONG        edge;
  745. } ddRgbFloatNormEdgePoint4D;
  746.  
  747. typedef struct {
  748.     ddCoord4D    pt;
  749.     ddHsvColour    colour;
  750.     ddVector3D    normal;
  751.     ddULONG        edge;
  752. } ddHsvNormEdgePoint4D;
  753.  
  754. typedef struct {
  755.     ddCoord4D    pt;
  756.     ddHlsColour    colour;
  757.     ddVector3D    normal;
  758.     ddULONG        edge;
  759. } ddHlsNormEdgePoint4D;
  760.  
  761. typedef struct {
  762.     ddCoord4D    pt;
  763.     ddCieColour    colour;
  764.     ddVector3D    normal;
  765.     ddULONG        edge;
  766. } ddCieNormEdgePoint4D;
  767.  
  768. typedef union {
  769.     ddCoord2D            *p2Dpt;
  770.     ddCoord3D            *p3Dpt;
  771.     ddCoord2DL            *p2DLpt;
  772.     ddCoord3DL            *p3DLpt;
  773.     ddCoord2DS            *p2DSpt;
  774.     ddCoord3DS            *p3DSpt;
  775.     ddIndexedColour            *pIndexClr;
  776.     ddRgb8Colour            *pRgb8Clr;
  777.     ddRgb16Colour            *pRgb16Clr;
  778.     ddRgbFloatColour        *pRgbFloatClr;
  779.     ddHsvColour            *pHsvClr;
  780.     ddHlsColour            *pHlsClr;
  781.     ddCieColour            *pCieClr;
  782.     ddIndexPoint            *pIndexpt;
  783.     ddRgb8Point            *pRgb8pt;  
  784.     ddRgb16Point            *pRgb16pt;
  785.     ddRgbFloatPoint            *pRgbFloatpt;
  786.     ddHsvPoint            *pHsvpt;
  787.     ddHlsPoint            *pHlspt;
  788.     ddCiePoint            *pCiept;
  789.     ddVector3D            *pNormal;
  790.     ddNormalPoint            *pNpt;
  791.     ddULONG                *pEdge;
  792.     ddEdgePoint            *pEpt;
  793.     ddIndexNormalPoint        *pIndexNpt;
  794.     ddRgb8NormalPoint        *pRgb8Npt;
  795.     ddRgb16NormalPoint        *pRgb16Npt;
  796.     ddRgbFloatNormalPoint        *pRgbFloatNpt;
  797.     ddHsvNormalPoint        *pHsvNpt;
  798.     ddHlsNormalPoint        *pHlsNpt;
  799.     ddCieNormalPoint        *pCieNpt;
  800.     ddIndexEdgePoint        *pIndexEpt;
  801.     ddRgb8EdgePoint            *pRgb8Ept;
  802.     ddRgb16EdgePoint        *pRgb16Ept;
  803.     ddRgbFloatEdgePoint        *pRgbFloatEpt;
  804.     ddHsvEdgePoint            *pHsvEpt;
  805.     ddHlsEdgePoint            *pHlsEpt;
  806.     ddCieEdgePoint            *pCieEpt;
  807.     ddNormEdgePoint            *pNEpt;
  808.     ddIndexNormEdgePoint        *pIndexNEpt;
  809.     ddRgb8NormEdgePoint        *pRgb8NEpt;
  810.     ddRgb16NormEdgePoint        *pRgb16NEpt;
  811.     ddRgbFloatNormEdgePoint        *pRgbFloatNEpt;
  812.     ddHsvNormEdgePoint        *pHsvNEpt;
  813.     ddHlsNormEdgePoint        *pHlsNEpt;
  814.     ddCieNormEdgePoint        *pCieNEpt;
  815.     ddCoord4D            *p4Dpt;
  816.     ddIndexPoint4D            *pIndexpt4D;
  817.     ddRgb8Point4D            *pRgb8pt4D;  
  818.     ddRgb16Point4D            *pRgb16pt4D;
  819.     ddRgbFloatPoint4D        *pRgbFloatpt4D;
  820.     ddHsvPoint4D            *pHsvpt4D;
  821.     ddHlsPoint4D            *pHlspt4D;
  822.     ddCiePoint4D            *pCiept4D;
  823.     ddNormalPoint4D            *pNpt4D;
  824.     ddEdgePoint4D            *pEpt4D;
  825.     ddIndexNormalPoint4D        *pIndexNpt4D;
  826.     ddRgb8NormalPoint4D        *pRgb8Npt4D;
  827.     ddRgb16NormalPoint4D        *pRgb16Npt4D;
  828.     ddRgbFloatNormalPoint4D        *pRgbFloatNpt4D;
  829.     ddHsvNormalPoint4D        *pHsvNpt4D;
  830.     ddHlsNormalPoint4D        *pHlsNpt4D;
  831.     ddCieNormalPoint4D        *pCieNpt4D;
  832.     ddIndexEdgePoint4D        *pIndexEpt4D;
  833.     ddRgb8EdgePoint4D        *pRgb8Ept4D;
  834.     ddRgb16EdgePoint4D        *pRgb16Ept4D;
  835.     ddRgbFloatEdgePoint4D        *pRgbFloatEpt4D;
  836.     ddHsvEdgePoint4D        *pHsvEpt4D;
  837.     ddHlsEdgePoint4D        *pHlsEpt4D;
  838.     ddCieEdgePoint4D        *pCieEpt4D;
  839.     ddNormEdgePoint4D        *pNEpt4D;
  840.     ddIndexNormEdgePoint4D        *pIndexNEpt4D;
  841.     ddRgb8NormEdgePoint4D        *pRgb8NEpt4D;
  842.     ddRgb16NormEdgePoint4D        *pRgb16NEpt4D;
  843.     ddRgbFloatNormEdgePoint4D    *pRgbFloatNEpt4D;
  844.     ddHsvNormEdgePoint4D        *pHsvNEpt4D;
  845.     ddHlsNormEdgePoint4D        *pHlsNEpt4D;
  846.     ddCieNormEdgePoint4D        *pCieNEpt4D;
  847.     char                *ptr;
  848. } ddPointUnion;
  849.  
  850. /*
  851.  * Last - create a point header data structure
  852.  *
  853.  * Note: any changes to this structure MUST also be
  854.  *       made to the MarkerlistofddPoint structure below.
  855.  */
  856. typedef struct {
  857.     ddULONG        numPoints;    /* number of vertices in list */
  858.     ddULONG        maxData;    /* allocated data in bytes */
  859.     ddPointUnion    pts;        /* pointer to vertex data */
  860. } listofddPoint;
  861.  
  862. /*
  863.  * Create a parallel structure to listofddPoint for
  864.  * pre-initializing Markers. Note that the listofddPoint
  865.  * structure and the MarkerlistofddPoint structure MUST always
  866.  * match with the exception of the union elememt.
  867.  */
  868. typedef struct {
  869.     ddULONG        numPoints;    /* number of vertices in list */
  870.     ddULONG        maxData;    /* allocated data in bytes */
  871.     ddCoord2D    *pts;
  872. } MarkerlistofddPoint;
  873.  
  874. typedef struct {
  875.     ddUSHORT    order;
  876.     ddFLOAT        uMin;
  877.     ddFLOAT        uMax;
  878.     ddULONG        numKnots;
  879.     ddFLOAT        *pKnots;
  880.     listofddPoint    points;
  881. } ddNurbCurve;
  882.  
  883. typedef enum {
  884.     DD_FACET_NONE=0,        /* no facet attributes */
  885.     DD_FACET_INDEX=1,        /* facet colour */
  886.     DD_FACET_RGB8=2,        /* facet colour */
  887.     DD_FACET_RGB16=3,        /* facet colour */
  888.     DD_FACET_RGBFLOAT=4,        /* facet colour */
  889.     DD_FACET_HSV=5,            /* facet colour */
  890.     DD_FACET_HLS=6,            /* facet colour */
  891.     DD_FACET_CIE=7,            /* facet colour */
  892.     DD_FACET_NORM=8,        /* facet normal */
  893.     DD_FACET_INDEX_NORM=9,        /* facet colour & normal */
  894.     DD_FACET_RGB8_NORM=10,        /* facet colour & normal */
  895.     DD_FACET_RGB16_NORM=11,        /* facet colour & normal */
  896.     DD_FACET_RGBFLOAT_NORM=12,    /* facet colour & normal */
  897.     DD_FACET_HSV_NORM=13,        /* facet colour & normal */
  898.     DD_FACET_HLS_NORM=14,        /* facet colour & normal */
  899.     DD_FACET_CIE_NORM=15        /* facet colour & normal */
  900. } ddFacetType;
  901.  
  902. /*
  903.  * A useful macro to determine the size of a facet
  904.  *
  905.  */
  906. #define DDFacetSIZE(type, size)                                         \
  907.         switch((type)){                                                 \
  908.           case(DD_FACET_NONE): (size) = 0;                              \
  909.             break;                                                      \
  910.           case(DD_FACET_INDEX): (size) = sizeof(ddIndexedColour);       \
  911.             break;                                                      \
  912.           case(DD_FACET_RGB8): (size) = sizeof(ddRgb8Colour);           \
  913.             break;                                                      \
  914.           case(DD_FACET_RGB16): (size) = sizeof(ddRgb16Colour);         \
  915.             break;                                                      \
  916.           case(DD_FACET_RGBFLOAT): (size) = sizeof(ddRgbFloatColour);   \
  917.             break;                                                      \
  918.           case(DD_FACET_HSV): (size) = sizeof(ddHsvColour);             \
  919.             break;                                                      \
  920.           case(DD_FACET_HLS): (size) = sizeof(ddHlsColour);             \
  921.             break;                                                      \
  922.           case(DD_FACET_CIE): (size) = sizeof(ddCieColour);             \
  923.             break;                                                      \
  924.           case(DD_FACET_NORM): (size) = sizeof(ddVector3D);             \
  925.             break;                                                      \
  926.           case(DD_FACET_INDEX_NORM): (size) = sizeof(ddIndexNormal);    \
  927.             break;                                                      \
  928.           case(DD_FACET_RGB8_NORM): (size) = sizeof(ddRgb8Normal);      \
  929.             break;                                                      \
  930.           case(DD_FACET_RGB16_NORM): (size) = sizeof(ddRgb16Normal);    \
  931.             break;                                                      \
  932.           case(DD_FACET_RGBFLOAT_NORM): (size) = sizeof(ddRgbFloatNormal);\
  933.             break;                                                      \
  934.           case(DD_FACET_HSV_NORM): (size) = sizeof(ddHsvNormal);        \
  935.             break;                                                      \
  936.           case(DD_FACET_HLS_NORM): (size) = sizeof(ddHlsNormal);        \
  937.             break;                                                      \
  938.           case(DD_FACET_CIE_NORM): (size) = sizeof(ddCieNormal);        \
  939.             break;                                                      \
  940.       default: (size) = -1;                        \
  941.         }
  942.  
  943. /*
  944.  * more facet macros for determining type.
  945.  */
  946. #define DD_IsFacetNormal(type)    \
  947. ((((int)type)>=((int)DD_FACET_NORM))&&(((int)type)<=((int)DD_FACET_CIE_NORM)))
  948. #define DD_IsFacetColour(type)    \
  949. ( ((type) != DD_FACET_NONE) && ((type) != DD_FACET_NORM) )
  950.  
  951. typedef struct {
  952.     ddIndexedColour    colour;
  953.     ddVector3D    normal;
  954. } ddIndexNormal;
  955.  
  956. typedef struct {
  957.     ddRgb8Colour    colour;
  958.     ddVector3D    normal;
  959. } ddRgb8Normal;
  960.  
  961. typedef struct {
  962.     ddRgb16Colour    colour;
  963.     ddVector3D    normal;
  964. } ddRgb16Normal;
  965.  
  966. typedef struct {
  967.     ddRgbFloatColour    colour;
  968.     ddVector3D    normal;
  969. } ddRgbFloatNormal;
  970.  
  971. typedef struct {
  972.     ddHsvColour    colour;
  973.     ddVector3D    normal;
  974. } ddHsvNormal;
  975.  
  976. typedef struct {
  977.     ddHlsColour    colour;
  978.     ddVector3D    normal;
  979. } ddHlsNormal;
  980.  
  981. typedef struct {
  982.     ddCieColour    colour;
  983.     ddVector3D    normal;
  984. } ddCieNormal;
  985.  
  986. typedef union {
  987.     ddPointer        pNoFacet;
  988.     ddIndexedColour        *pFacetIndex;
  989.     ddRgb8Colour        *pFacetRgb8;
  990.     ddRgb16Colour        *pFacetRgb16;
  991.     ddRgbFloatColour    *pFacetRgbFloat;
  992.     ddHsvColour        *pFacetHsv;
  993.     ddHlsColour        *pFacetHls;
  994.     ddCieColour        *pFacetCie;
  995.     ddVector3D        *pFacetN;
  996.     ddIndexNormal        *pFacetIndexN;
  997.     ddRgb8Normal        *pFacetRgb8N;
  998.     ddRgb16Normal        *pFacetRgb16N;
  999.     ddRgbFloatNormal    *pFacetRgbFloatN;
  1000.     ddHsvNormal        *pFacetHsvN;
  1001.     ddHlsNormal        *pFacetHlsN;
  1002.     ddCieNormal        *pFacetCieN;
  1003. } ddFacetUnion;
  1004.  
  1005. typedef struct {
  1006.     ddFacetType    type;
  1007.     ddULONG        numFacets;    /* number of facets in list */
  1008.     ddULONG        maxData;    /* allocated data in bytes */
  1009.     ddFacetUnion    facets;        /* Pointer to facet data */
  1010. } listofddFacet;
  1011.  
  1012. typedef enum {
  1013.     DD_VERTEX=0,
  1014.     DD_VERTEX_EDGE=1
  1015. } ddVertIndexType;
  1016.  
  1017. typedef struct {
  1018.     ddUSHORT    index;
  1019.     ddULONG        edge;
  1020. } ddVertIndexEdge;
  1021.     
  1022. typedef struct {
  1023.     ddVertIndexType    type;
  1024.     ddULONG        numIndex;
  1025.     union {
  1026.         ddUSHORT    *pVertIndex;
  1027.         ddVertIndexEdge        *pVertIndexE;
  1028.     } index;
  1029. } listofddIndex;
  1030.  
  1031. typedef struct {
  1032.     ddUSHORT    uOrder;
  1033.     ddUSHORT    vOrder;
  1034.     ddFLOAT        uMin;
  1035.     ddFLOAT        uMax;
  1036.     ddFLOAT        vMin;
  1037.     ddFLOAT        vMax;
  1038.     ddFLOAT        mpts;
  1039.     ddFLOAT        npts;
  1040.     ddULONG        numUKnots;
  1041.     ddFLOAT        *pUKnot;
  1042.     ddULONG        numVKnots;
  1043.     ddFLOAT        *pVKnot;
  1044.     listofddPoint    points;
  1045. } ddNurbSurface;
  1046.  
  1047. typedef struct {
  1048.     ddBYTE        visibility;
  1049.     ddUSHORT    order;
  1050.     ddCurveApprox    curveApprox;
  1051.     ddFLOAT        uMin;
  1052.     ddFLOAT        uMax;
  1053.     ddULONG        numKnots;
  1054.     ddFLOAT        *pKnots;
  1055.     ddPointType    pttype;
  1056.     listofddPoint    points;
  1057. } ddTrimCurve;
  1058.  
  1059. typedef struct {
  1060.     ddULONG        count;
  1061.     ddTrimCurve    *pTC;
  1062. } listofTrimCurve;
  1063.  
  1064. /* for cell arrays */
  1065. typedef struct {
  1066.     ddSHORT    colourType;
  1067.     union {
  1068.         ddIndexedColour        *pIndex;
  1069.         ddRgb8Colour        *pRgb8;
  1070.         ddRgb16Colour        *pRgb16;
  1071.         ddRgbFloatColour    *pRgbFloat;
  1072.         ddHsvColour        *pHsv;
  1073.         ddHlsColour        *pHls;
  1074.         ddCieColour        *pCie;
  1075.     } colour;
  1076. } listofColour;
  1077.  
  1078. #endif   /* DDPEX3_H */
  1079.