Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

530 lines
15 KiB

  1. /*
  2. File: QD3DSet.h
  3. Contains: Q3Set types and routines
  4. Version: Technology: Quickdraw 3D 1.6
  5. Release: QuickTime 7.3
  6. Copyright: (c) 2007 (c) 1995-1999 by Apple Computer, Inc., all rights reserved.
  7. Bugs?: For bug reports, consult the following page on
  8. the World Wide Web:
  9. http://developer.apple.com/bugreporter/
  10. */
  11. #ifndef __QD3DSET__
  12. #define __QD3DSET__
  13. #ifndef __QD3D__
  14. #include <QD3D.h>
  15. #endif
  16. #if PRAGMA_ONCE
  17. #pragma once
  18. #endif
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. #if PRAGMA_IMPORT
  23. #pragma import on
  24. #endif
  25. #if PRAGMA_ENUM_ALWAYSINT
  26. #if defined(__fourbyteints__) && !__fourbyteints__
  27. #define __QD3DSET__RESTORE_TWOBYTEINTS
  28. #pragma fourbyteints on
  29. #endif
  30. #pragma enumsalwaysint on
  31. #elif PRAGMA_ENUM_OPTIONS
  32. #pragma option enum=int
  33. #elif PRAGMA_ENUM_PACK
  34. #if __option(pack_enums)
  35. #define __QD3DSET__RESTORE_PACKED_ENUMS
  36. #pragma options(!pack_enums)
  37. #endif
  38. #endif
  39. /******************************************************************************
  40. ** **
  41. ** Set Routines **
  42. ** **
  43. *****************************************************************************/
  44. #if CALL_NOT_IN_CARBON
  45. /*
  46. * Q3Set_New()
  47. *
  48. * Availability:
  49. * Non-Carbon CFM: not available
  50. * CarbonLib: not available
  51. * Mac OS X: not available
  52. */
  53. EXTERN_API_C( TQ3SetObject )
  54. Q3Set_New(void);
  55. /*
  56. * Q3Set_GetType()
  57. *
  58. * Availability:
  59. * Non-Carbon CFM: not available
  60. * CarbonLib: not available
  61. * Mac OS X: not available
  62. */
  63. EXTERN_API_C( TQ3ObjectType )
  64. Q3Set_GetType(TQ3SetObject theSet);
  65. /*
  66. * Q3Set_Add()
  67. *
  68. * Availability:
  69. * Non-Carbon CFM: not available
  70. * CarbonLib: not available
  71. * Mac OS X: not available
  72. */
  73. EXTERN_API_C( TQ3Status )
  74. Q3Set_Add(
  75. TQ3SetObject theSet,
  76. TQ3ElementType theType,
  77. const void * data);
  78. /*
  79. * Q3Set_Get()
  80. *
  81. * Availability:
  82. * Non-Carbon CFM: not available
  83. * CarbonLib: not available
  84. * Mac OS X: not available
  85. */
  86. EXTERN_API_C( TQ3Status )
  87. Q3Set_Get(
  88. TQ3SetObject theSet,
  89. TQ3ElementType theType,
  90. void * data);
  91. /*
  92. * Q3Set_Contains()
  93. *
  94. * Availability:
  95. * Non-Carbon CFM: not available
  96. * CarbonLib: not available
  97. * Mac OS X: not available
  98. */
  99. EXTERN_API_C( TQ3Boolean )
  100. Q3Set_Contains(
  101. TQ3SetObject theSet,
  102. TQ3ElementType theType);
  103. /*
  104. * Q3Set_Clear()
  105. *
  106. * Availability:
  107. * Non-Carbon CFM: not available
  108. * CarbonLib: not available
  109. * Mac OS X: not available
  110. */
  111. EXTERN_API_C( TQ3Status )
  112. Q3Set_Clear(
  113. TQ3SetObject theSet,
  114. TQ3ElementType theType);
  115. /*
  116. * Q3Set_Empty()
  117. *
  118. * Availability:
  119. * Non-Carbon CFM: not available
  120. * CarbonLib: not available
  121. * Mac OS X: not available
  122. */
  123. EXTERN_API_C( TQ3Status )
  124. Q3Set_Empty(TQ3SetObject target);
  125. /*
  126. * Iterating through all elements in a set
  127. *
  128. * Pass in kQ3ElementTypeNone to get first type
  129. * kQ3ElementTypeNone is returned when end of list is reached
  130. */
  131. /*
  132. * Q3Set_GetNextElementType()
  133. *
  134. * Availability:
  135. * Non-Carbon CFM: not available
  136. * CarbonLib: not available
  137. * Mac OS X: not available
  138. */
  139. EXTERN_API_C( TQ3Status )
  140. Q3Set_GetNextElementType(
  141. TQ3SetObject theSet,
  142. TQ3ElementType * theType);
  143. /******************************************************************************
  144. ** **
  145. ** Attribute Types **
  146. ** **
  147. *****************************************************************************/
  148. /*
  149. * For the data types listed below, pass in a pointer to it in the _Add
  150. * and _Get calls.
  151. *
  152. * For surface shader attributes, reference counts are incremented on
  153. * the _Add and _Get
  154. */
  155. #endif /* CALL_NOT_IN_CARBON */
  156. enum TQ3AttributeTypes {
  157. /* Data Type */
  158. kQ3AttributeTypeNone = 0, /* --------- */
  159. kQ3AttributeTypeSurfaceUV = 1, /* TQ3Param2D */
  160. kQ3AttributeTypeShadingUV = 2, /* TQ3Param2D */
  161. kQ3AttributeTypeNormal = 3, /* TQ3Vector3D */
  162. kQ3AttributeTypeAmbientCoefficient = 4, /* float */
  163. kQ3AttributeTypeDiffuseColor = 5, /* TQ3ColorRGB */
  164. kQ3AttributeTypeSpecularColor = 6, /* TQ3ColorRGB */
  165. kQ3AttributeTypeSpecularControl = 7, /* float */
  166. kQ3AttributeTypeTransparencyColor = 8, /* TQ3ColorRGB */
  167. kQ3AttributeTypeSurfaceTangent = 9, /* TQ3Tangent2D */
  168. kQ3AttributeTypeHighlightState = 10, /* TQ3Switch */
  169. kQ3AttributeTypeSurfaceShader = 11, /* TQ3SurfaceShaderObject */
  170. kQ3AttributeTypeNumTypes = 12
  171. };
  172. typedef enum TQ3AttributeTypes TQ3AttributeTypes;
  173. typedef TQ3ElementType TQ3AttributeType;
  174. /******************************************************************************
  175. ** **
  176. ** Attribute Drawing **
  177. ** **
  178. *****************************************************************************/
  179. #if CALL_NOT_IN_CARBON
  180. /*
  181. * Q3Attribute_Submit()
  182. *
  183. * Availability:
  184. * Non-Carbon CFM: not available
  185. * CarbonLib: not available
  186. * Mac OS X: not available
  187. */
  188. EXTERN_API_C( TQ3Status )
  189. Q3Attribute_Submit(
  190. TQ3AttributeType attributeType,
  191. const void * data,
  192. TQ3ViewObject view);
  193. /******************************************************************************
  194. ** **
  195. ** AttributeSet Routines **
  196. ** **
  197. *****************************************************************************/
  198. /*
  199. * Q3AttributeSet_New()
  200. *
  201. * Availability:
  202. * Non-Carbon CFM: not available
  203. * CarbonLib: not available
  204. * Mac OS X: not available
  205. */
  206. EXTERN_API_C( TQ3AttributeSet )
  207. Q3AttributeSet_New(void);
  208. /*
  209. * Q3AttributeSet_Add()
  210. *
  211. * Availability:
  212. * Non-Carbon CFM: not available
  213. * CarbonLib: not available
  214. * Mac OS X: not available
  215. */
  216. EXTERN_API_C( TQ3Status )
  217. Q3AttributeSet_Add(
  218. TQ3AttributeSet attributeSet,
  219. TQ3AttributeType theType,
  220. const void * data);
  221. /*
  222. * Q3AttributeSet_Contains()
  223. *
  224. * Availability:
  225. * Non-Carbon CFM: not available
  226. * CarbonLib: not available
  227. * Mac OS X: not available
  228. */
  229. EXTERN_API_C( TQ3Boolean )
  230. Q3AttributeSet_Contains(
  231. TQ3AttributeSet attributeSet,
  232. TQ3AttributeType attributeType);
  233. /*
  234. * Q3AttributeSet_Get()
  235. *
  236. * Availability:
  237. * Non-Carbon CFM: not available
  238. * CarbonLib: not available
  239. * Mac OS X: not available
  240. */
  241. EXTERN_API_C( TQ3Status )
  242. Q3AttributeSet_Get(
  243. TQ3AttributeSet attributeSet,
  244. TQ3AttributeType theType,
  245. void * data);
  246. /*
  247. * Q3AttributeSet_Clear()
  248. *
  249. * Availability:
  250. * Non-Carbon CFM: not available
  251. * CarbonLib: not available
  252. * Mac OS X: not available
  253. */
  254. EXTERN_API_C( TQ3Status )
  255. Q3AttributeSet_Clear(
  256. TQ3AttributeSet attributeSet,
  257. TQ3AttributeType theType);
  258. /*
  259. * Q3AttributeSet_Empty()
  260. *
  261. * Availability:
  262. * Non-Carbon CFM: not available
  263. * CarbonLib: not available
  264. * Mac OS X: not available
  265. */
  266. EXTERN_API_C( TQ3Status )
  267. Q3AttributeSet_Empty(TQ3AttributeSet target);
  268. /*
  269. * Q3AttributeSet_GetNextAttributeType
  270. *
  271. * Pass in kQ3AttributeTypeNone to get first type
  272. * kQ3AttributeTypeNone is returned when end of list is reached
  273. */
  274. /*
  275. * Q3AttributeSet_GetNextAttributeType()
  276. *
  277. * Availability:
  278. * Non-Carbon CFM: not available
  279. * CarbonLib: not available
  280. * Mac OS X: not available
  281. */
  282. EXTERN_API_C( TQ3Status )
  283. Q3AttributeSet_GetNextAttributeType(
  284. TQ3AttributeSet source,
  285. TQ3AttributeType * theType);
  286. /*
  287. * Q3AttributeSet_Submit()
  288. *
  289. * Availability:
  290. * Non-Carbon CFM: not available
  291. * CarbonLib: not available
  292. * Mac OS X: not available
  293. */
  294. EXTERN_API_C( TQ3Status )
  295. Q3AttributeSet_Submit(
  296. TQ3AttributeSet attributeSet,
  297. TQ3ViewObject view);
  298. /*
  299. * Inherit from parent->child into result
  300. * Result attributes are:
  301. * all child attributes + all parent attributes NOT in the child
  302. */
  303. /*
  304. * Q3AttributeSet_Inherit()
  305. *
  306. * Availability:
  307. * Non-Carbon CFM: not available
  308. * CarbonLib: not available
  309. * Mac OS X: not available
  310. */
  311. EXTERN_API_C( TQ3Status )
  312. Q3AttributeSet_Inherit(
  313. TQ3AttributeSet parent,
  314. TQ3AttributeSet child,
  315. TQ3AttributeSet result);
  316. /******************************************************************************
  317. ** **
  318. ** Custom Element Registration **
  319. ** **
  320. *****************************************************************************/
  321. /*
  322. * Element Methods -
  323. *
  324. * When you create a custom element, you control what structures are
  325. * passed around the API. For example, you may allow the Q3Set_Add call
  326. * take one type of argument, store your element internally in some
  327. * abstract data type, and have the Q3Set_Get call take a different
  328. * argument.
  329. *
  330. * For example:
  331. *
  332. * There are four calls which at some point will copy an element:
  333. *
  334. * Q3Set_Add (copied from Application memory to QuickDraw3D memory)
  335. * Q3Set_Get (copied from QuickDraw3D memory to Application memory)
  336. * Q3Object_Duplicate (all elements are copied internally)
  337. * Q3AttributeSet_Inherit (all elements are copied internally)
  338. *
  339. * Either CopyAdd or CopyReplace is called during the "_Add" call.
  340. * - CopyAdd is destructive and should assume "toElement" is garbage
  341. * - CopyReplace is replacing an existing element.
  342. *
  343. * CopyGet is called during the "_Get" call.
  344. *
  345. * CopyDuplicate is called to duplicate an element's internal structure.
  346. *
  347. * Attributes Methods -
  348. *
  349. * For copying data while Inheriting. Element methods are used
  350. * at all other times.
  351. *
  352. * CopyInherit is called to duplicate an element's internal structure
  353. * during inheritance. You should make this as fast as possible.
  354. * (for example, if your custom element contains objects, you
  355. * should do a Q3Shared_GetReference instead of a Q3Object_Duplicate)
  356. *
  357. * The ElementDelete method will be called for all of your elements
  358. * copied around via CopyAdd, CopyReplace, CopyDuplicate, and
  359. * CopyInherit.
  360. * If CopyGet allocates any memory in it's destination, it is up to the
  361. * application to delete it on its side.
  362. */
  363. #endif /* CALL_NOT_IN_CARBON */
  364. #define kQ3XMethodTypeElementCopyAdd Q3_METHOD_TYPE('e','c','p','a')
  365. #define kQ3XMethodTypeElementCopyReplace Q3_METHOD_TYPE('e','c','p','r')
  366. #define kQ3XMethodTypeElementCopyGet Q3_METHOD_TYPE('e','c','p','g')
  367. #define kQ3XMethodTypeElementCopyDuplicate Q3_METHOD_TYPE('e','c','p','d')
  368. #define kQ3XMethodTypeElementDelete Q3_METHOD_TYPE('e','d','e','l')
  369. typedef CALLBACK_API_C( TQ3Status , TQ3XElementCopyAddMethod )(const void *fromAPIElement, void *toInternalElement);
  370. typedef CALLBACK_API_C( TQ3Status , TQ3XElementCopyReplaceMethod )(const void *fromAPIElement, void *ontoInternalElement);
  371. typedef CALLBACK_API_C( TQ3Status , TQ3XElementCopyGetMethod )(const void *fromInternalElement, void *toAPIElement);
  372. typedef CALLBACK_API_C( TQ3Status , TQ3XElementCopyDuplicateMethod )(const void *fromInternalElement, void *toInternalElement);
  373. typedef CALLBACK_API_C( TQ3Status , TQ3XElementDeleteMethod )(void * internalElement);
  374. #if CALL_NOT_IN_CARBON
  375. /*
  376. * Q3XElementClass_Register()
  377. *
  378. * Availability:
  379. * Non-Carbon CFM: not available
  380. * CarbonLib: not available
  381. * Mac OS X: not available
  382. */
  383. EXTERN_API_C( TQ3XObjectClass )
  384. Q3XElementClass_Register(
  385. TQ3ElementType * elementType,
  386. const char * name,
  387. unsigned long sizeOfElement,
  388. TQ3XMetaHandler metaHandler);
  389. /*
  390. * Q3XElementType_GetElementSize()
  391. *
  392. * Availability:
  393. * Non-Carbon CFM: not available
  394. * CarbonLib: not available
  395. * Mac OS X: not available
  396. */
  397. EXTERN_API_C( TQ3Status )
  398. Q3XElementType_GetElementSize(
  399. TQ3ElementType elementType,
  400. unsigned long * sizeOfElement);
  401. /******************************************************************************
  402. ** **
  403. ** Custom Attribute Registration **
  404. ** **
  405. *****************************************************************************/
  406. #define kQ3XMethodTypeAttributeInherit Q3_METHOD_TYPE('i','n','h','t')
  407. #endif /* CALL_NOT_IN_CARBON */
  408. typedef TQ3Boolean TQ3XAttributeInheritMethod;
  409. /* return kQ3True or kQ3False in your metahandler */
  410. #define kQ3XMethodTypeAttributeCopyInherit Q3_METHOD_TYPE('a','c','p','i')
  411. typedef CALLBACK_API_C( TQ3Status , TQ3XAttributeCopyInheritMethod )(const void *fromInternalAttribute, void *toInternalAttribute);
  412. #if CALL_NOT_IN_CARBON
  413. /*
  414. * Q3XAttributeClass_Register()
  415. *
  416. * Availability:
  417. * Non-Carbon CFM: not available
  418. * CarbonLib: not available
  419. * Mac OS X: not available
  420. */
  421. EXTERN_API_C( TQ3XObjectClass )
  422. Q3XAttributeClass_Register(
  423. TQ3AttributeType * attributeType,
  424. const char * creatorName,
  425. unsigned long sizeOfElement,
  426. TQ3XMetaHandler metaHandler);
  427. /*
  428. * Version 1.5
  429. */
  430. #define kQ3XMethodTypeAttributeDefault Q3_METHOD_TYPE('a','s','d','f')
  431. #endif /* CALL_NOT_IN_CARBON */
  432. typedef CALLBACK_API_C( TQ3Status , TQ3XAttributeDefaultMethod )(void * internalElement);
  433. #define kQ3XMethodTypeAttributeIsDefault Q3_METHOD_TYPE('a','i','d','f')
  434. typedef CALLBACK_API_C( TQ3Boolean , TQ3XAttributeIsDefaultMethod )(void * internalElement);
  435. #if PRAGMA_ENUM_ALWAYSINT
  436. #pragma enumsalwaysint reset
  437. #ifdef __QD3DSET__RESTORE_TWOBYTEINTS
  438. #pragma fourbyteints off
  439. #endif
  440. #elif PRAGMA_ENUM_OPTIONS
  441. #pragma option enum=reset
  442. #elif defined(__QD3DSET__RESTORE_PACKED_ENUMS)
  443. #pragma options(pack_enums)
  444. #endif
  445. #ifdef PRAGMA_IMPORT_OFF
  446. #pragma import off
  447. #elif PRAGMA_IMPORT
  448. #pragma import reset
  449. #endif
  450. #ifdef __cplusplus
  451. }
  452. #endif
  453. #endif /* __QD3DSET__ */