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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       QD3DController.h
  3.  
  4.      Contains:   Q3Controller 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 __QD3DCONTROLLER__
  18. #define __QD3DCONTROLLER__
  19. #ifndef __QD3D__
  20. #include "QD3D.h"
  21. #endif
  22. #if PRAGMA_ONCE
  23. #pragma once
  24. #endif
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. #if PRAGMA_IMPORT
  29. #pragma import on
  30. #endif
  31. #if PRAGMA_STRUCT_ALIGN
  32.     #pragma options align=power
  33. #elif PRAGMA_STRUCT_PACKPUSH
  34.     #pragma pack(push, 2)
  35. #elif PRAGMA_STRUCT_PACK
  36.     #pragma pack(2)
  37. #endif
  38. #if PRAGMA_ENUM_ALWAYSINT
  39.     #if defined(__fourbyteints__) && !__fourbyteints__ 
  40.         #define __QD3DCONTROLLER__RESTORE_TWOBYTEINTS
  41.         #pragma fourbyteints on
  42.     #endif
  43.     #pragma enumsalwaysint on
  44. #elif PRAGMA_ENUM_OPTIONS
  45.     #pragma option enum=int
  46. #elif PRAGMA_ENUM_PACK
  47.     #if __option(pack_enums)
  48.         #define __QD3DCONTROLLER__RESTORE_PACKED_ENUMS
  49.         #pragma options(!pack_enums)
  50.     #endif
  51. #endif
  52. /******************************************************************************
  53.  **                                                                          **
  54.  **                             Type Definitions                             **
  55.  **                                                                          **
  56.  *****************************************************************************/
  57. #define kQ3ControllerSetChannelMaxDataSize      256
  58. typedef CALLBACK_API_C( TQ3Status , TQ3ChannelGetMethod )(TQ3ControllerRef controllerRef, unsigned long channel, void *data, unsigned long *dataSize);
  59. typedef CALLBACK_API_C( TQ3Status , TQ3ChannelSetMethod )(TQ3ControllerRef controllerRef, unsigned long channel, const void *data, unsigned long dataSize);
  60. struct TQ3ControllerData {
  61.     char *                          signature;
  62.     unsigned long                   valueCount;
  63.     unsigned long                   channelCount;
  64.     TQ3ChannelGetMethod             channelGetMethod;
  65.     TQ3ChannelSetMethod             channelSetMethod;
  66. };
  67. typedef struct TQ3ControllerData        TQ3ControllerData;
  68. /******************************************************************************
  69.  **                                                                          **
  70.  **                                  Routines                                **
  71.  **                                                                          **
  72.  *****************************************************************************/
  73. #if CALL_NOT_IN_CARBON
  74. EXTERN_API_C( TQ3Status )
  75. Q3Controller_GetListChanged     (TQ3Boolean *           listChanged,
  76.                                  unsigned long *        serialNumber);
  77. EXTERN_API_C( TQ3Status )
  78. Q3Controller_Next               (TQ3ControllerRef       controllerRef,
  79.                                  TQ3ControllerRef *     nextControllerRef);
  80. EXTERN_API_C( TQ3ControllerRef )
  81. Q3Controller_New                (const TQ3ControllerData * controllerData);
  82. EXTERN_API_C( TQ3Status )
  83. Q3Controller_Decommission       (TQ3ControllerRef       controllerRef);
  84. EXTERN_API_C( TQ3Status )
  85. Q3Controller_SetActivation      (TQ3ControllerRef       controllerRef,
  86.                                  TQ3Boolean             active);
  87. EXTERN_API_C( TQ3Status )
  88. Q3Controller_GetActivation      (TQ3ControllerRef       controllerRef,
  89.                                  TQ3Boolean *           active);
  90. EXTERN_API_C( TQ3Status )
  91. Q3Controller_GetSignature       (TQ3ControllerRef       controllerRef,
  92.                                  char *                 signature,
  93.                                  unsigned long          numChars);
  94. EXTERN_API_C( TQ3Status )
  95. Q3Controller_SetChannel         (TQ3ControllerRef       controllerRef,
  96.                                  unsigned long          channel,
  97.                                  const void *           data,
  98.                                  unsigned long          dataSize);
  99. EXTERN_API_C( TQ3Status )
  100. Q3Controller_GetChannel         (TQ3ControllerRef       controllerRef,
  101.                                  unsigned long          channel,
  102.                                  void *                 data,
  103.                                  unsigned long *        dataSize);
  104. EXTERN_API_C( TQ3Status )
  105. Q3Controller_GetValueCount      (TQ3ControllerRef       controllerRef,
  106.                                  unsigned long *        valueCount);
  107. EXTERN_API_C( TQ3Status )
  108. Q3Controller_SetTracker         (TQ3ControllerRef       controllerRef,
  109.                                  TQ3TrackerObject       tracker);
  110. EXTERN_API_C( TQ3Status )
  111. Q3Controller_HasTracker         (TQ3ControllerRef       controllerRef,
  112.                                  TQ3Boolean *           hasTracker);
  113. EXTERN_API_C( TQ3Status )
  114. Q3Controller_Track2DCursor      (TQ3ControllerRef       controllerRef,
  115.                                  TQ3Boolean *           track2DCursor);
  116. EXTERN_API_C( TQ3Status )
  117. Q3Controller_Track3DCursor      (TQ3ControllerRef       controllerRef,
  118.                                  TQ3Boolean *           track3DCursor);
  119. EXTERN_API_C( TQ3Status )
  120. Q3Controller_GetButtons         (TQ3ControllerRef       controllerRef,
  121.                                  unsigned long *        buttons);
  122. EXTERN_API_C( TQ3Status )
  123. Q3Controller_SetButtons         (TQ3ControllerRef       controllerRef,
  124.                                  unsigned long          buttons);
  125. EXTERN_API_C( TQ3Status )
  126. Q3Controller_GetTrackerPosition (TQ3ControllerRef       controllerRef,
  127.                                  TQ3Point3D *           position);
  128. EXTERN_API_C( TQ3Status )
  129. Q3Controller_SetTrackerPosition (TQ3ControllerRef       controllerRef,
  130.                                  const TQ3Point3D *     position);
  131. EXTERN_API_C( TQ3Status )
  132. Q3Controller_MoveTrackerPosition (TQ3ControllerRef      controllerRef,
  133.                                  const TQ3Vector3D *    delta);
  134. EXTERN_API_C( TQ3Status )
  135. Q3Controller_GetTrackerOrientation (TQ3ControllerRef    controllerRef,
  136.                                  TQ3Quaternion *        orientation);
  137. EXTERN_API_C( TQ3Status )
  138. Q3Controller_SetTrackerOrientation (TQ3ControllerRef    controllerRef,
  139.                                  const TQ3Quaternion *  orientation);
  140. EXTERN_API_C( TQ3Status )
  141. Q3Controller_MoveTrackerOrientation (TQ3ControllerRef   controllerRef,
  142.                                  const TQ3Quaternion *  delta);
  143. EXTERN_API_C( TQ3Status )
  144. Q3Controller_GetValues          (TQ3ControllerRef       controllerRef,
  145.                                  unsigned long          valueCount,
  146.                                  float *                values,
  147.                                  TQ3Boolean *           changed,
  148.                                  unsigned long *        serialNumber);
  149. EXTERN_API_C( TQ3Status )
  150. Q3Controller_SetValues          (TQ3ControllerRef       controllerRef,
  151.                                  const float *          values,
  152.                                  unsigned long          valueCount);
  153. /******************************************************************************
  154.  **                                                                          **
  155.  **                                  Routines                                **
  156.  **                                                                          **
  157.  *****************************************************************************/
  158. EXTERN_API_C( TQ3ControllerStateObject )
  159. Q3ControllerState_New           (TQ3ControllerRef       controllerRef);
  160. EXTERN_API_C( TQ3Status )
  161. Q3ControllerState_SaveAndReset  (TQ3ControllerStateObject  controllerStateObject);
  162. EXTERN_API_C( TQ3Status )
  163. Q3ControllerState_Restore       (TQ3ControllerStateObject  controllerStateObject);
  164. /******************************************************************************
  165.  **                                                                          **
  166.  **                             Type Definitions                             **
  167.  **                                                                          **
  168.  *****************************************************************************/
  169. #endif  /* CALL_NOT_IN_CARBON */
  170. typedef CALLBACK_API_C( TQ3Status , TQ3TrackerNotifyFunc )(TQ3TrackerObject trackerObject, TQ3ControllerRef controllerRef);
  171. /******************************************************************************
  172.  **                                                                          **
  173.  **                                  Routines                                **
  174.  **                                                                          **
  175.  *****************************************************************************/
  176. #if CALL_NOT_IN_CARBON
  177. EXTERN_API_C( TQ3TrackerObject )
  178. Q3Tracker_New                   (TQ3TrackerNotifyFunc   notifyFunc);
  179. EXTERN_API_C( TQ3Status )
  180. Q3Tracker_SetNotifyThresholds   (TQ3TrackerObject       trackerObject,
  181.                                  float                  positionThresh,
  182.                                  float                  orientationThresh);
  183. EXTERN_API_C( TQ3Status )
  184. Q3Tracker_GetNotifyThresholds   (TQ3TrackerObject       trackerObject,
  185.                                  float *                positionThresh,
  186.                                  float *                orientationThresh);
  187. EXTERN_API_C( TQ3Status )
  188. Q3Tracker_SetActivation         (TQ3TrackerObject       trackerObject,
  189.                                  TQ3Boolean             active);
  190. EXTERN_API_C( TQ3Status )
  191. Q3Tracker_GetActivation         (TQ3TrackerObject       trackerObject,
  192.                                  TQ3Boolean *           active);
  193. EXTERN_API_C( TQ3Status )
  194. Q3Tracker_GetButtons            (TQ3TrackerObject       trackerObject,
  195.                                  unsigned long *        buttons);
  196. EXTERN_API_C( TQ3Status )
  197. Q3Tracker_ChangeButtons         (TQ3TrackerObject       trackerObject,
  198.                                  TQ3ControllerRef       controllerRef,
  199.                                  unsigned long          buttons,
  200.                                  unsigned long          buttonMask);
  201. EXTERN_API_C( TQ3Status )
  202. Q3Tracker_GetPosition           (TQ3TrackerObject       trackerObject,
  203.                                  TQ3Point3D *           position,
  204.                                  TQ3Vector3D *          delta,
  205.                                  TQ3Boolean *           changed,
  206.                                  unsigned long *        serialNumber);
  207. EXTERN_API_C( TQ3Status )
  208. Q3Tracker_SetPosition           (TQ3TrackerObject       trackerObject,
  209.                                  TQ3ControllerRef       controllerRef,
  210.                                  const TQ3Point3D *     position);
  211. EXTERN_API_C( TQ3Status )
  212. Q3Tracker_MovePosition          (TQ3TrackerObject       trackerObject,
  213.                                  TQ3ControllerRef       controllerRef,
  214.                                  const TQ3Vector3D *    delta);
  215. EXTERN_API_C( TQ3Status )
  216. Q3Tracker_GetOrientation        (TQ3TrackerObject       trackerObject,
  217.                                  TQ3Quaternion *        orientation,
  218.                                  TQ3Quaternion *        delta,
  219.                                  TQ3Boolean *           changed,
  220.                                  unsigned long *        serialNumber);
  221. EXTERN_API_C( TQ3Status )
  222. Q3Tracker_SetOrientation        (TQ3TrackerObject       trackerObject,
  223.                                  TQ3ControllerRef       controllerRef,
  224.                                  const TQ3Quaternion *  orientation);
  225. EXTERN_API_C( TQ3Status )
  226. Q3Tracker_MoveOrientation       (TQ3TrackerObject       trackerObject,
  227.                                  TQ3ControllerRef       controllerRef,
  228.                                  const TQ3Quaternion *  delta);
  229. EXTERN_API_C( TQ3Status )
  230. Q3Tracker_SetEventCoordinates   (TQ3TrackerObject       trackerObject,
  231.                                  unsigned long          timeStamp,
  232.                                  unsigned long          buttons,
  233.                                  const TQ3Point3D *     position,
  234.                                  const TQ3Quaternion *  orientation);
  235. EXTERN_API_C( TQ3Status )
  236. Q3Tracker_GetEventCoordinates   (TQ3TrackerObject       trackerObject,
  237.                                  unsigned long          timeStamp,
  238.                                  unsigned long *        buttons,
  239.                                  TQ3Point3D *           position,
  240.                                  TQ3Quaternion *        orientation);
  241. /******************************************************************************
  242.  **                                                                          **
  243.  **                              Types                                       **
  244.  **                                                                          **
  245.  *****************************************************************************/
  246. #endif  /* CALL_NOT_IN_CARBON */
  247. typedef CALLBACK_API_C( void , TQ3CursorTrackerNotifyFunc )(void );
  248. /******************************************************************************
  249.  **                                                                          **
  250.  **                              Routines                                    **
  251.  **                                                                          **
  252.  *****************************************************************************/
  253. #if CALL_NOT_IN_CARBON
  254. EXTERN_API_C( TQ3Status )
  255. Q3CursorTracker_PrepareTracking (void);
  256. EXTERN_API_C( TQ3Status )
  257. Q3CursorTracker_SetTrackDeltas  (TQ3Boolean             trackDeltas);
  258. EXTERN_API_C( TQ3Status )
  259. Q3CursorTracker_GetAndClearDeltas (float *              depth,
  260.                                  TQ3Quaternion *        orientation,
  261.                                  TQ3Boolean *           hasOrientation,
  262.                                  TQ3Boolean *           changed,
  263.                                  unsigned long *        serialNumber);
  264. EXTERN_API_C( TQ3Status )
  265. Q3CursorTracker_SetNotifyFunc   (TQ3CursorTrackerNotifyFunc  notifyFunc);
  266. EXTERN_API_C( TQ3Status )
  267. Q3CursorTracker_GetNotifyFunc   (TQ3CursorTrackerNotifyFunc * notifyFunc);
  268. #endif  /* CALL_NOT_IN_CARBON */
  269. #if PRAGMA_ENUM_ALWAYSINT
  270.     #pragma enumsalwaysint reset
  271.     #ifdef __QD3DCONTROLLER__RESTORE_TWOBYTEINTS
  272.         #pragma fourbyteints off
  273.     #endif
  274. #elif PRAGMA_ENUM_OPTIONS
  275.     #pragma option enum=reset
  276. #elif defined(__QD3DCONTROLLER__RESTORE_PACKED_ENUMS)
  277.     #pragma options(pack_enums)
  278. #endif
  279. #if PRAGMA_STRUCT_ALIGN
  280.     #pragma options align=reset
  281. #elif PRAGMA_STRUCT_PACKPUSH
  282.     #pragma pack(pop)
  283. #elif PRAGMA_STRUCT_PACK
  284.     #pragma pack()
  285. #endif
  286. #ifdef PRAGMA_IMPORT_OFF
  287. #pragma import off
  288. #elif PRAGMA_IMPORT
  289. #pragma import reset
  290. #endif
  291. #ifdef __cplusplus
  292. }
  293. #endif
  294. #endif /* __QD3DCONTROLLER__ */