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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       QD3DPick.h
  3.  
  4.      Contains:   Q3Pick methods
  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 __QD3DPICK__
  18. #define __QD3DPICK__
  19. #ifndef __QD3D__
  20. #include "QD3D.h"
  21. #endif
  22. #ifndef __QD3DSTYLE__
  23. #include "QD3DStyle.h"
  24. #endif
  25. #ifndef __QD3DGEOMETRY__
  26. #include "QD3DGeometry.h"
  27. #endif
  28. #if PRAGMA_ONCE
  29. #pragma once
  30. #endif
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #if PRAGMA_IMPORT
  35. #pragma import on
  36. #endif
  37. #if PRAGMA_STRUCT_ALIGN
  38.     #pragma options align=power
  39. #elif PRAGMA_STRUCT_PACKPUSH
  40.     #pragma pack(push, 2)
  41. #elif PRAGMA_STRUCT_PACK
  42.     #pragma pack(2)
  43. #endif
  44. #if PRAGMA_ENUM_ALWAYSINT
  45.     #if defined(__fourbyteints__) && !__fourbyteints__ 
  46.         #define __QD3DPICK__RESTORE_TWOBYTEINTS
  47.         #pragma fourbyteints on
  48.     #endif
  49.     #pragma enumsalwaysint on
  50. #elif PRAGMA_ENUM_OPTIONS
  51.     #pragma option enum=int
  52. #elif PRAGMA_ENUM_PACK
  53.     #if __option(pack_enums)
  54.         #define __QD3DPICK__RESTORE_PACKED_ENUMS
  55.         #pragma options(!pack_enums)
  56.     #endif
  57. #endif
  58. /*****************************************************************************
  59.  **                                                                         **
  60.  **                         Mask bits for hit information                   **
  61.  **                                                                         **
  62.  *****************************************************************************/
  63. enum TQ3PickDetailMasks {
  64.     kQ3PickDetailNone           = 0,
  65.     kQ3PickDetailMaskPickID     = 1 << 0,
  66.     kQ3PickDetailMaskPath       = 1 << 1,
  67.     kQ3PickDetailMaskObject     = 1 << 2,
  68.     kQ3PickDetailMaskLocalToWorldMatrix = 1 << 3,
  69.     kQ3PickDetailMaskXYZ        = 1 << 4,
  70.     kQ3PickDetailMaskDistance   = 1 << 5,
  71.     kQ3PickDetailMaskNormal     = 1 << 6,
  72.     kQ3PickDetailMaskShapePart  = 1 << 7,
  73.     kQ3PickDetailMaskPickPart   = 1 << 8,
  74.     kQ3PickDetailMaskUV         = 1 << 9
  75. };
  76. typedef enum TQ3PickDetailMasks TQ3PickDetailMasks;
  77. typedef unsigned long                   TQ3PickDetail;
  78. /******************************************************************************
  79.  **                                                                          **
  80.  **                             Hitlist sorting                              **
  81.  **                                                                          **
  82.  *****************************************************************************/
  83. enum TQ3PickSort {
  84.     kQ3PickSortNone             = 0,
  85.     kQ3PickSortNearToFar        = 1,
  86.     kQ3PickSortFarToNear        = 2
  87. };
  88. typedef enum TQ3PickSort TQ3PickSort;
  89. /******************************************************************************
  90.  **                                                                          **
  91.  **                 Data structures to set up the pick object                **
  92.  **                                                                          **
  93.  *****************************************************************************/
  94. #define kQ3ReturnAllHits        0
  95. struct TQ3PickData {
  96.     TQ3PickSort                     sort;
  97.     TQ3PickDetail                   mask;
  98.     unsigned long                   numHitsToReturn;
  99. };
  100. typedef struct TQ3PickData              TQ3PickData;
  101. struct TQ3WindowPointPickData {
  102.     TQ3PickData                     data;
  103.     TQ3Point2D                      point;
  104.     float                           vertexTolerance;
  105.     float                           edgeTolerance;
  106. };
  107. typedef struct TQ3WindowPointPickData   TQ3WindowPointPickData;
  108. struct TQ3WindowRectPickData {
  109.     TQ3PickData                     data;
  110.     TQ3Area                         rect;
  111. };
  112. typedef struct TQ3WindowRectPickData    TQ3WindowRectPickData;
  113. struct TQ3WorldRayPickData {
  114.     TQ3PickData                     data;
  115.     TQ3Ray3D                        ray;
  116.     float                           vertexTolerance;
  117.     float                           edgeTolerance;
  118. };
  119. typedef struct TQ3WorldRayPickData      TQ3WorldRayPickData;
  120. /******************************************************************************
  121.  **                                                                          **
  122.  **                                 Hit data                                 **
  123.  **                                                                          **
  124.  *****************************************************************************/
  125. struct TQ3HitPath {
  126.     TQ3GroupObject                  rootGroup;
  127.     unsigned long                   depth;
  128.     TQ3GroupPosition *              positions;
  129. };
  130. typedef struct TQ3HitPath               TQ3HitPath;
  131. /******************************************************************************
  132.  **                                                                          **
  133.  **                             Pick class methods                           **
  134.  **                                                                          **
  135.  *****************************************************************************/
  136. #if CALL_NOT_IN_CARBON
  137. EXTERN_API_C( TQ3ObjectType )
  138. Q3Pick_GetType                  (TQ3PickObject          pick);
  139. EXTERN_API_C( TQ3Status )
  140. Q3Pick_GetData                  (TQ3PickObject          pick,
  141.                                  TQ3PickData *          data);
  142. EXTERN_API_C( TQ3Status )
  143. Q3Pick_SetData                  (TQ3PickObject          pick,
  144.                                  const TQ3PickData *    data);
  145. EXTERN_API_C( TQ3Status )
  146. Q3Pick_GetVertexTolerance       (TQ3PickObject          pick,
  147.                                  float *                vertexTolerance);
  148. EXTERN_API_C( TQ3Status )
  149. Q3Pick_GetEdgeTolerance         (TQ3PickObject          pick,
  150.                                  float *                edgeTolerance);
  151. EXTERN_API_C( TQ3Status )
  152. Q3Pick_SetVertexTolerance       (TQ3PickObject          pick,
  153.                                  float                  vertexTolerance);
  154. EXTERN_API_C( TQ3Status )
  155. Q3Pick_SetEdgeTolerance         (TQ3PickObject          pick,
  156.                                  float                  edgeTolerance);
  157. EXTERN_API_C( TQ3Status )
  158. Q3Pick_GetNumHits               (TQ3PickObject          pick,
  159.                                  unsigned long *        numHits);
  160. EXTERN_API_C( TQ3Status )
  161. Q3Pick_EmptyHitList             (TQ3PickObject          pick);
  162. EXTERN_API_C( TQ3Status )
  163. Q3Pick_GetPickDetailValidMask   (TQ3PickObject          pick,
  164.                                  unsigned long          index,
  165.                                  TQ3PickDetail *        pickDetailValidMask);
  166. EXTERN_API_C( TQ3Status )
  167. Q3Pick_GetPickDetailData        (TQ3PickObject          pick,
  168.                                  unsigned long          index,
  169.                                  TQ3PickDetail          pickDetailValue,
  170.                                  void *                 detailData);
  171. EXTERN_API_C( TQ3Status )
  172. Q3HitPath_EmptyData             (TQ3HitPath *           hitPath);
  173. #endif  /* CALL_NOT_IN_CARBON */
  174. /******************************************************************************
  175.  **                                                                          **
  176.  **                         Window point pick methods                        **
  177.  **                                                                          **
  178.  *****************************************************************************/
  179. #if CALL_NOT_IN_CARBON
  180. EXTERN_API_C( TQ3PickObject )
  181. Q3WindowPointPick_New           (const TQ3WindowPointPickData * data);
  182. EXTERN_API_C( TQ3Status )
  183. Q3WindowPointPick_GetPoint      (TQ3PickObject          pick,
  184.                                  TQ3Point2D *           point);
  185. EXTERN_API_C( TQ3Status )
  186. Q3WindowPointPick_SetPoint      (TQ3PickObject          pick,
  187.                                  const TQ3Point2D *     point);
  188. EXTERN_API_C( TQ3Status )
  189. Q3WindowPointPick_GetData       (TQ3PickObject          pick,
  190.                                  TQ3WindowPointPickData * data);
  191. EXTERN_API_C( TQ3Status )
  192. Q3WindowPointPick_SetData       (TQ3PickObject          pick,
  193.                                  const TQ3WindowPointPickData * data);
  194. /******************************************************************************
  195.  **                                                                          **
  196.  **                         Window rect pick methods                         **
  197.  **                                                                          **
  198.  *****************************************************************************/
  199. EXTERN_API_C( TQ3PickObject )
  200. Q3WindowRectPick_New            (const TQ3WindowRectPickData * data);
  201. EXTERN_API_C( TQ3Status )
  202. Q3WindowRectPick_GetRect        (TQ3PickObject          pick,
  203.                                  TQ3Area *              rect);
  204. EXTERN_API_C( TQ3Status )
  205. Q3WindowRectPick_SetRect        (TQ3PickObject          pick,
  206.                                  const TQ3Area *        rect);
  207. EXTERN_API_C( TQ3Status )
  208. Q3WindowRectPick_GetData        (TQ3PickObject          pick,
  209.                                  TQ3WindowRectPickData * data);
  210. EXTERN_API_C( TQ3Status )
  211. Q3WindowRectPick_SetData        (TQ3PickObject          pick,
  212.                                  const TQ3WindowRectPickData * data);
  213. /******************************************************************************
  214.  **                                                                          **
  215.  **                         World ray pick methods                           **
  216.  **                                                                          **
  217.  *****************************************************************************/
  218. EXTERN_API_C( TQ3PickObject )
  219. Q3WorldRayPick_New              (const TQ3WorldRayPickData * data);
  220. EXTERN_API_C( TQ3Status )
  221. Q3WorldRayPick_GetRay           (TQ3PickObject          pick,
  222.                                  TQ3Ray3D *             ray);
  223. EXTERN_API_C( TQ3Status )
  224. Q3WorldRayPick_SetRay           (TQ3PickObject          pick,
  225.                                  const TQ3Ray3D *       ray);
  226. EXTERN_API_C( TQ3Status )
  227. Q3WorldRayPick_GetData          (TQ3PickObject          pick,
  228.                                  TQ3WorldRayPickData *  data);
  229. EXTERN_API_C( TQ3Status )
  230. Q3WorldRayPick_SetData          (TQ3PickObject          pick,
  231.                                  const TQ3WorldRayPickData * data);
  232. /******************************************************************************
  233.  **                                                                          **
  234.  **                             Shape Part methods                           **
  235.  **                                                                          **
  236.  *****************************************************************************/
  237. EXTERN_API_C( TQ3ObjectType )
  238. Q3ShapePart_GetType             (TQ3ShapePartObject     shapePartObject);
  239. EXTERN_API_C( TQ3ObjectType )
  240. Q3MeshPart_GetType              (TQ3MeshPartObject      meshPartObject);
  241. EXTERN_API_C( TQ3Status )
  242. Q3ShapePart_GetShape            (TQ3ShapePartObject     shapePartObject,
  243.                                  TQ3ShapeObject *       shapeObject);
  244. EXTERN_API_C( TQ3Status )
  245. Q3MeshPart_GetComponent         (TQ3MeshPartObject      meshPartObject,
  246.                                  TQ3MeshComponent *     component);
  247. EXTERN_API_C( TQ3Status )
  248. Q3MeshFacePart_GetFace          (TQ3MeshFacePartObject  meshFacePartObject,
  249.                                  TQ3MeshFace *          face);
  250. EXTERN_API_C( TQ3Status )
  251. Q3MeshEdgePart_GetEdge          (TQ3MeshEdgePartObject  meshEdgePartObject,
  252.                                  TQ3MeshEdge *          edge);
  253. EXTERN_API_C( TQ3Status )
  254. Q3MeshVertexPart_GetVertex      (TQ3MeshVertexPartObject  meshVertexPartObject,
  255.                                  TQ3MeshVertex *        vertex);
  256. #endif  /* CALL_NOT_IN_CARBON */
  257. #if PRAGMA_ENUM_ALWAYSINT
  258.     #pragma enumsalwaysint reset
  259.     #ifdef __QD3DPICK__RESTORE_TWOBYTEINTS
  260.         #pragma fourbyteints off
  261.     #endif
  262. #elif PRAGMA_ENUM_OPTIONS
  263.     #pragma option enum=reset
  264. #elif defined(__QD3DPICK__RESTORE_PACKED_ENUMS)
  265.     #pragma options(pack_enums)
  266. #endif
  267. #if PRAGMA_STRUCT_ALIGN
  268.     #pragma options align=reset
  269. #elif PRAGMA_STRUCT_PACKPUSH
  270.     #pragma pack(pop)
  271. #elif PRAGMA_STRUCT_PACK
  272.     #pragma pack()
  273. #endif
  274. #ifdef PRAGMA_IMPORT_OFF
  275. #pragma import off
  276. #elif PRAGMA_IMPORT
  277. #pragma import reset
  278. #endif
  279. #ifdef __cplusplus
  280. }
  281. #endif
  282. #endif /* __QD3DPICK__ */