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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       QD3DGroup.h
  3.  
  4.      Contains:   Q3Group 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 __QD3DGROUP__
  18. #define __QD3DGROUP__
  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 __QD3DGROUP__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 __QD3DGROUP__RESTORE_PACKED_ENUMS
  49.         #pragma options(!pack_enums)
  50.     #endif
  51. #endif
  52. /******************************************************************************
  53.  **                                                                          **
  54.  **                         Group Typedefs                                   **
  55.  **                                                                          **
  56.  *****************************************************************************/
  57. /*
  58.  * These flags affect how a group is traversed
  59.  * They apply to when a group is "drawn", "picked", "bounded", "written"
  60.  */
  61. enum TQ3DisplayGroupStateMasks {
  62.     kQ3DisplayGroupStateNone    = 0,
  63.     kQ3DisplayGroupStateMaskIsDrawn = 1 << 0,
  64.     kQ3DisplayGroupStateMaskIsInline = 1 << 1,
  65.     kQ3DisplayGroupStateMaskUseBoundingBox = 1 << 2,
  66.     kQ3DisplayGroupStateMaskUseBoundingSphere = 1 << 3,
  67.     kQ3DisplayGroupStateMaskIsPicked = 1 << 4,
  68.     kQ3DisplayGroupStateMaskIsWritten = 1 << 5
  69. };
  70. typedef enum TQ3DisplayGroupStateMasks TQ3DisplayGroupStateMasks;
  71. typedef unsigned long                   TQ3DisplayGroupState;
  72.  
  73. /******************************************************************************
  74.  **                                                                          **
  75.  **                 Group Routines (apply to all groups)                     **
  76.  **                                                                          **
  77.  *****************************************************************************/
  78. /* May contain any shared object */
  79. #if CALL_NOT_IN_CARBON
  80. EXTERN_API_C( TQ3GroupObject )
  81. Q3Group_New                     (void);
  82. EXTERN_API_C( TQ3ObjectType )
  83. Q3Group_GetType                 (TQ3GroupObject         group);
  84. EXTERN_API_C( TQ3GroupPosition )
  85. Q3Group_AddObject               (TQ3GroupObject         group,
  86.                                  TQ3Object              object);
  87. EXTERN_API_C( TQ3GroupPosition )
  88. Q3Group_AddObjectBefore         (TQ3GroupObject         group,
  89.                                  TQ3GroupPosition       position,
  90.                                  TQ3Object              object);
  91. EXTERN_API_C( TQ3GroupPosition )
  92. Q3Group_AddObjectAfter          (TQ3GroupObject         group,
  93.                                  TQ3GroupPosition       position,
  94.                                  TQ3Object              object);
  95. EXTERN_API_C( TQ3Status )
  96. Q3Group_GetPositionObject       (TQ3GroupObject         group,
  97.                                  TQ3GroupPosition       position,
  98.                                  TQ3Object *            object);
  99. EXTERN_API_C( TQ3Status )
  100. Q3Group_SetPositionObject       (TQ3GroupObject         group,
  101.                                  TQ3GroupPosition       position,
  102.                                  TQ3Object              object);
  103. EXTERN_API_C( TQ3Object )
  104. Q3Group_RemovePosition          (TQ3GroupObject         group,
  105.                                  TQ3GroupPosition       position);
  106. EXTERN_API_C( TQ3Status )
  107. Q3Group_GetFirstPosition        (TQ3GroupObject         group,
  108.                                  TQ3GroupPosition *     position);
  109. EXTERN_API_C( TQ3Status )
  110. Q3Group_GetLastPosition         (TQ3GroupObject         group,
  111.                                  TQ3GroupPosition *     position);
  112. EXTERN_API_C( TQ3Status )
  113. Q3Group_GetNextPosition         (TQ3GroupObject         group,
  114.                                  TQ3GroupPosition *     position);
  115. EXTERN_API_C( TQ3Status )
  116. Q3Group_GetPreviousPosition     (TQ3GroupObject         group,
  117.                                  TQ3GroupPosition *     position);
  118. EXTERN_API_C( TQ3Status )
  119. Q3Group_CountObjects            (TQ3GroupObject         group,
  120.                                  unsigned long *        nObjects);
  121. EXTERN_API_C( TQ3Status )
  122. Q3Group_EmptyObjects            (TQ3GroupObject         group);
  123. /*
  124.  *  Typed Access
  125.  */
  126. EXTERN_API_C( TQ3Status )
  127. Q3Group_GetFirstPositionOfType  (TQ3GroupObject         group,
  128.                                  TQ3ObjectType          isType,
  129.                                  TQ3GroupPosition *     position);
  130. EXTERN_API_C( TQ3Status )
  131. Q3Group_GetLastPositionOfType   (TQ3GroupObject         group,
  132.                                  TQ3ObjectType          isType,
  133.                                  TQ3GroupPosition *     position);
  134. EXTERN_API_C( TQ3Status )
  135. Q3Group_GetNextPositionOfType   (TQ3GroupObject         group,
  136.                                  TQ3ObjectType          isType,
  137.                                  TQ3GroupPosition *     position);
  138. EXTERN_API_C( TQ3Status )
  139. Q3Group_GetPreviousPositionOfType (TQ3GroupObject       group,
  140.                                  TQ3ObjectType          isType,
  141.                                  TQ3GroupPosition *     position);
  142. EXTERN_API_C( TQ3Status )
  143. Q3Group_CountObjectsOfType      (TQ3GroupObject         group,
  144.                                  TQ3ObjectType          isType,
  145.                                  unsigned long *        nObjects);
  146. EXTERN_API_C( TQ3Status )
  147. Q3Group_EmptyObjectsOfType      (TQ3GroupObject         group,
  148.                                  TQ3ObjectType          isType);
  149. /*
  150.  *  Determine position of objects in a group
  151.  */
  152. EXTERN_API_C( TQ3Status )
  153. Q3Group_GetFirstObjectPosition  (TQ3GroupObject         group,
  154.                                  TQ3Object              object,
  155.                                  TQ3GroupPosition *     position);
  156. EXTERN_API_C( TQ3Status )
  157. Q3Group_GetLastObjectPosition   (TQ3GroupObject         group,
  158.                                  TQ3Object              object,
  159.                                  TQ3GroupPosition *     position);
  160. EXTERN_API_C( TQ3Status )
  161. Q3Group_GetNextObjectPosition   (TQ3GroupObject         group,
  162.                                  TQ3Object              object,
  163.                                  TQ3GroupPosition *     position);
  164. EXTERN_API_C( TQ3Status )
  165. Q3Group_GetPreviousObjectPosition (TQ3GroupObject       group,
  166.                                  TQ3Object              object,
  167.                                  TQ3GroupPosition *     position);
  168. /******************************************************************************
  169.  **                                                                          **
  170.  **                         Group Subclasses                                 **
  171.  **                                                                          **
  172.  *****************************************************************************/
  173. /* Must contain only lights */
  174. EXTERN_API_C( TQ3GroupObject )
  175. Q3LightGroup_New                (void);
  176. /* Must contain only strings */
  177. EXTERN_API_C( TQ3GroupObject )
  178. Q3InfoGroup_New                 (void);
  179. /******************************************************************************
  180.  **                                                                          **
  181.  **                     Display Group Routines                               **
  182.  **                                                                          **
  183.  *****************************************************************************/
  184. /* May contain only drawables */
  185. EXTERN_API_C( TQ3GroupObject )
  186. Q3DisplayGroup_New              (void);
  187. EXTERN_API_C( TQ3ObjectType )
  188. Q3DisplayGroup_GetType          (TQ3GroupObject         group);
  189. EXTERN_API_C( TQ3Status )
  190. Q3DisplayGroup_GetState         (TQ3GroupObject         group,
  191.                                  TQ3DisplayGroupState * state);
  192. EXTERN_API_C( TQ3Status )
  193. Q3DisplayGroup_SetState         (TQ3GroupObject         group,
  194.                                  TQ3DisplayGroupState   state);
  195. EXTERN_API_C( TQ3Status )
  196. Q3DisplayGroup_Submit           (TQ3GroupObject         group,
  197.                                  TQ3ViewObject          view);
  198. EXTERN_API_C( TQ3Status )
  199. Q3DisplayGroup_SetAndUseBoundingBox (TQ3GroupObject     group,
  200.                                  TQ3BoundingBox *       bBox);
  201. EXTERN_API_C( TQ3Status )
  202. Q3DisplayGroup_GetBoundingBox   (TQ3GroupObject         group,
  203.                                  TQ3BoundingBox *       bBox);
  204. EXTERN_API_C( TQ3Status )
  205. Q3DisplayGroup_RemoveBoundingBox (TQ3GroupObject        group);
  206. EXTERN_API_C( TQ3Status )
  207. Q3DisplayGroup_CalcAndUseBoundingBox (TQ3GroupObject    group,
  208.                                  TQ3ComputeBounds       computeBounds,
  209.                                  TQ3ViewObject          view);
  210. /******************************************************************************
  211.  **                                                                          **
  212.  **     Ordered Display Group                                                **
  213.  **                                                                          **
  214.  **     Ordered display groups keep objects in order by the type of object:  **
  215.  **                                                                          **
  216.  **     1   kQ3ShapeTypeTransform                                            **
  217.  **     2   kQ3ShapeTypeStyle                                                **
  218.  **     3   kQ3SetTypeAttribute                                              **
  219.  **     4   kQ3ShapeTypeShader                                               **
  220.  **     5   kQ3ShapeTypeCamera                                               **
  221.  **     6   kQ3ShapeTypeLight                                                **
  222.  **     7   kQ3ShapeTypeGeometry                                             **
  223.  **     8   kQ3ShapeTypeGroup                                                **         
  224.  **     9   kQ3ShapeTypeUnknown                                              **
  225.  **                                                                          **
  226.  **     Within a type, you are responsible for keeping things in order.      **
  227.  **                                                                          **
  228.  **     You may access and/or manipulate the group using the above types     **
  229.  **     (fast), or you may use any parent or leaf class types (slower).      **
  230.  **                                                                          **
  231.  **     Additional types will be added as functionality grows.               **
  232.  **                                                                          **
  233.  **     The group calls which access by type are much faster for ordered     ** 
  234.  **     display group for the types above.                                   **
  235.  **                                                                          **
  236.  **     N.B. Lights and Cameras in groups are a no-op when drawn and will    **
  237.  **          post an error with the debug libraries.                         **
  238.  **                                                                          **
  239.  *****************************************************************************/
  240. EXTERN_API_C( TQ3GroupObject )
  241. Q3OrderedDisplayGroup_New       (void);
  242. /******************************************************************************
  243.  **                                                                          **
  244.  **     IO Proxy Display Group                                               **
  245.  **                                                                          **
  246.  **     IO Proxy display groups are used to place more than one              **
  247.  **     representation of an object in a metafile. For example, if you know  **
  248.  **     another program does not understand NURBPatches but does understand  **
  249.  **     Meshes, you may place a mesh and a NURB Patch in an IO Proxy Group,  **
  250.  **     and the reading program will select the desired representation.      **
  251.  **                                                                          **
  252.  **     Objects in an IO Proxy Display Group are placed in their preferencial**
  253.  **     order, with the FIRST object being the MOST preferred, the LAST      **
  254.  **     object the least preferred.                                          **
  255.  **                                                                          **
  256.  **     The behavior of an IO Proxy Display Group is that when drawn/picked/ **
  257.  **     bounded, the first object in the group that is not "Unknown" is used,**
  258.  **     and the other objects ignored.                                       **
  259.  **                                                                          **
  260.  *****************************************************************************/
  261. EXTERN_API_C( TQ3GroupObject )
  262. Q3IOProxyDisplayGroup_New       (void);
  263. /******************************************************************************
  264.  **                                                                          **
  265.  **                     Group Extension Definitions                          **
  266.  **                                                                          **
  267.  *****************************************************************************/
  268. /*
  269.  *  Searching methods - OPTIONAL
  270.  */
  271. #endif  /* CALL_NOT_IN_CARBON */
  272. enum {
  273.     kQ3XMethodType_GroupAcceptObject = FOUR_CHAR_CODE('gaco')
  274. };
  275. typedef CALLBACK_API_C( TQ3Boolean , TQ3XGroupAcceptObjectMethod )(TQ3GroupObject group, TQ3Object object);
  276. enum {
  277.     kQ3XMethodType_GroupAddObject = FOUR_CHAR_CODE('gado')
  278. };
  279. typedef CALLBACK_API_C( TQ3GroupPosition , TQ3XGroupAddObjectMethod )(TQ3GroupObject group, TQ3Object object);
  280. enum {
  281.     kQ3XMethodType_GroupAddObjectBefore = FOUR_CHAR_CODE('gaob')
  282. };
  283. typedef CALLBACK_API_C( TQ3GroupPosition , TQ3XGroupAddObjectBeforeMethod )(TQ3GroupObject group, TQ3GroupPosition position, TQ3Object object);
  284. enum {
  285.     kQ3XMethodType_GroupAddObjectAfter = FOUR_CHAR_CODE('gaoa')
  286. };
  287. typedef CALLBACK_API_C( TQ3GroupPosition , TQ3XGroupAddObjectAfterMethod )(TQ3GroupObject group, TQ3GroupPosition position, TQ3Object object);
  288. enum {
  289.     kQ3XMethodType_GroupSetPositionObject = FOUR_CHAR_CODE('gspo')
  290. };
  291. typedef CALLBACK_API_C( TQ3Status , TQ3XGroupSetPositionObjectMethod )(TQ3GroupObject group, TQ3GroupPosition gPos, TQ3Object obj);
  292. enum {
  293.     kQ3XMethodType_GroupRemovePosition = FOUR_CHAR_CODE('grmp')
  294. };
  295. typedef CALLBACK_API_C( TQ3Object , TQ3XGroupRemovePositionMethod )(TQ3GroupObject group, TQ3GroupPosition position);
  296.  
  297. /*
  298.  *  Searching methods - OPTIONAL - default uses above methods
  299.  */
  300. enum {
  301.     kQ3XMethodType_GroupGetFirstPositionOfType = FOUR_CHAR_CODE('gfrt')
  302. };
  303. typedef CALLBACK_API_C( TQ3Status , TQ3XGroupGetFirstPositionOfTypeMethod )(TQ3GroupObject group, TQ3ObjectType isType, TQ3GroupPosition *gPos);
  304. enum {
  305.     kQ3XMethodType_GroupGetLastPositionOfType = FOUR_CHAR_CODE('glst')
  306. };
  307. typedef CALLBACK_API_C( TQ3Status , TQ3XGroupGetLastPositionOfTypeMethod )(TQ3GroupObject group, TQ3ObjectType isType, TQ3GroupPosition *gPos);
  308. enum {
  309.     kQ3XMethodType_GroupGetNextPositionOfType = FOUR_CHAR_CODE('gnxt')
  310. };
  311. typedef CALLBACK_API_C( TQ3Status , TQ3XGroupGetNextPositionOfTypeMethod )(TQ3GroupObject group, TQ3ObjectType isType, TQ3GroupPosition *gPos);
  312. enum {
  313.     kQ3XMethodType_GroupGetPrevPositionOfType = FOUR_CHAR_CODE('gpvt')
  314. };
  315. typedef CALLBACK_API_C( TQ3Status , TQ3XGroupGetPrevPositionOfTypeMethod )(TQ3GroupObject group, TQ3ObjectType isType, TQ3GroupPosition *gPos);
  316. enum {
  317.     kQ3XMethodType_GroupCountObjectsOfType = FOUR_CHAR_CODE('gcnt')
  318. };
  319. typedef CALLBACK_API_C( TQ3Status , TQ3XGroupCountObjectsOfTypeMethod )(TQ3GroupObject group, TQ3ObjectType isType, unsigned long *nObjects);
  320. enum {
  321.     kQ3XMethodType_GroupEmptyObjectsOfType = FOUR_CHAR_CODE('geot')
  322. };
  323. typedef CALLBACK_API_C( TQ3Status , TQ3XGroupEmptyObjectsOfTypeMethod )(TQ3GroupObject group, TQ3ObjectType isType);
  324. enum {
  325.     kQ3XMethodType_GroupGetFirstObjectPosition = FOUR_CHAR_CODE('gfop')
  326. };
  327. typedef CALLBACK_API_C( TQ3Status , TQ3XGroupGetFirstObjectPositionMethod )(TQ3GroupObject group, TQ3Object object, TQ3GroupPosition *gPos);
  328. enum {
  329.     kQ3XMethodType_GroupGetLastObjectPosition = FOUR_CHAR_CODE('glop')
  330. };
  331. typedef CALLBACK_API_C( TQ3Status , TQ3XGroupGetLastObjectPositionMethod )(TQ3GroupObject group, TQ3Object object, TQ3GroupPosition *gPos);
  332. enum {
  333.     kQ3XMethodType_GroupGetNextObjectPosition = FOUR_CHAR_CODE('gnop')
  334. };
  335. typedef CALLBACK_API_C( TQ3Status , TQ3XGroupGetNextObjectPositionMethod )(TQ3GroupObject group, TQ3Object object, TQ3GroupPosition *gPos);
  336. enum {
  337.     kQ3XMethodType_GroupGetPrevObjectPosition = FOUR_CHAR_CODE('gpop')
  338. };
  339. typedef CALLBACK_API_C( TQ3Status , TQ3XGroupGetPrevObjectPositionMethod )(TQ3GroupObject group, TQ3Object object, TQ3GroupPosition *gPos);
  340.  
  341. /*
  342.  *  Group Position Methods
  343.  */
  344. enum {
  345.     kQ3XMethodType_GroupPositionSize = FOUR_CHAR_CODE('ggpz')
  346. };
  347. typedef unsigned long                   TQ3XMethodTypeGroupPositionSize;
  348. enum {
  349.     kQ3XMethodType_GroupPositionNew = FOUR_CHAR_CODE('ggpn')
  350. };
  351. typedef CALLBACK_API_C( TQ3Status , TQ3XGroupPositionNewMethod )(void *gPos, TQ3Object object, const void *initData);
  352. enum {
  353.     kQ3XMethodType_GroupPositionCopy = FOUR_CHAR_CODE('ggpc')
  354. };
  355. typedef CALLBACK_API_C( TQ3Status , TQ3XGroupPositionCopyMethod )(void *srcGPos, void *dstGPos);
  356. enum {
  357.     kQ3XMethodType_GroupPositionDelete = FOUR_CHAR_CODE('ggpd')
  358. };
  359. typedef CALLBACK_API_C( void , TQ3XGroupPositionDeleteMethod )(void *gPos);
  360.  
  361. /*
  362.  *  View Drawing Helpers
  363.  *  
  364.  *  TQ3XGroupStartIterateMethod
  365.  *
  366.  *      Pass back *object = NULL to NOT call EndIterate iterate
  367.  *      Pass back *object != NULL to draw object
  368.  *       (other side will pass it to EndIterate for deletion!)
  369.  *
  370.  *      *iterator is uninitialized, use for iteration state. Caller should 
  371.  *       ignore it.
  372.  *  
  373.  *  TQ3XGroupEndIterateMethod
  374.  *  
  375.  *      *object is previous object, dispose it or play with it.
  376.  *      Pass back NULL when last iteration has occurred
  377.  *      *iterator is previous value, use for iteration state Caller should 
  378.  *      ignore it.
  379.  */
  380. enum {
  381.     kQ3XMethodType_GroupStartIterate = FOUR_CHAR_CODE('gstd')
  382. };
  383. typedef CALLBACK_API_C( TQ3Status , TQ3XGroupStartIterateMethod )(TQ3GroupObject group, TQ3GroupPosition *iterator, TQ3Object *object, TQ3ViewObject view);
  384. enum {
  385.     kQ3XMethodType_GroupEndIterate = FOUR_CHAR_CODE('gitd')
  386. };
  387. typedef CALLBACK_API_C( TQ3Status , TQ3XGroupEndIterateMethod )(TQ3GroupObject group, TQ3GroupPosition *iterator, TQ3Object *object, TQ3ViewObject view);
  388.  
  389. /*
  390.  *  IO  Helpers
  391.  *  
  392.  *  TQ3XGroupEndReadMethod
  393.  *      Called when a group has been completely read. Group should perform
  394.  *      validation and clean up any reading caches.
  395.  */
  396. enum {
  397.     kQ3XMethodType_GroupEndRead = FOUR_CHAR_CODE('gerd')
  398. };
  399. typedef CALLBACK_API_C( TQ3Status , TQ3XGroupEndReadMethod )(TQ3GroupObject group);
  400. #if CALL_NOT_IN_CARBON
  401. EXTERN_API_C( void *)
  402. Q3XGroup_GetPositionPrivate     (TQ3GroupObject         group,
  403.                                  TQ3GroupPosition       position);
  404. #endif  /* CALL_NOT_IN_CARBON */
  405. #if PRAGMA_ENUM_ALWAYSINT
  406.     #pragma enumsalwaysint reset
  407.     #ifdef __QD3DGROUP__RESTORE_TWOBYTEINTS
  408.         #pragma fourbyteints off
  409.     #endif
  410. #elif PRAGMA_ENUM_OPTIONS
  411.     #pragma option enum=reset
  412. #elif defined(__QD3DGROUP__RESTORE_PACKED_ENUMS)
  413.     #pragma options(pack_enums)
  414. #endif
  415. #if PRAGMA_STRUCT_ALIGN
  416.     #pragma options align=reset
  417. #elif PRAGMA_STRUCT_PACKPUSH
  418.     #pragma pack(pop)
  419. #elif PRAGMA_STRUCT_PACK
  420.     #pragma pack()
  421. #endif
  422. #ifdef PRAGMA_IMPORT_OFF
  423. #pragma import off
  424. #elif PRAGMA_IMPORT
  425. #pragma import reset
  426. #endif
  427. #ifdef __cplusplus
  428. }
  429. #endif
  430. #endif /* __QD3DGROUP__ */