D3DX10tex.h 25 KB

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