d3dx9core.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. ///////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (C) Microsoft Corporation. All Rights Reserved.
  4. //
  5. // File: d3dx9core.h
  6. // Content: D3DX core types and functions
  7. //
  8. ///////////////////////////////////////////////////////////////////////////
  9. #include "d3dx9.h"
  10. #ifndef __D3DX9CORE_H__
  11. #define __D3DX9CORE_H__
  12. ///////////////////////////////////////////////////////////////////////////
  13. // D3DX_SDK_VERSION:
  14. // -----------------
  15. // This identifier is passed to D3DXCheckVersion in order to ensure that an
  16. // application was built against the correct header files and lib files.
  17. // This number is incremented whenever a header (or other) change would
  18. // require applications to be rebuilt. If the version doesn't match,
  19. // D3DXCheckVersion will return FALSE. (The number itself has no meaning.)
  20. ///////////////////////////////////////////////////////////////////////////
  21. #define D3DX_VERSION 0x0902
  22. #define D3DX_SDK_VERSION 42
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif //__cplusplus
  26. BOOL WINAPI
  27. D3DXCheckVersion(UINT D3DSdkVersion, UINT D3DXSdkVersion);
  28. #ifdef __cplusplus
  29. }
  30. #endif //__cplusplus
  31. ///////////////////////////////////////////////////////////////////////////
  32. // D3DXDebugMute
  33. // Mutes D3DX and D3D debug spew (TRUE - mute, FALSE - not mute)
  34. //
  35. // returns previous mute value
  36. //
  37. ///////////////////////////////////////////////////////////////////////////
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif //__cplusplus
  41. BOOL WINAPI
  42. D3DXDebugMute(BOOL Mute);
  43. #ifdef __cplusplus
  44. }
  45. #endif //__cplusplus
  46. ///////////////////////////////////////////////////////////////////////////
  47. // D3DXGetDriverLevel:
  48. // Returns driver version information:
  49. //
  50. // 700 - DX7 level driver
  51. // 800 - DX8 level driver
  52. // 900 - DX9 level driver
  53. ///////////////////////////////////////////////////////////////////////////
  54. #ifdef __cplusplus
  55. extern "C" {
  56. #endif //__cplusplus
  57. UINT WINAPI
  58. D3DXGetDriverLevel(LPDIRECT3DDEVICE9 pDevice);
  59. #ifdef __cplusplus
  60. }
  61. #endif //__cplusplus
  62. ///////////////////////////////////////////////////////////////////////////
  63. // ID3DXBuffer:
  64. // ------------
  65. // The buffer object is used by D3DX to return arbitrary size data.
  66. //
  67. // GetBufferPointer -
  68. // Returns a pointer to the beginning of the buffer.
  69. //
  70. // GetBufferSize -
  71. // Returns the size of the buffer, in bytes.
  72. ///////////////////////////////////////////////////////////////////////////
  73. typedef interface ID3DXBuffer ID3DXBuffer;
  74. typedef interface ID3DXBuffer *LPD3DXBUFFER;
  75. // {8BA5FB08-5195-40e2-AC58-0D989C3A0102}
  76. DEFINE_GUID(IID_ID3DXBuffer,
  77. 0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2);
  78. #undef INTERFACE
  79. #define INTERFACE ID3DXBuffer
  80. DECLARE_INTERFACE_(ID3DXBuffer, IUnknown)
  81. {
  82. // IUnknown
  83. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  84. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  85. STDMETHOD_(ULONG, Release)(THIS) PURE;
  86. // ID3DXBuffer
  87. STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE;
  88. STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE;
  89. };
  90. //////////////////////////////////////////////////////////////////////////////
  91. // D3DXSPRITE flags:
  92. // -----------------
  93. // D3DXSPRITE_DONOTSAVESTATE
  94. // Specifies device state is not to be saved and restored in Begin/End.
  95. // D3DXSPRITE_DONOTMODIFY_RENDERSTATE
  96. // Specifies device render state is not to be changed in Begin. The device
  97. // is assumed to be in a valid state to draw vertices containing POSITION0,
  98. // TEXCOORD0, and COLOR0 data.
  99. // D3DXSPRITE_OBJECTSPACE
  100. // The WORLD, VIEW, and PROJECTION transforms are NOT modified. The
  101. // transforms currently set to the device are used to transform the sprites
  102. // when the batch is drawn (at Flush or End). If this is not specified,
  103. // WORLD, VIEW, and PROJECTION transforms are modified so that sprites are
  104. // drawn in screenspace coordinates.
  105. // D3DXSPRITE_BILLBOARD
  106. // Rotates each sprite about its center so that it is facing the viewer.
  107. // D3DXSPRITE_ALPHABLEND
  108. // Enables ALPHABLEND(SRCALPHA, INVSRCALPHA) and ALPHATEST(alpha > 0).
  109. // ID3DXFont expects this to be set when drawing text.
  110. // D3DXSPRITE_SORT_TEXTURE
  111. // Sprites are sorted by texture prior to drawing. This is recommended when
  112. // drawing non-overlapping sprites of uniform depth. For example, drawing
  113. // screen-aligned text with ID3DXFont.
  114. // D3DXSPRITE_SORT_DEPTH_FRONTTOBACK
  115. // Sprites are sorted by depth front-to-back prior to drawing. This is
  116. // recommended when drawing opaque sprites of varying depths.
  117. // D3DXSPRITE_SORT_DEPTH_BACKTOFRONT
  118. // Sprites are sorted by depth back-to-front prior to drawing. This is
  119. // recommended when drawing transparent sprites of varying depths.
  120. // D3DXSPRITE_DO_NOT_ADDREF_TEXTURE
  121. // Disables calling AddRef() on every draw, and Release() on Flush() for
  122. // better performance.
  123. //////////////////////////////////////////////////////////////////////////////
  124. #define D3DXSPRITE_DONOTSAVESTATE (1 << 0)
  125. #define D3DXSPRITE_DONOTMODIFY_RENDERSTATE (1 << 1)
  126. #define D3DXSPRITE_OBJECTSPACE (1 << 2)
  127. #define D3DXSPRITE_BILLBOARD (1 << 3)
  128. #define D3DXSPRITE_ALPHABLEND (1 << 4)
  129. #define D3DXSPRITE_SORT_TEXTURE (1 << 5)
  130. #define D3DXSPRITE_SORT_DEPTH_FRONTTOBACK (1 << 6)
  131. #define D3DXSPRITE_SORT_DEPTH_BACKTOFRONT (1 << 7)
  132. #define D3DXSPRITE_DO_NOT_ADDREF_TEXTURE (1 << 8)
  133. //////////////////////////////////////////////////////////////////////////////
  134. // ID3DXSprite:
  135. // ------------
  136. // This object intends to provide an easy way to drawing sprites using D3D.
  137. //
  138. // Begin -
  139. // Prepares device for drawing sprites.
  140. //
  141. // Draw -
  142. // Draws a sprite. Before transformation, the sprite is the size of
  143. // SrcRect, with its top-left corner specified by Position. The color
  144. // and alpha channels are modulated by Color.
  145. //
  146. // Flush -
  147. // Forces all batched sprites to submitted to the device.
  148. //
  149. // End -
  150. // Restores device state to how it was when Begin was called.
  151. //
  152. // OnLostDevice, OnResetDevice -
  153. // Call OnLostDevice() on this object before calling Reset() on the
  154. // device, so that this object can release any stateblocks and video
  155. // memory resources. After Reset(), the call OnResetDevice().
  156. //////////////////////////////////////////////////////////////////////////////
  157. typedef interface ID3DXSprite ID3DXSprite;
  158. typedef interface ID3DXSprite *LPD3DXSPRITE;
  159. // {BA0B762D-7D28-43ec-B9DC-2F84443B0614}
  160. DEFINE_GUID(IID_ID3DXSprite,
  161. 0xba0b762d, 0x7d28, 0x43ec, 0xb9, 0xdc, 0x2f, 0x84, 0x44, 0x3b, 0x6, 0x14);
  162. #undef INTERFACE
  163. #define INTERFACE ID3DXSprite
  164. DECLARE_INTERFACE_(ID3DXSprite, IUnknown)
  165. {
  166. // IUnknown
  167. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  168. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  169. STDMETHOD_(ULONG, Release)(THIS) PURE;
  170. // ID3DXSprite
  171. STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
  172. STDMETHOD(GetTransform)(THIS_ D3DXMATRIX *pTransform) PURE;
  173. STDMETHOD(SetTransform)(THIS_ CONST D3DXMATRIX *pTransform) PURE;
  174. STDMETHOD(SetWorldViewRH)(THIS_ CONST D3DXMATRIX *pWorld, CONST D3DXMATRIX *pView) PURE;
  175. STDMETHOD(SetWorldViewLH)(THIS_ CONST D3DXMATRIX *pWorld, CONST D3DXMATRIX *pView) PURE;
  176. STDMETHOD(Begin)(THIS_ DWORD Flags) PURE;
  177. STDMETHOD(Draw)(THIS_ LPDIRECT3DTEXTURE9 pTexture, CONST RECT *pSrcRect, CONST D3DXVECTOR3 *pCenter, CONST D3DXVECTOR3 *pPosition, D3DCOLOR Color) PURE;
  178. STDMETHOD(Flush)(THIS) PURE;
  179. STDMETHOD(End)(THIS) PURE;
  180. STDMETHOD(OnLostDevice)(THIS) PURE;
  181. STDMETHOD(OnResetDevice)(THIS) PURE;
  182. };
  183. #ifdef __cplusplus
  184. extern "C" {
  185. #endif //__cplusplus
  186. HRESULT WINAPI
  187. D3DXCreateSprite(
  188. LPDIRECT3DDEVICE9 pDevice,
  189. LPD3DXSPRITE* ppSprite);
  190. #ifdef __cplusplus
  191. }
  192. #endif //__cplusplus
  193. //////////////////////////////////////////////////////////////////////////////
  194. // ID3DXFont:
  195. // ----------
  196. // Font objects contain the textures and resources needed to render a specific
  197. // font on a specific device.
  198. //
  199. // GetGlyphData -
  200. // Returns glyph cache data, for a given glyph.
  201. //
  202. // PreloadCharacters/PreloadGlyphs/PreloadText -
  203. // Preloads glyphs into the glyph cache textures.
  204. //
  205. // DrawText -
  206. // Draws formatted text on a D3D device. Some parameters are
  207. // surprisingly similar to those of GDI's DrawText function. See GDI
  208. // documentation for a detailed description of these parameters.
  209. // If pSprite is NULL, an internal sprite object will be used.
  210. //
  211. // OnLostDevice, OnResetDevice -
  212. // Call OnLostDevice() on this object before calling Reset() on the
  213. // device, so that this object can release any stateblocks and video
  214. // memory resources. After Reset(), the call OnResetDevice().
  215. //////////////////////////////////////////////////////////////////////////////
  216. typedef struct _D3DXFONT_DESCA
  217. {
  218. INT Height;
  219. UINT Width;
  220. UINT Weight;
  221. UINT MipLevels;
  222. BOOL Italic;
  223. BYTE CharSet;
  224. BYTE OutputPrecision;
  225. BYTE Quality;
  226. BYTE PitchAndFamily;
  227. CHAR FaceName[LF_FACESIZE];
  228. } D3DXFONT_DESCA, *LPD3DXFONT_DESCA;
  229. typedef struct _D3DXFONT_DESCW
  230. {
  231. INT Height;
  232. UINT Width;
  233. UINT Weight;
  234. UINT MipLevels;
  235. BOOL Italic;
  236. BYTE CharSet;
  237. BYTE OutputPrecision;
  238. BYTE Quality;
  239. BYTE PitchAndFamily;
  240. WCHAR FaceName[LF_FACESIZE];
  241. } D3DXFONT_DESCW, *LPD3DXFONT_DESCW;
  242. #ifdef UNICODE
  243. typedef D3DXFONT_DESCW D3DXFONT_DESC;
  244. typedef LPD3DXFONT_DESCW LPD3DXFONT_DESC;
  245. #else
  246. typedef D3DXFONT_DESCA D3DXFONT_DESC;
  247. typedef LPD3DXFONT_DESCA LPD3DXFONT_DESC;
  248. #endif
  249. typedef interface ID3DXFont ID3DXFont;
  250. typedef interface ID3DXFont *LPD3DXFONT;
  251. // {D79DBB70-5F21-4d36-BBC2-FF525C213CDC}
  252. DEFINE_GUID(IID_ID3DXFont,
  253. 0xd79dbb70, 0x5f21, 0x4d36, 0xbb, 0xc2, 0xff, 0x52, 0x5c, 0x21, 0x3c, 0xdc);
  254. #undef INTERFACE
  255. #define INTERFACE ID3DXFont
  256. DECLARE_INTERFACE_(ID3DXFont, IUnknown)
  257. {
  258. // IUnknown
  259. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  260. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  261. STDMETHOD_(ULONG, Release)(THIS) PURE;
  262. // ID3DXFont
  263. STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9 *ppDevice) PURE;
  264. STDMETHOD(GetDescA)(THIS_ D3DXFONT_DESCA *pDesc) PURE;
  265. STDMETHOD(GetDescW)(THIS_ D3DXFONT_DESCW *pDesc) PURE;
  266. STDMETHOD_(BOOL, GetTextMetricsA)(THIS_ TEXTMETRICA *pTextMetrics) PURE;
  267. STDMETHOD_(BOOL, GetTextMetricsW)(THIS_ TEXTMETRICW *pTextMetrics) PURE;
  268. STDMETHOD_(HDC, GetDC)(THIS) PURE;
  269. STDMETHOD(GetGlyphData)(THIS_ UINT Glyph, LPDIRECT3DTEXTURE9 *ppTexture, RECT *pBlackBox, POINT *pCellInc) PURE;
  270. STDMETHOD(PreloadCharacters)(THIS_ UINT First, UINT Last) PURE;
  271. STDMETHOD(PreloadGlyphs)(THIS_ UINT First, UINT Last) PURE;
  272. STDMETHOD(PreloadTextA)(THIS_ LPCSTR pString, INT Count) PURE;
  273. STDMETHOD(PreloadTextW)(THIS_ LPCWSTR pString, INT Count) PURE;
  274. STDMETHOD_(INT, DrawTextA)(THIS_ LPD3DXSPRITE pSprite, LPCSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE;
  275. STDMETHOD_(INT, DrawTextW)(THIS_ LPD3DXSPRITE pSprite, LPCWSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE;
  276. STDMETHOD(OnLostDevice)(THIS) PURE;
  277. STDMETHOD(OnResetDevice)(THIS) PURE;
  278. #ifdef __cplusplus
  279. #ifdef UNICODE
  280. HRESULT GetDesc(D3DXFONT_DESCW *pDesc) { return GetDescW(pDesc); }
  281. HRESULT PreloadText(LPCWSTR pString, INT Count) { return PreloadTextW(pString, Count); }
  282. #else
  283. HRESULT GetDesc(D3DXFONT_DESCA *pDesc) { return GetDescA(pDesc); }
  284. HRESULT PreloadText(LPCSTR pString, INT Count) { return PreloadTextA(pString, Count); }
  285. #endif
  286. #endif //__cplusplus
  287. };
  288. #ifndef GetTextMetrics
  289. #ifdef UNICODE
  290. #define GetTextMetrics GetTextMetricsW
  291. #else
  292. #define GetTextMetrics GetTextMetricsA
  293. #endif
  294. #endif
  295. #ifndef DrawText
  296. #ifdef UNICODE
  297. #define DrawText DrawTextW
  298. #else
  299. #define DrawText DrawTextA
  300. #endif
  301. #endif
  302. #ifdef __cplusplus
  303. extern "C" {
  304. #endif //__cplusplus
  305. HRESULT WINAPI
  306. D3DXCreateFontA(
  307. LPDIRECT3DDEVICE9 pDevice,
  308. INT Height,
  309. UINT Width,
  310. UINT Weight,
  311. UINT MipLevels,
  312. BOOL Italic,
  313. DWORD CharSet,
  314. DWORD OutputPrecision,
  315. DWORD Quality,
  316. DWORD PitchAndFamily,
  317. LPCSTR pFaceName,
  318. LPD3DXFONT* ppFont);
  319. HRESULT WINAPI
  320. D3DXCreateFontW(
  321. LPDIRECT3DDEVICE9 pDevice,
  322. INT Height,
  323. UINT Width,
  324. UINT Weight,
  325. UINT MipLevels,
  326. BOOL Italic,
  327. DWORD CharSet,
  328. DWORD OutputPrecision,
  329. DWORD Quality,
  330. DWORD PitchAndFamily,
  331. LPCWSTR pFaceName,
  332. LPD3DXFONT* ppFont);
  333. #ifdef UNICODE
  334. #define D3DXCreateFont D3DXCreateFontW
  335. #else
  336. #define D3DXCreateFont D3DXCreateFontA
  337. #endif
  338. HRESULT WINAPI
  339. D3DXCreateFontIndirectA(
  340. LPDIRECT3DDEVICE9 pDevice,
  341. CONST D3DXFONT_DESCA* pDesc,
  342. LPD3DXFONT* ppFont);
  343. HRESULT WINAPI
  344. D3DXCreateFontIndirectW(
  345. LPDIRECT3DDEVICE9 pDevice,
  346. CONST D3DXFONT_DESCW* pDesc,
  347. LPD3DXFONT* ppFont);
  348. #ifdef UNICODE
  349. #define D3DXCreateFontIndirect D3DXCreateFontIndirectW
  350. #else
  351. #define D3DXCreateFontIndirect D3DXCreateFontIndirectA
  352. #endif
  353. #ifdef __cplusplus
  354. }
  355. #endif //__cplusplus
  356. ///////////////////////////////////////////////////////////////////////////
  357. // ID3DXRenderToSurface:
  358. // ---------------------
  359. // This object abstracts rendering to surfaces. These surfaces do not
  360. // necessarily need to be render targets. If they are not, a compatible
  361. // render target is used, and the result copied into surface at end scene.
  362. //
  363. // BeginScene, EndScene -
  364. // Call BeginScene() and EndScene() at the beginning and ending of your
  365. // scene. These calls will setup and restore render targets, viewports,
  366. // etc..
  367. //
  368. // OnLostDevice, OnResetDevice -
  369. // Call OnLostDevice() on this object before calling Reset() on the
  370. // device, so that this object can release any stateblocks and video
  371. // memory resources. After Reset(), the call OnResetDevice().
  372. ///////////////////////////////////////////////////////////////////////////
  373. typedef struct _D3DXRTS_DESC
  374. {
  375. UINT Width;
  376. UINT Height;
  377. D3DFORMAT Format;
  378. BOOL DepthStencil;
  379. D3DFORMAT DepthStencilFormat;
  380. } D3DXRTS_DESC, *LPD3DXRTS_DESC;
  381. typedef interface ID3DXRenderToSurface ID3DXRenderToSurface;
  382. typedef interface ID3DXRenderToSurface *LPD3DXRENDERTOSURFACE;
  383. // {6985F346-2C3D-43b3-BE8B-DAAE8A03D894}
  384. DEFINE_GUID(IID_ID3DXRenderToSurface,
  385. 0x6985f346, 0x2c3d, 0x43b3, 0xbe, 0x8b, 0xda, 0xae, 0x8a, 0x3, 0xd8, 0x94);
  386. #undef INTERFACE
  387. #define INTERFACE ID3DXRenderToSurface
  388. DECLARE_INTERFACE_(ID3DXRenderToSurface, IUnknown)
  389. {
  390. // IUnknown
  391. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  392. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  393. STDMETHOD_(ULONG, Release)(THIS) PURE;
  394. // ID3DXRenderToSurface
  395. STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
  396. STDMETHOD(GetDesc)(THIS_ D3DXRTS_DESC* pDesc) PURE;
  397. STDMETHOD(BeginScene)(THIS_ LPDIRECT3DSURFACE9 pSurface, CONST D3DVIEWPORT9* pViewport) PURE;
  398. STDMETHOD(EndScene)(THIS_ DWORD MipFilter) PURE;
  399. STDMETHOD(OnLostDevice)(THIS) PURE;
  400. STDMETHOD(OnResetDevice)(THIS) PURE;
  401. };
  402. #ifdef __cplusplus
  403. extern "C" {
  404. #endif //__cplusplus
  405. HRESULT WINAPI
  406. D3DXCreateRenderToSurface(
  407. LPDIRECT3DDEVICE9 pDevice,
  408. UINT Width,
  409. UINT Height,
  410. D3DFORMAT Format,
  411. BOOL DepthStencil,
  412. D3DFORMAT DepthStencilFormat,
  413. LPD3DXRENDERTOSURFACE* ppRenderToSurface);
  414. #ifdef __cplusplus
  415. }
  416. #endif //__cplusplus
  417. ///////////////////////////////////////////////////////////////////////////
  418. // ID3DXRenderToEnvMap:
  419. // --------------------
  420. // This object abstracts rendering to environment maps. These surfaces
  421. // do not necessarily need to be render targets. If they are not, a
  422. // compatible render target is used, and the result copied into the
  423. // environment map at end scene.
  424. //
  425. // BeginCube, BeginSphere, BeginHemisphere, BeginParabolic -
  426. // This function initiates the rendering of the environment map. As
  427. // parameters, you pass the textures in which will get filled in with
  428. // the resulting environment map.
  429. //
  430. // Face -
  431. // Call this function to initiate the drawing of each face. For each
  432. // environment map, you will call this six times.. once for each face
  433. // in D3DCUBEMAP_FACES.
  434. //
  435. // End -
  436. // This will restore all render targets, and if needed compose all the
  437. // rendered faces into the environment map surfaces.
  438. //
  439. // OnLostDevice, OnResetDevice -
  440. // Call OnLostDevice() on this object before calling Reset() on the
  441. // device, so that this object can release any stateblocks and video
  442. // memory resources. After Reset(), the call OnResetDevice().
  443. ///////////////////////////////////////////////////////////////////////////
  444. typedef struct _D3DXRTE_DESC
  445. {
  446. UINT Size;
  447. UINT MipLevels;
  448. D3DFORMAT Format;
  449. BOOL DepthStencil;
  450. D3DFORMAT DepthStencilFormat;
  451. } D3DXRTE_DESC, *LPD3DXRTE_DESC;
  452. typedef interface ID3DXRenderToEnvMap ID3DXRenderToEnvMap;
  453. typedef interface ID3DXRenderToEnvMap *LPD3DXRenderToEnvMap;
  454. // {313F1B4B-C7B0-4fa2-9D9D-8D380B64385E}
  455. DEFINE_GUID(IID_ID3DXRenderToEnvMap,
  456. 0x313f1b4b, 0xc7b0, 0x4fa2, 0x9d, 0x9d, 0x8d, 0x38, 0xb, 0x64, 0x38, 0x5e);
  457. #undef INTERFACE
  458. #define INTERFACE ID3DXRenderToEnvMap
  459. DECLARE_INTERFACE_(ID3DXRenderToEnvMap, IUnknown)
  460. {
  461. // IUnknown
  462. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  463. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  464. STDMETHOD_(ULONG, Release)(THIS) PURE;
  465. // ID3DXRenderToEnvMap
  466. STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
  467. STDMETHOD(GetDesc)(THIS_ D3DXRTE_DESC* pDesc) PURE;
  468. STDMETHOD(BeginCube)(THIS_
  469. LPDIRECT3DCUBETEXTURE9 pCubeTex) PURE;
  470. STDMETHOD(BeginSphere)(THIS_
  471. LPDIRECT3DTEXTURE9 pTex) PURE;
  472. STDMETHOD(BeginHemisphere)(THIS_
  473. LPDIRECT3DTEXTURE9 pTexZPos,
  474. LPDIRECT3DTEXTURE9 pTexZNeg) PURE;
  475. STDMETHOD(BeginParabolic)(THIS_
  476. LPDIRECT3DTEXTURE9 pTexZPos,
  477. LPDIRECT3DTEXTURE9 pTexZNeg) PURE;
  478. STDMETHOD(Face)(THIS_ D3DCUBEMAP_FACES Face, DWORD MipFilter) PURE;
  479. STDMETHOD(End)(THIS_ DWORD MipFilter) PURE;
  480. STDMETHOD(OnLostDevice)(THIS) PURE;
  481. STDMETHOD(OnResetDevice)(THIS) PURE;
  482. };
  483. #ifdef __cplusplus
  484. extern "C" {
  485. #endif //__cplusplus
  486. HRESULT WINAPI
  487. D3DXCreateRenderToEnvMap(
  488. LPDIRECT3DDEVICE9 pDevice,
  489. UINT Size,
  490. UINT MipLevels,
  491. D3DFORMAT Format,
  492. BOOL DepthStencil,
  493. D3DFORMAT DepthStencilFormat,
  494. LPD3DXRenderToEnvMap* ppRenderToEnvMap);
  495. #ifdef __cplusplus
  496. }
  497. #endif //__cplusplus
  498. ///////////////////////////////////////////////////////////////////////////
  499. // ID3DXLine:
  500. // ------------
  501. // This object intends to provide an easy way to draw lines using D3D.
  502. //
  503. // Begin -
  504. // Prepares device for drawing lines
  505. //
  506. // Draw -
  507. // Draws a line strip in screen-space.
  508. // Input is in the form of a array defining points on the line strip. of D3DXVECTOR2
  509. //
  510. // DrawTransform -
  511. // Draws a line in screen-space with a specified input transformation matrix.
  512. //
  513. // End -
  514. // Restores device state to how it was when Begin was called.
  515. //
  516. // SetPattern -
  517. // Applies a stipple pattern to the line. Input is one 32-bit
  518. // DWORD which describes the stipple pattern. 1 is opaque, 0 is
  519. // transparent.
  520. //
  521. // SetPatternScale -
  522. // Stretches the stipple pattern in the u direction. Input is one
  523. // floating-point value. 0.0f is no scaling, whereas 1.0f doubles
  524. // the length of the stipple pattern.
  525. //
  526. // SetWidth -
  527. // Specifies the thickness of the line in the v direction. Input is
  528. // one floating-point value.
  529. //
  530. // SetAntialias -
  531. // Toggles line antialiasing. Input is a BOOL.
  532. // TRUE = Antialiasing on.
  533. // FALSE = Antialiasing off.
  534. //
  535. // SetGLLines -
  536. // Toggles non-antialiased OpenGL line emulation. Input is a BOOL.
  537. // TRUE = OpenGL line emulation on.
  538. // FALSE = OpenGL line emulation off.
  539. //
  540. // OpenGL line: Regular line:
  541. // *\ *\
  542. // | \ / \
  543. // | \ *\ \
  544. // *\ \ \ \
  545. // \ \ \ \
  546. // \ * \ *
  547. // \ | \ /
  548. // \| *
  549. // *
  550. //
  551. // OnLostDevice, OnResetDevice -
  552. // Call OnLostDevice() on this object before calling Reset() on the
  553. // device, so that this object can release any stateblocks and video
  554. // memory resources. After Reset(), the call OnResetDevice().
  555. ///////////////////////////////////////////////////////////////////////////
  556. typedef interface ID3DXLine ID3DXLine;
  557. typedef interface ID3DXLine *LPD3DXLINE;
  558. // {D379BA7F-9042-4ac4-9F5E-58192A4C6BD8}
  559. DEFINE_GUID(IID_ID3DXLine,
  560. 0xd379ba7f, 0x9042, 0x4ac4, 0x9f, 0x5e, 0x58, 0x19, 0x2a, 0x4c, 0x6b, 0xd8);
  561. #undef INTERFACE
  562. #define INTERFACE ID3DXLine
  563. DECLARE_INTERFACE_(ID3DXLine, IUnknown)
  564. {
  565. // IUnknown
  566. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  567. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  568. STDMETHOD_(ULONG, Release)(THIS) PURE;
  569. // ID3DXLine
  570. STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
  571. STDMETHOD(Begin)(THIS) PURE;
  572. STDMETHOD(Draw)(THIS_ CONST D3DXVECTOR2 *pVertexList,
  573. DWORD dwVertexListCount, D3DCOLOR Color) PURE;
  574. STDMETHOD(DrawTransform)(THIS_ CONST D3DXVECTOR3 *pVertexList,
  575. DWORD dwVertexListCount, CONST D3DXMATRIX* pTransform,
  576. D3DCOLOR Color) PURE;
  577. STDMETHOD(SetPattern)(THIS_ DWORD dwPattern) PURE;
  578. STDMETHOD_(DWORD, GetPattern)(THIS) PURE;
  579. STDMETHOD(SetPatternScale)(THIS_ FLOAT fPatternScale) PURE;
  580. STDMETHOD_(FLOAT, GetPatternScale)(THIS) PURE;
  581. STDMETHOD(SetWidth)(THIS_ FLOAT fWidth) PURE;
  582. STDMETHOD_(FLOAT, GetWidth)(THIS) PURE;
  583. STDMETHOD(SetAntialias)(THIS_ BOOL bAntialias) PURE;
  584. STDMETHOD_(BOOL, GetAntialias)(THIS) PURE;
  585. STDMETHOD(SetGLLines)(THIS_ BOOL bGLLines) PURE;
  586. STDMETHOD_(BOOL, GetGLLines)(THIS) PURE;
  587. STDMETHOD(End)(THIS) PURE;
  588. STDMETHOD(OnLostDevice)(THIS) PURE;
  589. STDMETHOD(OnResetDevice)(THIS) PURE;
  590. };
  591. #ifdef __cplusplus
  592. extern "C" {
  593. #endif //__cplusplus
  594. HRESULT WINAPI
  595. D3DXCreateLine(
  596. LPDIRECT3DDEVICE9 pDevice,
  597. LPD3DXLINE* ppLine);
  598. #ifdef __cplusplus
  599. }
  600. #endif //__cplusplus
  601. #endif //__D3DX9CORE_H__