home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / QuickTime VR / Windows / Interfaces / QD3D.h next >
Encoding:
C/C++ Source or Header  |  1996-05-03  |  44.9 KB  |  1,282 lines  |  [TEXT/LMAN]

  1. /******************************************************************************
  2.  **                                                                              **
  3.  **     Module:        QD3D.h                                                     **                        
  4.  **                                                                              **
  5.  **                                                                              **
  6.  **     Purpose:     System include file.                                     **            
  7.  **                                                                              **
  8.  **                                                                              **
  9.  **                                                                              **
  10.  **     Copyright (C) 1992-1996 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                              **
  12.  **                                                                              **
  13.  *****************************************************************************/
  14. #ifndef QD3D_h
  15. #define QD3D_h
  16.  
  17. #include <stdio.h>
  18.  
  19. /******************************************************************************
  20.  **                                                                             **
  21.  **                                Porting Control                                 **
  22.  **                                                                             **
  23.  *****************************************************************************/
  24.  
  25. /*
  26.  *  NOTE:  To compile on a Unix workstation (assumes X11 window system):
  27.  *                1. Add to compiler command line: "-DOS_MACINTOSH=0"
  28.  *                2. Add "-DOS_UNIX=1"
  29.  *                3. Add "-DWINDOW_SYSTEM_X11=1"
  30.  */
  31. #if defined(_WIN32) || defined(_WINDOWS)
  32.     #define OS_MACINTOSH                0
  33.     #define OS_WIN32                    1
  34.     #define OS_UNIX                        0
  35.  
  36.     #define WINDOW_SYSTEM_MACINTOSH        0
  37.     #define WINDOW_SYSTEM_WIN32            1
  38.     #define WINDOW_SYSTEM_X11            0
  39. #elif !defined(OS_MACINTOSH)
  40.     #define OS_MACINTOSH                1
  41.     #define OS_WIN32                    0
  42.     #define OS_UNIX                        0
  43.  
  44.     #define WINDOW_SYSTEM_MACINTOSH        1
  45.     #define WINDOW_SYSTEM_WIN32            0
  46.     #define WINDOW_SYSTEM_X11            0
  47.  
  48.     #if defined(THINK_C) || defined(__SC__) || defined(__MWERKS__)
  49.          #define PRAGMA_ONCE                1
  50.     #else
  51.          #define PRAGMA_ONCE                0
  52.     #endif  /*  defined(THINK_C) || defined(__SC__) || defined(__MWERKS__)  */
  53.  
  54.     /*
  55.      * Set required compiler options (if possible):
  56.      *   1. enums must always be ints in QD3D and in applications;
  57.      *      this consistency is required to prevent misinterpretation
  58.      *      of an app's enum values by an API; it is also required for
  59.      *      compliance with ANSI
  60.      *   2. alignment of char and short arrays in structures is not on
  61.      *      long boundaries; (could be other way, but must be consistent
  62.      *      in QD3D and in applications)
  63.      *   3. alignment of longs, floats, and pointers in structures
  64.      *      is on long boundaries for PowerPC
  65.      */
  66.     #if defined(THINK_C) || defined(__SC__)
  67.         #pragma options(!pack_enums, !align_arrays)
  68.         #pragma SC options align=power
  69.     #elif defined(__MWERKS__)
  70.         #pragma enumsalwaysint on
  71.         #pragma align_array_members off
  72.         #pragma options align=native
  73.     #elif defined(__PPCC__)
  74.         #pragma options align=power
  75.     #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  76.         #pragma options enum=int
  77.     #endif
  78.     
  79.     enum {
  80.         gestaltQD3D                = 'qd3d',
  81.         gestaltQD3DVersion        = 'q3v ',
  82.         gestaltQD3DNotPresent    = 0,
  83.         gestaltQD3DAvailable    = 1
  84.     };
  85.     
  86. #endif  /*  OS_MACINTOSH  */
  87.  
  88. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  89.     #pragma once
  90. #endif  /*  PRAGMA_ONCE  */
  91.  
  92. /******************************************************************************
  93.  **                                                                             **
  94.  **                                Export Control                                 **
  95.  **                                                                             **
  96.  *****************************************************************************/
  97.  
  98. #if defined(_MSC_VER)    /* Microsoft Visual C */
  99.     #if defined(WIN32_EXPORTING)    // define when building DLL
  100.         #define QD3D_EXPORT __declspec( dllexport )     
  101.     #else
  102.         #define QD3D_EXPORT __declspec( dllimport )    
  103.     #endif //WIN32_EXPORTING
  104. #else
  105.     #define QD3D_EXPORT
  106. #endif  /*  _MSC_VER  */
  107.  
  108.  
  109. /******************************************************************************
  110.  **                                                                             **
  111.  **                                NULL definition                                 **
  112.  **                                                                             **
  113.  *****************************************************************************/
  114.  
  115. #ifndef NULL
  116. #error NULL is undefined.
  117. #endif /* NULL */
  118.  
  119.  
  120. /******************************************************************************
  121.  **                                                                             **
  122.  **                                    Objects                                     **
  123.  **                                                                             **
  124.  *****************************************************************************/
  125. /*
  126.  * Everything in QuickDraw 3D is an OBJECT: a bunch of data with a type,
  127.  * deletion, duplication, and i/o methods.
  128.  */
  129. typedef long                    TQ3ObjectType;
  130.  
  131. typedef struct TQ3ObjectPrivate    *TQ3Object;
  132.  
  133. /*
  134.  * There are four subclasses of OBJECT:
  135.  *    an ELEMENT, which is data that is placed in a SET
  136.  *    a SHAREDOBJECT, which is reference-counted data that is shared
  137.  *    VIEWs, which maintain state information for an image
  138.  *    a PICK, which used to query a VIEW
  139.  */
  140. typedef TQ3Object                TQ3ElementObject;
  141. typedef TQ3Object                TQ3SharedObject;
  142. typedef TQ3Object                TQ3ViewObject;
  143. typedef TQ3Object                TQ3PickObject;
  144.  
  145. /*
  146.  * There are several types of SharedObjects:
  147.  *    RENDERERs, which paint to a drawContext
  148.  *    DRAWCONTEXTs, which are an interface to a device 
  149.  *    SETs, which maintains "mathematical sets" of ELEMENTs
  150.  *    FILEs, which maintain state information for a metafile
  151.  *    SHAPEs, which affect the state of the View
  152.  *    SHAPEPARTs, which contain geometry-specific data about a picking hit
  153.  *    CONTROLLERSTATEs, which hold state of the output channels for a CONTROLLER
  154.  *    TRACKERs, which represent a position and orientation in the user interface
  155.  *  STRINGs, which are abstractions of text string data.
  156.  *    STORAGE, which is an abstraction for stream-based data storage (files, 
  157.  *        memory)
  158.  *    TEXTUREs, for sharing bitmap information for TEXTURESHADERS
  159.  *    VIEWHINTs, which specifies viewing preferences in FILEs
  160.  */
  161. typedef TQ3SharedObject            TQ3RendererObject;
  162. typedef TQ3SharedObject            TQ3DrawContextObject;
  163. typedef TQ3SharedObject            TQ3SetObject;
  164. typedef TQ3SharedObject            TQ3FileObject;
  165. typedef TQ3SharedObject            TQ3ShapeObject;
  166. typedef TQ3SharedObject            TQ3ShapePartObject;
  167. typedef TQ3SharedObject            TQ3ControllerStateObject;
  168. typedef TQ3SharedObject            TQ3TrackerObject;
  169. typedef TQ3SharedObject            TQ3StringObject;
  170. typedef TQ3SharedObject            TQ3StorageObject;
  171. typedef TQ3SharedObject            TQ3TextureObject;
  172. typedef TQ3SharedObject            TQ3ViewHintsObject;
  173.  
  174. #if defined(ESCHER_VER_15) && ESCHER_VER_15
  175. /*
  176.  * (and for QuickDraw 3D 1.5)
  177.  *    COLORSCHEMEs, which determine colors of user interface objects
  178.  *    DEEPBUFFERs, which cache a lot of rasterized information for
  179.  *  deferred interactive imaging.
  180.  *    WIDGETs, for interacting with objects in a view
  181.  *    ATTACHMENTs, for adding parametrizations to geometries
  182.  */
  183. typedef TQ3SharedObject            TQ3ColorSchemeObject;
  184. typedef TQ3SharedObject            TQ3DeepBufferObject;
  185. typedef TQ3SharedObject            TQ3WidgetObject;
  186. typedef TQ3SharedObject            TQ3AttachmentObject;
  187. #endif  /*  ESCHER_VER_15  */
  188.  
  189. /*
  190.  * There is one type of VIEW:
  191.  *    UIVIEWs, which provide interactive facilities
  192.  */
  193. #if defined(ESCHER_VER_15) && ESCHER_VER_15
  194. typedef TQ3ViewObject            TQ3UIViewObject;
  195. #endif  /*  ESCHER_VER_15  */
  196.  
  197. /*
  198.  * There is one types of SET:
  199.  *    ATTRIBUTESETs, which contain ATTRIBUTEs which are inherited 
  200.  */
  201. typedef TQ3SetObject                TQ3AttributeSet;
  202.  
  203. /*
  204.  * There are many types of SHAPEs:
  205.  *    LIGHTs, which affect how the RENDERER draws 3-D cues
  206.  *    CAMERAs, which affects the location and orientation of the RENDERER in 
  207.  *        space
  208.  *    GROUPs, which may contain any number of SHARED OBJECTS
  209.  *    GEOMETRYs, which are representations of three-dimensional data
  210.  *    SHADERs, which affect how colors are drawn on a geometry
  211.  *    STYLEs, which affect how the RENDERER paints to the DRAWCONTEXT
  212.  *    TRANSFORMs, which affect the coordinate system in the VIEW
  213.  *    REFERENCEs, which are references to objects in FILEs
  214.  *  UNKNOWN, which hold unknown objects read from a metafile.
  215.  */
  216. typedef TQ3ShapeObject            TQ3GroupObject;
  217. typedef TQ3ShapeObject            TQ3GeometryObject;
  218. typedef TQ3ShapeObject            TQ3ShaderObject;
  219. typedef TQ3ShapeObject            TQ3StyleObject;
  220. typedef TQ3ShapeObject            TQ3TransformObject;
  221. typedef TQ3ShapeObject            TQ3LightObject;
  222. typedef TQ3ShapeObject            TQ3CameraObject;
  223. typedef TQ3ShapeObject            TQ3UnknownObject;
  224. typedef TQ3ShapeObject            TQ3ReferenceObject;
  225.  
  226. #if defined(ESCHER_VER_15) && ESCHER_VER_15
  227. typedef TQ3ShapeObject            TQ3GuideObject;
  228. typedef TQ3ShapeObject            TQ3MappingObject;
  229. #endif  /*  ESCHER_VER_15  */
  230.  
  231. /*
  232.  * For now, there is only one type of SHAPEPARTs:
  233.  *    MESHPARTs, which describe some part of a mesh
  234.  */
  235. typedef TQ3ShapePartObject        TQ3MeshPartObject;
  236.  
  237. /*
  238.  * There are three types of MESHPARTs:
  239.  *    MESHFACEPARTs, which describe a face of a mesh
  240.  *    MESHEDGEPARTs, which describe a edge of a mesh
  241.  *    MESHVERTEXPARTs, which describe a vertex of a mesh
  242.  */
  243. typedef TQ3MeshPartObject        TQ3MeshFacePartObject;
  244. typedef TQ3MeshPartObject        TQ3MeshEdgePartObject;
  245. typedef TQ3MeshPartObject        TQ3MeshVertexPartObject;
  246.  
  247. /*
  248.  * A DISPLAY Group can be drawn to a view
  249.  */
  250. typedef TQ3GroupObject            TQ3DisplayGroupObject;
  251.  
  252. /*
  253.  * There are many types of SHADERs:
  254.  *    SURFACESHADERs, which affect how the surface of a geometry is painted
  255.  *    ILLUMINATIONSHADERs, which affect how lights affect the color of a surface
  256.  */
  257. typedef TQ3ShaderObject            TQ3SurfaceShaderObject;
  258. typedef TQ3ShaderObject            TQ3IlluminationShaderObject;
  259.  
  260. /*
  261.  * A handle to an object in a group
  262.  */
  263. typedef struct TQ3GroupPositionPrivate    *TQ3GroupPosition;
  264.  
  265.  
  266. /******************************************************************************
  267.  **                                                                             **
  268.  **                            Client/Server Things                             **
  269.  **                                                                             **
  270.  *****************************************************************************/
  271.  
  272. typedef void *TQ3ControllerRef;
  273.  
  274.  
  275. /******************************************************************************
  276.  **                                                                             **
  277.  **                            Flags and Switches                                 **
  278.  **                                                                             **
  279.  *****************************************************************************/
  280.  
  281. typedef enum TQ3Boolean {
  282.     kQ3False,
  283.     kQ3True
  284. } TQ3Boolean;
  285.  
  286. typedef enum TQ3Switch {
  287.     kQ3Off,
  288.     kQ3On
  289. } TQ3Switch;
  290.  
  291. typedef enum TQ3Status {
  292.     kQ3Failure,
  293.     kQ3Success
  294. } TQ3Status;
  295.  
  296. typedef enum TQ3Axis {
  297.     kQ3AxisX,
  298.     kQ3AxisY,
  299.     kQ3AxisZ
  300. } TQ3Axis;
  301.  
  302. typedef enum TQ3PixelType {
  303.     kQ3PixelTypeRGB32        = 0,    /* 32 bits/pixel, Alpha:8 (ignored), R:8, G:8, B:8    */
  304.     kQ3PixelTypeARGB32        = 1,    /* 32 bits/pixel, Alpha:8, R:8, G:8, B:8             */
  305.     kQ3PixelTypeRGB16        = 2,    /* 16 bits/pixel, Alpha:1 (ignored), R:5, G:5, B:5    */
  306.     kQ3PixelTypeARGB16        = 3        /* 16 bits/pixel, Alpha:1, R:5, G:5, B:5             */
  307. #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  308.     ,
  309.     kQ3PixelTypeRGB16_565    = 4,    /* 16 bits/pixel, R:5, G:6, B:5                        */
  310.     kQ3PixelTypeRGB24        = 5        /* 24 bits/pixel, R:8, G:8, B:8                        */
  311. #endif /* WINDOW_SYSTEM_WIN32 */
  312. #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  313.     ,
  314.     kQ3PixelTypeCL8            = 6,    /* 8 bits/pixel, 8-bit color table index            */
  315.     kQ3PixelTypeCL4            = 7,    /* 4 bits/pixel, 4-bit color table index            */
  316.     kQ3PixelTypeAlpha1        = 8        /* 1 bit/pixel, alpha                                */
  317. #endif /* ESCHER_VER_FUTURE */
  318. } TQ3PixelType;
  319.  
  320. typedef enum TQ3Endian{
  321.     kQ3EndianBig,
  322.     kQ3EndianLittle
  323. } TQ3Endian;
  324.  
  325. typedef enum TQ3EndCapMasks {
  326.     kQ3EndCapNone            = 0,
  327.     kQ3EndCapMaskTop        = 1 << 0,
  328.     kQ3EndCapMaskBottom        = 1 << 1,
  329.     kQ3EndCapMaskInterior    = 1 << 2
  330. } TQ3EndCapMasks;
  331.  
  332. typedef unsigned long TQ3EndCap;
  333.  
  334.  
  335. /******************************************************************************
  336.  **                                                                             **
  337.  **                        Point and Vector Definitions                         **
  338.  **                                                                             **
  339.  *****************************************************************************/
  340.  
  341. typedef struct TQ3Vector2D {
  342.     float        x;
  343.     float        y;
  344. } TQ3Vector2D;
  345.  
  346. typedef struct TQ3Vector3D {
  347.     float         x;
  348.     float        y;
  349.     float        z;
  350. } TQ3Vector3D;
  351.  
  352. typedef struct TQ3Point2D {
  353.     float        x;
  354.     float        y;
  355. } TQ3Point2D;
  356.  
  357. typedef struct TQ3Point3D {
  358.     float         x;
  359.     float        y;
  360.     float        z;
  361. } TQ3Point3D;
  362.  
  363. typedef struct TQ3RationalPoint4D {
  364.     float         x;
  365.     float        y;
  366.     float        z;
  367.     float        w;
  368. } TQ3RationalPoint4D;
  369.  
  370. typedef struct TQ3RationalPoint3D {
  371.     float        x;
  372.     float        y;
  373.     float        w;
  374. } TQ3RationalPoint3D;
  375.  
  376.  
  377. /******************************************************************************
  378.  **                                                                             **
  379.  **                                Quaternion                                     **
  380.  **                                                                             **
  381.  *****************************************************************************/
  382.  
  383. typedef struct TQ3Quaternion {
  384.     float        w;
  385.     float        x;
  386.     float        y;
  387.     float        z;
  388. } TQ3Quaternion;
  389.  
  390.  
  391. /******************************************************************************
  392.  **                                                                             **
  393.  **                                Ray Definition                                 **
  394.  **                                                                             **
  395.  *****************************************************************************/
  396.  
  397. typedef struct TQ3Ray3D {
  398.     TQ3Point3D        origin;
  399.     TQ3Vector3D        direction;
  400. } TQ3Ray3D;
  401.  
  402.  
  403. /******************************************************************************
  404.  **                                                                             **
  405.  **                        Parameterization Data Structures                     **
  406.  **                                                                             **
  407.  *****************************************************************************/
  408.  
  409. typedef struct TQ3Param2D {
  410.     float            u;
  411.     float            v;
  412. } TQ3Param2D;
  413.  
  414. typedef struct TQ3Param3D {
  415.     float            u;
  416.     float            v;
  417.     float            w;
  418. } TQ3Param3D;
  419.  
  420. typedef struct TQ3Tangent2D {
  421.     TQ3Vector3D        uTangent;
  422.     TQ3Vector3D        vTangent;
  423. } TQ3Tangent2D;
  424.  
  425. typedef struct TQ3Tangent3D {
  426.     TQ3Vector3D        uTangent;
  427.     TQ3Vector3D        vTangent;
  428.     TQ3Vector3D        wTangent;
  429. } TQ3Tangent3D;
  430.  
  431.  
  432. /******************************************************************************
  433.  **                                                                             **
  434.  **                        Polar and Spherical Coordinates                         **
  435.  **                                                                             **
  436.  *****************************************************************************/
  437.  
  438.  typedef struct TQ3PolarPoint {
  439.      float        r;
  440.      float        theta;
  441.   } TQ3PolarPoint;
  442.  
  443.  typedef struct TQ3SphericalPoint {
  444.      float        rho;
  445.      float        theta;
  446.      float        phi;
  447.  } TQ3SphericalPoint;
  448.  
  449.  
  450. /******************************************************************************
  451.  **                                                                             **
  452.  **                            Color Definition                                 **
  453.  **                                                                             **
  454.  *****************************************************************************/
  455.  
  456. typedef struct TQ3ColorRGB {
  457.     float             r;
  458.     float            g;
  459.     float            b;
  460. } TQ3ColorRGB;
  461.  
  462.  
  463. typedef struct TQ3ColorARGB {
  464.     float             a;
  465.     float             r;
  466.     float            g;
  467.     float            b;
  468. } TQ3ColorARGB;
  469.  
  470.  
  471. /******************************************************************************
  472.  **                                                                             **
  473.  **                                    Vertices                                 **
  474.  **                                                                             **
  475.  *****************************************************************************/
  476.  
  477. typedef struct TQ3Vertex3D {
  478.     TQ3Point3D            point;
  479.     TQ3AttributeSet        attributeSet;
  480. }  TQ3Vertex3D;
  481.  
  482.  
  483. /******************************************************************************
  484.  **                                                                             **
  485.  **                                    Matrices                                 **
  486.  **                                                                             **
  487.  *****************************************************************************/
  488.  
  489. typedef struct TQ3Matrix3x3 {
  490.     float    value[3][3];
  491. } TQ3Matrix3x3;
  492.  
  493. typedef struct TQ3Matrix4x4 {
  494.     float    value[4][4];
  495. } TQ3Matrix4x4;
  496.  
  497.  
  498. /******************************************************************************
  499.  **                                                                             **
  500.  **                                Color Table                                     **
  501.  **                                                                             **
  502.  *****************************************************************************/
  503.  
  504. #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  505. typedef unsigned long TQ3ColorRGB32;        /* Alpha:8 (ignored), R:8, G:8, B:8 */
  506.  
  507. typedef enum TQ3ColorTableType
  508. {
  509.     kQ3ColorTableType_CL8_RGB32        = 0,    /* 256 entries of TQ3ColorRGB32        */
  510.     kQ3ColorTableType_CL4_RGB32        = 1        /* 16 entries of TQ3ColorRGB32        */
  511. } TQ3ColorTableType;
  512.  
  513. typedef struct TQ3ColorTableData
  514. {
  515.     TQ3ColorTableType        colorTableType;
  516.     TQ3Boolean                hasTransparent;    /* true if index zero is transparent */
  517.     TQ3ColorRGB32            colors[256];    /* actual number determined from type */
  518. } TQ3ColorTableData;
  519.  
  520. typedef TQ3SharedObject    TQ3ColorTableObject;
  521. #endif /* ESCHER_VER_FUTURE */
  522.  
  523.  
  524. /******************************************************************************
  525.  **                                                                             **
  526.  **                                Bitmap/Pixmap                                 **
  527.  **                                                                             **
  528.  *****************************************************************************/
  529.  
  530.  
  531. typedef struct TQ3Pixmap {
  532.     void                *image;
  533.     unsigned long        width;
  534.     unsigned long        height;
  535.     unsigned long        rowBytes;
  536.     unsigned long        pixelSize;    /* MUST be 16 or 32 to use with the         */
  537.                                     /* Interactive Renderer on Mac OS         */
  538.     TQ3PixelType        pixelType;
  539.     TQ3Endian            bitOrder;
  540.     TQ3Endian            byteOrder;
  541. } TQ3Pixmap;
  542.  
  543. typedef struct TQ3StoragePixmap {
  544.     TQ3StorageObject    image;
  545.     unsigned long        width;
  546.     unsigned long        height;
  547.     unsigned long        rowBytes;
  548.     unsigned long        pixelSize;    /* MUST be 16 or 32 to use with the     */
  549.                                     /* Interactive Renderer on Mac OS        */
  550.     TQ3PixelType        pixelType;
  551.     TQ3Endian            bitOrder;
  552.     TQ3Endian            byteOrder;
  553. } TQ3StoragePixmap;
  554.  
  555. typedef struct TQ3Bitmap {
  556.     unsigned char        *image;
  557.     unsigned long        width;
  558.     unsigned long        height;
  559.     unsigned long        rowBytes;
  560.     TQ3Endian            bitOrder;
  561. } TQ3Bitmap;
  562.  
  563. typedef struct TQ3MipmapImage {        /* An image for use as a texture mipmap  */
  564.     unsigned long        width;        /* Width of mipmap, must be power of 2   */
  565.     unsigned long        height;        /* Height of mipmap, must be power of 2  */
  566.     unsigned long        rowBytes;    /* Rowbytes of mipmap                    */
  567.     unsigned long        offset;        /* Offset from image base to this mipmap */
  568. } TQ3MipmapImage;
  569.  
  570. typedef struct TQ3Mipmap {
  571.     TQ3StorageObject    image;        /* Data containing the texture map and     */
  572.                                     /* if (mipmap==kQ3True) the mipmap data */
  573.     TQ3Boolean            mipmap;        /* True if mipmapping should be used     */
  574.                                     /* and all mipmaps have been provided   */
  575.     TQ3PixelType        pixelType;
  576.     TQ3Endian            bitOrder;
  577.     TQ3Endian            byteOrder;
  578. #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  579.     TQ3ColorTableObject    colorTable;
  580. #else
  581.     unsigned long        reserved;    /* leave NULL for next version */
  582. #endif /* ESCHER_VER_FUTURE */
  583.     TQ3MipmapImage        mipmaps[32];/* The actual number of mipmaps is         */
  584.                                     /* determined from the size of the         */
  585.                                     /* first mipmap                            */
  586. } TQ3Mipmap;
  587.  
  588.  
  589. /******************************************************************************
  590.  **                                                                             **
  591.  **                        Higher dimension quantities                             **
  592.  **                                                                             **
  593.  *****************************************************************************/
  594.  
  595. typedef struct TQ3Area {
  596.     TQ3Point2D             min;
  597.     TQ3Point2D             max;
  598. } TQ3Area;
  599.  
  600. typedef struct TQ3PlaneEquation {
  601.     TQ3Vector3D            normal;
  602.     float                constant;
  603. } TQ3PlaneEquation;
  604.  
  605. typedef struct TQ3BoundingBox {
  606.     TQ3Point3D             min;
  607.     TQ3Point3D             max;
  608.     TQ3Boolean            isEmpty;
  609. } TQ3BoundingBox;
  610.  
  611. typedef struct TQ3BoundingSphere {
  612.     TQ3Point3D            origin;
  613.     float                radius;
  614.     TQ3Boolean            isEmpty;
  615. } TQ3BoundingSphere;
  616.  
  617. /*
  618.  *    The TQ3ComputeBounds flag passed to StartBoundingBox or StartBoundingSphere
  619.  *    calls in the View. It's a hint to the system as to how it should 
  620.  *    compute the bbox of a shape:
  621.  *
  622.  *    kQ3ComputeBoundsExact:    
  623.  *        Vertices of shapes are transformed into world space and
  624.  *        the world space bounding box is computed from them.  Slow!
  625.  *    
  626.  *    kQ3ComputeBoundsApproximate: 
  627.  *        A local space bounding box is computed from a shape's
  628.  *        vertices.  This bbox is then transformed into world space,
  629.  *        and its bounding box is taken as the shape's approximate
  630.  *        bbox.  Fast but the bbox is larger than optimal.
  631.  */
  632.  
  633. typedef enum TQ3ComputeBounds {
  634.     kQ3ComputeBoundsExact,
  635.     kQ3ComputeBoundsApproximate
  636. } TQ3ComputeBounds;
  637.  
  638.  
  639. /******************************************************************************
  640.  **                                                                             **
  641.  **                            Object System Types                                 **
  642.  **                                                                             **
  643.  *****************************************************************************/
  644.  
  645. typedef struct TQ3ObjectClassPrivate        *TQ3ObjectClass;
  646.  
  647. typedef unsigned long                         TQ3MethodType;
  648.  
  649. /*
  650.  * Object methods
  651.  */
  652. #define kQ3MethodTypeObjectUnregister        Q3_METHOD_TYPE('u','n','r','g')
  653.  
  654. /*
  655.  * IO Methods
  656.  */
  657. #define kQ3MethodTypeObjectFileVersion        Q3_METHOD_TYPE('v','e','r','s') /* version */
  658. #define kQ3MethodTypeObjectTraverse            Q3_METHOD_TYPE('t','r','v','s') /* byte count */
  659. #define kQ3MethodTypeObjectTraverseData        Q3_METHOD_TYPE('t','r','v','d') /* byte count */
  660. #define kQ3MethodTypeObjectWrite            Q3_METHOD_TYPE('w','r','i','t') /* Dump info to file */
  661. #define kQ3MethodTypeObjectReadData            Q3_METHOD_TYPE('r','d','d','t') /* Read info from file into buffer or, attach read data to parent */ 
  662.  
  663. typedef void (*TQ3FunctionPointer)(
  664.     void);
  665.  
  666. typedef TQ3FunctionPointer (*TQ3MetaHandler)(
  667.     TQ3MethodType        methodType);
  668.  
  669. /*
  670.  * MetaHandler:
  671.  *        When you give a metahandler to QuickDraw 3D, it is called multiple 
  672.  *        times to build method tables, and then is thrown away. You are 
  673.  *        guaranteed that your metahandler will never be called again after a 
  674.  *        call that was passed a metahandler returns.
  675.  *
  676.  *        Your metahandler should contain a switch on the methodType passed to it
  677.  *        and should return the corresponding method as an TQ3FunctionPointer.
  678.  *
  679.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  680.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  681.  *
  682.  *        These types here are prototypes of how your functions should look.
  683.  */
  684.  
  685. typedef TQ3Status (*TQ3ObjectUnregisterMethod)(
  686.     TQ3ObjectClass        objectClass);
  687.     
  688. /*
  689.  * See QD3DIO.h for the IO method types: 
  690.  *        ObjectReadData, ObjectTraverse, ObjectWrite
  691.  */
  692.  
  693. /******************************************************************************
  694.  **                                                                             **
  695.  **                                Set Types                                     **
  696.  **                                                                             **
  697.  *****************************************************************************/
  698.  
  699. typedef long                    TQ3ElementType;
  700.  
  701. #define kQ3ElementTypeNone        0
  702. #define kQ3ElementTypeUnknown    32
  703. #define kQ3ElementTypeSet        33
  704. #define kQ3ElementTypeName        34
  705. #define kQ3ElementTypeURL        35
  706.  
  707. /* 
  708.  *    kQ3ElementTypeUnknown is a TQ3Object. 
  709.  *    
  710.  *        Do Q3Set_Add(s, ..., &obj) or Q3Set_Get(s, ..., &obj);
  711.  *        
  712.  *        Note that the object is always referenced when copying around. 
  713.  *        
  714.  *        Generally, it is an Unknown object, a Group of Unknown objects, or a 
  715.  *        group of other "objects" which have been found in the metafile and
  716.  *        have no attachment method to their parent. Be prepared to handle
  717.  *        any or all of these cases if you actually access the set on a shape.
  718.  *
  719.  *    kQ3ElementTypeSet is a TQ3SetObject. 
  720.  *    
  721.  *        Q3Shape_GetSet(s,&o) is eqivalent to 
  722.  *            Q3Shape_GetElement(s, kQ3ElementTypeSet, &o)
  723.  *            
  724.  *        Q3Shape_SetSet(s,o)  is eqivalent to 
  725.  *            Q3Shape_SetElement(s, kQ3ElementTypeSet, &o)
  726.  *    
  727.  *        Note that the object is always referenced when copying around. 
  728.  *        
  729.  *    See the note below about the Set and Shape changes.
  730.  */
  731.  
  732. /******************************************************************************
  733.  **                                                                             **
  734.  **                            Object System Macros                             **
  735.  **                                                                             **
  736.  *****************************************************************************/
  737.  
  738. #define Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d)         \
  739.             ((const unsigned long)                     \
  740.             ((const unsigned long) (a) << 24) |     \
  741.             ((const unsigned long) (b) << 16) |        \
  742.             ((const unsigned long) (c) << 8)  |     \
  743.             ((const unsigned long) (d)))
  744.  
  745. #define Q3_OBJECT_TYPE(a,b,c,d) \
  746.     ((TQ3ObjectType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  747.     
  748. #define Q3_METHOD_TYPE(a,b,c,d) \
  749.     ((TQ3MethodType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  750.  
  751.  
  752. /******************************************************************************
  753.  **                                                                             **
  754.  **                                Object Types                                 **
  755.  **                                                                             **
  756.  *****************************************************************************/
  757.  
  758. /*
  759.  * Note:    a call to Q3Foo_GetType will return a value kQ3FooTypeBar
  760.  *            e.g. Q3Shared_GetType(object) returns kQ3SharedTypeShape, etc.
  761.  */
  762. #define kQ3ObjectTypeInvalid                            0
  763. #define kQ3ObjectTypeView                                Q3_OBJECT_TYPE('v','i','e','w')
  764.     #if defined(ESCHER_VER_15) && ESCHER_VER_15
  765.     #define kQ3ViewTypeUIView                            Q3_OBJECT_TYPE('u','i','v','w')
  766.     #endif  /*  ESCHER_VER_15  */
  767. #define kQ3ObjectTypeElement                            Q3_OBJECT_TYPE('e','l','m','n')
  768.     #define kQ3ElementTypeAttribute                        Q3_OBJECT_TYPE('e','a','t','t')
  769. #define kQ3ObjectTypePick                                Q3_OBJECT_TYPE('p','i','c','k')
  770.     #define kQ3PickTypeWindowPoint                        Q3_OBJECT_TYPE('p','k','w','p')
  771.     #define kQ3PickTypeWindowRect                        Q3_OBJECT_TYPE('p','k','w','r')
  772.     #if defined(ESCHER_VER_15) && ESCHER_VER_15
  773.     #define kQ3PickTypeBox                                Q3_OBJECT_TYPE('p','k','b','x')
  774.     #define kQ3PickTypeRay                                Q3_OBJECT_TYPE('p','k','r','y')
  775.     #define kQ3PickTypeSphere                            Q3_OBJECT_TYPE('p','k','s','p')
  776.     #endif  /*  ESCHER_VER_15  */
  777. #define kQ3ObjectTypeShared                                Q3_OBJECT_TYPE('s','h','r','d')
  778.     #define kQ3SharedTypeRenderer                        Q3_OBJECT_TYPE('r','d','d','r')
  779.         #define kQ3RendererTypeWireFrame                Q3_OBJECT_TYPE('w','r','f','r')
  780.         #define kQ3RendererTypeGeneric                    Q3_OBJECT_TYPE('g','n','r','r')
  781.         #define kQ3RendererTypeInteractive                Q3_OBJECT_TYPE('c','t','w','n')
  782.     #define kQ3SharedTypeShape                            Q3_OBJECT_TYPE('s','h','a','p')
  783.         #define kQ3ShapeTypeGeometry                    Q3_OBJECT_TYPE('g','m','t','r')
  784.             #define kQ3GeometryTypeBox                    Q3_OBJECT_TYPE('b','o','x',' ')
  785.             #define kQ3GeometryTypeGeneralPolygon        Q3_OBJECT_TYPE('g','p','g','n')
  786.             #define kQ3GeometryTypeLine                    Q3_OBJECT_TYPE('l','i','n','e')
  787.             #define kQ3GeometryTypeMarker                Q3_OBJECT_TYPE('m','r','k','r')
  788.             #define kQ3GeometryTypePixmapMarker            Q3_OBJECT_TYPE('m','r','k','p')
  789.             #define kQ3GeometryTypeMesh                    Q3_OBJECT_TYPE('m','e','s','h')
  790.             #define kQ3GeometryTypeNURBCurve            Q3_OBJECT_TYPE('n','r','b','c')
  791.             #define kQ3GeometryTypeNURBPatch            Q3_OBJECT_TYPE('n','r','b','p')
  792.             #define kQ3GeometryTypePoint                Q3_OBJECT_TYPE('p','n','t',' ')
  793.             #define kQ3GeometryTypePolygon                Q3_OBJECT_TYPE('p','l','y','g')
  794.             #define kQ3GeometryTypePolyLine                Q3_OBJECT_TYPE('p','l','y','l')
  795.             #define kQ3GeometryTypeTriangle                Q3_OBJECT_TYPE('t','r','n','g')
  796.             #define kQ3GeometryTypeTriGrid                Q3_OBJECT_TYPE('t','r','i','g')
  797.             #define kQ3GeometryTypeCone                    Q3_OBJECT_TYPE('c','o','n','e')
  798.             #define kQ3GeometryTypeCylinder                Q3_OBJECT_TYPE('c','y','l','n')
  799.             #define kQ3GeometryTypeDisk                    Q3_OBJECT_TYPE('d','i','s','k')
  800.             #define kQ3GeometryTypeEllipse                Q3_OBJECT_TYPE('e','l','p','s')
  801.             #define kQ3GeometryTypeEllipsoid            Q3_OBJECT_TYPE('e','l','p','d')
  802.             #define kQ3GeometryTypePolyhedron            Q3_OBJECT_TYPE('p','l','h','d')
  803.             #define kQ3GeometryTypeTorus                Q3_OBJECT_TYPE('t','o','r','s')
  804.             #define kQ3GeometryTypeTriMesh                Q3_OBJECT_TYPE('t','m','s','h')
  805.         #define kQ3ShapeTypeShader                        Q3_OBJECT_TYPE('s','h','d','r')
  806.             #define kQ3ShaderTypeSurface                Q3_OBJECT_TYPE('s','u','s','h')
  807.                 #define kQ3SurfaceShaderTypeTexture        Q3_OBJECT_TYPE('t','x','s','u')
  808.             #define kQ3ShaderTypeIllumination            Q3_OBJECT_TYPE('i','l','s','h')
  809.                 #define kQ3IlluminationTypePhong        Q3_OBJECT_TYPE('p','h','i','l')
  810.                 #define kQ3IlluminationTypeLambert        Q3_OBJECT_TYPE('l','m','i','l')
  811.                 #define kQ3IlluminationTypeNULL            Q3_OBJECT_TYPE('n','u','i','l')
  812.             #if defined(ESCHER_VER_15) && ESCHER_VER_15
  813.             #define kQ3ShaderTypeImage                    Q3_OBJECT_TYPE('i','m','s','h')
  814.             #define kQ3ShaderTypeTrim                    Q3_OBJECT_TYPE('t','r','s','h')
  815.             #define kQ3ShaderTypeAtmospheric            Q3_OBJECT_TYPE('a','t','s','h')
  816.             #endif  /*  ESCHER_VER_15  */
  817.         #define kQ3ShapeTypeStyle                        Q3_OBJECT_TYPE('s','t','y','l')
  818.             #define kQ3StyleTypeBackfacing                Q3_OBJECT_TYPE('b','c','k','f')
  819.             #define kQ3StyleTypeInterpolation            Q3_OBJECT_TYPE('i','n','t','p')
  820.             #define kQ3StyleTypeFill                    Q3_OBJECT_TYPE('f','i','s','t')
  821.             #define kQ3StyleTypePickID                    Q3_OBJECT_TYPE('p','k','i','d')
  822.             #define kQ3StyleTypeReceiveShadows            Q3_OBJECT_TYPE('r','c','s','h')
  823.             #define kQ3StyleTypeHighlight                Q3_OBJECT_TYPE('h','i','g','h')
  824.             #define kQ3StyleTypeSubdivision                Q3_OBJECT_TYPE('s','b','d','v')
  825.             #define kQ3StyleTypeOrientation                Q3_OBJECT_TYPE('o','f','d','r')
  826.             #define kQ3StyleTypePickParts                Q3_OBJECT_TYPE('p','k','p','t')
  827.             #define kQ3StyleTypeZCompare                Q3_OBJECT_TYPE('z','c','m','p')
  828.             #define kQ3StyleTypeAntiAlias                Q3_OBJECT_TYPE('a','n','t','i')
  829.             #if defined(ESCHER_VER_15) && ESCHER_VER_15
  830.             #define kQ3StyleTypeTimeInterpolation        Q3_OBJECT_TYPE('t','i','n','t')
  831.             #endif  /*  ESCHER_VER_15  */
  832.         #define kQ3ShapeTypeTransform                    Q3_OBJECT_TYPE('x','f','r','m')
  833.             #define kQ3TransformTypeMatrix                Q3_OBJECT_TYPE('m','t','r','x')
  834.             #define kQ3TransformTypeScale                Q3_OBJECT_TYPE('s','c','a','l')
  835.             #define kQ3TransformTypeTranslate            Q3_OBJECT_TYPE('t','r','n','s')
  836.             #define kQ3TransformTypeRotate                Q3_OBJECT_TYPE('r','o','t','t')
  837.             #define kQ3TransformTypeRotateAboutPoint     Q3_OBJECT_TYPE('r','t','a','p')
  838.             #define kQ3TransformTypeRotateAboutAxis     Q3_OBJECT_TYPE('r','t','a','a')
  839.             #define kQ3TransformTypeQuaternion            Q3_OBJECT_TYPE('q','t','r','n')
  840.             #define kQ3TransformTypeReset                Q3_OBJECT_TYPE('r','s','e','t')
  841.         #if defined(ESCHER_VER_15) && ESCHER_VER_15
  842.         #define kQ3ShapeTypeTimeTransform                Q3_OBJECT_TYPE('t','f','r','m')
  843.         #endif  /*  ESCHER_VER_15  */
  844.         #define kQ3ShapeTypeLight                        Q3_OBJECT_TYPE('l','g','h','t')
  845.             #define kQ3LightTypeAmbient                    Q3_OBJECT_TYPE('a','m','b','n')
  846.             #define kQ3LightTypeDirectional                Q3_OBJECT_TYPE('d','r','c','t')
  847.             #define kQ3LightTypePoint                    Q3_OBJECT_TYPE('p','n','t','l')
  848.             #define kQ3LightTypeSpot                    Q3_OBJECT_TYPE('s','p','o','t')
  849.         #define kQ3ShapeTypeCamera                        Q3_OBJECT_TYPE('c','m','r','a')
  850.             #define kQ3CameraTypeOrthographic            Q3_OBJECT_TYPE('o','r','t','h')
  851.             #define kQ3CameraTypeViewPlane                Q3_OBJECT_TYPE('v','w','p','l')
  852.             #define kQ3CameraTypeViewAngleAspect        Q3_OBJECT_TYPE('v','a','n','a')
  853.     
  854.         #if defined(ESCHER_VER_15) && ESCHER_VER_15
  855.         #define kQ3ShapeTypeGuide                        Q3_OBJECT_TYPE('g','u','i','d')
  856.             #define kQ3GuideTypePoint                    Q3_OBJECT_TYPE('p','n','t','g')
  857.             #define kQ3GuideTypeLine                    Q3_OBJECT_TYPE('l','i','n','g')
  858.             #define kQ3GuideTypeCircle                    Q3_OBJECT_TYPE('c','i','r','g')
  859.             #define kQ3GuideTypePlane                    Q3_OBJECT_TYPE('p','l','n','g')
  860.             #define kQ3GuideTypeSphere                    Q3_OBJECT_TYPE('s','p','h','g')
  861.         #endif  /*  ESCHER_VER_15  */
  862.         #define kQ3ShapeTypeGroup                            Q3_OBJECT_TYPE('g','r','u','p')
  863.             #define kQ3GroupTypeDisplay                        Q3_OBJECT_TYPE('d','s','p','g')
  864.                 #define kQ3DisplayGroupTypeOrdered            Q3_OBJECT_TYPE('o','r','d','g')
  865.                 #define kQ3DisplayGroupTypeIOProxy            Q3_OBJECT_TYPE('i','o','p','x')
  866.                 #if defined(ESCHER_VER_15) && ESCHER_VER_15
  867.                 #define kQ3DisplayGroupTypeKeyFrame            Q3_OBJECT_TYPE('k','f','r','m')
  868.                 #endif  /*  ESCHER_VER_15  */
  869.             #define kQ3GroupTypeLight                        Q3_OBJECT_TYPE('l','g','h','g')
  870.             #define kQ3GroupTypeInfo                        Q3_OBJECT_TYPE('i','n','f','o')
  871.             
  872.             #if defined(ESCHER_VER_15) && ESCHER_VER_15
  873.             #define kQ3GroupTypeGuide                        Q3_OBJECT_TYPE('g','u','d','g')
  874.             #endif  /*  ESCHER_VER_15  */
  875.             
  876.         #define kQ3ShapeTypeUnknown                        Q3_OBJECT_TYPE('u','n','k','n')
  877.             #define kQ3UnknownTypeText                    Q3_OBJECT_TYPE('u','k','t','x')
  878.             #define kQ3UnknownTypeBinary                Q3_OBJECT_TYPE('u','k','b','n')
  879.         #define kQ3ShapeTypeReference                    Q3_OBJECT_TYPE('r','f','r','n')
  880.             #define kQ3ReferenceTypeExternal            Q3_OBJECT_TYPE('r','f','e','x')
  881.     #define kQ3SharedTypeSet                            Q3_OBJECT_TYPE('s','e','t',' ')
  882.         #define kQ3SetTypeAttribute                        Q3_OBJECT_TYPE('a','t','t','r')
  883.     #define kQ3SharedTypeDrawContext                    Q3_OBJECT_TYPE('d','c','t','x')
  884.         #define kQ3DrawContextTypePixmap                Q3_OBJECT_TYPE('d','p','x','p')
  885.         #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  886.         #define kQ3DrawContextTypeMacintosh                Q3_OBJECT_TYPE('d','m','a','c')
  887.         #endif  /*  WINDOW_SYSTEM_MACINTOSH  */
  888.         #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  889.         #define kQ3DrawContextTypeWin32DC                Q3_OBJECT_TYPE('d','w','3','2')
  890.         #define kQ3DrawContextTypeDDSurface                Q3_OBJECT_TYPE('d','d','d','s')
  891.         #endif  /*  WINDOW_SYSTEM_WIN32  */
  892.         #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  893.         #define kQ3DrawContextTypeX11                    Q3_OBJECT_TYPE('d','x','1','1')
  894.         #endif  /*  WINDOW_SYSTEM_X11  */
  895.         #if defined(ESCHER_VER_15) && ESCHER_VER_15
  896.         #define kQ3DrawContextTypeFile                    Q3_OBJECT_TYPE('d','f','i','l')
  897.         #endif  /*  ESCHER_VER_15  */
  898.     #define kQ3SharedTypeTexture                        Q3_OBJECT_TYPE('t','x','t','r')
  899.         #define kQ3TextureTypePixmap                    Q3_OBJECT_TYPE('t','x','p','m')
  900.         #define kQ3TextureTypeMipmap                    Q3_OBJECT_TYPE('t','x','m','m')
  901.         #if defined(ESCHER_VER_15) && ESCHER_VER_15
  902.         #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  903.         #define kQ3TextureTypeQuickdrawGX                Q3_OBJECT_TYPE('t','x','g','x')
  904.         #endif  /*  WINDOW_SYSTEM_MACINTOSH  */
  905.         #endif  /*  ESCHER_VER_15  */
  906.     #if defined(ESCHER_VER_15) && ESCHER_VER_15
  907.     #define kQ3SharedTypeMapping                        Q3_OBJECT_TYPE('m','a','p','p')
  908.         #define kQ3MappingTypePicking                    Q3_OBJECT_TYPE('p','c','k','m')
  909.         #define kQ3MappingTypeGuide                        Q3_OBJECT_TYPE('g','u','d','m')
  910.         #define kQ3MappingTypeFree                        Q3_OBJECT_TYPE('f','r','e','m')
  911.         #define kQ3MappingTypeAlign                        Q3_OBJECT_TYPE('a','l','g','m')
  912.     #endif  /*  ESCHER_VER_15  */
  913.     
  914.     #if defined(ESCHER_VER_15) && ESCHER_VER_15
  915.     #define kQ3SharedTypeAttachment                        Q3_OBJECT_TYPE('a','t','c','h')
  916.     #endif  /*  ESCHER_VER_15  */
  917.     #define kQ3SharedTypeFile                            Q3_OBJECT_TYPE('f','i','l','e')
  918.     #define kQ3SharedTypeStorage                        Q3_OBJECT_TYPE('s','t','r','g')
  919.         #define kQ3StorageTypeMemory                    Q3_OBJECT_TYPE('m','e','m','s')
  920.             #if defined(OS_MACINTOSH) && OS_MACINTOSH
  921.             #define kQ3MemoryStorageTypeHandle                Q3_OBJECT_TYPE('h','n','d','l')
  922.             #endif  /*  OS_MACINTOSH  */
  923.         #define kQ3StorageTypeUnix                        Q3_OBJECT_TYPE('u','x','s','t')
  924.             #define kQ3UnixStorageTypePath                    Q3_OBJECT_TYPE('u','n','i','x')
  925.         #if defined(OS_MACINTOSH) && OS_MACINTOSH
  926.         #define kQ3StorageTypeMacintosh                    Q3_OBJECT_TYPE('m','a','c','n')
  927.             #define kQ3MacintoshStorageTypeFSSpec            Q3_OBJECT_TYPE('m','a','c','p')                    
  928.         #endif  /*  OS_MACINTOSH  */
  929.         #if defined(OS_WIN32) && OS_WIN32
  930.         #define kQ3StorageTypeWin32                        Q3_OBJECT_TYPE('w','i','s','t')
  931.         #endif  /*  OS_WIN32  */
  932.     #define kQ3SharedTypeString                            Q3_OBJECT_TYPE('s','t','r','n')
  933.         #define kQ3StringTypeCString                    Q3_OBJECT_TYPE('s','t','r','c')
  934.         #if defined(ESCHER_VER_15) && ESCHER_VER_15
  935.         #define kQ3StringTypeUnicode                    Q3_OBJECT_TYPE('u','n','c','d')
  936.         #if defined(OS_MACINTOSH) && OS_MACINTOSH
  937.         #define kQ3StringTypeWorldScript                Q3_OBJECT_TYPE('s','c','r','p')
  938.         #endif  /*  OS_MACINTOSH  */
  939.         #endif  /*  ESCHER_VER_15  */
  940.     #define kQ3SharedTypeShapePart                        Q3_OBJECT_TYPE('s','p','r','t')
  941.         #define kQ3ShapePartTypeMeshPart                Q3_OBJECT_TYPE('s','p','m','h')
  942.             #define kQ3MeshPartTypeMeshFacePart            Q3_OBJECT_TYPE('m','f','a','c')
  943.             #define kQ3MeshPartTypeMeshEdgePart            Q3_OBJECT_TYPE('m','e','d','g')
  944.             #define kQ3MeshPartTypeMeshVertexPart        Q3_OBJECT_TYPE('m','v','t','x')
  945.     #define kQ3SharedTypeControllerState                Q3_OBJECT_TYPE('c','t','s','t')
  946.     #define kQ3SharedTypeTracker                        Q3_OBJECT_TYPE('t','r','k','r')
  947.     #define kQ3SharedTypeViewHints                        Q3_OBJECT_TYPE('v','w','h','n')
  948.     #if defined(ESCHER_VER_15) && ESCHER_VER_15
  949.     #define kQ3SharedTypeDeepBuffer                        Q3_OBJECT_TYPE('d','e','e','p')
  950.     #define kQ3SharedTypeWidget                            Q3_OBJECT_TYPE('w','d','g','t')
  951.     #define kQ3SharedTypeColorScheme                    Q3_OBJECT_TYPE('c','s','c','h')
  952.     #endif  /*  ESCHER_VER_15  */
  953.     #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  954.     #define kQ3SharedTypeColorTable                        Q3_OBJECT_TYPE('c','l','u','t')
  955.     #endif /*  ESCHER_VER_FUTURE  */
  956. #define kQ3ObjectTypeEndGroup                            Q3_OBJECT_TYPE('e','n','d','g')
  957.  
  958. #ifdef __cplusplus
  959. extern "C" {
  960. #endif    /* __cplusplus */
  961.  
  962. /******************************************************************************
  963.  **                                                                             **
  964.  **                            QuickDraw 3D System Routines                     **
  965.  **                                                                             **
  966.  *****************************************************************************/
  967.  
  968. QD3D_EXPORT TQ3Status Q3Initialize(
  969.     void);
  970.  
  971. QD3D_EXPORT TQ3Status Q3Exit(
  972.     void);
  973.  
  974. QD3D_EXPORT TQ3Boolean Q3IsInitialized(
  975.     void);
  976.  
  977. QD3D_EXPORT TQ3Status Q3GetVersion(
  978.     unsigned long        *majorRevision,
  979.     unsigned long        *minorRevision);
  980.  
  981.  
  982. /******************************************************************************
  983.  **                                                                             **
  984.  **                            ObjectClass Routines                             **
  985.  **                                                                             **
  986.  *****************************************************************************/
  987.  
  988. QD3D_EXPORT TQ3Status Q3ObjectClass_Unregister(
  989.     TQ3ObjectClass        objectClass);
  990.  
  991.  
  992. /******************************************************************************
  993.  **                                                                             **
  994.  **                                Object Routines                                 **
  995.  **                                                                             **
  996.  *****************************************************************************/
  997.  
  998. QD3D_EXPORT TQ3Status Q3Object_Dispose(
  999.     TQ3Object             object);
  1000.     
  1001. QD3D_EXPORT TQ3Object Q3Object_Duplicate(
  1002.     TQ3Object            object);
  1003.     
  1004. QD3D_EXPORT TQ3Status Q3Object_Submit(
  1005.     TQ3Object            object,
  1006.     TQ3ViewObject        view);
  1007.     
  1008. QD3D_EXPORT TQ3Boolean Q3Object_IsDrawable(
  1009.     TQ3Object            object);
  1010.  
  1011. QD3D_EXPORT TQ3Boolean Q3Object_IsWritable(
  1012.     TQ3Object            object,
  1013.     TQ3FileObject        file);
  1014.  
  1015.  
  1016. /******************************************************************************
  1017.  **                                                                             **
  1018.  **                            Object Type Routines                             **
  1019.  **                                                                             **
  1020.  *****************************************************************************/
  1021.  
  1022. QD3D_EXPORT TQ3ObjectType Q3Object_GetType(
  1023.     TQ3Object            object);
  1024.  
  1025. QD3D_EXPORT TQ3ObjectType Q3Object_GetLeafType(
  1026.     TQ3Object            object);
  1027.  
  1028. QD3D_EXPORT TQ3Boolean Q3Object_IsType(
  1029.     TQ3Object            object,
  1030.     TQ3ObjectType        type);
  1031.  
  1032.  
  1033. /******************************************************************************
  1034.  **                                                                             **
  1035.  **                            Shared Object Routines                             **
  1036.  **                                                                             **
  1037.  *****************************************************************************/
  1038.  
  1039. QD3D_EXPORT TQ3ObjectType Q3Shared_GetType(
  1040.     TQ3SharedObject     sharedObject);
  1041.  
  1042. QD3D_EXPORT TQ3SharedObject Q3Shared_GetReference(
  1043.     TQ3SharedObject     sharedObject);
  1044.  
  1045. /* 
  1046.     Q3Shared_IsReferenced
  1047.         Returns kQ3True if there is more than one reference to sharedObject.
  1048.         Returns kQ3False if there is ONE reference to sharedObject.
  1049.     
  1050.     This call is intended to allow applications and plug-in objects to delete
  1051.     objects of which they hold THE ONLY REFERENCE. This is useful when
  1052.     caching objects, etc.
  1053.     
  1054.     Although many may be tempted, DO NOT DO THIS:
  1055.         while (Q3Shared_IsReferenced(foo)) { Q3Object_Dispose(foo); }
  1056.     
  1057.     Your application will crash and no one will buy it. Chapter 11 is 
  1058.     never fun (unless you short the stock). Thanks.
  1059. */
  1060. QD3D_EXPORT TQ3Boolean Q3Shared_IsReferenced(
  1061.     TQ3SharedObject         sharedObject);
  1062.  
  1063. /*
  1064.     Q3Shared_GetEditIndex
  1065.         Returns the "serial number" of sharedObject. Usefuly for caching 
  1066.         object information. Returns 0 on error.
  1067.         
  1068.         Hold onto this number to determine if an object has changed since you
  1069.         last built your caches... To validate, do:
  1070.         
  1071.         if (Q3Shared_GetEditIndex(foo) == oldFooEditIndex) {
  1072.             // Cache is valid
  1073.         } else {
  1074.             // Cache is invalid
  1075.             RebuildSomeSortOfCache(foo);
  1076.             oldFooEditIndex = Q3Shared_GetEditIndex(foo);
  1077.         }
  1078. */
  1079. QD3D_EXPORT unsigned long Q3Shared_GetEditIndex(
  1080.     TQ3SharedObject         sharedObject);
  1081.  
  1082. /*
  1083.     Q3Shared_Edited
  1084.         Bumps the "serial number" of sharedObject to a different value. This
  1085.         call is intended to be used solely from a plug-in object which is 
  1086.         shared. Call this whenever your private instance data changes.
  1087.         
  1088.         Returns kQ3Failure iff sharedObject is not a shared object, OR
  1089.             QuickDraw 3D isn't initialized.
  1090. */
  1091. QD3D_EXPORT TQ3Status Q3Shared_Edited(
  1092.     TQ3SharedObject         sharedObject);
  1093.  
  1094. /******************************************************************************
  1095.  **                                                                             **
  1096.  **                                Shape Routines                                 **
  1097.  **                                                                             **
  1098.  *****************************************************************************/
  1099.  
  1100. /*
  1101.  *    QuickDraw 3D 1.1 Note:
  1102.  *
  1103.  *    Shapes and Sets are now (sort of) polymorphic.
  1104.  *
  1105.  *        You may call Q3Shape_Foo or Q3Set_Foo on a shape or a set.
  1106.  *        The following calls are identical, in implementation:
  1107.  *
  1108.  *            Q3Shape_GetElement            =    Q3Set_Get
  1109.  *            Q3Shape_AddElement            =    Q3Set_Add
  1110.  *            Q3Shape_ContainsElement        =    Q3Set_Contains
  1111.  *            Q3Shape_GetNextElementType    =    Q3Set_GetNextElementType
  1112.  *            Q3Shape_EmptyElements        =    Q3Set_Empty
  1113.  *            Q3Shape_ClearElement        =    Q3Set_Clear
  1114.  *
  1115.  *    All of these calls accept a shape or a set as their first parameter.
  1116.  *
  1117.  *    The Q3Shape_GetSet and Q3ShapeSetSet calls are implemented via a new
  1118.  *    element type kQ3ElementTypeSet. See the note above about 
  1119.  *    kQ3ElementTypeSet;
  1120.  *
  1121.  *    It is important to note that the new Q3Shape_...Element... calls do not
  1122.  *    create a set on a shape and then add the element to it. This data is
  1123.  *    attached directly to the shape. Therefore, it is possible for an element
  1124.  *    to exist on a shape without a set existing on it as well. 
  1125.  *
  1126.  *    In your application, if you attach an element to a shape like this:
  1127.  *        (this isn't checking for errors for simplicity)
  1128.  *
  1129.  *        set = Q3Set_New();
  1130.  *        Q3Set_AddElement(set, kMyElemType, &data);
  1131.  *        Q3Shape_SetSet(shape, set);
  1132.  *
  1133.  *    You should retrieve it in the same manner:
  1134.  *
  1135.  *        Q3Shape_GetSet(shape, &set);
  1136.  *        if (Q3Set_Contains(set, kMyElemType) == kTrue) {
  1137.  *            Q3Set_Get(set, kMyElemType, &data);
  1138.  *        }
  1139.  *
  1140.  *    Similarly, if you attach data to a shape with the new calls:
  1141.  *
  1142.  *        Q3Shape_AddElement(shape, kMyElemType, &data);
  1143.  *
  1144.  *    You should retrieve it in the same manner:
  1145.  *
  1146.  *        if (Q3Shape_ContainsElement(set, kMyElemType) == kTrue) 
  1147.  *        {
  1148.  *            Q3Shape_GetElement(set, kMyElemType, &data);
  1149.  *        }
  1150.  *
  1151.  *    This really becomes an issue when dealing with version 1.0 and version 1.1 
  1152.  *    metafiles.
  1153.  *
  1154.  *    When attempting to find a particular element on a shape, you should
  1155.  *    first check with Q3Shape_GetNextElementType or Q3Shape_GetElement, then,
  1156.  *    Q3Shape_GetSet(s, &set) (or Q3Shape_GetElement(s, kQ3ElementTypeSet, &set))
  1157.  *    and then Q3Shape_GetElement(set, ...).
  1158.  *
  1159.  *    In terms of implementation, Q3Shape_SetSet and Q3Shape_GetSet should only be
  1160.  *    used for sets of information that are shared among multiple shapes.
  1161.  *    
  1162.  *    Q3Shape_AddElement, Q3Shape_GetElement, etc. calls should only be used
  1163.  *    for elements that are unique for a particular shape.
  1164.  *    
  1165.  */
  1166. QD3D_EXPORT TQ3ObjectType Q3Shape_GetType(
  1167.     TQ3ShapeObject    shape);
  1168.  
  1169. QD3D_EXPORT TQ3Status Q3Shape_GetSet(
  1170.     TQ3ShapeObject    shape,
  1171.     TQ3SetObject    *set);
  1172.  
  1173. QD3D_EXPORT TQ3Status Q3Shape_SetSet(
  1174.     TQ3ShapeObject    shape,
  1175.     TQ3SetObject     set);
  1176.  
  1177. QD3D_EXPORT TQ3Status Q3Shape_AddElement(
  1178.     TQ3ShapeObject    shape,
  1179.     TQ3ElementType    type,
  1180.     const void        *data);
  1181.  
  1182. QD3D_EXPORT TQ3Status Q3Shape_GetElement(
  1183.     TQ3ShapeObject    shape,
  1184.     TQ3ElementType    type,
  1185.     void            *data);
  1186.     
  1187. QD3D_EXPORT TQ3Boolean Q3Shape_ContainsElement(
  1188.     TQ3ShapeObject    shape,
  1189.     TQ3ElementType    type);
  1190.  
  1191. QD3D_EXPORT TQ3Status Q3Shape_GetNextElementType(
  1192.     TQ3ShapeObject    shape,
  1193.     TQ3ElementType    *type);
  1194.  
  1195. QD3D_EXPORT TQ3Status Q3Shape_EmptyElements(
  1196.     TQ3ShapeObject    shape);
  1197.  
  1198. QD3D_EXPORT TQ3Status Q3Shape_ClearElement(
  1199.     TQ3ShapeObject    shape,
  1200.     TQ3ElementType    type);
  1201.  
  1202. /******************************************************************************
  1203.  **                                                                             **
  1204.  **                            Color Table Routines                             **
  1205.  **                                                                             **
  1206.  *****************************************************************************/
  1207.  
  1208. #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  1209.  
  1210. QD3D_EXPORT TQ3ColorTableObject Q3ColorTable_New(
  1211.     const TQ3ColorTableData        *colorTableData);
  1212.  
  1213. QD3D_EXPORT TQ3Status Q3ColorTable_Set(
  1214.     TQ3ColorTableObject            colorTable,
  1215.     const TQ3ColorTableData        *colorTableData);
  1216.  
  1217. QD3D_EXPORT TQ3Status Q3ColorTable_Get(
  1218.     TQ3ColorTableObject            colorTable,
  1219.     const TQ3ColorTableData        *colorTableData);
  1220.  
  1221. QD3D_EXPORT TQ3Status Q3ColorTable_SetType(
  1222.     TQ3ColorTableObject            colorTable,
  1223.     TQ3ColorTableType            colorTableType);
  1224.  
  1225. QD3D_EXPORT TQ3Status Q3ColorTable_GetType(
  1226.     TQ3ColorTableObject            colorTable,
  1227.     TQ3ColorTableType            *colorTableType);
  1228.  
  1229. QD3D_EXPORT TQ3Status Q3ColorTable_SetTransparent(
  1230.     TQ3ColorTableObject            colorTable,
  1231.     TQ3Boolean                    hasTransparent);
  1232.  
  1233. QD3D_EXPORT TQ3Status Q3ColorTable_GetTransparent(
  1234.     TQ3ColorTableObject            colorTable,
  1235.     TQ3Boolean                    *hasTransparent);
  1236.  
  1237. QD3D_EXPORT TQ3Status Q3ColorTable_SetColors(
  1238.     TQ3ColorTableObject            colorTable,
  1239.     unsigned long                startIndex,
  1240.     unsigned long                count,
  1241.     const TQ3ColorRGB32            *colors);
  1242.  
  1243. QD3D_EXPORT TQ3Status Q3ColorTable_GetColors(
  1244.     TQ3ColorTableObject            colorTable,
  1245.     unsigned long                startIndex,
  1246.     unsigned long                count,
  1247.     TQ3ColorRGB32                *colors);
  1248.  
  1249. QD3D_EXPORT void Q3ColorRGB32_Set(
  1250.     TQ3ColorRGB32            *colorRGB32,
  1251.     unsigned char            r,
  1252.     unsigned char            g,
  1253.     unsigned char            b);
  1254.  
  1255. QD3D_EXPORT void Q3ColorRGB32_Get(
  1256.     TQ3ColorRGB32            colorRGB32,
  1257.     unsigned char            *r,
  1258.     unsigned char            *g,
  1259.     unsigned char            *b);
  1260.  
  1261. #endif /* ESCHER_VER_FUTURE */
  1262.  
  1263. QD3D_EXPORT TQ3Status Q3Bitmap_Empty(
  1264.     TQ3Bitmap            *bitmap);
  1265.  
  1266. QD3D_EXPORT unsigned long Q3Bitmap_GetImageSize(
  1267.     unsigned long        width,
  1268.     unsigned long        height);
  1269.  
  1270. #ifdef __cplusplus
  1271. }
  1272. #endif  /*  __cplusplus  */
  1273.  
  1274. #if defined(__MWERKS__)
  1275.     #pragma enumsalwaysint reset
  1276. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  1277.     #pragma options enum=reset
  1278. #endif
  1279.  
  1280. #endif /*  QD3D_h  */
  1281.  
  1282.