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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       QD3DSet.h
  3.  
  4.      Contains:   Q3Set types and routines
  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 __QD3DSET__
  18. #define __QD3DSET__
  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 __QD3DSET__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 __QD3DSET__RESTORE_PACKED_ENUMS
  49.         #pragma options(!pack_enums)
  50.     #endif
  51. #endif
  52. /******************************************************************************
  53.  **                                                                          **
  54.  **                             Set Routines                                 **
  55.  **                                                                          **
  56.  *****************************************************************************/
  57. #if CALL_NOT_IN_CARBON
  58. EXTERN_API_C( TQ3SetObject )
  59. Q3Set_New                       (void);
  60. EXTERN_API_C( TQ3ObjectType )
  61. Q3Set_GetType                   (TQ3SetObject           theSet);
  62. EXTERN_API_C( TQ3Status )
  63. Q3Set_Add                       (TQ3SetObject           theSet,
  64.                                  TQ3ElementType         theType,
  65.                                  const void *           data);
  66. EXTERN_API_C( TQ3Status )
  67. Q3Set_Get                       (TQ3SetObject           theSet,
  68.                                  TQ3ElementType         theType,
  69.                                  void *                 data);
  70. EXTERN_API_C( TQ3Boolean )
  71. Q3Set_Contains                  (TQ3SetObject           theSet,
  72.                                  TQ3ElementType         theType);
  73. EXTERN_API_C( TQ3Status )
  74. Q3Set_Clear                     (TQ3SetObject           theSet,
  75.                                  TQ3ElementType         theType);
  76. EXTERN_API_C( TQ3Status )
  77. Q3Set_Empty                     (TQ3SetObject           target);
  78. /*
  79.  *  Iterating through all elements in a set
  80.  *
  81.  *  Pass in kQ3ElementTypeNone to get first type
  82.  *  kQ3ElementTypeNone is returned when end of list is reached
  83.  */
  84. EXTERN_API_C( TQ3Status )
  85. Q3Set_GetNextElementType        (TQ3SetObject           theSet,
  86.                                  TQ3ElementType *       theType);
  87. /******************************************************************************
  88.  **                                                                          **
  89.  **                             Attribute Types                              **
  90.  **                                                                          **
  91.  *****************************************************************************/
  92. /* 
  93.  *  For the data types listed below, pass in a pointer to it in the _Add 
  94.  *  and _Get calls.
  95.  *
  96.  *  For surface shader attributes, reference counts are incremented on 
  97.  *  the _Add and _Get 
  98.  */
  99. #endif  /* CALL_NOT_IN_CARBON */
  100. enum TQ3AttributeTypes {
  101.                                                                 /* Data Type          */
  102.     kQ3AttributeTypeNone        = 0,                            /* ---------          */
  103.     kQ3AttributeTypeSurfaceUV   = 1,                            /* TQ3Param2D          */
  104.     kQ3AttributeTypeShadingUV   = 2,                            /* TQ3Param2D           */
  105.     kQ3AttributeTypeNormal      = 3,                            /* TQ3Vector3D           */
  106.     kQ3AttributeTypeAmbientCoefficient = 4,                     /* float            */
  107.     kQ3AttributeTypeDiffuseColor = 5,                           /* TQ3ColorRGB          */
  108.     kQ3AttributeTypeSpecularColor = 6,                          /* TQ3ColorRGB          */
  109.     kQ3AttributeTypeSpecularControl = 7,                        /* float            */
  110.     kQ3AttributeTypeTransparencyColor = 8,                      /* TQ3ColorRGB          */
  111.     kQ3AttributeTypeSurfaceTangent = 9,                         /* TQ3Tangent2D          */
  112.     kQ3AttributeTypeHighlightState = 10,                        /* TQ3Switch           */
  113.     kQ3AttributeTypeSurfaceShader = 11,                         /* TQ3SurfaceShaderObject */
  114.     kQ3AttributeTypeNumTypes    = 12
  115. };
  116. typedef enum TQ3AttributeTypes TQ3AttributeTypes;
  117. typedef TQ3ElementType                  TQ3AttributeType;
  118. /******************************************************************************
  119.  **                                                                          **
  120.  **                             Attribute Drawing                            **
  121.  **                                                                          **
  122.  *****************************************************************************/
  123. #if CALL_NOT_IN_CARBON
  124. EXTERN_API_C( TQ3Status )
  125. Q3Attribute_Submit              (TQ3AttributeType       attributeType,
  126.                                  const void *           data,
  127.                                  TQ3ViewObject          view);
  128. /******************************************************************************
  129.  **                                                                          **
  130.  **                         AttributeSet Routines                            **
  131.  **                                                                          **
  132.  *****************************************************************************/
  133. EXTERN_API_C( TQ3AttributeSet )
  134. Q3AttributeSet_New              (void);
  135. EXTERN_API_C( TQ3Status )
  136. Q3AttributeSet_Add              (TQ3AttributeSet        attributeSet,
  137.                                  TQ3AttributeType       theType,
  138.                                  const void *           data);
  139. EXTERN_API_C( TQ3Boolean )
  140. Q3AttributeSet_Contains         (TQ3AttributeSet        attributeSet,
  141.                                  TQ3AttributeType       attributeType);
  142. EXTERN_API_C( TQ3Status )
  143. Q3AttributeSet_Get              (TQ3AttributeSet        attributeSet,
  144.                                  TQ3AttributeType       theType,
  145.                                  void *                 data);
  146. EXTERN_API_C( TQ3Status )
  147. Q3AttributeSet_Clear            (TQ3AttributeSet        attributeSet,
  148.                                  TQ3AttributeType       theType);
  149. EXTERN_API_C( TQ3Status )
  150. Q3AttributeSet_Empty            (TQ3AttributeSet        target);
  151. /*
  152.  * Q3AttributeSet_GetNextAttributeType
  153.  *
  154.  * Pass in kQ3AttributeTypeNone to get first type
  155.  * kQ3AttributeTypeNone is returned when end of list is reached
  156.  */
  157. EXTERN_API_C( TQ3Status )
  158. Q3AttributeSet_GetNextAttributeType (TQ3AttributeSet    source,
  159.                                  TQ3AttributeType *     theType);
  160. EXTERN_API_C( TQ3Status )
  161. Q3AttributeSet_Submit           (TQ3AttributeSet        attributeSet,
  162.                                  TQ3ViewObject          view);
  163. /*
  164.  * Inherit from parent->child into result
  165.  *  Result attributes are:
  166.  *      all child attributes + all parent attributes NOT in the child
  167.  */
  168. EXTERN_API_C( TQ3Status )
  169. Q3AttributeSet_Inherit          (TQ3AttributeSet        parent,
  170.                                  TQ3AttributeSet        child,
  171.                                  TQ3AttributeSet        result);
  172. /******************************************************************************
  173.  **                                                                          **
  174.  **                         Custom Element Registration                      **
  175.  **                                                                          **
  176.  *****************************************************************************/
  177. /*
  178.  * Element Methods - 
  179.  *
  180.  *      When you create a custom element, you control what structures are 
  181.  *      passed around the API. For example, you may allow the Q3Set_Add call 
  182.  *      take one type of argument, store your element internally in some 
  183.  *      abstract data type, and have the Q3Set_Get call take a different 
  184.  *      argument.
  185.  *
  186.  *      For example:
  187.  *          
  188.  *      There are four calls which at some point will copy an element:
  189.  *
  190.  *      Q3Set_Add (copied from Application memory to QuickDraw3D memory)
  191.  *      Q3Set_Get (copied from QuickDraw3D memory to Application memory)
  192.  *      Q3Object_Duplicate (all elements are copied internally)
  193.  *      Q3AttributeSet_Inherit (all elements are copied internally)
  194.  *
  195.  *      Either CopyAdd or CopyReplace is called during the "_Add" call.
  196.  *          - CopyAdd is destructive and should assume "toElement" is garbage
  197.  *          - CopyReplace is replacing an existing element.
  198.  *
  199.  *      CopyGet is called during the "_Get" call.
  200.  *
  201.  *      CopyDuplicate is called to duplicate an element's internal structure.
  202.  *
  203.  * Attributes Methods - 
  204.  *
  205.  *      For copying data while Inheriting. Element methods are used
  206.  *      at all other times.
  207.  *  
  208.  *      CopyInherit is called to duplicate an element's internal structure 
  209.  *          during inheritance. You should make this as fast as possible.
  210.  *          (for example, if your custom element contains objects, you
  211.  *           should do a Q3Shared_GetReference instead of a Q3Object_Duplicate)
  212.  *          
  213.  *      The ElementDelete method will be called for all of your elements 
  214.  *      copied around via CopyAdd, CopyReplace, CopyDuplicate, and 
  215.  *      CopyInherit.
  216.  *      If CopyGet allocates any memory in it's destination, it is up to the 
  217.  *      application to delete it on its side.
  218.  */
  219. #endif  /* CALL_NOT_IN_CARBON */
  220. #define kQ3XMethodTypeElementCopyAdd            Q3_METHOD_TYPE('e','c','p','a')
  221. #define kQ3XMethodTypeElementCopyReplace        Q3_METHOD_TYPE('e','c','p','r')
  222. #define kQ3XMethodTypeElementCopyGet            Q3_METHOD_TYPE('e','c','p','g')
  223. #define kQ3XMethodTypeElementCopyDuplicate      Q3_METHOD_TYPE('e','c','p','d')
  224. #define kQ3XMethodTypeElementDelete             Q3_METHOD_TYPE('e','d','e','l')
  225. typedef CALLBACK_API_C( TQ3Status , TQ3XElementCopyAddMethod )(const void *fromAPIElement, void *toInternalElement);
  226. typedef CALLBACK_API_C( TQ3Status , TQ3XElementCopyReplaceMethod )(const void *fromAPIElement, void *ontoInternalElement);
  227. typedef CALLBACK_API_C( TQ3Status , TQ3XElementCopyGetMethod )(const void *fromInternalElement, void *toAPIElement);
  228. typedef CALLBACK_API_C( TQ3Status , TQ3XElementCopyDuplicateMethod )(const void *fromInternalElement, void *toInternalElement);
  229. typedef CALLBACK_API_C( TQ3Status , TQ3XElementDeleteMethod )(void *internalElement);
  230. #if CALL_NOT_IN_CARBON
  231. EXTERN_API_C( TQ3XObjectClass )
  232. Q3XElementClass_Register        (TQ3ElementType *       elementType,
  233.                                  const char *           name,
  234.                                  unsigned long          sizeOfElement,
  235.                                  TQ3XMetaHandler        metaHandler);
  236. EXTERN_API_C( TQ3Status )
  237. Q3XElementType_GetElementSize   (TQ3ElementType         elementType,
  238.                                  unsigned long *        sizeOfElement);
  239. /******************************************************************************
  240.  **                                                                          **
  241.  **                     Custom Attribute Registration                        **
  242.  **                                                                          **
  243.  *****************************************************************************/
  244. #define kQ3XMethodTypeAttributeInherit      Q3_METHOD_TYPE('i','n','h','t')
  245. #endif  /* CALL_NOT_IN_CARBON */
  246. typedef TQ3Boolean                      TQ3XAttributeInheritMethod;
  247. /* return kQ3True or kQ3False in your metahandler */
  248. #define kQ3XMethodTypeAttributeCopyInherit  Q3_METHOD_TYPE('a','c','p','i')
  249. typedef CALLBACK_API_C( TQ3Status , TQ3XAttributeCopyInheritMethod )(const void *fromInternalAttribute, void *toInternalAttribute);
  250. #if CALL_NOT_IN_CARBON
  251. EXTERN_API_C( TQ3XObjectClass )
  252. Q3XAttributeClass_Register      (TQ3AttributeType *     attributeType,
  253.                                  const char *           creatorName,
  254.                                  unsigned long          sizeOfElement,
  255.                                  TQ3XMetaHandler        metaHandler);
  256. /*
  257.  *  Version 1.5
  258.  */
  259. #define kQ3XMethodTypeAttributeDefault      Q3_METHOD_TYPE('a','s','d','f')
  260. #endif  /* CALL_NOT_IN_CARBON */
  261. typedef CALLBACK_API_C( TQ3Status , TQ3XAttributeDefaultMethod )(void *internalElement);
  262. #define kQ3XMethodTypeAttributeIsDefault        Q3_METHOD_TYPE('a','i','d','f')
  263. typedef CALLBACK_API_C( TQ3Boolean , TQ3XAttributeIsDefaultMethod )(void *internalElement);
  264. #if PRAGMA_ENUM_ALWAYSINT
  265.     #pragma enumsalwaysint reset
  266.     #ifdef __QD3DSET__RESTORE_TWOBYTEINTS
  267.         #pragma fourbyteints off
  268.     #endif
  269. #elif PRAGMA_ENUM_OPTIONS
  270.     #pragma option enum=reset
  271. #elif defined(__QD3DSET__RESTORE_PACKED_ENUMS)
  272.     #pragma options(pack_enums)
  273. #endif
  274. #if PRAGMA_STRUCT_ALIGN
  275.     #pragma options align=reset
  276. #elif PRAGMA_STRUCT_PACKPUSH
  277.     #pragma pack(pop)
  278. #elif PRAGMA_STRUCT_PACK
  279.     #pragma pack()
  280. #endif
  281. #ifdef PRAGMA_IMPORT_OFF
  282. #pragma import off
  283. #elif PRAGMA_IMPORT
  284. #pragma import reset
  285. #endif
  286. #ifdef __cplusplus
  287. }
  288. #endif
  289. #endif /* __QD3DSET__ */