QD3D.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:54k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       QD3D.h
  3.  
  4.      Contains:   Base types for Quickdraw 3D
  5.  
  6.      Version:    Technology: Quickdraw 3D 1.6
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1995-2001 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __QD3D__
  18. #define __QD3D__
  19. #ifndef __CONDITIONALMACROS__
  20. #include "ConditionalMacros.h"
  21. #endif
  22. #if TARGET_OS_MAC
  23. #ifndef __MACTYPES__
  24. #include "MacTypes.h"
  25. #endif
  26. #endif  /* TARGET_OS_MAC */
  27. #define ushort FREDDIE
  28. #include "stdio.h"
  29. #if PRAGMA_ONCE
  30. #pragma once
  31. #endif
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #if PRAGMA_IMPORT
  36. #pragma import on
  37. #endif
  38. #if PRAGMA_STRUCT_ALIGN
  39.     #pragma options align=power
  40. #elif PRAGMA_STRUCT_PACKPUSH
  41.     #pragma pack(push, 2)
  42. #elif PRAGMA_STRUCT_PACK
  43.     #pragma pack(2)
  44. #endif
  45. #if PRAGMA_ENUM_ALWAYSINT
  46.     #if defined(__fourbyteints__) && !__fourbyteints__ 
  47.         #define __QD3D__RESTORE_TWOBYTEINTS
  48.         #pragma fourbyteints on
  49.     #endif
  50.     #pragma enumsalwaysint on
  51. #elif PRAGMA_ENUM_OPTIONS
  52.     #pragma option enum=int
  53. #elif PRAGMA_ENUM_PACK
  54.     #if __option(pack_enums)
  55.         #define __QD3D__RESTORE_PACKED_ENUMS
  56.         #pragma options(!pack_enums)
  57.     #endif
  58. #endif
  59. #if TARGET_OS_MAC
  60. #define OS_MACINTOSH 1
  61. #define OS_WIN32 0
  62. #define OS_UNIX 0
  63. #define OS_NEXT 0
  64. #define WINDOW_SYSTEM_MACINTOSH 1
  65. #define WINDOW_SYSTEM_WIN32 0
  66. #define WINDOW_SYSTEM_X11 0
  67. #define WINDOW_SYSTEM_NEXT 0
  68. #endif  /* TARGET_OS_MAC */
  69. #if TARGET_OS_WIN32
  70. #define OS_MACINTOSH 0
  71. #define OS_WIN32 1
  72. #define OS_UNIX 0
  73. #define OS_NEXT 0
  74. #define WINDOW_SYSTEM_MACINTOSH 0
  75. #define WINDOW_SYSTEM_WIN32 1
  76. #define WINDOW_SYSTEM_X11 0
  77. #define WINDOW_SYSTEM_NEXT 0
  78. #endif  /* TARGET_OS_WIN32 */
  79. #if TARGET_OS_UNIX
  80. #define OS_MACINTOSH 0
  81. #define OS_WIN32 0
  82. #define WINDOW_SYSTEM_MACINTOSH 0
  83. #define WINDOW_SYSTEM_WIN32 0
  84. #if NeXT
  85. #define OS_UNIX 0
  86. #define OS_NEXT 1
  87. #define WINDOW_SYSTEM_X11 0
  88. #define WINDOW_SYSTEM_NEXT 1
  89. #else
  90. #define OS_UNIX 1
  91. #define OS_NEXT 0
  92. #define WINDOW_SYSTEM_X11 1
  93. #define WINDOW_SYSTEM_NEXT 0
  94. #endif  /* NeXT */
  95. #endif  /* TARGET_OS_UNIX */
  96. /******************************************************************************
  97.  **                                                                             **
  98.  **                             Export Control                               **
  99.  **                                                                          **
  100.  *****************************************************************************/
  101. #if TARGET_OS_WIN32
  102.     #if defined(WIN32_EXPORTING)    /* define when building DLL */
  103.      #define QD3D_EXPORT __declspec( dllexport )  
  104.       #define QD3D_CALL   
  105.        #define QD3D_CALLBACK   
  106.    #else
  107.       #define QD3D_EXPORT __declspec( dllimport ) 
  108.        #define QD3D_CALL   __cdecl
  109.         #define QD3D_CALLBACK   __cdecl 
  110.    #endif /* WIN32_EXPORTING */
  111. #else
  112.  #define QD3D_EXPORT
  113.     #define QD3D_CALL   
  114.    #define QD3D_CALLBACK   
  115. #endif  /*  TARGET_OS_WIN32  */
  116. /******************************************************************************
  117.  **                                                                          **
  118.  **                             NULL definition                              **
  119.  **                                                                          **
  120.  *****************************************************************************/
  121.  
  122. #ifndef NULL
  123.  #error /*   NULL is undefined?  */
  124. #endif /* NULL */
  125. /******************************************************************************
  126.  **                                                                          **
  127.  **                                 Objects                                  **
  128.  **                                                                          **
  129.  *****************************************************************************/
  130. /*
  131.  * Everything in QuickDraw 3D is an OBJECT: a bunch of data with a type,
  132.  * deletion, duplication, and i/o methods.
  133.  */
  134. typedef long                            TQ3ObjectType;
  135. typedef struct OpaqueTQ3Object*         TQ3Object;
  136. /* */
  137. /*
  138.  * There are four subclasses of OBJECT:
  139.  *  an ELEMENT, which is data that is placed in a SET
  140.  *  a SHAREDOBJECT, which is reference-counted data that is shared
  141.  *  VIEWs, which maintain state information for an image
  142.  *  a PICK, which used to query a VIEW
  143.  */
  144. typedef TQ3Object                       TQ3ElementObject;
  145. typedef TQ3Object                       TQ3SharedObject;
  146. typedef TQ3Object                       TQ3ViewObject;
  147. typedef TQ3Object                       TQ3PickObject;
  148. /*
  149.  * There are several types of SharedObjects:
  150.  *  RENDERERs, which paint to a drawContext
  151.  *  DRAWCONTEXTs, which are an interface to a device 
  152.  *  SETs, which maintains "mathematical sets" of ELEMENTs
  153.  *  FILEs, which maintain state information for a metafile
  154.  *  SHAPEs, which affect the state of the View
  155.  *  SHAPEPARTs, which contain geometry-specific data about a picking hit
  156.  *  CONTROLLERSTATEs, which hold state of the output channels for a CONTROLLER
  157.  *  TRACKERs, which represent a position and orientation in the user interface
  158.  *  STRINGs, which are abstractions of text string data.
  159.  *  STORAGE, which is an abstraction for stream-based data storage (files, memory)
  160.  *  TEXTUREs, for sharing bitmap information for TEXTURESHADERS
  161.  *  VIEWHINTs, which specifies viewing preferences in FILEs
  162.  */
  163. typedef TQ3SharedObject                 TQ3RendererObject;
  164. typedef TQ3SharedObject                 TQ3DrawContextObject;
  165. typedef TQ3SharedObject                 TQ3SetObject;
  166. typedef TQ3SharedObject                 TQ3FileObject;
  167. typedef TQ3SharedObject                 TQ3ShapeObject;
  168. typedef TQ3SharedObject                 TQ3ShapePartObject;
  169. typedef TQ3SharedObject                 TQ3ControllerStateObject;
  170. typedef TQ3SharedObject                 TQ3TrackerObject;
  171. typedef TQ3SharedObject                 TQ3StringObject;
  172. typedef TQ3SharedObject                 TQ3StorageObject;
  173. typedef TQ3SharedObject                 TQ3TextureObject;
  174. typedef TQ3SharedObject                 TQ3ViewHintsObject;
  175. /*
  176.  * There is one types of SET:
  177.  *  ATTRIBUTESETs, which contain ATTRIBUTEs which are inherited 
  178.  */
  179. typedef TQ3SetObject                    TQ3AttributeSet;
  180. /*
  181.  * There are many types of SHAPEs:
  182.  *  LIGHTs, which affect how the RENDERER draws 3-D cues
  183.  *  CAMERAs, which affects the location and orientation of the RENDERER in space
  184.  *  GROUPs, which may contain any number of SHARED OBJECTS
  185.  *  GEOMETRYs, which are representations of three-dimensional data
  186.  *  SHADERs, which affect how colors are drawn on a geometry
  187.  *  STYLEs, which affect how the RENDERER paints to the DRAWCONTEXT
  188.  *  TRANSFORMs, which affect the coordinate system in the VIEW
  189.  *  REFERENCEs, which are references to objects in FILEs
  190.  *  UNKNOWN, which hold unknown objects read from a metafile.
  191.  */
  192. typedef TQ3ShapeObject                  TQ3GroupObject;
  193. typedef TQ3ShapeObject                  TQ3GeometryObject;
  194. typedef TQ3ShapeObject                  TQ3ShaderObject;
  195. typedef TQ3ShapeObject                  TQ3StyleObject;
  196. typedef TQ3ShapeObject                  TQ3TransformObject;
  197. typedef TQ3ShapeObject                  TQ3LightObject;
  198. typedef TQ3ShapeObject                  TQ3CameraObject;
  199. typedef TQ3ShapeObject                  TQ3UnknownObject;
  200. typedef TQ3ShapeObject                  TQ3ReferenceObject;
  201. typedef TQ3ShapeObject                  TQ3StateOperatorObject;
  202. /*
  203.  * For now, there is only one type of SHAPEPARTs:
  204.  *  MESHPARTs, which describe some part of a mesh
  205.  */
  206. typedef TQ3ShapePartObject              TQ3MeshPartObject;
  207. /*
  208.  * There are three types of MESHPARTs:
  209.  *  MESHFACEPARTs, which describe a face of a mesh
  210.  *  MESHEDGEPARTs, which describe a edge of a mesh
  211.  *  MESHVERTEXPARTs, which describe a vertex of a mesh
  212.  */
  213. typedef TQ3MeshPartObject               TQ3MeshFacePartObject;
  214. typedef TQ3MeshPartObject               TQ3MeshEdgePartObject;
  215. typedef TQ3MeshPartObject               TQ3MeshVertexPartObject;
  216. /*
  217.  * A DISPLAY Group can be drawn to a view
  218.  */
  219. typedef TQ3GroupObject                  TQ3DisplayGroupObject;
  220. /*
  221.  * There are many types of SHADERs:
  222.  *  SURFACESHADERs, which affect how the surface of a geometry is painted
  223.  *  ILLUMINATIONSHADERs, which affect how lights affect the color of a surface
  224.  */
  225. typedef TQ3ShaderObject                 TQ3SurfaceShaderObject;
  226. typedef TQ3ShaderObject                 TQ3IlluminationShaderObject;
  227. /*
  228.  * A handle to an object in a group
  229.  */
  230. typedef struct OpaqueTQ3GroupPosition*  TQ3GroupPosition;
  231. /* 
  232.  * TQ3ObjectClassNameString is used for the class name of an object
  233.  */
  234. enum {
  235.     kQ3StringMaximumLength      = 1024
  236. };
  237.    typedef char TQ3ObjectClassNameString[kQ3StringMaximumLength];
  238.  
  239.    
  240. /******************************************************************************
  241.  **                                                                          **
  242.  **                         Client/Server Things                             **
  243.  **                                                                          **
  244.  *****************************************************************************/
  245. typedef void *                          TQ3ControllerRef;
  246. /******************************************************************************
  247.  **                                                                          **
  248.  **                         Flags and Switches                               **
  249.  **                                                                          **
  250.  *****************************************************************************/
  251. enum TQ3Boolean {
  252.     kQ3False                    = 0,
  253.     kQ3True                     = 1
  254. };
  255. typedef enum TQ3Boolean TQ3Boolean;
  256. enum TQ3Switch {
  257.     kQ3Off                      = 0,
  258.     kQ3On                       = 1
  259. };
  260. typedef enum TQ3Switch TQ3Switch;
  261. enum TQ3Status {
  262.     kQ3Failure                  = 0,
  263.     kQ3Success                  = 1
  264. };
  265. typedef enum TQ3Status TQ3Status;
  266. enum TQ3Axis {
  267.     kQ3AxisX                    = 0,
  268.     kQ3AxisY                    = 1,
  269.     kQ3AxisZ                    = 2
  270. };
  271. typedef enum TQ3Axis TQ3Axis;
  272. enum TQ3PixelType {
  273.     kQ3PixelTypeRGB32           = 0,                            /* Alpha:8 (ignored), R:8, G:8, B:8   */
  274.     kQ3PixelTypeARGB32          = 1,                            /* Alpha:8, R:8, G:8, B:8          */
  275.     kQ3PixelTypeRGB16           = 2,                            /* Alpha:1 (ignored), R:5, G:5, B:5   */
  276.     kQ3PixelTypeARGB16          = 3,                            /* Alpha:1, R:5, G:5, B:5          */
  277.     kQ3PixelTypeRGB16_565       = 4,                            /* Win32 only: 16 bits/pixel, R:5, G:6, B:5     */
  278.     kQ3PixelTypeRGB24           = 5                             /* Win32 only: 24 bits/pixel, R:8, G:8, B:8     */
  279. };
  280. typedef enum TQ3PixelType TQ3PixelType;
  281. enum TQ3Endian {
  282.     kQ3EndianBig                = 0,
  283.     kQ3EndianLittle             = 1
  284. };
  285. typedef enum TQ3Endian TQ3Endian;
  286. enum TQ3EndCapMasks {
  287.     kQ3EndCapNone               = 0,
  288.     kQ3EndCapMaskTop            = 1 << 0,
  289.     kQ3EndCapMaskBottom         = 1 << 1,
  290.     kQ3EndCapMaskInterior       = 1 << 2
  291. };
  292. typedef enum TQ3EndCapMasks TQ3EndCapMasks;
  293. typedef unsigned long                   TQ3EndCap;
  294.    enum {
  295.      kQ3ArrayIndexNULL = ~0  
  296.    };
  297.  
  298.    
  299. /******************************************************************************
  300.  **                                                                          **
  301.  **                     Point and Vector Definitions                         **
  302.  **                                                                          **
  303.  *****************************************************************************/
  304. struct TQ3Vector2D {
  305.     float                           x;
  306.     float                           y;
  307. };
  308. typedef struct TQ3Vector2D              TQ3Vector2D;
  309. struct TQ3Vector3D {
  310.     float                           x;
  311.     float                           y;
  312.     float                           z;
  313. };
  314. typedef struct TQ3Vector3D              TQ3Vector3D;
  315. struct TQ3Point2D {
  316.     float                           x;
  317.     float                           y;
  318. };
  319. typedef struct TQ3Point2D               TQ3Point2D;
  320. struct TQ3Point3D {
  321.     float                           x;
  322.     float                           y;
  323.     float                           z;
  324. };
  325. typedef struct TQ3Point3D               TQ3Point3D;
  326. struct TQ3RationalPoint4D {
  327.     float                           x;
  328.     float                           y;
  329.     float                           z;
  330.     float                           w;
  331. };
  332. typedef struct TQ3RationalPoint4D       TQ3RationalPoint4D;
  333. struct TQ3RationalPoint3D {
  334.     float                           x;
  335.     float                           y;
  336.     float                           w;
  337. };
  338. typedef struct TQ3RationalPoint3D       TQ3RationalPoint3D;
  339. /******************************************************************************
  340.  **                                                                          **
  341.  **                             Quaternion                                   **
  342.  **                                                                          **
  343.  *****************************************************************************/
  344. struct TQ3Quaternion {
  345.     float                           w;
  346.     float                           x;
  347.     float                           y;
  348.     float                           z;
  349. };
  350. typedef struct TQ3Quaternion            TQ3Quaternion;
  351. /******************************************************************************
  352.  **                                                                          **
  353.  **                             Ray Definition                               **
  354.  **                                                                          **
  355.  *****************************************************************************/
  356. struct TQ3Ray3D {
  357.     TQ3Point3D                      origin;
  358.     TQ3Vector3D                     direction;
  359. };
  360. typedef struct TQ3Ray3D                 TQ3Ray3D;
  361. /******************************************************************************
  362.  **                                                                          **
  363.  **                     Parameterization Data Structures                     **
  364.  **                                                                          **
  365.  *****************************************************************************/
  366. struct TQ3Param2D {
  367.     float                           u;
  368.     float                           v;
  369. };
  370. typedef struct TQ3Param2D               TQ3Param2D;
  371. struct TQ3Param3D {
  372.     float                           u;
  373.     float                           v;
  374.     float                           w;
  375. };
  376. typedef struct TQ3Param3D               TQ3Param3D;
  377. struct TQ3Tangent2D {
  378.     TQ3Vector3D                     uTangent;
  379.     TQ3Vector3D                     vTangent;
  380. };
  381. typedef struct TQ3Tangent2D             TQ3Tangent2D;
  382. struct TQ3Tangent3D {
  383.     TQ3Vector3D                     uTangent;
  384.     TQ3Vector3D                     vTangent;
  385.     TQ3Vector3D                     wTangent;
  386. };
  387. typedef struct TQ3Tangent3D             TQ3Tangent3D;
  388. /******************************************************************************
  389.  **                                                                          **
  390.  **                     Polar and Spherical Coordinates                      **
  391.  **                                                                          **
  392.  *****************************************************************************/
  393. struct TQ3PolarPoint {
  394.     float                           r;
  395.     float                           theta;
  396. };
  397. typedef struct TQ3PolarPoint            TQ3PolarPoint;
  398. struct TQ3SphericalPoint {
  399.     float                           rho;
  400.     float                           theta;
  401.     float                           phi;
  402. };
  403. typedef struct TQ3SphericalPoint        TQ3SphericalPoint;
  404. /******************************************************************************
  405.  **                                                                          **
  406.  **                         Color Definition                                 **
  407.  **                                                                          **
  408.  *****************************************************************************/
  409. struct TQ3ColorRGB {
  410.     float                           r;
  411.     float                           g;
  412.     float                           b;
  413. };
  414. typedef struct TQ3ColorRGB              TQ3ColorRGB;
  415. struct TQ3ColorARGB {
  416.     float                           a;
  417.     float                           r;
  418.     float                           g;
  419.     float                           b;
  420. };
  421. typedef struct TQ3ColorARGB             TQ3ColorARGB;
  422. /******************************************************************************
  423.  **                                                                          **
  424.  **                                 Vertices                                 **
  425.  **                                                                          **
  426.  *****************************************************************************/
  427. struct TQ3Vertex3D {
  428.     TQ3Point3D                      point;
  429.     TQ3AttributeSet                 attributeSet;
  430. };
  431. typedef struct TQ3Vertex3D              TQ3Vertex3D;
  432. /******************************************************************************
  433.  **                                                                          **
  434.  **                                 Matrices                                 **
  435.  **                                                                          **
  436.  *****************************************************************************/
  437. struct TQ3Matrix3x3 {
  438.     float                           value[3][3];
  439. };
  440. typedef struct TQ3Matrix3x3             TQ3Matrix3x3;
  441. struct TQ3Matrix4x4 {
  442.     float                           value[4][4];
  443. };
  444. typedef struct TQ3Matrix4x4             TQ3Matrix4x4;
  445. /******************************************************************************
  446.  **                                                                          **
  447.  **                             Bitmap/Pixmap                                **
  448.  **                                                                          **
  449.  *****************************************************************************/
  450. struct TQ3Pixmap {
  451.     void *                          image;
  452.     unsigned long                   width;
  453.     unsigned long                   height;
  454.     unsigned long                   rowBytes;
  455.     unsigned long                   pixelSize;                  /* MUST be 16 or 32 to use with the   Interactive Renderer on Mac OS*/
  456.     TQ3PixelType                    pixelType;
  457.     TQ3Endian                       bitOrder;
  458.     TQ3Endian                       byteOrder;
  459. };
  460. typedef struct TQ3Pixmap                TQ3Pixmap;
  461. struct TQ3StoragePixmap {
  462.     TQ3StorageObject                image;
  463.     unsigned long                   width;
  464.     unsigned long                   height;
  465.     unsigned long                   rowBytes;
  466.     unsigned long                   pixelSize;                  /* MUST be 16 or 32 to use with the   Interactive Renderer on Mac OS*/
  467.     TQ3PixelType                    pixelType;
  468.     TQ3Endian                       bitOrder;
  469.     TQ3Endian                       byteOrder;
  470. };
  471. typedef struct TQ3StoragePixmap         TQ3StoragePixmap;
  472. struct TQ3Bitmap {
  473.     unsigned char *                 image;
  474.     unsigned long                   width;
  475.     unsigned long                   height;
  476.     unsigned long                   rowBytes;
  477.     TQ3Endian                       bitOrder;
  478. };
  479. typedef struct TQ3Bitmap                TQ3Bitmap;
  480. struct TQ3MipmapImage {                                         /* An image for use as a texture mipmap  */
  481.     unsigned long                   width;                      /* Width of mipmap, must be power of 2   */
  482.     unsigned long                   height;                     /* Height of mipmap, must be power of 2  */
  483.     unsigned long                   rowBytes;                   /* Rowbytes of mipmap                    */
  484.     unsigned long                   offset;                     /* Offset from image base to this mipmap */
  485. };
  486. typedef struct TQ3MipmapImage           TQ3MipmapImage;
  487. struct TQ3Mipmap {
  488.     TQ3StorageObject                image;                      /* Data containing the texture map and     */
  489.                                                                 /* if (useMipmapping==kQ3True) the       */
  490.                                                                 /* mipmap data                  */
  491.     TQ3Boolean                      useMipmapping;              /* True if mipmapping should be used   */
  492.                                                                 /* and all mipmaps have been provided    */
  493.     TQ3PixelType                    pixelType;
  494.     TQ3Endian                       bitOrder;
  495.     TQ3Endian                       byteOrder;
  496.     unsigned long                   reserved;                   /* leave NULL for next version          */
  497.     TQ3MipmapImage                  mipmaps[32];                /* The actual number of mipmaps is determined from the size of the first mipmap */
  498. };
  499. typedef struct TQ3Mipmap                TQ3Mipmap;
  500. struct TQ3CompressedPixmap {
  501.     TQ3StorageObject                compressedImage;            /* storage obj containing compressed image data */
  502.     TQ3Endian                       imageDescByteOrder;         /* endianness of the data in the imageDesc */
  503.     TQ3StorageObject                imageDesc;                  /* storage obj containing image description created by Quicktime to store info about compressed image */
  504.     TQ3Boolean                      makeMipmaps;
  505.     unsigned long                   width;
  506.     unsigned long                   height;
  507.     unsigned long                   pixelSize;
  508.     TQ3PixelType                    pixelType;
  509. };
  510. typedef struct TQ3CompressedPixmap      TQ3CompressedPixmap;
  511. /******************************************************************************
  512.  **                                                                          **
  513.  **                     Higher dimension quantities                          **
  514.  **                                                                          **
  515.  *****************************************************************************/
  516. struct TQ3Area {
  517.     TQ3Point2D                      min;
  518.     TQ3Point2D                      max;
  519. };
  520. typedef struct TQ3Area                  TQ3Area;
  521. struct TQ3PlaneEquation {
  522.     TQ3Vector3D                     normal;
  523.     float                           constant;
  524. };
  525. typedef struct TQ3PlaneEquation         TQ3PlaneEquation;
  526. struct TQ3BoundingBox {
  527.     TQ3Point3D                      min;
  528.     TQ3Point3D                      max;
  529.     TQ3Boolean                      isEmpty;
  530. };
  531. typedef struct TQ3BoundingBox           TQ3BoundingBox;
  532. struct TQ3BoundingSphere {
  533.     TQ3Point3D                      origin;
  534.     float                           radius;
  535.     TQ3Boolean                      isEmpty;
  536. };
  537. typedef struct TQ3BoundingSphere        TQ3BoundingSphere;
  538. /*
  539.  *  The TQ3ComputeBounds flag passed to StartBoundingBox or StartBoundingSphere
  540.  *  calls in the View. It's a hint to the system as to how it should 
  541.  *  compute the bbox of a shape:
  542.  *
  543.  *  kQ3ComputeBoundsExact:  
  544.  *      Vertices of shapes are transformed into world space and
  545.  *      the world space bounding box is computed from them.  Slow!
  546.  *  
  547.  *  kQ3ComputeBoundsApproximate: 
  548.  *      A local space bounding box is computed from a shape's
  549.  *      vertices.  This bbox is then transformed into world space,
  550.  *      and its bounding box is taken as the shape's approximate
  551.  *      bbox.  Fast but the bbox is larger than optimal.
  552.  */
  553. enum TQ3ComputeBounds {
  554.     kQ3ComputeBoundsExact       = 0,
  555.     kQ3ComputeBoundsApproximate = 1
  556. };
  557. typedef enum TQ3ComputeBounds TQ3ComputeBounds;
  558. /******************************************************************************
  559.  **                                                                          **
  560.  **                         Object System Types                              **
  561.  **                                                                          **
  562.  *****************************************************************************/
  563. typedef struct OpaqueTQ3XObjectClass*   TQ3XObjectClass;
  564. typedef unsigned long                   TQ3XMethodType;
  565. /*
  566.  * Object methods
  567.  */
  568. #define kQ3XMethodTypeObjectUnregister      Q3_METHOD_TYPE('u','n','r','g')
  569. /* 
  570.  *  Return true from the metahandler if this 
  571.  *  object can be submitted in a rendering loop 
  572.  */
  573. #define kQ3XMethodTypeObjectIsDrawable      Q3_METHOD_TYPE('i','s','d','r') /* return true from the metahandler if this object can be submitted in a rendering loop */
  574. typedef CALLBACK_API_C( void , TQ3XFunctionPointer )(void );
  575. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XMetaHandler )(TQ3XMethodType methodType);
  576. /*
  577.  * MetaHandler:
  578.  *      When you give a metahandler to QuickDraw 3D, it is called multiple 
  579.  *      times to build method tables, and then is thrown away. You are 
  580.  *      guaranteed that your metahandler will never be called again after a 
  581.  *      call that was passed a metahandler returns.
  582.  *
  583.  *      Your metahandler should contain a switch on the methodType passed to it
  584.  *      and should return the corresponding method as an TQ3XFunctionPointer.
  585.  *
  586.  *      IMPORTANT: A metaHandler MUST always "return" a value. If you are
  587.  *      passed a methodType that you do not understand, ALWAYS return NULL.
  588.  *
  589.  *      These types here are prototypes of how your functions should look.
  590.  */
  591. typedef CALLBACK_API_C( TQ3Status , TQ3XObjectUnregisterMethod )(TQ3XObjectClass objectClass);
  592. /*
  593.  * See QD3DIO.h for the IO method types: 
  594.  *      ObjectReadData, ObjectTraverse, ObjectWrite
  595.  */
  596. /******************************************************************************
  597.  **                                                                          **
  598.  **                             Set Types                                    **
  599.  **                                                                          **
  600.  *****************************************************************************/
  601. typedef long                            TQ3ElementType;
  602. enum {
  603.     kQ3ElementTypeNone          = 0,
  604.     kQ3ElementTypeUnknown       = 32,
  605.     kQ3ElementTypeSet           = 33
  606. };
  607. /* 
  608.  *  kQ3ElementTypeUnknown is a TQ3Object. 
  609.  *  
  610.  *      Do Q3Set_Add(s, ..., &obj) or Q3Set_Get(s, ..., &obj);
  611.  *      
  612.  *      Note that the object is always referenced when copying around. 
  613.  *      
  614.  *      Generally, it is an Unknown object, a Group of Unknown objects, or a 
  615.  *      group of other "objects" which have been found in the metafile and
  616.  *      have no attachment method to their parent. Be prepared to handle
  617.  *      any or all of these cases if you actually access the set on a shape.
  618.  *
  619.  *  kQ3ElementTypeSet is a TQ3SetObject. 
  620.  *  
  621.  *      Q3Shape_GetSet(s,&o) is eqivalent to 
  622.  *          Q3Shape_GetElement(s, kQ3ElementTypeSet, &o)
  623.  *          
  624.  *      Q3Shape_SetSet(s,o)  is eqivalent to 
  625.  *          Q3Shape_SetElement(s, kQ3ElementTypeSet, &o)
  626.  *  
  627.  *      Note that the object is always referenced when copying around. 
  628.  *      
  629.  *  See the note below about the Set and Shape changes.
  630.  */
  631. /******************************************************************************
  632.  **                                                                          **
  633.  **                         Object System Macros                             **
  634.  **                                                                          **
  635.  *****************************************************************************/
  636. #define Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d)        
  637.           ((const unsigned long)                  
  638.           ((const unsigned long) (a) << 24) |     
  639.           ((const unsigned long) (b) << 16) |     
  640.           ((const unsigned long) (c) << 8)  |     
  641.           ((const unsigned long) (d)))
  642. #define Q3_OBJECT_TYPE(a,b,c,d) 
  643.     ((TQ3ObjectType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  644. #define Q3_METHOD_TYPE(a,b,c,d) 
  645.    ((TQ3XMethodType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  646. /******************************************************************************
  647.  **                                                                          **
  648.  **                             Object Types                                 **
  649.  **                                                                          **
  650.  *****************************************************************************/
  651. /*
  652.  * Note:    a call to Q3Foo_GetType will return a value kQ3FooTypeBar
  653.  *          e.g. Q3Shared_GetType(object) returns kQ3SharedTypeShape, etc.
  654.  */
  655. #define kQ3ObjectTypeInvalid                           0L
  656. #define kQ3ObjectTypeView                                ((TQ3ObjectType)FOUR_CHAR_CODE('view'))
  657. #define kQ3ObjectTypeElement                            ((TQ3ObjectType)FOUR_CHAR_CODE('elmn'))
  658.     #define kQ3ElementTypeAttribute                     ((TQ3ObjectType)FOUR_CHAR_CODE('eatt'))
  659. #define kQ3ObjectTypePick                               ((TQ3ObjectType)FOUR_CHAR_CODE('pick'))
  660.     #define kQ3PickTypeWindowPoint                      ((TQ3ObjectType)FOUR_CHAR_CODE('pkwp'))
  661.     #define kQ3PickTypeWindowRect                       ((TQ3ObjectType)FOUR_CHAR_CODE('pkwr'))
  662.     #define kQ3PickTypeWorldRay                         ((TQ3ObjectType)FOUR_CHAR_CODE('pkry'))
  663. #define kQ3ObjectTypeShared                             ((TQ3ObjectType)FOUR_CHAR_CODE('shrd'))
  664.     #define kQ3SharedTypeRenderer                       ((TQ3ObjectType)FOUR_CHAR_CODE('rddr'))
  665.         #define kQ3RendererTypeWireFrame                ((TQ3ObjectType)FOUR_CHAR_CODE('wrfr'))
  666.         #define kQ3RendererTypeGeneric                  ((TQ3ObjectType)FOUR_CHAR_CODE('gnrr'))
  667.         #define kQ3RendererTypeInteractive              ((TQ3ObjectType)FOUR_CHAR_CODE('ctwn'))
  668.     #define kQ3SharedTypeShape                          ((TQ3ObjectType)FOUR_CHAR_CODE('shap'))
  669.             
  670.        #define kQ3ShapeTypeGeometry                    ((TQ3ObjectType)FOUR_CHAR_CODE('gmtr'))
  671.             #define kQ3GeometryTypeBox                  ((TQ3ObjectType)FOUR_CHAR_CODE('box '))
  672.             #define kQ3GeometryTypeGeneralPolygon       ((TQ3ObjectType)FOUR_CHAR_CODE('gpgn'))
  673.             #define kQ3GeometryTypeLine                 ((TQ3ObjectType)FOUR_CHAR_CODE('line'))
  674.             #define kQ3GeometryTypeMarker               ((TQ3ObjectType)FOUR_CHAR_CODE('mrkr'))
  675.             #define kQ3GeometryTypePixmapMarker         ((TQ3ObjectType)FOUR_CHAR_CODE('mrkp'))
  676.             #define kQ3GeometryTypeMesh                 ((TQ3ObjectType)FOUR_CHAR_CODE('mesh'))
  677.             #define kQ3GeometryTypeNURBCurve            ((TQ3ObjectType)FOUR_CHAR_CODE('nrbc'))
  678.             #define kQ3GeometryTypeNURBPatch            ((TQ3ObjectType)FOUR_CHAR_CODE('nrbp'))
  679.             #define kQ3GeometryTypePoint                ((TQ3ObjectType)FOUR_CHAR_CODE('pnt '))
  680.             #define kQ3GeometryTypePolygon              ((TQ3ObjectType)FOUR_CHAR_CODE('plyg'))
  681.             #define kQ3GeometryTypePolyLine             ((TQ3ObjectType)FOUR_CHAR_CODE('plyl'))
  682.             #define kQ3GeometryTypeTriangle             ((TQ3ObjectType)FOUR_CHAR_CODE('trng'))
  683.             #define kQ3GeometryTypeTriGrid              ((TQ3ObjectType)FOUR_CHAR_CODE('trig'))
  684.             #define kQ3GeometryTypeCone                 ((TQ3ObjectType)FOUR_CHAR_CODE('cone'))
  685.             #define kQ3GeometryTypeCylinder             ((TQ3ObjectType)FOUR_CHAR_CODE('cyln'))
  686.             #define kQ3GeometryTypeDisk                 ((TQ3ObjectType)FOUR_CHAR_CODE('disk'))
  687.             #define kQ3GeometryTypeEllipse              ((TQ3ObjectType)FOUR_CHAR_CODE('elps'))
  688.             #define kQ3GeometryTypeEllipsoid            ((TQ3ObjectType)FOUR_CHAR_CODE('elpd'))
  689.             #define kQ3GeometryTypePolyhedron           ((TQ3ObjectType)FOUR_CHAR_CODE('plhd'))
  690.             #define kQ3GeometryTypeTorus                ((TQ3ObjectType)FOUR_CHAR_CODE('tors'))
  691.             #define kQ3GeometryTypeTriMesh              ((TQ3ObjectType)FOUR_CHAR_CODE('tmsh'))
  692.             
  693.        #define kQ3ShapeTypeShader                      ((TQ3ObjectType)FOUR_CHAR_CODE('shdr'))
  694.             #define kQ3ShaderTypeSurface                ((TQ3ObjectType)FOUR_CHAR_CODE('sush'))
  695.                 #define kQ3SurfaceShaderTypeTexture     ((TQ3ObjectType)FOUR_CHAR_CODE('txsu'))
  696.             #define kQ3ShaderTypeIllumination           ((TQ3ObjectType)FOUR_CHAR_CODE('ilsh'))
  697.                 #define kQ3IlluminationTypePhong        ((TQ3ObjectType)FOUR_CHAR_CODE('phil'))
  698.                 #define kQ3IlluminationTypeLambert      ((TQ3ObjectType)FOUR_CHAR_CODE('lmil'))
  699.                 #define kQ3IlluminationTypeNULL         ((TQ3ObjectType)FOUR_CHAR_CODE('nuil'))
  700.         #define kQ3ShapeTypeStyle                       ((TQ3ObjectType)FOUR_CHAR_CODE('styl'))
  701.             #define kQ3StyleTypeBackfacing              ((TQ3ObjectType)FOUR_CHAR_CODE('bckf'))
  702.             #define kQ3StyleTypeInterpolation           ((TQ3ObjectType)FOUR_CHAR_CODE('intp'))
  703.             #define kQ3StyleTypeFill                    ((TQ3ObjectType)FOUR_CHAR_CODE('fist'))
  704.             #define kQ3StyleTypePickID                  ((TQ3ObjectType)FOUR_CHAR_CODE('pkid'))
  705.             #define kQ3StyleTypeReceiveShadows          ((TQ3ObjectType)FOUR_CHAR_CODE('rcsh'))
  706.             #define kQ3StyleTypeHighlight               ((TQ3ObjectType)FOUR_CHAR_CODE('high'))
  707.             #define kQ3StyleTypeSubdivision             ((TQ3ObjectType)FOUR_CHAR_CODE('sbdv'))
  708.             #define kQ3StyleTypeOrientation             ((TQ3ObjectType)FOUR_CHAR_CODE('ofdr'))
  709.             #define kQ3StyleTypePickParts               ((TQ3ObjectType)FOUR_CHAR_CODE('pkpt'))
  710.             #define kQ3StyleTypeAntiAlias               ((TQ3ObjectType)FOUR_CHAR_CODE('anti'))
  711.             #define kQ3StyleTypeFog                     ((TQ3ObjectType)FOUR_CHAR_CODE('fogg'))
  712.             
  713.        #define kQ3ShapeTypeTransform                   ((TQ3ObjectType)FOUR_CHAR_CODE('xfrm'))
  714.             #define kQ3TransformTypeMatrix              ((TQ3ObjectType)FOUR_CHAR_CODE('mtrx'))
  715.             #define kQ3TransformTypeScale               ((TQ3ObjectType)FOUR_CHAR_CODE('scal'))
  716.             #define kQ3TransformTypeTranslate           ((TQ3ObjectType)FOUR_CHAR_CODE('trns'))
  717.             #define kQ3TransformTypeRotate              ((TQ3ObjectType)FOUR_CHAR_CODE('rott'))
  718.             #define kQ3TransformTypeRotateAboutPoint    ((TQ3ObjectType)FOUR_CHAR_CODE('rtap'))
  719.             #define kQ3TransformTypeRotateAboutAxis     ((TQ3ObjectType)FOUR_CHAR_CODE('rtaa'))
  720.             #define kQ3TransformTypeQuaternion          ((TQ3ObjectType)FOUR_CHAR_CODE('qtrn'))
  721.             #define kQ3TransformTypeReset               ((TQ3ObjectType)FOUR_CHAR_CODE('rset'))
  722.         #define kQ3ShapeTypeLight                       ((TQ3ObjectType)FOUR_CHAR_CODE('lght'))
  723.             #define kQ3LightTypeAmbient                 ((TQ3ObjectType)FOUR_CHAR_CODE('ambn'))
  724.             #define kQ3LightTypeDirectional             ((TQ3ObjectType)FOUR_CHAR_CODE('drct'))
  725.             #define kQ3LightTypePoint                   ((TQ3ObjectType)FOUR_CHAR_CODE('pntl'))
  726.             #define kQ3LightTypeSpot                    ((TQ3ObjectType)FOUR_CHAR_CODE('spot'))
  727.             
  728.        #define kQ3ShapeTypeCamera                      ((TQ3ObjectType)FOUR_CHAR_CODE('cmra'))
  729.             #define kQ3CameraTypeOrthographic           ((TQ3ObjectType)FOUR_CHAR_CODE('orth'))
  730.             #define kQ3CameraTypeViewPlane              ((TQ3ObjectType)FOUR_CHAR_CODE('vwpl'))
  731.             #define kQ3CameraTypeViewAngleAspect        ((TQ3ObjectType)FOUR_CHAR_CODE('vana'))
  732.         #define kQ3ShapeTypeStateOperator               ((TQ3ObjectType)FOUR_CHAR_CODE('stop'))
  733.             #define kQ3StateOperatorTypePush            ((TQ3ObjectType)FOUR_CHAR_CODE('push'))
  734.             #define kQ3StateOperatorTypePop             ((TQ3ObjectType)FOUR_CHAR_CODE('pop '))
  735.         #define kQ3ShapeTypeGroup                       ((TQ3ObjectType)FOUR_CHAR_CODE('grup'))
  736.             #define kQ3GroupTypeDisplay                 ((TQ3ObjectType)FOUR_CHAR_CODE('dspg'))
  737.                 #define kQ3DisplayGroupTypeOrdered      ((TQ3ObjectType)FOUR_CHAR_CODE('ordg'))
  738.                 #define kQ3DisplayGroupTypeIOProxy      ((TQ3ObjectType)FOUR_CHAR_CODE('iopx'))
  739.             #define kQ3GroupTypeLight                   ((TQ3ObjectType)FOUR_CHAR_CODE('lghg'))
  740.             #define kQ3GroupTypeInfo                    ((TQ3ObjectType)FOUR_CHAR_CODE('info'))
  741.             
  742.        #define kQ3ShapeTypeUnknown                     ((TQ3ObjectType)FOUR_CHAR_CODE('unkn'))
  743.             #define kQ3UnknownTypeText                  ((TQ3ObjectType)FOUR_CHAR_CODE('uktx'))
  744.             #define kQ3UnknownTypeBinary                ((TQ3ObjectType)FOUR_CHAR_CODE('ukbn'))
  745.         #define kQ3ShapeTypeReference                   ((TQ3ObjectType)FOUR_CHAR_CODE('rfrn'))
  746.             #define kQ3ReferenceTypeExternal            ((TQ3ObjectType)FOUR_CHAR_CODE('rfex'))
  747.     #define kQ3SharedTypeSet                            ((TQ3ObjectType)FOUR_CHAR_CODE('set '))
  748.         #define kQ3SetTypeAttribute                     ((TQ3ObjectType)FOUR_CHAR_CODE('attr'))
  749.     #define kQ3SharedTypeDrawContext                    ((TQ3ObjectType)FOUR_CHAR_CODE('dctx'))
  750.         #define kQ3DrawContextTypePixmap                ((TQ3ObjectType)FOUR_CHAR_CODE('dpxp'))
  751.         #define kQ3DrawContextTypeMacintosh             ((TQ3ObjectType)FOUR_CHAR_CODE('dmac'))
  752.         #define kQ3DrawContextTypeWin32DC               ((TQ3ObjectType)FOUR_CHAR_CODE('dw32'))
  753.         #define kQ3DrawContextTypeDDSurface             ((TQ3ObjectType)FOUR_CHAR_CODE('ddds'))
  754.         #define kQ3DrawContextTypeX11                   ((TQ3ObjectType)FOUR_CHAR_CODE('dx11'))
  755.     #define kQ3SharedTypeTexture                        ((TQ3ObjectType)FOUR_CHAR_CODE('txtr'))
  756.         #define kQ3TextureTypePixmap                    ((TQ3ObjectType)FOUR_CHAR_CODE('txpm')) 
  757.        #define kQ3TextureTypeMipmap                    ((TQ3ObjectType)FOUR_CHAR_CODE('txmm')) 
  758.        #define kQ3TextureTypeCompressedPixmap          ((TQ3ObjectType)FOUR_CHAR_CODE('txcp'))
  759.             
  760.    #define kQ3SharedTypeFile                           ((TQ3ObjectType)FOUR_CHAR_CODE('file'))
  761.     #define kQ3SharedTypeStorage                        ((TQ3ObjectType)FOUR_CHAR_CODE('strg'))
  762.         #define kQ3StorageTypeMemory                    ((TQ3ObjectType)FOUR_CHAR_CODE('mems'))
  763.         #define kQ3MemoryStorageTypeHandle              ((TQ3ObjectType)FOUR_CHAR_CODE('hndl'))
  764.         #define kQ3StorageTypeUnix                      ((TQ3ObjectType)FOUR_CHAR_CODE('uxst'))
  765.         #define kQ3UnixStorageTypePath                  ((TQ3ObjectType)FOUR_CHAR_CODE('unix'))
  766.         #define kQ3StorageTypeMacintosh                 ((TQ3ObjectType)FOUR_CHAR_CODE('macn'))
  767.         #define kQ3MacintoshStorageTypeFSSpec           ((TQ3ObjectType)FOUR_CHAR_CODE('macp'))                 
  768.        #define kQ3StorageTypeWin32                     ((TQ3ObjectType)FOUR_CHAR_CODE('wist'))
  769.     #define kQ3SharedTypeString                         ((TQ3ObjectType)FOUR_CHAR_CODE('strn'))
  770.         #define kQ3StringTypeCString                    ((TQ3ObjectType)FOUR_CHAR_CODE('strc'))
  771.     #define kQ3SharedTypeShapePart                      ((TQ3ObjectType)FOUR_CHAR_CODE('sprt'))
  772.         #define kQ3ShapePartTypeMeshPart                ((TQ3ObjectType)FOUR_CHAR_CODE('spmh'))
  773.             #define kQ3MeshPartTypeMeshFacePart         ((TQ3ObjectType)FOUR_CHAR_CODE('mfac'))
  774.             #define kQ3MeshPartTypeMeshEdgePart         ((TQ3ObjectType)FOUR_CHAR_CODE('medg'))
  775.             #define kQ3MeshPartTypeMeshVertexPart       ((TQ3ObjectType)FOUR_CHAR_CODE('mvtx'))
  776.     #define kQ3SharedTypeControllerState                ((TQ3ObjectType)FOUR_CHAR_CODE('ctst'))
  777.     #define kQ3SharedTypeTracker                        ((TQ3ObjectType)FOUR_CHAR_CODE('trkr'))
  778.     #define kQ3SharedTypeViewHints                      ((TQ3ObjectType)FOUR_CHAR_CODE('vwhn'))
  779.     #define kQ3SharedTypeEndGroup                       ((TQ3ObjectType)FOUR_CHAR_CODE('endg'))
  780. /******************************************************************************
  781.  **                                                                          **
  782.  **                         QuickDraw 3D System Routines                     **
  783.  **                                                                          **
  784.  *****************************************************************************/
  785. #if CALL_NOT_IN_CARBON
  786. EXTERN_API_C( TQ3Status )
  787. Q3Initialize                    (void);
  788. EXTERN_API_C( TQ3Status )
  789. Q3Exit                          (void);
  790. EXTERN_API_C( TQ3Boolean )
  791. Q3IsInitialized                 (void);
  792. EXTERN_API_C( TQ3Status )
  793. Q3GetVersion                    (unsigned long *        majorRevision,
  794.                                  unsigned long *        minorRevision);
  795. /*
  796.  *  Q3GetReleaseVersion returns the release version number,
  797.  *  in the format of the first four bytes of a 'vers' resource
  798.  *  (e.g. 0x01518000 ==> 1.5.1 release).
  799.  */
  800. EXTERN_API_C( TQ3Status )
  801. Q3GetReleaseVersion             (unsigned long *        releaseRevision);
  802. /******************************************************************************
  803.  **                                                                          **
  804.  **                         ObjectClass Routines                             **
  805.  **                                                                          **
  806.  *****************************************************************************/
  807. /* 
  808.  *  New object system calls to query the object system.
  809.  *
  810.  *  These comments to move to the stubs file before final release, they 
  811.  *  are here for documentation for developers using early seeds.
  812.  */
  813. /*
  814.  *  Given a class name as a string return the associated class type for the 
  815.  *  class, may return kQ3Failure if the string representing the class is 
  816.  *  invalid.
  817.  */
  818. EXTERN_API_C( TQ3Status )
  819. Q3ObjectHierarchy_GetTypeFromString (TQ3ObjectClassNameString  objectClassString,
  820.                                  TQ3ObjectType *        objectClassType);
  821. /*
  822.  *  Given a class type as return the associated string for the class name, 
  823.  *  may return kQ3Failure if the type representing the class is invalid.
  824.  */
  825. EXTERN_API_C( TQ3Status )
  826. Q3ObjectHierarchy_GetStringFromType (TQ3ObjectType      objectClassType,
  827.                                  TQ3ObjectClassNameString  objectClassString);
  828. /* 
  829.  *  Return true if the class with this type is registered, false if not 
  830.  */
  831. EXTERN_API_C( TQ3Boolean )
  832. Q3ObjectHierarchy_IsTypeRegistered (TQ3ObjectType       objectClassType);
  833. /* 
  834.  *  Return true if the class with this name is registered, false if not 
  835.  */
  836. EXTERN_API_C( TQ3Boolean )
  837. Q3ObjectHierarchy_IsNameRegistered (const char *        objectClassName);
  838. /*
  839.  * TQ3SubClassData is used when querying the object system for
  840.  * the subclasses of a particular parent type:
  841.  */
  842. #endif  /* CALL_NOT_IN_CARBON */
  843. struct TQ3SubClassData {
  844.     unsigned long                   numClasses;                 /* the # of subclass types found for a parent class */
  845.     TQ3ObjectType *                 classTypes;                 /* an array containing the class types */
  846. };
  847. typedef struct TQ3SubClassData          TQ3SubClassData;
  848. /*
  849.  *  Given a parent type and an instance of the TQ3SubClassData struct fill
  850.  *  it in with the number and class types of all of the subclasses immediately
  851.  *  below the parent in the class hierarchy.  Return kQ3Success to indicate no
  852.  *  errors occurred, else kQ3Failure.
  853.  *
  854.  *  NOTE:  This function will allocate memory for the classTypes array.  Be 
  855.  *  sure to call Q3ObjectClass_EmptySubClassData to free this memory up.
  856.  */
  857. #if CALL_NOT_IN_CARBON
  858. EXTERN_API_C( TQ3Status )
  859. Q3ObjectHierarchy_GetSubClassData (TQ3ObjectType        objectClassType,
  860.                                  TQ3SubClassData *      subClassData);
  861. /*
  862.  *  Given an instance of the TQ3SubClassData struct free all memory allocated 
  863.  *  by the Q3ObjectClass_GetSubClassData call.
  864.  *
  865.  *  NOTE: This call MUST be made after a call to Q3ObjectClass_GetSubClassData
  866.  *  to avoid memory leaks.
  867.  */
  868. EXTERN_API_C( TQ3Status )
  869. Q3ObjectHierarchy_EmptySubClassData (TQ3SubClassData *  subClassData);
  870. /******************************************************************************
  871.  **                                                                          **
  872.  **                             Object Routines                              **
  873.  **                                                                          **
  874.  *****************************************************************************/
  875. EXTERN_API_C( TQ3Status )
  876. Q3Object_Dispose                (TQ3Object              object);
  877. EXTERN_API_C( TQ3Object )
  878. Q3Object_Duplicate              (TQ3Object              object);
  879. EXTERN_API_C( TQ3Status )
  880. Q3Object_Submit                 (TQ3Object              object,
  881.                                  TQ3ViewObject          view);
  882. EXTERN_API_C( TQ3Boolean )
  883. Q3Object_IsDrawable             (TQ3Object              object);
  884. EXTERN_API_C( TQ3Boolean )
  885. Q3Object_IsWritable             (TQ3Object              object,
  886.                                  TQ3FileObject          theFile);
  887. /******************************************************************************
  888.  **                                                                          **
  889.  **                         Object Type Routines                             **
  890.  **                                                                          **
  891.  *****************************************************************************/
  892. EXTERN_API_C( TQ3ObjectType )
  893. Q3Object_GetType                (TQ3Object              object);
  894. EXTERN_API_C( TQ3ObjectType )
  895. Q3Object_GetLeafType            (TQ3Object              object);
  896. EXTERN_API_C( TQ3Boolean )
  897. Q3Object_IsType                 (TQ3Object              object,
  898.                                  TQ3ObjectType          theType);
  899. /******************************************************************************
  900.  **                                                                          **
  901.  **                         Shared Object Routines                           **
  902.  **                                                                          **
  903.  *****************************************************************************/
  904. EXTERN_API_C( TQ3ObjectType )
  905. Q3Shared_GetType                (TQ3SharedObject        sharedObject);
  906. EXTERN_API_C( TQ3SharedObject )
  907. Q3Shared_GetReference           (TQ3SharedObject        sharedObject);
  908. /* 
  909.  *  Q3Shared_IsReferenced
  910.  *      Returns kQ3True if there is more than one reference to sharedObject.
  911.  *      Returns kQ3False if there is ONE reference to sharedObject.
  912.  *  
  913.  *  This call is intended to allow applications and plug-in objects to delete
  914.  *  objects of which they hold THE ONLY REFERENCE. This is useful when
  915.  *  caching objects, etc.
  916.  *  
  917.  *  Although many may be tempted, DO NOT DO THIS:
  918.  *      while (Q3Shared_IsReferenced(foo)) { Q3Object_Dispose(foo); }
  919.  *  
  920.  *  Your application will crash and no one will buy it. Chapter 11 is 
  921.  *  never fun (unless you short the stock). Thanks.
  922.  */
  923. EXTERN_API_C( TQ3Boolean )
  924. Q3Shared_IsReferenced           (TQ3SharedObject        sharedObject);
  925. /*
  926.  *  Q3Shared_GetEditIndex
  927.  *      Returns the "serial number" of sharedObject. Usefuly for caching 
  928.  *      object information. Returns 0 on error.
  929.  *      
  930.  *      Hold onto this number to determine if an object has changed since you
  931.  *      last built your caches... To validate, do:
  932.  *      
  933.  *      if (Q3Shared_GetEditIndex(foo) == oldFooEditIndex) {
  934.  *          // Cache is valid
  935.  *      } else {
  936.  *          // Cache is invalid
  937.  *          RebuildSomeSortOfCache(foo);
  938.  *          oldFooEditIndex = Q3Shared_GetEditIndex(foo);
  939.  *      }
  940.  */
  941. EXTERN_API_C( unsigned long )
  942. Q3Shared_GetEditIndex           (TQ3SharedObject        sharedObject);
  943. /*
  944.  *  Q3Shared_Edited
  945.  *      Bumps the "serial number" of sharedObject to a different value. This
  946.  *      call is intended to be used solely from a plug-in object which is 
  947.  *      shared. Call this whenever your private instance data changes.
  948.  *      
  949.  *      Returns kQ3Failure iff sharedObject is not a shared object, OR
  950.  *          QuickDraw 3D isn't initialized.
  951.  */
  952. EXTERN_API_C( TQ3Status )
  953. Q3Shared_Edited                 (TQ3SharedObject        sharedObject);
  954. /******************************************************************************
  955.  **                                                                          **
  956.  **                             Shape Routines                               **
  957.  **                                                                          **
  958.  *****************************************************************************/
  959. /*
  960.  *  QuickDraw 3D 1.5 Note:
  961.  *
  962.  *  Shapes and Sets are now (sort of) polymorphic.
  963.  *
  964.  *      You may call Q3Shape_Foo or Q3Set_Foo on a shape or a set.
  965.  *      The following calls are identical, in implementation:
  966.  *
  967.  *          Q3Shape_GetElement          =   Q3Set_Get
  968.  *          Q3Shape_AddElement          =   Q3Set_Add
  969.  *          Q3Shape_ContainsElement     =   Q3Set_Contains
  970.  *          Q3Shape_GetNextElementType  =   Q3Set_GetNextElementType
  971.  *          Q3Shape_EmptyElements       =   Q3Set_Empty
  972.  *          Q3Shape_ClearElement        =   Q3Set_Clear
  973.  *
  974.  *  All of these calls accept a shape or a set as their first parameter.
  975.  *
  976.  *  The Q3Shape_GetSet and Q3ShapeSetSet calls are implemented via a new
  977.  *  element type kQ3ElementTypeSet. See the note above about 
  978.  *  kQ3ElementTypeSet;
  979.  *
  980.  *  It is important to note that the new Q3Shape_...Element... calls do not
  981.  *  create a set on a shape and then add the element to it. This data is
  982.  *  attached directly to the shape. Therefore, it is possible for an element
  983.  *  to exist on a shape without a set existing on it as well. 
  984.  *
  985.  *  In your application, if you attach an element to a shape like this:
  986.  *      (this isn't checking for errors for simplicity)
  987.  *
  988.  *      set = Q3Set_New();
  989.  *      Q3Set_AddElement(set, kMyElemType, &data);
  990.  *      Q3Shape_SetSet(shape, set);
  991.  *
  992.  *  You should retrieve it in the same manner:
  993.  *
  994.  *      Q3Shape_GetSet(shape, &set);
  995.  *      if (Q3Set_Contains(set, kMyElemType) == kTrue) {
  996.  *          Q3Set_Get(set, kMyElemType, &data);
  997.  *      }
  998.  *
  999.  *  Similarly, if you attach data to a shape with the new calls:
  1000.  *
  1001.  *      Q3Shape_AddElement(shape, kMyElemType, &data);
  1002.  *
  1003.  *  You should retrieve it in the same manner:
  1004.  *
  1005.  *      if (Q3Shape_ContainsElement(set, kMyElemType) == kTrue) {
  1006.  *          Q3Shape_GetElement(set, kMyElemType, &data);
  1007.  *      }
  1008.  *
  1009.  *  This really becomes an issue when dealing with version 1.0 and version 1.1 
  1010.  *  metafiles.
  1011.  *
  1012.  *  When attempting to find a particular element on a shape, you should
  1013.  *  first check with Q3Shape_GetNextElementType or Q3Shape_GetElement, then,
  1014.  *  Q3Shape_GetSet(s, &set) (or Q3Shape_GetElement(s, kQ3ElementTypeSet, &set))
  1015.  *  and then Q3Shape_GetElement(set, ...).
  1016.  *
  1017.  *  In terms of implementation, Q3Shape_SetSet and Q3Shape_GetSet should only be
  1018.  *  used for sets of information that are shared among multiple shapes.
  1019.  *  
  1020.  *  Q3Shape_AddElement, Q3Shape_GetElement, etc. calls should only be used
  1021.  *  for elements that are unique for a particular shape.
  1022.  *  
  1023.  */
  1024. EXTERN_API_C( TQ3ObjectType )
  1025. Q3Shape_GetType                 (TQ3ShapeObject         shape);
  1026. EXTERN_API_C( TQ3Status )
  1027. Q3Shape_GetSet                  (TQ3ShapeObject         shape,
  1028.                                  TQ3SetObject *         theSet);
  1029. EXTERN_API_C( TQ3Status )
  1030. Q3Shape_SetSet                  (TQ3ShapeObject         shape,
  1031.                                  TQ3SetObject           theSet);
  1032. EXTERN_API_C( TQ3Status )
  1033. Q3Shape_AddElement              (TQ3ShapeObject         shape,
  1034.                                  TQ3ElementType         theType,
  1035.                                  const void *           data);
  1036. EXTERN_API_C( TQ3Status )
  1037. Q3Shape_GetElement              (TQ3ShapeObject         shape,
  1038.                                  TQ3ElementType         theType,
  1039.                                  void *                 data);
  1040. EXTERN_API_C( TQ3Boolean )
  1041. Q3Shape_ContainsElement         (TQ3ShapeObject         shape,
  1042.                                  TQ3ElementType         theType);
  1043. EXTERN_API_C( TQ3Status )
  1044. Q3Shape_GetNextElementType      (TQ3ShapeObject         shape,
  1045.                                  TQ3ElementType *       theType);
  1046. EXTERN_API_C( TQ3Status )
  1047. Q3Shape_EmptyElements           (TQ3ShapeObject         shape);
  1048. EXTERN_API_C( TQ3Status )
  1049. Q3Shape_ClearElement            (TQ3ShapeObject         shape,
  1050.                                  TQ3ElementType         theType);
  1051. /******************************************************************************
  1052.  **                                                                          **
  1053.  **                         Color Table Routines                             **
  1054.  **                                                                          **
  1055.  *****************************************************************************/
  1056. EXTERN_API_C( TQ3Status )
  1057. Q3Bitmap_Empty                  (TQ3Bitmap *            bitmap);
  1058. EXTERN_API_C( unsigned long )
  1059. Q3Bitmap_GetImageSize           (unsigned long          width,
  1060.                                  unsigned long          height);
  1061. #endif  /* CALL_NOT_IN_CARBON */
  1062. #if PRAGMA_ENUM_ALWAYSINT
  1063.     #pragma enumsalwaysint reset
  1064.     #ifdef __QD3D__RESTORE_TWOBYTEINTS
  1065.         #pragma fourbyteints off
  1066.     #endif
  1067. #elif PRAGMA_ENUM_OPTIONS
  1068.     #pragma option enum=reset
  1069. #elif defined(__QD3D__RESTORE_PACKED_ENUMS)
  1070.     #pragma options(pack_enums)
  1071. #endif
  1072. #if PRAGMA_STRUCT_ALIGN
  1073.     #pragma options align=reset
  1074. #elif PRAGMA_STRUCT_PACKPUSH
  1075.     #pragma pack(pop)
  1076. #elif PRAGMA_STRUCT_PACK
  1077.     #pragma pack()
  1078. #endif
  1079. #ifdef PRAGMA_IMPORT_OFF
  1080. #pragma import off
  1081. #elif PRAGMA_IMPORT
  1082. #pragma import reset
  1083. #endif
  1084. #ifdef __cplusplus
  1085. }
  1086. #endif
  1087. #endif /* __QD3D__ */