Subversion Repositories Games.Chess Giants

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  Copyright (C) Microsoft Corporation.  All Rights Reserved.
  4. //
  5. //  File:       d3dx10tex.h
  6. //  Content:    D3DX10 texturing APIs
  7. //
  8. //////////////////////////////////////////////////////////////////////////////
  9.  
  10. #include "d3dx10.h"
  11.  
  12. #ifndef __D3DX10TEX_H__
  13. #define __D3DX10TEX_H__
  14.  
  15.  
  16. //----------------------------------------------------------------------------
  17. // D3DX10_FILTER flags:
  18. // ------------------
  19. //
  20. // A valid filter must contain one of these values:
  21. //
  22. //  D3DX10_FILTER_NONE
  23. //      No scaling or filtering will take place.  Pixels outside the bounds
  24. //      of the source image are assumed to be transparent black.
  25. //  D3DX10_FILTER_POINT
  26. //      Each destination pixel is computed by sampling the nearest pixel
  27. //      from the source image.
  28. //  D3DX10_FILTER_LINEAR
  29. //      Each destination pixel is computed by linearly interpolating between
  30. //      the nearest pixels in the source image.  This filter works best
  31. //      when the scale on each axis is less than 2.
  32. //  D3DX10_FILTER_TRIANGLE
  33. //      Every pixel in the source image contributes equally to the
  34. //      destination image.  This is the slowest of all the filters.
  35. //  D3DX10_FILTER_BOX
  36. //      Each pixel is computed by averaging a 2x2(x2) box pixels from
  37. //      the source image. Only works when the dimensions of the
  38. //      destination are half those of the source. (as with mip maps)
  39. //
  40. // And can be OR'd with any of these optional flags:
  41. //
  42. //  D3DX10_FILTER_MIRROR_U
  43. //      Indicates that pixels off the edge of the texture on the U-axis
  44. //      should be mirrored, not wraped.
  45. //  D3DX10_FILTER_MIRROR_V
  46. //      Indicates that pixels off the edge of the texture on the V-axis
  47. //      should be mirrored, not wraped.
  48. //  D3DX10_FILTER_MIRROR_W
  49. //      Indicates that pixels off the edge of the texture on the W-axis
  50. //      should be mirrored, not wraped.
  51. //  D3DX10_FILTER_MIRROR
  52. //      Same as specifying D3DX10_FILTER_MIRROR_U | D3DX10_FILTER_MIRROR_V |
  53. //      D3DX10_FILTER_MIRROR_V
  54. //  D3DX10_FILTER_DITHER
  55. //      Dithers the resulting image using a 4x4 order dither pattern.
  56. //  D3DX10_FILTER_SRGB_IN
  57. //      Denotes that the input data is in sRGB (gamma 2.2) colorspace.
  58. //  D3DX10_FILTER_SRGB_OUT
  59. //      Denotes that the output data is in sRGB (gamma 2.2) colorspace.
  60. //  D3DX10_FILTER_SRGB
  61. //      Same as specifying D3DX10_FILTER_SRGB_IN | D3DX10_FILTER_SRGB_OUT
  62. //
  63. //----------------------------------------------------------------------------
  64.  
  65. typedef enum D3DX10_FILTER_FLAG
  66. {
  67.     D3DX10_FILTER_NONE            =   (1 << 0),
  68.     D3DX10_FILTER_POINT           =   (2 << 0),
  69.     D3DX10_FILTER_LINEAR          =   (3 << 0),
  70.     D3DX10_FILTER_TRIANGLE        =   (4 << 0),
  71.     D3DX10_FILTER_BOX             =   (5 << 0),
  72.  
  73.     D3DX10_FILTER_MIRROR_U        =   (1 << 16),
  74.     D3DX10_FILTER_MIRROR_V        =   (2 << 16),
  75.     D3DX10_FILTER_MIRROR_W        =   (4 << 16),
  76.     D3DX10_FILTER_MIRROR          =   (7 << 16),
  77.  
  78.     D3DX10_FILTER_DITHER          =   (1 << 19),
  79.     D3DX10_FILTER_DITHER_DIFFUSION=   (2 << 19),
  80.  
  81.     D3DX10_FILTER_SRGB_IN         =   (1 << 21),
  82.     D3DX10_FILTER_SRGB_OUT        =   (2 << 21),
  83.     D3DX10_FILTER_SRGB            =   (3 << 21),
  84. } D3DX10_FILTER_FLAG;
  85.  
  86. //----------------------------------------------------------------------------
  87. // D3DX10_NORMALMAP flags:
  88. // ---------------------
  89. // These flags are used to control how D3DX10ComputeNormalMap generates normal
  90. // maps.  Any number of these flags may be OR'd together in any combination.
  91. //
  92. //  D3DX10_NORMALMAP_MIRROR_U
  93. //      Indicates that pixels off the edge of the texture on the U-axis
  94. //      should be mirrored, not wraped.
  95. //  D3DX10_NORMALMAP_MIRROR_V
  96. //      Indicates that pixels off the edge of the texture on the V-axis
  97. //      should be mirrored, not wraped.
  98. //  D3DX10_NORMALMAP_MIRROR
  99. //      Same as specifying D3DX10_NORMALMAP_MIRROR_U | D3DX10_NORMALMAP_MIRROR_V
  100. //  D3DX10_NORMALMAP_INVERTSIGN
  101. //      Inverts the direction of each normal
  102. //  D3DX10_NORMALMAP_COMPUTE_OCCLUSION
  103. //      Compute the per pixel Occlusion term and encodes it into the alpha.
  104. //      An Alpha of 1 means that the pixel is not obscured in anyway, and
  105. //      an alpha of 0 would mean that the pixel is completly obscured.
  106. //
  107. //----------------------------------------------------------------------------
  108.  
  109. typedef enum D3DX10_NORMALMAP_FLAG
  110. {
  111.     D3DX10_NORMALMAP_MIRROR_U          =   (1 << 16),
  112.     D3DX10_NORMALMAP_MIRROR_V          =   (2 << 16),
  113.     D3DX10_NORMALMAP_MIRROR            =   (3 << 16),
  114.     D3DX10_NORMALMAP_INVERTSIGN        =   (8 << 16),
  115.     D3DX10_NORMALMAP_COMPUTE_OCCLUSION =   (16 << 16),
  116. } D3DX10_NORMALMAP_FLAG;
  117.  
  118. //----------------------------------------------------------------------------
  119. // D3DX10_CHANNEL flags:
  120. // -------------------
  121. // These flags are used by functions which operate on or more channels
  122. // in a texture.
  123. //
  124. // D3DX10_CHANNEL_RED
  125. //     Indicates the red channel should be used
  126. // D3DX10_CHANNEL_BLUE
  127. //     Indicates the blue channel should be used
  128. // D3DX10_CHANNEL_GREEN
  129. //     Indicates the green channel should be used
  130. // D3DX10_CHANNEL_ALPHA
  131. //     Indicates the alpha channel should be used
  132. // D3DX10_CHANNEL_LUMINANCE
  133. //     Indicates the luminaces of the red green and blue channels should be
  134. //     used.
  135. //
  136. //----------------------------------------------------------------------------
  137.  
  138. typedef enum D3DX10_CHANNEL_FLAG
  139. {
  140.     D3DX10_CHANNEL_RED           =    (1 << 0),
  141.     D3DX10_CHANNEL_BLUE          =    (1 << 1),
  142.     D3DX10_CHANNEL_GREEN         =    (1 << 2),
  143.     D3DX10_CHANNEL_ALPHA         =    (1 << 3),
  144.     D3DX10_CHANNEL_LUMINANCE     =    (1 << 4),
  145. } D3DX10_CHANNEL_FLAG;
  146.  
  147.  
  148.  
  149. //----------------------------------------------------------------------------
  150. // D3DX10_IMAGE_FILE_FORMAT:
  151. // ---------------------
  152. // This enum is used to describe supported image file formats.
  153. //
  154. //----------------------------------------------------------------------------
  155.  
  156. typedef enum D3DX10_IMAGE_FILE_FORMAT
  157. {
  158.     D3DX10_IFF_BMP         = 0,
  159.     D3DX10_IFF_JPG         = 1,
  160.     D3DX10_IFF_PNG         = 3,
  161.     D3DX10_IFF_DDS         = 4,
  162.     D3DX10_IFF_TIFF               = 10,
  163.     D3DX10_IFF_GIF                = 11,
  164.     D3DX10_IFF_WMP                = 12,
  165.     D3DX10_IFF_FORCE_DWORD = 0x7fffffff
  166.  
  167. } D3DX10_IMAGE_FILE_FORMAT;
  168.  
  169.  
  170. //----------------------------------------------------------------------------
  171. // D3DX10_SAVE_TEXTURE_FLAG:
  172. // ---------------------
  173. // This enum is used to support texture saving options.
  174. //
  175. //----------------------------------------------------------------------------
  176.  
  177. typedef enum D3DX10_SAVE_TEXTURE_FLAG
  178. {
  179.     D3DX10_STF_USEINPUTBLOB      = 0x0001,
  180. } D3DX10_SAVE_TEXTURE_FLAG;
  181.  
  182.  
  183.  
  184. //----------------------------------------------------------------------------
  185. // D3DX10_IMAGE_INFO:
  186. // ---------------
  187. // This structure is used to return a rough description of what the
  188. // the original contents of an image file looked like.
  189. //
  190. //  Width
  191. //      Width of original image in pixels
  192. //  Height
  193. //      Height of original image in pixels
  194. //  Depth
  195. //      Depth of original image in pixels
  196. //  ArraySize
  197. //      Array size in textures
  198. //  MipLevels
  199. //      Number of mip levels in original image
  200. //  MiscFlags
  201. //      Miscellaneous flags
  202. //  Format
  203. //      D3D format which most closely describes the data in original image
  204. //  ResourceDimension
  205. //      D3D10_RESOURCE_DIMENSION representing the dimension of texture stored in the file.
  206. //      D3D10_RESOURCE_DIMENSION_TEXTURE1D, 2D, 3D
  207. //  ImageFileFormat
  208. //      D3DX10_IMAGE_FILE_FORMAT representing the format of the image file.
  209. //----------------------------------------------------------------------------
  210.  
  211. typedef struct D3DX10_IMAGE_INFO
  212. {
  213.     UINT                        Width;
  214.     UINT                        Height;
  215.     UINT                        Depth;
  216.     UINT                        ArraySize;
  217.     UINT                        MipLevels;
  218.     UINT                        MiscFlags;
  219.     DXGI_FORMAT                 Format;
  220.     D3D10_RESOURCE_DIMENSION    ResourceDimension;
  221.     D3DX10_IMAGE_FILE_FORMAT    ImageFileFormat;
  222. } D3DX10_IMAGE_INFO;
  223.  
  224.  
  225.  
  226.  
  227.  
  228. #ifdef __cplusplus
  229. extern "C" {
  230. #endif //__cplusplus
  231.  
  232.  
  233.  
  234. //////////////////////////////////////////////////////////////////////////////
  235. // Image File APIs ///////////////////////////////////////////////////////////
  236. //////////////////////////////////////////////////////////////////////////////
  237.  
  238. //----------------------------------------------------------------------------
  239. // D3DX10_IMAGE_LOAD_INFO:
  240. // ---------------
  241. // This structure can be optionally passed in to texture loader APIs to
  242. // control how textures get loaded. Pass in D3DX10_DEFAULT for any of these
  243. // to have D3DX automatically pick defaults based on the source file.
  244. //
  245. //  Width
  246. //      Rescale texture to Width texels wide
  247. //  Height
  248. //      Rescale texture to Height texels high
  249. //  Depth
  250. //      Rescale texture to Depth texels deep
  251. //  FirstMipLevel
  252. //      First mip level to load
  253. //  MipLevels
  254. //      Number of mip levels to load after the first level
  255. //  Usage
  256. //      D3D10_USAGE flag for the new texture
  257. //  BindFlags
  258. //      D3D10 Bind flags for the new texture
  259. //  CpuAccessFlags
  260. //      D3D10 CPU Access flags for the new texture
  261. //  MiscFlags
  262. //      Reserved. Must be 0
  263. //  Format
  264. //      Resample texture to the specified format
  265. //  Filter
  266. //      Filter the texture using the specified filter (only when resampling)
  267. //  MipFilter
  268. //      Filter the texture mip levels using the specified filter (only if
  269. //      generating mips)
  270. //  pSrcInfo
  271. //      (optional) pointer to a D3DX10_IMAGE_INFO structure that will get
  272. //      populated with source image information
  273. //----------------------------------------------------------------------------
  274.  
  275.  
  276. typedef struct D3DX10_IMAGE_LOAD_INFO
  277. {
  278.     UINT                       Width;
  279.     UINT                       Height;
  280.     UINT                       Depth;
  281.     UINT                       FirstMipLevel;
  282.     UINT                       MipLevels;
  283.     D3D10_USAGE                Usage;
  284.     UINT                       BindFlags;
  285.     UINT                       CpuAccessFlags;
  286.     UINT                       MiscFlags;
  287.     DXGI_FORMAT                Format;
  288.     UINT                       Filter;
  289.     UINT                       MipFilter;
  290.     D3DX10_IMAGE_INFO*         pSrcInfo;
  291.    
  292. #ifdef __cplusplus
  293.     D3DX10_IMAGE_LOAD_INFO()
  294.     {
  295.         Width = D3DX10_DEFAULT;
  296.         Height = D3DX10_DEFAULT;
  297.         Depth = D3DX10_DEFAULT;
  298.         FirstMipLevel = D3DX10_DEFAULT;
  299.         MipLevels = D3DX10_DEFAULT;
  300.         Usage = (D3D10_USAGE) D3DX10_DEFAULT;
  301.         BindFlags = D3DX10_DEFAULT;
  302.         CpuAccessFlags = D3DX10_DEFAULT;
  303.         MiscFlags = D3DX10_DEFAULT;
  304.         Format = DXGI_FORMAT_FROM_FILE;
  305.         Filter = D3DX10_DEFAULT;
  306.         MipFilter = D3DX10_DEFAULT;
  307.         pSrcInfo = NULL;
  308.     }  
  309. #endif
  310.  
  311. } D3DX10_IMAGE_LOAD_INFO;
  312.  
  313. //-------------------------------------------------------------------------------
  314. // GetImageInfoFromFile/Resource/Memory:
  315. // ------------------------------
  316. // Fills in a D3DX10_IMAGE_INFO struct with information about an image file.
  317. //
  318. // Parameters:
  319. //  pSrcFile
  320. //      File name of the source image.
  321. //  pSrcModule
  322. //      Module where resource is located, or NULL for module associated
  323. //      with image the os used to create the current process.
  324. //  pSrcResource
  325. //      Resource name.
  326. //  pSrcData
  327. //      Pointer to file in memory.
  328. //  SrcDataSize
  329. //      Size in bytes of file in memory.
  330. //  pPump
  331. //      Optional pointer to a thread pump object to use.
  332. //  pSrcInfo
  333. //      Pointer to a D3DX10_IMAGE_INFO structure to be filled in with the
  334. //      description of the data in the source image file.
  335. //  pHResult
  336. //      Pointer to a memory location to receive the return value upon completion.
  337. //      Maybe NULL if not needed.
  338. //      If pPump != NULL, pHResult must be a valid memory location until the
  339. //      the asynchronous execution completes.
  340. //-------------------------------------------------------------------------------
  341.  
  342. HRESULT WINAPI
  343.     D3DX10GetImageInfoFromFileA(
  344.         LPCSTR                    pSrcFile,
  345.         ID3DX10ThreadPump*        pPump,
  346.         D3DX10_IMAGE_INFO*        pSrcInfo,
  347.         HRESULT*                  pHResult);
  348.  
  349. HRESULT WINAPI
  350.     D3DX10GetImageInfoFromFileW(
  351.         LPCWSTR                   pSrcFile,
  352.         ID3DX10ThreadPump*        pPump,
  353.         D3DX10_IMAGE_INFO*        pSrcInfo,
  354.         HRESULT*                  pHResult);
  355.  
  356. #ifdef UNICODE
  357. #define D3DX10GetImageInfoFromFile D3DX10GetImageInfoFromFileW
  358. #else
  359. #define D3DX10GetImageInfoFromFile D3DX10GetImageInfoFromFileA
  360. #endif
  361.  
  362.  
  363. HRESULT WINAPI
  364.     D3DX10GetImageInfoFromResourceA(
  365.         HMODULE                   hSrcModule,
  366.         LPCSTR                    pSrcResource,
  367.         ID3DX10ThreadPump*        pPump,
  368.         D3DX10_IMAGE_INFO*        pSrcInfo,
  369.         HRESULT*                  pHResult);
  370.  
  371. HRESULT WINAPI
  372.     D3DX10GetImageInfoFromResourceW(
  373.         HMODULE                   hSrcModule,
  374.         LPCWSTR                   pSrcResource,
  375.         ID3DX10ThreadPump*        pPump,
  376.         D3DX10_IMAGE_INFO*        pSrcInfo,
  377.         HRESULT*                  pHResult);
  378.  
  379. #ifdef UNICODE
  380. #define D3DX10GetImageInfoFromResource D3DX10GetImageInfoFromResourceW
  381. #else
  382. #define D3DX10GetImageInfoFromResource D3DX10GetImageInfoFromResourceA
  383. #endif
  384.  
  385.  
  386. HRESULT WINAPI
  387.     D3DX10GetImageInfoFromMemory(
  388.         LPCVOID                   pSrcData,
  389.         SIZE_T                    SrcDataSize,
  390.         ID3DX10ThreadPump*        pPump,
  391.         D3DX10_IMAGE_INFO*        pSrcInfo,
  392.         HRESULT*                  pHResult);
  393.  
  394.  
  395. //////////////////////////////////////////////////////////////////////////////
  396. // Create/Save Texture APIs //////////////////////////////////////////////////
  397. //////////////////////////////////////////////////////////////////////////////
  398.  
  399. //----------------------------------------------------------------------------
  400. // D3DX10CreateTextureFromFile/Resource/Memory:
  401. // D3DX10CreateShaderResourceViewFromFile/Resource/Memory:
  402. // -----------------------------------
  403. // Create a texture object from a file or resource.
  404. //
  405. // Parameters:
  406. //
  407. //  pDevice
  408. //      The D3D device with which the texture is going to be used.
  409. //  pSrcFile
  410. //      File name.
  411. //  hSrcModule
  412. //      Module handle. if NULL, current module will be used.
  413. //  pSrcResource
  414. //      Resource name in module
  415. //  pvSrcData
  416. //      Pointer to file in memory.
  417. //  SrcDataSize
  418. //      Size in bytes of file in memory.
  419. //  pLoadInfo
  420. //      Optional pointer to a D3DX10_IMAGE_LOAD_INFO structure that
  421. //      contains additional loader parameters.
  422. //  pPump
  423. //      Optional pointer to a thread pump object to use.
  424. //  ppTexture
  425. //      [out] Created texture object.
  426. //  ppShaderResourceView
  427. //      [out] Shader resource view object created.
  428. //  pHResult
  429. //      Pointer to a memory location to receive the return value upon completion.
  430. //      Maybe NULL if not needed.
  431. //      If pPump != NULL, pHResult must be a valid memory location until the
  432. //      the asynchronous execution completes.
  433. //
  434. //----------------------------------------------------------------------------
  435.  
  436.  
  437. // FromFile
  438.  
  439. HRESULT WINAPI
  440.     D3DX10CreateShaderResourceViewFromFileA(
  441.         ID3D10Device*               pDevice,
  442.         LPCSTR                      pSrcFile,
  443.         D3DX10_IMAGE_LOAD_INFO      *pLoadInfo,
  444.         ID3DX10ThreadPump*          pPump,
  445.         ID3D10ShaderResourceView**  ppShaderResourceView,
  446.         HRESULT*                    pHResult);
  447.  
  448. HRESULT WINAPI
  449.     D3DX10CreateShaderResourceViewFromFileW(
  450.         ID3D10Device*               pDevice,
  451.         LPCWSTR                     pSrcFile,
  452.         D3DX10_IMAGE_LOAD_INFO      *pLoadInfo,
  453.         ID3DX10ThreadPump*          pPump,
  454.         ID3D10ShaderResourceView**  ppShaderResourceView,
  455.         HRESULT*                    pHResult);
  456.  
  457. #ifdef UNICODE
  458. #define D3DX10CreateShaderResourceViewFromFile D3DX10CreateShaderResourceViewFromFileW
  459. #else
  460. #define D3DX10CreateShaderResourceViewFromFile D3DX10CreateShaderResourceViewFromFileA
  461. #endif
  462.  
  463. HRESULT WINAPI
  464.     D3DX10CreateTextureFromFileA(
  465.         ID3D10Device*               pDevice,
  466.         LPCSTR                      pSrcFile,
  467.         D3DX10_IMAGE_LOAD_INFO      *pLoadInfo,
  468.         ID3DX10ThreadPump*          pPump,
  469.         ID3D10Resource**            ppTexture,
  470.         HRESULT*                    pHResult);
  471.  
  472. HRESULT WINAPI
  473.     D3DX10CreateTextureFromFileW(
  474.         ID3D10Device*               pDevice,
  475.         LPCWSTR                     pSrcFile,
  476.         D3DX10_IMAGE_LOAD_INFO      *pLoadInfo,
  477.         ID3DX10ThreadPump*          pPump,
  478.         ID3D10Resource**            ppTexture,
  479.         HRESULT*                    pHResult);
  480.  
  481. #ifdef UNICODE
  482. #define D3DX10CreateTextureFromFile D3DX10CreateTextureFromFileW
  483. #else
  484. #define D3DX10CreateTextureFromFile D3DX10CreateTextureFromFileA
  485. #endif
  486.  
  487.  
  488. // FromResource (resources in dll/exes)
  489.  
  490. HRESULT WINAPI
  491.     D3DX10CreateShaderResourceViewFromResourceA(
  492.         ID3D10Device*              pDevice,
  493.         HMODULE                    hSrcModule,
  494.         LPCSTR                     pSrcResource,
  495.         D3DX10_IMAGE_LOAD_INFO*    pLoadInfo,
  496.         ID3DX10ThreadPump*         pPump,
  497.         ID3D10ShaderResourceView** ppShaderResourceView,
  498.         HRESULT*                   pHResult);
  499.  
  500. HRESULT WINAPI
  501.     D3DX10CreateShaderResourceViewFromResourceW(
  502.         ID3D10Device*              pDevice,
  503.         HMODULE                    hSrcModule,
  504.         LPCWSTR                    pSrcResource,
  505.         D3DX10_IMAGE_LOAD_INFO*    pLoadInfo,
  506.         ID3DX10ThreadPump*         pPump,
  507.         ID3D10ShaderResourceView** ppShaderResourceView,
  508.         HRESULT*                   pHResult);
  509.  
  510. #ifdef UNICODE
  511. #define D3DX10CreateShaderResourceViewFromResource D3DX10CreateShaderResourceViewFromResourceW
  512. #else
  513. #define D3DX10CreateShaderResourceViewFromResource D3DX10CreateShaderResourceViewFromResourceA
  514. #endif
  515.  
  516. HRESULT WINAPI
  517.     D3DX10CreateTextureFromResourceA(
  518.         ID3D10Device*            pDevice,
  519.         HMODULE                  hSrcModule,
  520.         LPCSTR                   pSrcResource,
  521.         D3DX10_IMAGE_LOAD_INFO   *pLoadInfo,  
  522.         ID3DX10ThreadPump*       pPump,  
  523.         ID3D10Resource**         ppTexture,
  524.         HRESULT*                 pHResult);
  525.  
  526. HRESULT WINAPI
  527.     D3DX10CreateTextureFromResourceW(
  528.         ID3D10Device*           pDevice,
  529.         HMODULE                 hSrcModule,
  530.         LPCWSTR                 pSrcResource,
  531.         D3DX10_IMAGE_LOAD_INFO* pLoadInfo,
  532.         ID3DX10ThreadPump*      pPump,
  533.         ID3D10Resource**        ppTexture,
  534.         HRESULT*                pHResult);
  535.  
  536. #ifdef UNICODE
  537. #define D3DX10CreateTextureFromResource D3DX10CreateTextureFromResourceW
  538. #else
  539. #define D3DX10CreateTextureFromResource D3DX10CreateTextureFromResourceA
  540. #endif
  541.  
  542.  
  543. // FromFileInMemory
  544.  
  545. HRESULT WINAPI
  546.     D3DX10CreateShaderResourceViewFromMemory(
  547.         ID3D10Device*              pDevice,
  548.         LPCVOID                    pSrcData,
  549.         SIZE_T                     SrcDataSize,
  550.         D3DX10_IMAGE_LOAD_INFO*    pLoadInfo,
  551.         ID3DX10ThreadPump*         pPump,        
  552.         ID3D10ShaderResourceView** ppShaderResourceView,
  553.         HRESULT*                   pHResult);
  554.  
  555. HRESULT WINAPI
  556.     D3DX10CreateTextureFromMemory(
  557.         ID3D10Device*             pDevice,
  558.         LPCVOID                   pSrcData,
  559.         SIZE_T                    SrcDataSize,
  560.         D3DX10_IMAGE_LOAD_INFO*   pLoadInfo,    
  561.         ID3DX10ThreadPump*        pPump,    
  562.         ID3D10Resource**          ppTexture,
  563.         HRESULT*                  pHResult);
  564.  
  565.  
  566. //////////////////////////////////////////////////////////////////////////////
  567. // Misc Texture APIs /////////////////////////////////////////////////////////
  568. //////////////////////////////////////////////////////////////////////////////
  569.  
  570. //----------------------------------------------------------------------------
  571. // D3DX10_TEXTURE_LOAD_INFO:
  572. // ------------------------
  573. //
  574. //----------------------------------------------------------------------------
  575.  
  576. typedef struct _D3DX10_TEXTURE_LOAD_INFO
  577. {
  578.     D3D10_BOX       *pSrcBox;
  579.     D3D10_BOX       *pDstBox;
  580.     UINT            SrcFirstMip;
  581.     UINT            DstFirstMip;
  582.     UINT            NumMips;
  583.     UINT            SrcFirstElement;
  584.     UINT            DstFirstElement;
  585.     UINT            NumElements;
  586.     UINT            Filter;
  587.     UINT            MipFilter;
  588.    
  589. #ifdef __cplusplus
  590.     _D3DX10_TEXTURE_LOAD_INFO()
  591.     {
  592.         pSrcBox = NULL;
  593.         pDstBox = NULL;
  594.         SrcFirstMip = 0;
  595.         DstFirstMip = 0;
  596.         NumMips = D3DX10_DEFAULT;
  597.         SrcFirstElement = 0;
  598.         DstFirstElement = 0;
  599.         NumElements = D3DX10_DEFAULT;
  600.         Filter = D3DX10_DEFAULT;
  601.         MipFilter = D3DX10_DEFAULT;
  602.     }  
  603. #endif
  604.  
  605. } D3DX10_TEXTURE_LOAD_INFO;
  606.  
  607.  
  608. //----------------------------------------------------------------------------
  609. // D3DX10LoadTextureFromTexture:
  610. // ----------------------------
  611. // Load a texture from a texture.
  612. //
  613. // Parameters:
  614. //
  615. //----------------------------------------------------------------------------
  616.  
  617.  
  618. HRESULT WINAPI
  619.     D3DX10LoadTextureFromTexture(
  620.         ID3D10Resource            *pSrcTexture,
  621.         D3DX10_TEXTURE_LOAD_INFO  *pLoadInfo,
  622.         ID3D10Resource            *pDstTexture);
  623.  
  624.  
  625. //----------------------------------------------------------------------------
  626. // D3DX10FilterTexture:
  627. // ------------------
  628. // Filters mipmaps levels of a texture.
  629. //
  630. // Parameters:
  631. //  pBaseTexture
  632. //      The texture object to be filtered
  633. //  SrcLevel
  634. //      The level whose image is used to generate the subsequent levels.
  635. //  MipFilter
  636. //      D3DX10_FILTER flags controlling how each miplevel is filtered.
  637. //      Or D3DX10_DEFAULT for D3DX10_FILTER_BOX,
  638. //
  639. //----------------------------------------------------------------------------
  640.  
  641. HRESULT WINAPI
  642.     D3DX10FilterTexture(
  643.         ID3D10Resource            *pTexture,
  644.         UINT                      SrcLevel,
  645.         UINT                      MipFilter);
  646.  
  647.  
  648. //----------------------------------------------------------------------------
  649. // D3DX10SaveTextureToFile:
  650. // ----------------------
  651. // Save a texture to a file.
  652. //
  653. // Parameters:
  654. //  pDestFile
  655. //      File name of the destination file
  656. //  DestFormat
  657. //      D3DX10_IMAGE_FILE_FORMAT specifying file format to use when saving.
  658. //  pSrcTexture
  659. //      Source texture, containing the image to be saved
  660. //
  661. //----------------------------------------------------------------------------
  662.  
  663. HRESULT WINAPI
  664.     D3DX10SaveTextureToFileA(
  665.         ID3D10Resource            *pSrcTexture,
  666.         D3DX10_IMAGE_FILE_FORMAT    DestFormat,
  667.         LPCSTR                    pDestFile);
  668.  
  669. HRESULT WINAPI
  670.     D3DX10SaveTextureToFileW(
  671.         ID3D10Resource            *pSrcTexture,
  672.         D3DX10_IMAGE_FILE_FORMAT    DestFormat,
  673.         LPCWSTR                   pDestFile);
  674.  
  675. #ifdef UNICODE
  676. #define D3DX10SaveTextureToFile D3DX10SaveTextureToFileW
  677. #else
  678. #define D3DX10SaveTextureToFile D3DX10SaveTextureToFileA
  679. #endif
  680.  
  681.  
  682. //----------------------------------------------------------------------------
  683. // D3DX10SaveTextureToMemory:
  684. // ----------------------
  685. // Save a texture to a blob.
  686. //
  687. // Parameters:
  688. //  pSrcTexture
  689. //      Source texture, containing the image to be saved
  690. //  DestFormat
  691. //      D3DX10_IMAGE_FILE_FORMAT specifying file format to use when saving.
  692. //  ppDestBuf
  693. //      address of a d3dxbuffer pointer to return the image data
  694. //  Flags
  695. //      optional flags
  696. //----------------------------------------------------------------------------
  697.  
  698. HRESULT WINAPI
  699.     D3DX10SaveTextureToMemory(
  700.         ID3D10Resource*            pSrcTexture,
  701.         D3DX10_IMAGE_FILE_FORMAT   DestFormat,
  702.         LPD3D10BLOB*               ppDestBuf,
  703.         UINT                       Flags);
  704.  
  705.  
  706. //----------------------------------------------------------------------------
  707. // D3DX10ComputeNormalMap:
  708. // ---------------------
  709. // Converts a height map into a normal map.  The (x,y,z) components of each
  710. // normal are mapped to the (r,g,b) channels of the output texture.
  711. //
  712. // Parameters
  713. //  pSrcTexture
  714. //      Pointer to the source heightmap texture
  715. //  Flags
  716. //      D3DX10_NORMALMAP flags
  717. //  Channel
  718. //      D3DX10_CHANNEL specifying source of height information
  719. //  Amplitude
  720. //      The constant value which the height information is multiplied by.
  721. //  pDestTexture
  722. //      Pointer to the destination texture
  723. //---------------------------------------------------------------------------
  724.  
  725. HRESULT WINAPI
  726.     D3DX10ComputeNormalMap(
  727.         ID3D10Texture2D              *pSrcTexture,
  728.         UINT                      Flags,
  729.         UINT                      Channel,
  730.         FLOAT                     Amplitude,
  731.         ID3D10Texture2D              *pDestTexture);
  732.  
  733.  
  734. //----------------------------------------------------------------------------
  735. // D3DX10SHProjectCubeMap:
  736. // ----------------------
  737. //  Projects a function represented in a cube map into spherical harmonics.
  738. //
  739. //  Parameters:
  740. //   Order
  741. //      Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
  742. //   pCubeMap
  743. //      CubeMap that is going to be projected into spherical harmonics
  744. //   pROut
  745. //      Output SH vector for Red.
  746. //   pGOut
  747. //      Output SH vector for Green
  748. //   pBOut
  749. //      Output SH vector for Blue        
  750. //
  751. //---------------------------------------------------------------------------
  752.  
  753. HRESULT WINAPI
  754.     D3DX10SHProjectCubeMap(
  755.         __in_range(2,6) UINT                                Order,
  756.         ID3D10Texture2D                                    *pCubeMap,
  757.         __out_ecount(Order*Order) FLOAT                    *pROut,
  758.         __out_ecount_opt(Order*Order) FLOAT                *pGOut,
  759.         __out_ecount_opt(Order*Order) FLOAT                *pBOut);
  760.  
  761. #ifdef __cplusplus
  762. }
  763. #endif //__cplusplus
  764.  
  765. #endif //__D3DX10TEX_H__
  766.  
  767.