Subversion Repositories Games.Chess Giants

Rev

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

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