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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       QD3DShader.h
  3.  
  4.      Contains:   QuickDraw 3D Shader / Color 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 __QD3DSHADER__
  18. #define __QD3DSHADER__
  19. #ifndef __QD3D__
  20. #include "QD3D.h"
  21. #endif
  22. #ifndef __MOVIES__
  23. #include "Movies.h"
  24. #endif
  25. #if PRAGMA_ONCE
  26. #pragma once
  27. #endif
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. #if PRAGMA_IMPORT
  32. #pragma import on
  33. #endif
  34. #if PRAGMA_STRUCT_ALIGN
  35.     #pragma options align=power
  36. #elif PRAGMA_STRUCT_PACKPUSH
  37.     #pragma pack(push, 2)
  38. #elif PRAGMA_STRUCT_PACK
  39.     #pragma pack(2)
  40. #endif
  41. #if PRAGMA_ENUM_ALWAYSINT
  42.     #if defined(__fourbyteints__) && !__fourbyteints__ 
  43.         #define __QD3DSHADER__RESTORE_TWOBYTEINTS
  44.         #pragma fourbyteints on
  45.     #endif
  46.     #pragma enumsalwaysint on
  47. #elif PRAGMA_ENUM_OPTIONS
  48.     #pragma option enum=int
  49. #elif PRAGMA_ENUM_PACK
  50.     #if __option(pack_enums)
  51.         #define __QD3DSHADER__RESTORE_PACKED_ENUMS
  52.         #pragma options(!pack_enums)
  53.     #endif
  54. #endif
  55. /******************************************************************************
  56.  **                                                                          **
  57.  **                             RGB Color routines                           **
  58.  **                                                                          **
  59.  *****************************************************************************/
  60. #if CALL_NOT_IN_CARBON
  61. EXTERN_API_C( TQ3ColorRGB *)
  62. Q3ColorRGB_Set                  (TQ3ColorRGB *          color,
  63.                                  float                  r,
  64.                                  float                  g,
  65.                                  float                  b);
  66. EXTERN_API_C( TQ3ColorARGB *)
  67. Q3ColorARGB_Set                 (TQ3ColorARGB *         color,
  68.                                  float                  a,
  69.                                  float                  r,
  70.                                  float                  g,
  71.                                  float                  b);
  72. EXTERN_API_C( TQ3ColorRGB *)
  73. Q3ColorRGB_Add                  (const TQ3ColorRGB *    c1,
  74.                                  const TQ3ColorRGB *    c2,
  75.                                  TQ3ColorRGB *          result);
  76. EXTERN_API_C( TQ3ColorRGB *)
  77. Q3ColorRGB_Subtract             (const TQ3ColorRGB *    c1,
  78.                                  const TQ3ColorRGB *    c2,
  79.                                  TQ3ColorRGB *          result);
  80. EXTERN_API_C( TQ3ColorRGB *)
  81. Q3ColorRGB_Scale                (const TQ3ColorRGB *    color,
  82.                                  float                  scale,
  83.                                  TQ3ColorRGB *          result);
  84. EXTERN_API_C( TQ3ColorRGB *)
  85. Q3ColorRGB_Clamp                (const TQ3ColorRGB *    color,
  86.                                  TQ3ColorRGB *          result);
  87. EXTERN_API_C( TQ3ColorRGB *)
  88. Q3ColorRGB_Lerp                 (const TQ3ColorRGB *    first,
  89.                                  const TQ3ColorRGB *    last,
  90.                                  float                  alpha,
  91.                                  TQ3ColorRGB *          result);
  92. EXTERN_API_C( TQ3ColorRGB *)
  93. Q3ColorRGB_Accumulate           (const TQ3ColorRGB *    src,
  94.                                  TQ3ColorRGB *          result);
  95. #endif  /* CALL_NOT_IN_CARBON */
  96. #if CALL_NOT_IN_CARBON
  97. EXTERN_API_C( float *)
  98. Q3ColorRGB_Luminance            (const TQ3ColorRGB *    color,
  99.                                  float *                luminance);
  100. #endif  /* CALL_NOT_IN_CARBON */
  101. /******************************************************************************
  102.  **                                                                          **
  103.  **                             Shader Types                                 **
  104.  **                                                                          **
  105.  *****************************************************************************/
  106. enum TQ3ShaderUVBoundary {
  107.     kQ3ShaderUVBoundaryWrap     = 0,
  108.     kQ3ShaderUVBoundaryClamp    = 1
  109. };
  110. typedef enum TQ3ShaderUVBoundary TQ3ShaderUVBoundary;
  111. /******************************************************************************
  112.  **                                                                          **
  113.  **                             Shader Routines                              **
  114.  **                                                                          **
  115.  *****************************************************************************/
  116. #if CALL_NOT_IN_CARBON
  117. EXTERN_API_C( TQ3ObjectType )
  118. Q3Shader_GetType                (TQ3ShaderObject        shader);
  119. EXTERN_API_C( TQ3Status )
  120. Q3Shader_Submit                 (TQ3ShaderObject        shader,
  121.                                  TQ3ViewObject          view);
  122. EXTERN_API_C( TQ3Status )
  123. Q3Shader_SetUVTransform         (TQ3ShaderObject        shader,
  124.                                  const TQ3Matrix3x3 *   uvTransform);
  125. EXTERN_API_C( TQ3Status )
  126. Q3Shader_GetUVTransform         (TQ3ShaderObject        shader,
  127.                                  TQ3Matrix3x3 *         uvTransform);
  128. EXTERN_API_C( TQ3Status )
  129. Q3Shader_SetUBoundary           (TQ3ShaderObject        shader,
  130.                                  TQ3ShaderUVBoundary    uBoundary);
  131. EXTERN_API_C( TQ3Status )
  132. Q3Shader_SetVBoundary           (TQ3ShaderObject        shader,
  133.                                  TQ3ShaderUVBoundary    vBoundary);
  134. EXTERN_API_C( TQ3Status )
  135. Q3Shader_GetUBoundary           (TQ3ShaderObject        shader,
  136.                                  TQ3ShaderUVBoundary *  uBoundary);
  137. EXTERN_API_C( TQ3Status )
  138. Q3Shader_GetVBoundary           (TQ3ShaderObject        shader,
  139.                                  TQ3ShaderUVBoundary *  vBoundary);
  140. /******************************************************************************
  141.  **                                                                          **
  142.  **                         Illumination Shader Classes                      **
  143.  **                                                                          **
  144.  *****************************************************************************/
  145. EXTERN_API_C( TQ3ObjectType )
  146. Q3IlluminationShader_GetType    (TQ3ShaderObject        shader);
  147. EXTERN_API_C( TQ3ShaderObject )
  148. Q3PhongIllumination_New         (void);
  149. EXTERN_API_C( TQ3ShaderObject )
  150. Q3LambertIllumination_New       (void);
  151. EXTERN_API_C( TQ3ShaderObject )
  152. Q3NULLIllumination_New          (void);
  153. /******************************************************************************
  154.  **                                                                          **
  155.  **                              Surface Shader                              **
  156.  **                                                                          **
  157.  *****************************************************************************/
  158. EXTERN_API_C( TQ3ObjectType )
  159. Q3SurfaceShader_GetType         (TQ3SurfaceShaderObject  shader);
  160. /******************************************************************************
  161.  **                                                                          **
  162.  **                             Texture Shader                               **
  163.  **                                                                          **
  164.  *****************************************************************************/
  165. EXTERN_API_C( TQ3ShaderObject )
  166. Q3TextureShader_New             (TQ3TextureObject       texture);
  167. EXTERN_API_C( TQ3Status )
  168. Q3TextureShader_GetTexture      (TQ3ShaderObject        shader,
  169.                                  TQ3TextureObject *     texture);
  170. EXTERN_API_C( TQ3Status )
  171. Q3TextureShader_SetTexture      (TQ3ShaderObject        shader,
  172.                                  TQ3TextureObject       texture);
  173. /******************************************************************************
  174.  **                                                                          **
  175.  **                             Texture Objects                              **
  176.  **                                                                          **
  177.  *****************************************************************************/
  178. EXTERN_API_C( TQ3ObjectType )
  179. Q3Texture_GetType               (TQ3TextureObject       texture);
  180. EXTERN_API_C( TQ3Status )
  181. Q3Texture_GetWidth              (TQ3TextureObject       texture,
  182.                                  unsigned long *        width);
  183. EXTERN_API_C( TQ3Status )
  184. Q3Texture_GetHeight             (TQ3TextureObject       texture,
  185.                                  unsigned long *        height);
  186. /******************************************************************************
  187.  **                                                                          **
  188.  **                             Pixmap Texture                               **
  189.  **                                                                          **
  190.  *****************************************************************************/
  191. EXTERN_API_C( TQ3TextureObject )
  192. Q3PixmapTexture_New             (const TQ3StoragePixmap * pixmap);
  193. EXTERN_API_C( TQ3Status )
  194. Q3PixmapTexture_GetPixmap       (TQ3TextureObject       texture,
  195.                                  TQ3StoragePixmap *     pixmap);
  196. EXTERN_API_C( TQ3Status )
  197. Q3PixmapTexture_SetPixmap       (TQ3TextureObject       texture,
  198.                                  const TQ3StoragePixmap * pixmap);
  199. /******************************************************************************
  200.  **                                                                          **
  201.  **                             Mipmap Texture                               **
  202.  **                                                                          **
  203.  *****************************************************************************/
  204. EXTERN_API_C( TQ3TextureObject )
  205. Q3MipmapTexture_New             (const TQ3Mipmap *      mipmap);
  206. EXTERN_API_C( TQ3Status )
  207. Q3MipmapTexture_GetMipmap       (TQ3TextureObject       texture,
  208.                                  TQ3Mipmap *            mipmap);
  209. EXTERN_API_C( TQ3Status )
  210. Q3MipmapTexture_SetMipmap       (TQ3TextureObject       texture,
  211.                                  const TQ3Mipmap *      mipmap);
  212. /******************************************************************************
  213.  **                                                                          **
  214.  **                 Compressed Pixmap Texture                                **
  215.  **                                                                          **
  216.  *****************************************************************************/
  217. EXTERN_API_C( TQ3TextureObject )
  218. Q3CompressedPixmapTexture_New   (const TQ3CompressedPixmap * compressedPixmap);
  219. EXTERN_API_C( TQ3Status )
  220. Q3CompressedPixmapTexture_GetCompressedPixmap (TQ3TextureObject  texture,
  221.                                  TQ3CompressedPixmap *  compressedPixmap);
  222. EXTERN_API_C( TQ3Status )
  223. Q3CompressedPixmapTexture_SetCompressedPixmap (TQ3TextureObject  texture,
  224.                                  const TQ3CompressedPixmap * compressedPixmap);
  225. EXTERN_API_C( TQ3Status )
  226. Q3CompressedPixmapTexture_CompressImage (TQ3CompressedPixmap * compressedPixmap,
  227.                                  PixMapHandle           sourcePixMap,
  228.                                  CodecType              codecType,
  229.                                  CodecComponent         codecComponent,
  230.                                  short                  codedDepth,
  231.                                  CodecQ                 codecQuality);
  232. #endif  /* CALL_NOT_IN_CARBON */
  233. #if PRAGMA_ENUM_ALWAYSINT
  234.     #pragma enumsalwaysint reset
  235.     #ifdef __QD3DSHADER__RESTORE_TWOBYTEINTS
  236.         #pragma fourbyteints off
  237.     #endif
  238. #elif PRAGMA_ENUM_OPTIONS
  239.     #pragma option enum=reset
  240. #elif defined(__QD3DSHADER__RESTORE_PACKED_ENUMS)
  241.     #pragma options(pack_enums)
  242. #endif
  243. #if PRAGMA_STRUCT_ALIGN
  244.     #pragma options align=reset
  245. #elif PRAGMA_STRUCT_PACKPUSH
  246.     #pragma pack(pop)
  247. #elif PRAGMA_STRUCT_PACK
  248.     #pragma pack()
  249. #endif
  250. #ifdef PRAGMA_IMPORT_OFF
  251. #pragma import off
  252. #elif PRAGMA_IMPORT
  253. #pragma import reset
  254. #endif
  255. #ifdef __cplusplus
  256. }
  257. #endif
  258. #endif /* __QD3DSHADER__ */