Counter Strike : Global Offensive Source Code
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.

1592 lines
53 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (C) Microsoft Corporation. All Rights Reserved.
  4. //
  5. // File: d3dx8tex.h
  6. // Content: D3DX texturing APIs
  7. //
  8. //////////////////////////////////////////////////////////////////////////////
  9. #include "d3dx8.h"
  10. #ifndef __D3DX8TEX_H__
  11. #define __D3DX8TEX_H__
  12. //----------------------------------------------------------------------------
  13. // D3DX_FILTER flags:
  14. // ------------------
  15. //
  16. // A valid filter must contain one of these values:
  17. //
  18. // D3DX_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. // D3DX_FILTER_POINT
  22. // Each destination pixel is computed by sampling the nearest pixel
  23. // from the source image.
  24. // D3DX_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. // D3DX_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. // D3DX_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. // D3DX_FILTER_MIRROR_U
  39. // Indicates that pixels off the edge of the texture on the U-axis
  40. // should be mirrored, not wraped.
  41. // D3DX_FILTER_MIRROR_V
  42. // Indicates that pixels off the edge of the texture on the V-axis
  43. // should be mirrored, not wraped.
  44. // D3DX_FILTER_MIRROR_W
  45. // Indicates that pixels off the edge of the texture on the W-axis
  46. // should be mirrored, not wraped.
  47. // D3DX_FILTER_MIRROR
  48. // Same as specifying D3DX_FILTER_MIRROR_U | D3DX_FILTER_MIRROR_V |
  49. // D3DX_FILTER_MIRROR_V
  50. // D3DX_FILTER_DITHER
  51. // Dithers the resulting image.
  52. //
  53. //----------------------------------------------------------------------------
  54. #define D3DX_FILTER_NONE (1 << 0)
  55. #define D3DX_FILTER_POINT (2 << 0)
  56. #define D3DX_FILTER_LINEAR (3 << 0)
  57. #define D3DX_FILTER_TRIANGLE (4 << 0)
  58. #define D3DX_FILTER_BOX (5 << 0)
  59. #define D3DX_FILTER_MIRROR_U (1 << 16)
  60. #define D3DX_FILTER_MIRROR_V (2 << 16)
  61. #define D3DX_FILTER_MIRROR_W (4 << 16)
  62. #define D3DX_FILTER_MIRROR (7 << 16)
  63. #define D3DX_FILTER_DITHER (8 << 16)
  64. //----------------------------------------------------------------------------
  65. // D3DX_NORMALMAP flags:
  66. // ---------------------
  67. // These flags are used to control how D3DXComputeNormalMap generates normal
  68. // maps. Any number of these flags may be OR'd together in any combination.
  69. //
  70. // D3DX_NORMALMAP_MIRROR_U
  71. // Indicates that pixels off the edge of the texture on the U-axis
  72. // should be mirrored, not wraped.
  73. // D3DX_NORMALMAP_MIRROR_V
  74. // Indicates that pixels off the edge of the texture on the V-axis
  75. // should be mirrored, not wraped.
  76. // D3DX_NORMALMAP_MIRROR
  77. // Same as specifying D3DX_NORMALMAP_MIRROR_U | D3DX_NORMALMAP_MIRROR_V
  78. // D3DX_NORMALMAP_INVERTSIGN
  79. // Inverts the direction of each normal
  80. // D3DX_NORMALMAP_COMPUTE_OCCLUSION
  81. // Compute the per pixel Occlusion term and encodes it into the alpha.
  82. // An Alpha of 1 means that the pixel is not obscured in anyway, and
  83. // an alpha of 0 would mean that the pixel is completly obscured.
  84. //
  85. //----------------------------------------------------------------------------
  86. //----------------------------------------------------------------------------
  87. #define D3DX_NORMALMAP_MIRROR_U (1 << 16)
  88. #define D3DX_NORMALMAP_MIRROR_V (2 << 16)
  89. #define D3DX_NORMALMAP_MIRROR (3 << 16)
  90. #define D3DX_NORMALMAP_INVERTSIGN (8 << 16)
  91. #define D3DX_NORMALMAP_COMPUTE_OCCLUSION (16 << 16)
  92. //----------------------------------------------------------------------------
  93. // D3DX_CHANNEL flags:
  94. // -------------------
  95. // These flags are used by functions which operate on or more channels
  96. // in a texture.
  97. //
  98. // D3DX_CHANNEL_RED
  99. // Indicates the red channel should be used
  100. // D3DX_CHANNEL_BLUE
  101. // Indicates the blue channel should be used
  102. // D3DX_CHANNEL_GREEN
  103. // Indicates the green channel should be used
  104. // D3DX_CHANNEL_ALPHA
  105. // Indicates the alpha channel should be used
  106. // D3DX_CHANNEL_LUMINANCE
  107. // Indicates the luminaces of the red green and blue channels should be
  108. // used.
  109. //
  110. //----------------------------------------------------------------------------
  111. #define D3DX_CHANNEL_RED (1 << 0)
  112. #define D3DX_CHANNEL_BLUE (1 << 1)
  113. #define D3DX_CHANNEL_GREEN (1 << 2)
  114. #define D3DX_CHANNEL_ALPHA (1 << 3)
  115. #define D3DX_CHANNEL_LUMINANCE (1 << 4)
  116. //----------------------------------------------------------------------------
  117. // D3DXIMAGE_FILEFORMAT:
  118. // ---------------------
  119. // This enum is used to describe supported image file formats.
  120. //
  121. //----------------------------------------------------------------------------
  122. typedef enum _D3DXIMAGE_FILEFORMAT
  123. {
  124. D3DXIFF_BMP = 0,
  125. D3DXIFF_JPG = 1,
  126. D3DXIFF_TGA = 2,
  127. D3DXIFF_PNG = 3,
  128. D3DXIFF_DDS = 4,
  129. D3DXIFF_PPM = 5,
  130. D3DXIFF_DIB = 6,
  131. D3DXIFF_FORCE_DWORD = 0x7fffffff
  132. } D3DXIMAGE_FILEFORMAT;
  133. //----------------------------------------------------------------------------
  134. // LPD3DXFILL2D and LPD3DXFILL3D:
  135. // ------------------------------
  136. // Function types used by the texture fill functions.
  137. //
  138. // Parameters:
  139. // pOut
  140. // Pointer to a vector which the function uses to return its result.
  141. // X,Y,Z,W will be mapped to R,G,B,A respectivly.
  142. // pTexCoord
  143. // Pointer to a vector containing the coordinates of the texel currently
  144. // being evaluated. Textures and VolumeTexture texcoord components
  145. // range from 0 to 1. CubeTexture texcoord component range from -1 to 1.
  146. // pTexelSize
  147. // Pointer to a vector containing the dimensions of the current texel.
  148. // pData
  149. // Pointer to user data.
  150. //
  151. //----------------------------------------------------------------------------
  152. typedef VOID (*LPD3DXFILL2D)(D3DXVECTOR4 *pOut, D3DXVECTOR2 *pTexCoord, D3DXVECTOR2 *pTexelSize, LPVOID pData);
  153. typedef VOID (*LPD3DXFILL3D)(D3DXVECTOR4 *pOut, D3DXVECTOR3 *pTexCoord, D3DXVECTOR3 *pTexelSize, LPVOID pData);
  154. //----------------------------------------------------------------------------
  155. // D3DXIMAGE_INFO:
  156. // ---------------
  157. // This structure is used to return a rough description of what the
  158. // the original contents of an image file looked like.
  159. //
  160. // Width
  161. // Width of original image in pixels
  162. // Height
  163. // Height of original image in pixels
  164. // Depth
  165. // Depth of original image in pixels
  166. // MipLevels
  167. // Number of mip levels in original image
  168. // Format
  169. // D3D format which most closely describes the data in original image
  170. // ResourceType
  171. // D3DRESOURCETYPE representing the type of texture stored in the file.
  172. // D3DRTYPE_TEXTURE, D3DRTYPE_VOLUMETEXTURE, or D3DRTYPE_CUBETEXTURE.
  173. // ImageFileFormat
  174. // D3DXIMAGE_FILEFORMAT representing the format of the image file.
  175. //
  176. //----------------------------------------------------------------------------
  177. typedef struct _D3DXIMAGE_INFO
  178. {
  179. UINT Width;
  180. UINT Height;
  181. UINT Depth;
  182. UINT MipLevels;
  183. D3DFORMAT Format;
  184. D3DRESOURCETYPE ResourceType;
  185. D3DXIMAGE_FILEFORMAT ImageFileFormat;
  186. } D3DXIMAGE_INFO;
  187. #ifdef __cplusplus
  188. extern "C" {
  189. #endif //__cplusplus
  190. //////////////////////////////////////////////////////////////////////////////
  191. // Image File APIs ///////////////////////////////////////////////////////////
  192. //////////////////////////////////////////////////////////////////////////////
  193. ;
  194. //----------------------------------------------------------------------------
  195. // GetImageInfoFromFile/Resource:
  196. // ------------------------------
  197. // Fills in a D3DXIMAGE_INFO struct with information about an image file.
  198. //
  199. // Parameters:
  200. // pSrcFile
  201. // File name of the source image.
  202. // pSrcModule
  203. // Module where resource is located, or NULL for module associated
  204. // with image the os used to create the current process.
  205. // pSrcResource
  206. // Resource name
  207. // pSrcData
  208. // Pointer to file in memory.
  209. // SrcDataSize
  210. // Size in bytes of file in memory.
  211. // pSrcInfo
  212. // Pointer to a D3DXIMAGE_INFO structure to be filled in with the
  213. // description of the data in the source image file.
  214. //
  215. //----------------------------------------------------------------------------
  216. HRESULT WINAPI
  217. D3DXGetImageInfoFromFileA(
  218. LPCSTR pSrcFile,
  219. D3DXIMAGE_INFO* pSrcInfo);
  220. HRESULT WINAPI
  221. D3DXGetImageInfoFromFileW(
  222. LPCWSTR pSrcFile,
  223. D3DXIMAGE_INFO* pSrcInfo);
  224. #ifdef UNICODE
  225. #define D3DXGetImageInfoFromFile D3DXGetImageInfoFromFileW
  226. #else
  227. #define D3DXGetImageInfoFromFile D3DXGetImageInfoFromFileA
  228. #endif
  229. HRESULT WINAPI
  230. D3DXGetImageInfoFromResourceA(
  231. HMODULE hSrcModule,
  232. LPCSTR pSrcResource,
  233. D3DXIMAGE_INFO* pSrcInfo);
  234. HRESULT WINAPI
  235. D3DXGetImageInfoFromResourceW(
  236. HMODULE hSrcModule,
  237. LPCWSTR pSrcResource,
  238. D3DXIMAGE_INFO* pSrcInfo);
  239. #ifdef UNICODE
  240. #define D3DXGetImageInfoFromResource D3DXGetImageInfoFromResourceW
  241. #else
  242. #define D3DXGetImageInfoFromResource D3DXGetImageInfoFromResourceA
  243. #endif
  244. HRESULT WINAPI
  245. D3DXGetImageInfoFromFileInMemory(
  246. LPCVOID pSrcData,
  247. UINT SrcDataSize,
  248. D3DXIMAGE_INFO* pSrcInfo);
  249. //////////////////////////////////////////////////////////////////////////////
  250. // Load/Save Surface APIs ////////////////////////////////////////////////////
  251. //////////////////////////////////////////////////////////////////////////////
  252. //----------------------------------------------------------------------------
  253. // D3DXLoadSurfaceFromFile/Resource:
  254. // ---------------------------------
  255. // Load surface from a file or resource
  256. //
  257. // Parameters:
  258. // pDestSurface
  259. // Destination surface, which will receive the image.
  260. // pDestPalette
  261. // Destination palette of 256 colors, or NULL
  262. // pDestRect
  263. // Destination rectangle, or NULL for entire surface
  264. // pSrcFile
  265. // File name of the source image.
  266. // pSrcModule
  267. // Module where resource is located, or NULL for module associated
  268. // with image the os used to create the current process.
  269. // pSrcResource
  270. // Resource name
  271. // pSrcData
  272. // Pointer to file in memory.
  273. // SrcDataSize
  274. // Size in bytes of file in memory.
  275. // pSrcRect
  276. // Source rectangle, or NULL for entire image
  277. // Filter
  278. // D3DX_FILTER flags controlling how the image is filtered.
  279. // Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  280. // ColorKey
  281. // Color to replace with transparent black, or 0 to disable colorkey.
  282. // This is always a 32-bit ARGB color, independent of the source image
  283. // format. Alpha is significant, and should usually be set to FF for
  284. // opaque colorkeys. (ex. Opaque black == 0xff000000)
  285. // pSrcInfo
  286. // Pointer to a D3DXIMAGE_INFO structure to be filled in with the
  287. // description of the data in the source image file, or NULL.
  288. //
  289. //----------------------------------------------------------------------------
  290. HRESULT WINAPI
  291. D3DXLoadSurfaceFromFileA(
  292. LPDIRECT3DSURFACE8 pDestSurface,
  293. CONST PALETTEENTRY* pDestPalette,
  294. CONST RECT* pDestRect,
  295. LPCSTR pSrcFile,
  296. CONST RECT* pSrcRect,
  297. DWORD Filter,
  298. D3DCOLOR ColorKey,
  299. D3DXIMAGE_INFO* pSrcInfo);
  300. HRESULT WINAPI
  301. D3DXLoadSurfaceFromFileW(
  302. LPDIRECT3DSURFACE8 pDestSurface,
  303. CONST PALETTEENTRY* pDestPalette,
  304. CONST RECT* pDestRect,
  305. LPCWSTR pSrcFile,
  306. CONST RECT* pSrcRect,
  307. DWORD Filter,
  308. D3DCOLOR ColorKey,
  309. D3DXIMAGE_INFO* pSrcInfo);
  310. #ifdef UNICODE
  311. #define D3DXLoadSurfaceFromFile D3DXLoadSurfaceFromFileW
  312. #else
  313. #define D3DXLoadSurfaceFromFile D3DXLoadSurfaceFromFileA
  314. #endif
  315. HRESULT WINAPI
  316. D3DXLoadSurfaceFromResourceA(
  317. LPDIRECT3DSURFACE8 pDestSurface,
  318. CONST PALETTEENTRY* pDestPalette,
  319. CONST RECT* pDestRect,
  320. HMODULE hSrcModule,
  321. LPCSTR pSrcResource,
  322. CONST RECT* pSrcRect,
  323. DWORD Filter,
  324. D3DCOLOR ColorKey,
  325. D3DXIMAGE_INFO* pSrcInfo);
  326. HRESULT WINAPI
  327. D3DXLoadSurfaceFromResourceW(
  328. LPDIRECT3DSURFACE8 pDestSurface,
  329. CONST PALETTEENTRY* pDestPalette,
  330. CONST RECT* pDestRect,
  331. HMODULE hSrcModule,
  332. LPCWSTR pSrcResource,
  333. CONST RECT* pSrcRect,
  334. DWORD Filter,
  335. D3DCOLOR ColorKey,
  336. D3DXIMAGE_INFO* pSrcInfo);
  337. #ifdef UNICODE
  338. #define D3DXLoadSurfaceFromResource D3DXLoadSurfaceFromResourceW
  339. #else
  340. #define D3DXLoadSurfaceFromResource D3DXLoadSurfaceFromResourceA
  341. #endif
  342. HRESULT WINAPI
  343. D3DXLoadSurfaceFromFileInMemory(
  344. LPDIRECT3DSURFACE8 pDestSurface,
  345. CONST PALETTEENTRY* pDestPalette,
  346. CONST RECT* pDestRect,
  347. LPCVOID pSrcData,
  348. UINT SrcDataSize,
  349. CONST RECT* pSrcRect,
  350. DWORD Filter,
  351. D3DCOLOR ColorKey,
  352. D3DXIMAGE_INFO* pSrcInfo);
  353. //----------------------------------------------------------------------------
  354. // D3DXLoadSurfaceFromSurface:
  355. // ---------------------------
  356. // Load surface from another surface (with color conversion)
  357. //
  358. // Parameters:
  359. // pDestSurface
  360. // Destination surface, which will receive the image.
  361. // pDestPalette
  362. // Destination palette of 256 colors, or NULL
  363. // pDestRect
  364. // Destination rectangle, or NULL for entire surface
  365. // pSrcSurface
  366. // Source surface
  367. // pSrcPalette
  368. // Source palette of 256 colors, or NULL
  369. // pSrcRect
  370. // Source rectangle, or NULL for entire surface
  371. // Filter
  372. // D3DX_FILTER flags controlling how the image is filtered.
  373. // Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  374. // ColorKey
  375. // Color to replace with transparent black, or 0 to disable colorkey.
  376. // This is always a 32-bit ARGB color, independent of the source image
  377. // format. Alpha is significant, and should usually be set to FF for
  378. // opaque colorkeys. (ex. Opaque black == 0xff000000)
  379. //
  380. //----------------------------------------------------------------------------
  381. HRESULT WINAPI
  382. D3DXLoadSurfaceFromSurface(
  383. LPDIRECT3DSURFACE8 pDestSurface,
  384. CONST PALETTEENTRY* pDestPalette,
  385. CONST RECT* pDestRect,
  386. LPDIRECT3DSURFACE8 pSrcSurface,
  387. CONST PALETTEENTRY* pSrcPalette,
  388. CONST RECT* pSrcRect,
  389. DWORD Filter,
  390. D3DCOLOR ColorKey);
  391. //----------------------------------------------------------------------------
  392. // D3DXLoadSurfaceFromMemory:
  393. // --------------------------
  394. // Load surface from memory.
  395. //
  396. // Parameters:
  397. // pDestSurface
  398. // Destination surface, which will receive the image.
  399. // pDestPalette
  400. // Destination palette of 256 colors, or NULL
  401. // pDestRect
  402. // Destination rectangle, or NULL for entire surface
  403. // pSrcMemory
  404. // Pointer to the top-left corner of the source image in memory
  405. // SrcFormat
  406. // Pixel format of the source image.
  407. // SrcPitch
  408. // Pitch of source image, in bytes. For DXT formats, this number
  409. // should represent the width of one row of cells, in bytes.
  410. // pSrcPalette
  411. // Source palette of 256 colors, or NULL
  412. // pSrcRect
  413. // Source rectangle.
  414. // Filter
  415. // D3DX_FILTER flags controlling how the image is filtered.
  416. // Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  417. // ColorKey
  418. // Color to replace with transparent black, or 0 to disable colorkey.
  419. // This is always a 32-bit ARGB color, independent of the source image
  420. // format. Alpha is significant, and should usually be set to FF for
  421. // opaque colorkeys. (ex. Opaque black == 0xff000000)
  422. //
  423. //----------------------------------------------------------------------------
  424. HRESULT WINAPI
  425. D3DXLoadSurfaceFromMemory(
  426. LPDIRECT3DSURFACE8 pDestSurface,
  427. CONST PALETTEENTRY* pDestPalette,
  428. CONST RECT* pDestRect,
  429. LPCVOID pSrcMemory,
  430. D3DFORMAT SrcFormat,
  431. UINT SrcPitch,
  432. CONST PALETTEENTRY* pSrcPalette,
  433. CONST RECT* pSrcRect,
  434. DWORD Filter,
  435. D3DCOLOR ColorKey);
  436. //----------------------------------------------------------------------------
  437. // D3DXSaveSurfaceToFile:
  438. // ----------------------
  439. // Save a surface to a image file.
  440. //
  441. // Parameters:
  442. // pDestFile
  443. // File name of the destination file
  444. // DestFormat
  445. // D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
  446. // pSrcSurface
  447. // Source surface, containing the image to be saved
  448. // pSrcPalette
  449. // Source palette of 256 colors, or NULL
  450. // pSrcRect
  451. // Source rectangle, or NULL for the entire image
  452. //
  453. //----------------------------------------------------------------------------
  454. HRESULT WINAPI
  455. D3DXSaveSurfaceToFileA(
  456. LPCSTR pDestFile,
  457. D3DXIMAGE_FILEFORMAT DestFormat,
  458. LPDIRECT3DSURFACE8 pSrcSurface,
  459. CONST PALETTEENTRY* pSrcPalette,
  460. CONST RECT* pSrcRect);
  461. HRESULT WINAPI
  462. D3DXSaveSurfaceToFileW(
  463. LPCWSTR pDestFile,
  464. D3DXIMAGE_FILEFORMAT DestFormat,
  465. LPDIRECT3DSURFACE8 pSrcSurface,
  466. CONST PALETTEENTRY* pSrcPalette,
  467. CONST RECT* pSrcRect);
  468. #ifdef UNICODE
  469. #define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileW
  470. #else
  471. #define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileA
  472. #endif
  473. //////////////////////////////////////////////////////////////////////////////
  474. // Load/Save Volume APIs /////////////////////////////////////////////////////
  475. //////////////////////////////////////////////////////////////////////////////
  476. //----------------------------------------------------------------------------
  477. // D3DXLoadVolumeFromFile/Resource:
  478. // --------------------------------
  479. // Load volume from a file or resource
  480. //
  481. // Parameters:
  482. // pDestVolume
  483. // Destination volume, which will receive the image.
  484. // pDestPalette
  485. // Destination palette of 256 colors, or NULL
  486. // pDestBox
  487. // Destination box, or NULL for entire volume
  488. // pSrcFile
  489. // File name of the source image.
  490. // pSrcModule
  491. // Module where resource is located, or NULL for module associated
  492. // with image the os used to create the current process.
  493. // pSrcResource
  494. // Resource name
  495. // pSrcData
  496. // Pointer to file in memory.
  497. // SrcDataSize
  498. // Size in bytes of file in memory.
  499. // pSrcBox
  500. // Source box, or NULL for entire image
  501. // Filter
  502. // D3DX_FILTER flags controlling how the image is filtered.
  503. // Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  504. // ColorKey
  505. // Color to replace with transparent black, or 0 to disable colorkey.
  506. // This is always a 32-bit ARGB color, independent of the source image
  507. // format. Alpha is significant, and should usually be set to FF for
  508. // opaque colorkeys. (ex. Opaque black == 0xff000000)
  509. // pSrcInfo
  510. // Pointer to a D3DXIMAGE_INFO structure to be filled in with the
  511. // description of the data in the source image file, or NULL.
  512. //
  513. //----------------------------------------------------------------------------
  514. HRESULT WINAPI
  515. D3DXLoadVolumeFromFileA(
  516. LPDIRECT3DVOLUME8 pDestVolume,
  517. CONST PALETTEENTRY* pDestPalette,
  518. CONST D3DBOX* pDestBox,
  519. LPCSTR pSrcFile,
  520. CONST D3DBOX* pSrcBox,
  521. DWORD Filter,
  522. D3DCOLOR ColorKey,
  523. D3DXIMAGE_INFO* pSrcInfo);
  524. HRESULT WINAPI
  525. D3DXLoadVolumeFromFileW(
  526. LPDIRECT3DVOLUME8 pDestVolume,
  527. CONST PALETTEENTRY* pDestPalette,
  528. CONST D3DBOX* pDestBox,
  529. LPCWSTR pSrcFile,
  530. CONST D3DBOX* pSrcBox,
  531. DWORD Filter,
  532. D3DCOLOR ColorKey,
  533. D3DXIMAGE_INFO* pSrcInfo);
  534. #ifdef UNICODE
  535. #define D3DXLoadVolumeFromFile D3DXLoadVolumeFromFileW
  536. #else
  537. #define D3DXLoadVolumeFromFile D3DXLoadVolumeFromFileA
  538. #endif
  539. HRESULT WINAPI
  540. D3DXLoadVolumeFromResourceA(
  541. LPDIRECT3DVOLUME8 pDestVolume,
  542. CONST PALETTEENTRY* pDestPalette,
  543. CONST D3DBOX* pDestBox,
  544. HMODULE hSrcModule,
  545. LPCSTR pSrcResource,
  546. CONST D3DBOX* pSrcBox,
  547. DWORD Filter,
  548. D3DCOLOR ColorKey,
  549. D3DXIMAGE_INFO* pSrcInfo);
  550. HRESULT WINAPI
  551. D3DXLoadVolumeFromResourceW(
  552. LPDIRECT3DVOLUME8 pDestVolume,
  553. CONST PALETTEENTRY* pDestPalette,
  554. CONST D3DBOX* pDestBox,
  555. HMODULE hSrcModule,
  556. LPCWSTR pSrcResource,
  557. CONST D3DBOX* pSrcBox,
  558. DWORD Filter,
  559. D3DCOLOR ColorKey,
  560. D3DXIMAGE_INFO* pSrcInfo);
  561. #ifdef UNICODE
  562. #define D3DXLoadVolumeFromResource D3DXLoadVolumeFromResourceW
  563. #else
  564. #define D3DXLoadVolumeFromResource D3DXLoadVolumeFromResourceA
  565. #endif
  566. HRESULT WINAPI
  567. D3DXLoadVolumeFromFileInMemory(
  568. LPDIRECT3DVOLUME8 pDestVolume,
  569. CONST PALETTEENTRY* pDestPalette,
  570. CONST D3DBOX* pDestBox,
  571. LPCVOID pSrcData,
  572. UINT SrcDataSize,
  573. CONST D3DBOX* pSrcBox,
  574. DWORD Filter,
  575. D3DCOLOR ColorKey,
  576. D3DXIMAGE_INFO* pSrcInfo);
  577. //----------------------------------------------------------------------------
  578. // D3DXLoadVolumeFromVolume:
  579. // -------------------------
  580. // Load volume from another volume (with color conversion)
  581. //
  582. // Parameters:
  583. // pDestVolume
  584. // Destination volume, which will receive the image.
  585. // pDestPalette
  586. // Destination palette of 256 colors, or NULL
  587. // pDestBox
  588. // Destination box, or NULL for entire volume
  589. // pSrcVolume
  590. // Source volume
  591. // pSrcPalette
  592. // Source palette of 256 colors, or NULL
  593. // pSrcBox
  594. // Source box, or NULL for entire volume
  595. // Filter
  596. // D3DX_FILTER flags controlling how the image is filtered.
  597. // Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  598. // ColorKey
  599. // Color to replace with transparent black, or 0 to disable colorkey.
  600. // This is always a 32-bit ARGB color, independent of the source image
  601. // format. Alpha is significant, and should usually be set to FF for
  602. // opaque colorkeys. (ex. Opaque black == 0xff000000)
  603. //
  604. //----------------------------------------------------------------------------
  605. HRESULT WINAPI
  606. D3DXLoadVolumeFromVolume(
  607. LPDIRECT3DVOLUME8 pDestVolume,
  608. CONST PALETTEENTRY* pDestPalette,
  609. CONST D3DBOX* pDestBox,
  610. LPDIRECT3DVOLUME8 pSrcVolume,
  611. CONST PALETTEENTRY* pSrcPalette,
  612. CONST D3DBOX* pSrcBox,
  613. DWORD Filter,
  614. D3DCOLOR ColorKey);
  615. //----------------------------------------------------------------------------
  616. // D3DXLoadVolumeFromMemory:
  617. // -------------------------
  618. // Load volume from memory.
  619. //
  620. // Parameters:
  621. // pDestVolume
  622. // Destination volume, which will receive the image.
  623. // pDestPalette
  624. // Destination palette of 256 colors, or NULL
  625. // pDestBox
  626. // Destination box, or NULL for entire volume
  627. // pSrcMemory
  628. // Pointer to the top-left corner of the source volume in memory
  629. // SrcFormat
  630. // Pixel format of the source volume.
  631. // SrcRowPitch
  632. // Pitch of source image, in bytes. For DXT formats, this number
  633. // should represent the size of one row of cells, in bytes.
  634. // SrcSlicePitch
  635. // Pitch of source image, in bytes. For DXT formats, this number
  636. // should represent the size of one slice of cells, in bytes.
  637. // pSrcPalette
  638. // Source palette of 256 colors, or NULL
  639. // pSrcBox
  640. // Source box.
  641. // Filter
  642. // D3DX_FILTER flags controlling how the image is filtered.
  643. // Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  644. // ColorKey
  645. // Color to replace with transparent black, or 0 to disable colorkey.
  646. // This is always a 32-bit ARGB color, independent of the source image
  647. // format. Alpha is significant, and should usually be set to FF for
  648. // opaque colorkeys. (ex. Opaque black == 0xff000000)
  649. //
  650. //----------------------------------------------------------------------------
  651. HRESULT WINAPI
  652. D3DXLoadVolumeFromMemory(
  653. LPDIRECT3DVOLUME8 pDestVolume,
  654. CONST PALETTEENTRY* pDestPalette,
  655. CONST D3DBOX* pDestBox,
  656. LPCVOID pSrcMemory,
  657. D3DFORMAT SrcFormat,
  658. UINT SrcRowPitch,
  659. UINT SrcSlicePitch,
  660. CONST PALETTEENTRY* pSrcPalette,
  661. CONST D3DBOX* pSrcBox,
  662. DWORD Filter,
  663. D3DCOLOR ColorKey);
  664. //----------------------------------------------------------------------------
  665. // D3DXSaveVolumeToFile:
  666. // ---------------------
  667. // Save a volume to a image file.
  668. //
  669. // Parameters:
  670. // pDestFile
  671. // File name of the destination file
  672. // DestFormat
  673. // D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
  674. // pSrcVolume
  675. // Source volume, containing the image to be saved
  676. // pSrcPalette
  677. // Source palette of 256 colors, or NULL
  678. // pSrcBox
  679. // Source box, or NULL for the entire volume
  680. //
  681. //----------------------------------------------------------------------------
  682. HRESULT WINAPI
  683. D3DXSaveVolumeToFileA(
  684. LPCSTR pDestFile,
  685. D3DXIMAGE_FILEFORMAT DestFormat,
  686. LPDIRECT3DVOLUME8 pSrcVolume,
  687. CONST PALETTEENTRY* pSrcPalette,
  688. CONST D3DBOX* pSrcBox);
  689. HRESULT WINAPI
  690. D3DXSaveVolumeToFileW(
  691. LPCWSTR pDestFile,
  692. D3DXIMAGE_FILEFORMAT DestFormat,
  693. LPDIRECT3DVOLUME8 pSrcVolume,
  694. CONST PALETTEENTRY* pSrcPalette,
  695. CONST D3DBOX* pSrcBox);
  696. #ifdef UNICODE
  697. #define D3DXSaveVolumeToFile D3DXSaveVolumeToFileW
  698. #else
  699. #define D3DXSaveVolumeToFile D3DXSaveVolumeToFileA
  700. #endif
  701. //////////////////////////////////////////////////////////////////////////////
  702. // Create/Save Texture APIs //////////////////////////////////////////////////
  703. //////////////////////////////////////////////////////////////////////////////
  704. //----------------------------------------------------------------------------
  705. // D3DXCheckTextureRequirements:
  706. // -----------------------------
  707. // Checks texture creation parameters. If parameters are invalid, this
  708. // function returns corrected parameters.
  709. //
  710. // Parameters:
  711. //
  712. // pDevice
  713. // The D3D device to be used
  714. // pWidth, pHeight, pDepth, pSize
  715. // Desired size in pixels, or NULL. Returns corrected size.
  716. // pNumMipLevels
  717. // Number of desired mipmap levels, or NULL. Returns corrected number.
  718. // Usage
  719. // Texture usage flags
  720. // pFormat
  721. // Desired pixel format, or NULL. Returns corrected format.
  722. // Pool
  723. // Memory pool to be used to create texture
  724. //
  725. //----------------------------------------------------------------------------
  726. HRESULT WINAPI
  727. D3DXCheckTextureRequirements(
  728. LPDIRECT3DDEVICE8 pDevice,
  729. UINT* pWidth,
  730. UINT* pHeight,
  731. UINT* pNumMipLevels,
  732. DWORD Usage,
  733. D3DFORMAT* pFormat,
  734. D3DPOOL Pool);
  735. HRESULT WINAPI
  736. D3DXCheckCubeTextureRequirements(
  737. LPDIRECT3DDEVICE8 pDevice,
  738. UINT* pSize,
  739. UINT* pNumMipLevels,
  740. DWORD Usage,
  741. D3DFORMAT* pFormat,
  742. D3DPOOL Pool);
  743. HRESULT WINAPI
  744. D3DXCheckVolumeTextureRequirements(
  745. LPDIRECT3DDEVICE8 pDevice,
  746. UINT* pWidth,
  747. UINT* pHeight,
  748. UINT* pDepth,
  749. UINT* pNumMipLevels,
  750. DWORD Usage,
  751. D3DFORMAT* pFormat,
  752. D3DPOOL Pool);
  753. //----------------------------------------------------------------------------
  754. // D3DXCreateTexture:
  755. // ------------------
  756. // Create an empty texture
  757. //
  758. // Parameters:
  759. //
  760. // pDevice
  761. // The D3D device with which the texture is going to be used.
  762. // Width, Height, Depth, Size
  763. // size in pixels; these must be non-zero
  764. // MipLevels
  765. // number of mip levels desired; if zero or D3DX_DEFAULT, a complete
  766. // mipmap chain will be created.
  767. // Usage
  768. // Texture usage flags
  769. // Format
  770. // Pixel format.
  771. // Pool
  772. // Memory pool to be used to create texture
  773. // ppTexture, ppCubeTexture, ppVolumeTexture
  774. // The texture object that will be created
  775. //
  776. //----------------------------------------------------------------------------
  777. HRESULT WINAPI
  778. D3DXCreateTexture(
  779. LPDIRECT3DDEVICE8 pDevice,
  780. UINT Width,
  781. UINT Height,
  782. UINT MipLevels,
  783. DWORD Usage,
  784. D3DFORMAT Format,
  785. D3DPOOL Pool,
  786. LPDIRECT3DTEXTURE8* ppTexture);
  787. HRESULT WINAPI
  788. D3DXCreateCubeTexture(
  789. LPDIRECT3DDEVICE8 pDevice,
  790. UINT Size,
  791. UINT MipLevels,
  792. DWORD Usage,
  793. D3DFORMAT Format,
  794. D3DPOOL Pool,
  795. LPDIRECT3DCUBETEXTURE8* ppCubeTexture);
  796. HRESULT WINAPI
  797. D3DXCreateVolumeTexture(
  798. LPDIRECT3DDEVICE8 pDevice,
  799. UINT Width,
  800. UINT Height,
  801. UINT Depth,
  802. UINT MipLevels,
  803. DWORD Usage,
  804. D3DFORMAT Format,
  805. D3DPOOL Pool,
  806. LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  807. //----------------------------------------------------------------------------
  808. // D3DXCreateTextureFromFile/Resource:
  809. // -----------------------------------
  810. // Create a texture object from a file or resource.
  811. //
  812. // Parameters:
  813. //
  814. // pDevice
  815. // The D3D device with which the texture is going to be used.
  816. // pSrcFile
  817. // File name.
  818. // hSrcModule
  819. // Module handle. if NULL, current module will be used.
  820. // pSrcResource
  821. // Resource name in module
  822. // pvSrcData
  823. // Pointer to file in memory.
  824. // SrcDataSize
  825. // Size in bytes of file in memory.
  826. // Width, Height, Depth, Size
  827. // Size in pixels; if zero or D3DX_DEFAULT, the size will be taken
  828. // from the file.
  829. // MipLevels
  830. // Number of mip levels; if zero or D3DX_DEFAULT, a complete mipmap
  831. // chain will be created.
  832. // Usage
  833. // Texture usage flags
  834. // Format
  835. // Desired pixel format. If D3DFMT_UNKNOWN, the format will be
  836. // taken from the file.
  837. // Pool
  838. // Memory pool to be used to create texture
  839. // Filter
  840. // D3DX_FILTER flags controlling how the image is filtered.
  841. // Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  842. // MipFilter
  843. // D3DX_FILTER flags controlling how each miplevel is filtered.
  844. // Or D3DX_DEFAULT for D3DX_FILTER_BOX,
  845. // ColorKey
  846. // Color to replace with transparent black, or 0 to disable colorkey.
  847. // This is always a 32-bit ARGB color, independent of the source image
  848. // format. Alpha is significant, and should usually be set to FF for
  849. // opaque colorkeys. (ex. Opaque black == 0xff000000)
  850. // pSrcInfo
  851. // Pointer to a D3DXIMAGE_INFO structure to be filled in with the
  852. // description of the data in the source image file, or NULL.
  853. // pPalette
  854. // 256 color palette to be filled in, or NULL
  855. // ppTexture, ppCubeTexture, ppVolumeTexture
  856. // The texture object that will be created
  857. //
  858. //----------------------------------------------------------------------------
  859. // FromFile
  860. HRESULT WINAPI
  861. D3DXCreateTextureFromFileA(
  862. LPDIRECT3DDEVICE8 pDevice,
  863. LPCSTR pSrcFile,
  864. LPDIRECT3DTEXTURE8* ppTexture);
  865. HRESULT WINAPI
  866. D3DXCreateTextureFromFileW(
  867. LPDIRECT3DDEVICE8 pDevice,
  868. LPCWSTR pSrcFile,
  869. LPDIRECT3DTEXTURE8* ppTexture);
  870. #ifdef UNICODE
  871. #define D3DXCreateTextureFromFile D3DXCreateTextureFromFileW
  872. #else
  873. #define D3DXCreateTextureFromFile D3DXCreateTextureFromFileA
  874. #endif
  875. HRESULT WINAPI
  876. D3DXCreateCubeTextureFromFileA(
  877. LPDIRECT3DDEVICE8 pDevice,
  878. LPCSTR pSrcFile,
  879. LPDIRECT3DCUBETEXTURE8* ppCubeTexture);
  880. HRESULT WINAPI
  881. D3DXCreateCubeTextureFromFileW(
  882. LPDIRECT3DDEVICE8 pDevice,
  883. LPCWSTR pSrcFile,
  884. LPDIRECT3DCUBETEXTURE8* ppCubeTexture);
  885. #ifdef UNICODE
  886. #define D3DXCreateCubeTextureFromFile D3DXCreateCubeTextureFromFileW
  887. #else
  888. #define D3DXCreateCubeTextureFromFile D3DXCreateCubeTextureFromFileA
  889. #endif
  890. HRESULT WINAPI
  891. D3DXCreateVolumeTextureFromFileA(
  892. LPDIRECT3DDEVICE8 pDevice,
  893. LPCSTR pSrcFile,
  894. LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  895. HRESULT WINAPI
  896. D3DXCreateVolumeTextureFromFileW(
  897. LPDIRECT3DDEVICE8 pDevice,
  898. LPCWSTR pSrcFile,
  899. LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  900. #ifdef UNICODE
  901. #define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileW
  902. #else
  903. #define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileA
  904. #endif
  905. // FromResource
  906. HRESULT WINAPI
  907. D3DXCreateTextureFromResourceA(
  908. LPDIRECT3DDEVICE8 pDevice,
  909. HMODULE hSrcModule,
  910. LPCSTR pSrcResource,
  911. LPDIRECT3DTEXTURE8* ppTexture);
  912. HRESULT WINAPI
  913. D3DXCreateTextureFromResourceW(
  914. LPDIRECT3DDEVICE8 pDevice,
  915. HMODULE hSrcModule,
  916. LPCWSTR pSrcResource,
  917. LPDIRECT3DTEXTURE8* ppTexture);
  918. #ifdef UNICODE
  919. #define D3DXCreateTextureFromResource D3DXCreateTextureFromResourceW
  920. #else
  921. #define D3DXCreateTextureFromResource D3DXCreateTextureFromResourceA
  922. #endif
  923. HRESULT WINAPI
  924. D3DXCreateCubeTextureFromResourceA(
  925. LPDIRECT3DDEVICE8 pDevice,
  926. HMODULE hSrcModule,
  927. LPCSTR pSrcResource,
  928. LPDIRECT3DCUBETEXTURE8* ppCubeTexture);
  929. HRESULT WINAPI
  930. D3DXCreateCubeTextureFromResourceW(
  931. LPDIRECT3DDEVICE8 pDevice,
  932. HMODULE hSrcModule,
  933. LPCWSTR pSrcResource,
  934. LPDIRECT3DCUBETEXTURE8* ppCubeTexture);
  935. #ifdef UNICODE
  936. #define D3DXCreateCubeTextureFromResource D3DXCreateCubeTextureFromResourceW
  937. #else
  938. #define D3DXCreateCubeTextureFromResource D3DXCreateCubeTextureFromResourceA
  939. #endif
  940. HRESULT WINAPI
  941. D3DXCreateVolumeTextureFromResourceA(
  942. LPDIRECT3DDEVICE8 pDevice,
  943. HMODULE hSrcModule,
  944. LPCSTR pSrcResource,
  945. LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  946. HRESULT WINAPI
  947. D3DXCreateVolumeTextureFromResourceW(
  948. LPDIRECT3DDEVICE8 pDevice,
  949. HMODULE hSrcModule,
  950. LPCWSTR pSrcResource,
  951. LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  952. #ifdef UNICODE
  953. #define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceW
  954. #else
  955. #define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceA
  956. #endif
  957. // FromFileEx
  958. HRESULT WINAPI
  959. D3DXCreateTextureFromFileExA(
  960. LPDIRECT3DDEVICE8 pDevice,
  961. LPCSTR pSrcFile,
  962. UINT Width,
  963. UINT Height,
  964. UINT MipLevels,
  965. DWORD Usage,
  966. D3DFORMAT Format,
  967. D3DPOOL Pool,
  968. DWORD Filter,
  969. DWORD MipFilter,
  970. D3DCOLOR ColorKey,
  971. D3DXIMAGE_INFO* pSrcInfo,
  972. PALETTEENTRY* pPalette,
  973. LPDIRECT3DTEXTURE8* ppTexture);
  974. HRESULT WINAPI
  975. D3DXCreateTextureFromFileExW(
  976. LPDIRECT3DDEVICE8 pDevice,
  977. LPCWSTR pSrcFile,
  978. UINT Width,
  979. UINT Height,
  980. UINT MipLevels,
  981. DWORD Usage,
  982. D3DFORMAT Format,
  983. D3DPOOL Pool,
  984. DWORD Filter,
  985. DWORD MipFilter,
  986. D3DCOLOR ColorKey,
  987. D3DXIMAGE_INFO* pSrcInfo,
  988. PALETTEENTRY* pPalette,
  989. LPDIRECT3DTEXTURE8* ppTexture);
  990. #ifdef UNICODE
  991. #define D3DXCreateTextureFromFileEx D3DXCreateTextureFromFileExW
  992. #else
  993. #define D3DXCreateTextureFromFileEx D3DXCreateTextureFromFileExA
  994. #endif
  995. HRESULT WINAPI
  996. D3DXCreateCubeTextureFromFileExA(
  997. LPDIRECT3DDEVICE8 pDevice,
  998. LPCSTR pSrcFile,
  999. UINT Size,
  1000. UINT MipLevels,
  1001. DWORD Usage,
  1002. D3DFORMAT Format,
  1003. D3DPOOL Pool,
  1004. DWORD Filter,
  1005. DWORD MipFilter,
  1006. D3DCOLOR ColorKey,
  1007. D3DXIMAGE_INFO* pSrcInfo,
  1008. PALETTEENTRY* pPalette,
  1009. LPDIRECT3DCUBETEXTURE8* ppCubeTexture);
  1010. HRESULT WINAPI
  1011. D3DXCreateCubeTextureFromFileExW(
  1012. LPDIRECT3DDEVICE8 pDevice,
  1013. LPCWSTR pSrcFile,
  1014. UINT Size,
  1015. UINT MipLevels,
  1016. DWORD Usage,
  1017. D3DFORMAT Format,
  1018. D3DPOOL Pool,
  1019. DWORD Filter,
  1020. DWORD MipFilter,
  1021. D3DCOLOR ColorKey,
  1022. D3DXIMAGE_INFO* pSrcInfo,
  1023. PALETTEENTRY* pPalette,
  1024. LPDIRECT3DCUBETEXTURE8* ppCubeTexture);
  1025. #ifdef UNICODE
  1026. #define D3DXCreateCubeTextureFromFileEx D3DXCreateCubeTextureFromFileExW
  1027. #else
  1028. #define D3DXCreateCubeTextureFromFileEx D3DXCreateCubeTextureFromFileExA
  1029. #endif
  1030. HRESULT WINAPI
  1031. D3DXCreateVolumeTextureFromFileExA(
  1032. LPDIRECT3DDEVICE8 pDevice,
  1033. LPCSTR pSrcFile,
  1034. UINT Width,
  1035. UINT Height,
  1036. UINT Depth,
  1037. UINT MipLevels,
  1038. DWORD Usage,
  1039. D3DFORMAT Format,
  1040. D3DPOOL Pool,
  1041. DWORD Filter,
  1042. DWORD MipFilter,
  1043. D3DCOLOR ColorKey,
  1044. D3DXIMAGE_INFO* pSrcInfo,
  1045. PALETTEENTRY* pPalette,
  1046. LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  1047. HRESULT WINAPI
  1048. D3DXCreateVolumeTextureFromFileExW(
  1049. LPDIRECT3DDEVICE8 pDevice,
  1050. LPCWSTR pSrcFile,
  1051. UINT Width,
  1052. UINT Height,
  1053. UINT Depth,
  1054. UINT MipLevels,
  1055. DWORD Usage,
  1056. D3DFORMAT Format,
  1057. D3DPOOL Pool,
  1058. DWORD Filter,
  1059. DWORD MipFilter,
  1060. D3DCOLOR ColorKey,
  1061. D3DXIMAGE_INFO* pSrcInfo,
  1062. PALETTEENTRY* pPalette,
  1063. LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  1064. #ifdef UNICODE
  1065. #define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExW
  1066. #else
  1067. #define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExA
  1068. #endif
  1069. // FromResourceEx
  1070. HRESULT WINAPI
  1071. D3DXCreateTextureFromResourceExA(
  1072. LPDIRECT3DDEVICE8 pDevice,
  1073. HMODULE hSrcModule,
  1074. LPCSTR pSrcResource,
  1075. UINT Width,
  1076. UINT Height,
  1077. UINT MipLevels,
  1078. DWORD Usage,
  1079. D3DFORMAT Format,
  1080. D3DPOOL Pool,
  1081. DWORD Filter,
  1082. DWORD MipFilter,
  1083. D3DCOLOR ColorKey,
  1084. D3DXIMAGE_INFO* pSrcInfo,
  1085. PALETTEENTRY* pPalette,
  1086. LPDIRECT3DTEXTURE8* ppTexture);
  1087. HRESULT WINAPI
  1088. D3DXCreateTextureFromResourceExW(
  1089. LPDIRECT3DDEVICE8 pDevice,
  1090. HMODULE hSrcModule,
  1091. LPCWSTR pSrcResource,
  1092. UINT Width,
  1093. UINT Height,
  1094. UINT MipLevels,
  1095. DWORD Usage,
  1096. D3DFORMAT Format,
  1097. D3DPOOL Pool,
  1098. DWORD Filter,
  1099. DWORD MipFilter,
  1100. D3DCOLOR ColorKey,
  1101. D3DXIMAGE_INFO* pSrcInfo,
  1102. PALETTEENTRY* pPalette,
  1103. LPDIRECT3DTEXTURE8* ppTexture);
  1104. #ifdef UNICODE
  1105. #define D3DXCreateTextureFromResourceEx D3DXCreateTextureFromResourceExW
  1106. #else
  1107. #define D3DXCreateTextureFromResourceEx D3DXCreateTextureFromResourceExA
  1108. #endif
  1109. HRESULT WINAPI
  1110. D3DXCreateCubeTextureFromResourceExA(
  1111. LPDIRECT3DDEVICE8 pDevice,
  1112. HMODULE hSrcModule,
  1113. LPCSTR pSrcResource,
  1114. UINT Size,
  1115. UINT MipLevels,
  1116. DWORD Usage,
  1117. D3DFORMAT Format,
  1118. D3DPOOL Pool,
  1119. DWORD Filter,
  1120. DWORD MipFilter,
  1121. D3DCOLOR ColorKey,
  1122. D3DXIMAGE_INFO* pSrcInfo,
  1123. PALETTEENTRY* pPalette,
  1124. LPDIRECT3DCUBETEXTURE8* ppCubeTexture);
  1125. HRESULT WINAPI
  1126. D3DXCreateCubeTextureFromResourceExW(
  1127. LPDIRECT3DDEVICE8 pDevice,
  1128. HMODULE hSrcModule,
  1129. LPCWSTR pSrcResource,
  1130. UINT Size,
  1131. UINT MipLevels,
  1132. DWORD Usage,
  1133. D3DFORMAT Format,
  1134. D3DPOOL Pool,
  1135. DWORD Filter,
  1136. DWORD MipFilter,
  1137. D3DCOLOR ColorKey,
  1138. D3DXIMAGE_INFO* pSrcInfo,
  1139. PALETTEENTRY* pPalette,
  1140. LPDIRECT3DCUBETEXTURE8* ppCubeTexture);
  1141. #ifdef UNICODE
  1142. #define D3DXCreateCubeTextureFromResourceEx D3DXCreateCubeTextureFromResourceExW
  1143. #else
  1144. #define D3DXCreateCubeTextureFromResourceEx D3DXCreateCubeTextureFromResourceExA
  1145. #endif
  1146. HRESULT WINAPI
  1147. D3DXCreateVolumeTextureFromResourceExA(
  1148. LPDIRECT3DDEVICE8 pDevice,
  1149. HMODULE hSrcModule,
  1150. LPCSTR pSrcResource,
  1151. UINT Width,
  1152. UINT Height,
  1153. UINT Depth,
  1154. UINT MipLevels,
  1155. DWORD Usage,
  1156. D3DFORMAT Format,
  1157. D3DPOOL Pool,
  1158. DWORD Filter,
  1159. DWORD MipFilter,
  1160. D3DCOLOR ColorKey,
  1161. D3DXIMAGE_INFO* pSrcInfo,
  1162. PALETTEENTRY* pPalette,
  1163. LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  1164. HRESULT WINAPI
  1165. D3DXCreateVolumeTextureFromResourceExW(
  1166. LPDIRECT3DDEVICE8 pDevice,
  1167. HMODULE hSrcModule,
  1168. LPCWSTR pSrcResource,
  1169. UINT Width,
  1170. UINT Height,
  1171. UINT Depth,
  1172. UINT MipLevels,
  1173. DWORD Usage,
  1174. D3DFORMAT Format,
  1175. D3DPOOL Pool,
  1176. DWORD Filter,
  1177. DWORD MipFilter,
  1178. D3DCOLOR ColorKey,
  1179. D3DXIMAGE_INFO* pSrcInfo,
  1180. PALETTEENTRY* pPalette,
  1181. LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  1182. #ifdef UNICODE
  1183. #define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExW
  1184. #else
  1185. #define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExA
  1186. #endif
  1187. // FromFileInMemory
  1188. HRESULT WINAPI
  1189. D3DXCreateTextureFromFileInMemory(
  1190. LPDIRECT3DDEVICE8 pDevice,
  1191. LPCVOID pSrcData,
  1192. UINT SrcDataSize,
  1193. LPDIRECT3DTEXTURE8* ppTexture);
  1194. HRESULT WINAPI
  1195. D3DXCreateCubeTextureFromFileInMemory(
  1196. LPDIRECT3DDEVICE8 pDevice,
  1197. LPCVOID pSrcData,
  1198. UINT SrcDataSize,
  1199. LPDIRECT3DCUBETEXTURE8* ppCubeTexture);
  1200. HRESULT WINAPI
  1201. D3DXCreateVolumeTextureFromFileInMemory(
  1202. LPDIRECT3DDEVICE8 pDevice,
  1203. LPCVOID pSrcData,
  1204. UINT SrcDataSize,
  1205. LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  1206. // FromFileInMemoryEx
  1207. HRESULT WINAPI
  1208. D3DXCreateTextureFromFileInMemoryEx(
  1209. LPDIRECT3DDEVICE8 pDevice,
  1210. LPCVOID pSrcData,
  1211. UINT SrcDataSize,
  1212. UINT Width,
  1213. UINT Height,
  1214. UINT MipLevels,
  1215. DWORD Usage,
  1216. D3DFORMAT Format,
  1217. D3DPOOL Pool,
  1218. DWORD Filter,
  1219. DWORD MipFilter,
  1220. D3DCOLOR ColorKey,
  1221. D3DXIMAGE_INFO* pSrcInfo,
  1222. PALETTEENTRY* pPalette,
  1223. LPDIRECT3DTEXTURE8* ppTexture);
  1224. HRESULT WINAPI
  1225. D3DXCreateCubeTextureFromFileInMemoryEx(
  1226. LPDIRECT3DDEVICE8 pDevice,
  1227. LPCVOID pSrcData,
  1228. UINT SrcDataSize,
  1229. UINT Size,
  1230. UINT MipLevels,
  1231. DWORD Usage,
  1232. D3DFORMAT Format,
  1233. D3DPOOL Pool,
  1234. DWORD Filter,
  1235. DWORD MipFilter,
  1236. D3DCOLOR ColorKey,
  1237. D3DXIMAGE_INFO* pSrcInfo,
  1238. PALETTEENTRY* pPalette,
  1239. LPDIRECT3DCUBETEXTURE8* ppCubeTexture);
  1240. HRESULT WINAPI
  1241. D3DXCreateVolumeTextureFromFileInMemoryEx(
  1242. LPDIRECT3DDEVICE8 pDevice,
  1243. LPCVOID pSrcData,
  1244. UINT SrcDataSize,
  1245. UINT Width,
  1246. UINT Height,
  1247. UINT Depth,
  1248. UINT MipLevels,
  1249. DWORD Usage,
  1250. D3DFORMAT Format,
  1251. D3DPOOL Pool,
  1252. DWORD Filter,
  1253. DWORD MipFilter,
  1254. D3DCOLOR ColorKey,
  1255. D3DXIMAGE_INFO* pSrcInfo,
  1256. PALETTEENTRY* pPalette,
  1257. LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  1258. //----------------------------------------------------------------------------
  1259. // D3DXSaveTextureToFile:
  1260. // ----------------------
  1261. // Save a texture to a file.
  1262. //
  1263. // Parameters:
  1264. // pDestFile
  1265. // File name of the destination file
  1266. // DestFormat
  1267. // D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
  1268. // pSrcTexture
  1269. // Source texture, containing the image to be saved
  1270. // pSrcPalette
  1271. // Source palette of 256 colors, or NULL
  1272. //
  1273. //----------------------------------------------------------------------------
  1274. HRESULT WINAPI
  1275. D3DXSaveTextureToFileA(
  1276. LPCSTR pDestFile,
  1277. D3DXIMAGE_FILEFORMAT DestFormat,
  1278. LPDIRECT3DBASETEXTURE8 pSrcTexture,
  1279. CONST PALETTEENTRY* pSrcPalette);
  1280. HRESULT WINAPI
  1281. D3DXSaveTextureToFileW(
  1282. LPCWSTR pDestFile,
  1283. D3DXIMAGE_FILEFORMAT DestFormat,
  1284. LPDIRECT3DBASETEXTURE8 pSrcTexture,
  1285. CONST PALETTEENTRY* pSrcPalette);
  1286. #ifdef UNICODE
  1287. #define D3DXSaveTextureToFile D3DXSaveTextureToFileW
  1288. #else
  1289. #define D3DXSaveTextureToFile D3DXSaveTextureToFileA
  1290. #endif
  1291. //////////////////////////////////////////////////////////////////////////////
  1292. // Misc Texture APIs /////////////////////////////////////////////////////////
  1293. //////////////////////////////////////////////////////////////////////////////
  1294. //----------------------------------------------------------------------------
  1295. // D3DXFilterTexture:
  1296. // ------------------
  1297. // Filters mipmaps levels of a texture.
  1298. //
  1299. // Parameters:
  1300. // pBaseTexture
  1301. // The texture object to be filtered
  1302. // pPalette
  1303. // 256 color palette to be used, or NULL for non-palettized formats
  1304. // SrcLevel
  1305. // The level whose image is used to generate the subsequent levels.
  1306. // Filter
  1307. // D3DX_FILTER flags controlling how each miplevel is filtered.
  1308. // Or D3DX_DEFAULT for D3DX_FILTER_BOX,
  1309. //
  1310. //----------------------------------------------------------------------------
  1311. HRESULT WINAPI
  1312. D3DXFilterTexture(
  1313. LPDIRECT3DBASETEXTURE8 pBaseTexture,
  1314. CONST PALETTEENTRY* pPalette,
  1315. UINT SrcLevel,
  1316. DWORD Filter);
  1317. #define D3DXFilterCubeTexture D3DXFilterTexture
  1318. #define D3DXFilterVolumeTexture D3DXFilterTexture
  1319. //----------------------------------------------------------------------------
  1320. // D3DXFillTexture:
  1321. // ----------------
  1322. // Uses a user provided function to fill each texel of each mip level of a
  1323. // given texture.
  1324. //
  1325. // Paramters:
  1326. // pTexture, pCubeTexture, pVolumeTexture
  1327. // Pointer to the texture to be filled.
  1328. // pFunction
  1329. // Pointer to user provided evalutor function which will be used to
  1330. // compute the value of each texel.
  1331. // pData
  1332. // Pointer to an arbitrary block of user defined data. This pointer
  1333. // will be passed to the function provided in pFunction
  1334. //-----------------------------------------------------------------------------
  1335. HRESULT WINAPI
  1336. D3DXFillTexture(
  1337. LPDIRECT3DTEXTURE8 pTexture,
  1338. LPD3DXFILL2D pFunction,
  1339. LPVOID pData);
  1340. HRESULT WINAPI
  1341. D3DXFillCubeTexture(
  1342. LPDIRECT3DCUBETEXTURE8 pCubeTexture,
  1343. LPD3DXFILL3D pFunction,
  1344. LPVOID pData);
  1345. HRESULT WINAPI
  1346. D3DXFillVolumeTexture(
  1347. LPDIRECT3DVOLUMETEXTURE8 pVolumeTexture,
  1348. LPD3DXFILL3D pFunction,
  1349. LPVOID pData);
  1350. //----------------------------------------------------------------------------
  1351. // D3DXComputeNormalMap:
  1352. // ---------------------
  1353. // Converts a height map into a normal map. The (x,y,z) components of each
  1354. // normal are mapped to the (r,g,b) channels of the output texture.
  1355. //
  1356. // Parameters
  1357. // pTexture
  1358. // Pointer to the destination texture
  1359. // pSrcTexture
  1360. // Pointer to the source heightmap texture
  1361. // pSrcPalette
  1362. // Source palette of 256 colors, or NULL
  1363. // Flags
  1364. // D3DX_NORMALMAP flags
  1365. // Channel
  1366. // D3DX_CHANNEL specifying source of height information
  1367. // Amplitude
  1368. // The constant value which the height information is multiplied by.
  1369. //---------------------------------------------------------------------------
  1370. HRESULT WINAPI
  1371. D3DXComputeNormalMap(
  1372. LPDIRECT3DTEXTURE8 pTexture,
  1373. LPDIRECT3DTEXTURE8 pSrcTexture,
  1374. CONST PALETTEENTRY* pSrcPalette,
  1375. DWORD Flags,
  1376. DWORD Channel,
  1377. FLOAT Amplitude);
  1378. #ifdef __cplusplus
  1379. }
  1380. #endif //__cplusplus
  1381. #endif //__D3DX8TEX_H__