d3dx8effect.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:7k
源码类别:

模拟服务器

开发平台:

C/C++

  1. ///////////////////////////////////////////////////////////////////////////
  2. //
  3. //  Copyright (C) Microsoft Corporation.  All Rights Reserved.
  4. //
  5. //  File:       d3dx8effect.h
  6. //  Content:    D3DX effect types and functions
  7. //
  8. ///////////////////////////////////////////////////////////////////////////
  9. #include "d3dx8.h"
  10. #ifndef __D3DX8EFFECT_H__
  11. #define __D3DX8EFFECT_H__
  12. #define D3DXFX_DONOTSAVESTATE  (1 << 0)
  13. typedef enum _D3DXPARAMETERTYPE
  14. {
  15.     D3DXPT_DWORD        = 0,
  16.     D3DXPT_FLOAT        = 1,
  17.     D3DXPT_VECTOR       = 2,
  18.     D3DXPT_MATRIX       = 3,
  19.     D3DXPT_TEXTURE      = 4,
  20.     D3DXPT_VERTEXSHADER = 5,
  21.     D3DXPT_PIXELSHADER  = 6,
  22.     D3DXPT_CONSTANT     = 7,
  23.     D3DXPT_STRING       = 8,
  24.     D3DXPT_FORCE_DWORD  = 0x7fffffff /* force 32-bit size enum */
  25. } D3DXPARAMETERTYPE;
  26. typedef struct _D3DXEFFECT_DESC
  27. {
  28.     UINT Parameters;
  29.     UINT Techniques;
  30. } D3DXEFFECT_DESC;
  31. typedef struct _D3DXPARAMETER_DESC
  32. {
  33.     LPCSTR Name;
  34.     LPCSTR Index;
  35.     D3DXPARAMETERTYPE Type;
  36. } D3DXPARAMETER_DESC;
  37. typedef struct _D3DXTECHNIQUE_DESC
  38. {
  39.     LPCSTR Name;
  40.     LPCSTR Index;
  41.     UINT   Passes;
  42. } D3DXTECHNIQUE_DESC;
  43. typedef struct _D3DXPASS_DESC
  44. {
  45.     LPCSTR Name;
  46.     LPCSTR Index;
  47. } D3DXPASS_DESC;
  48. //////////////////////////////////////////////////////////////////////////////
  49. // ID3DXEffect ///////////////////////////////////////////////////////////////
  50. //////////////////////////////////////////////////////////////////////////////
  51. typedef interface ID3DXEffect ID3DXEffect;
  52. typedef interface ID3DXEffect *LPD3DXEFFECT;
  53. // {281BBDD4-AEDF-4907-8650-E79CDFD45165}
  54. DEFINE_GUID( IID_ID3DXEffect, 
  55. 0x281bbdd4, 0xaedf, 0x4907, 0x86, 0x50, 0xe7, 0x9c, 0xdf, 0xd4, 0x51, 0x65);
  56. #undef INTERFACE
  57. #define INTERFACE ID3DXEffect
  58. DECLARE_INTERFACE_(ID3DXEffect, IUnknown)
  59. {
  60.     // IUnknown
  61.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  62.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  63.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  64.     // ID3DXEffect
  65.     STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE;
  66.     STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE;
  67.     STDMETHOD(GetParameterDesc)(THIS_ LPCSTR pParameter, D3DXPARAMETER_DESC* pDesc) PURE;
  68.     STDMETHOD(GetTechniqueDesc)(THIS_ LPCSTR pTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE;
  69.     STDMETHOD(GetPassDesc)(THIS_ LPCSTR pTechnique, LPCSTR pPass, D3DXPASS_DESC* pDesc) PURE;
  70.     STDMETHOD(FindNextValidTechnique)(THIS_ LPCSTR pTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE;
  71.     STDMETHOD(CloneEffect)(THIS_ LPDIRECT3DDEVICE8 pDevice, LPD3DXEFFECT* ppEffect) PURE;
  72.     STDMETHOD(GetCompiledEffect)(THIS_ LPD3DXBUFFER* ppCompiledEffect) PURE;
  73.     STDMETHOD(SetTechnique)(THIS_ LPCSTR pTechnique) PURE;
  74.     STDMETHOD(GetTechnique)(THIS_ LPCSTR* ppTechnique) PURE;
  75.     STDMETHOD(SetDword)(THIS_ LPCSTR pParameter, DWORD dw) PURE;
  76.     STDMETHOD(GetDword)(THIS_ LPCSTR pParameter, DWORD* pdw) PURE; 
  77.     STDMETHOD(SetFloat)(THIS_ LPCSTR pParameter, FLOAT f) PURE;
  78.     STDMETHOD(GetFloat)(THIS_ LPCSTR pParameter, FLOAT* pf) PURE;    
  79.     STDMETHOD(SetVector)(THIS_ LPCSTR pParameter, D3DXVECTOR4* pVector) PURE;
  80.     STDMETHOD(GetVector)(THIS_ LPCSTR pParameter, D3DXVECTOR4* pVector) PURE;
  81.     STDMETHOD(SetMatrix)(THIS_ LPCSTR pParameter, D3DXMATRIX* pMatrix) PURE;
  82.     STDMETHOD(GetMatrix)(THIS_ LPCSTR pParameter, D3DXMATRIX* pMatrix) PURE;
  83.     STDMETHOD(SetTexture)(THIS_ LPCSTR pParameter, LPDIRECT3DBASETEXTURE8 pTexture) PURE;
  84.     STDMETHOD(GetTexture)(THIS_ LPCSTR pParameter, LPDIRECT3DBASETEXTURE8 *ppTexture) PURE;
  85.     STDMETHOD(SetVertexShader)(THIS_ LPCSTR pParameter, DWORD Handle) PURE;
  86.     STDMETHOD(GetVertexShader)(THIS_ LPCSTR pParameter, DWORD* pHandle) PURE;
  87.     STDMETHOD(SetPixelShader)(THIS_ LPCSTR pParameter, DWORD Handle) PURE;
  88.     STDMETHOD(GetPixelShader)(THIS_ LPCSTR pParameter, DWORD* pHandle) PURE;
  89.     STDMETHOD(SetString)(THIS_ LPCSTR pParameter, LPCSTR pString) PURE;
  90.     STDMETHOD(GetString)(THIS_ LPCSTR pParameter, LPCSTR* ppString) PURE;
  91.     STDMETHOD_(BOOL, IsParameterUsed)(THIS_ LPCSTR pParameter) PURE;
  92.     STDMETHOD(Validate)(THIS) PURE;
  93.     STDMETHOD(Begin)(THIS_ UINT *pPasses, DWORD Flags) PURE;
  94.     STDMETHOD(Pass)(THIS_ UINT Pass) PURE;
  95.     STDMETHOD(End)(THIS) PURE;
  96.     STDMETHOD(OnLostDevice)(THIS) PURE;
  97.     STDMETHOD(OnResetDevice)(THIS) PURE;
  98. };
  99. //////////////////////////////////////////////////////////////////////////////
  100. // APIs //////////////////////////////////////////////////////////////////////
  101. //////////////////////////////////////////////////////////////////////////////
  102. #ifdef __cplusplus
  103. extern "C" {
  104. #endif //__cplusplus
  105. //----------------------------------------------------------------------------
  106. // D3DXCreateEffect:
  107. // -----------------
  108. // Creates an effect from an ascii or binaray effect description.
  109. //
  110. // Parameters:
  111. //  pDevice
  112. //      Pointer of the device on which to create the effect
  113. //  pSrcFile
  114. //      Name of the file containing the effect description
  115. //  hSrcModule
  116. //      Module handle. if NULL, current module will be used.
  117. //  pSrcResource
  118. //      Resource name in module
  119. //  pSrcData
  120. //      Pointer to effect description
  121. //  SrcDataSize
  122. //      Size of the effect description in bytes
  123. //  ppEffect
  124. //      Returns a buffer containing created effect.
  125. //  ppCompilationErrors
  126. //      Returns a buffer containing any error messages which occurred during
  127. //      compile.  Or NULL if you do not care about the error messages.
  128. //
  129. //----------------------------------------------------------------------------
  130. HRESULT WINAPI
  131.     D3DXCreateEffectFromFileA(
  132.         LPDIRECT3DDEVICE8 pDevice,
  133.         LPCSTR            pSrcFile,
  134.         LPD3DXEFFECT*     ppEffect,
  135.         LPD3DXBUFFER*     ppCompilationErrors);
  136. HRESULT WINAPI
  137.     D3DXCreateEffectFromFileW(
  138.         LPDIRECT3DDEVICE8 pDevice,
  139.         LPCWSTR           pSrcFile,
  140.         LPD3DXEFFECT*     ppEffect,
  141.         LPD3DXBUFFER*     ppCompilationErrors);
  142. #ifdef UNICODE
  143. #define D3DXCreateEffectFromFile D3DXCreateEffectFromFileW
  144. #else
  145. #define D3DXCreateEffectFromFile D3DXCreateEffectFromFileA
  146. #endif
  147. HRESULT WINAPI
  148.     D3DXCreateEffectFromResourceA(
  149.         LPDIRECT3DDEVICE8 pDevice,
  150.         HMODULE           hSrcModule,
  151.         LPCSTR            pSrcResource,
  152.         LPD3DXEFFECT*     ppEffect,
  153.         LPD3DXBUFFER*     ppCompilationErrors);
  154. HRESULT WINAPI
  155.     D3DXCreateEffectFromResourceW(
  156.         LPDIRECT3DDEVICE8 pDevice,
  157.         HMODULE           hSrcModule,
  158.         LPCWSTR           pSrcResource,
  159.         LPD3DXEFFECT*     ppEffect,
  160.         LPD3DXBUFFER*     ppCompilationErrors);
  161. #ifdef UNICODE
  162. #define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceW
  163. #else
  164. #define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceA
  165. #endif
  166. HRESULT WINAPI
  167.     D3DXCreateEffect(
  168.         LPDIRECT3DDEVICE8 pDevice,
  169.         LPCVOID           pSrcData,
  170.         UINT              SrcDataSize,
  171.         LPD3DXEFFECT*     ppEffect,
  172.         LPD3DXBUFFER*     ppCompilationErrors);
  173. #ifdef __cplusplus
  174. }
  175. #endif //__cplusplus
  176. #endif //__D3DX8EFFECT_H__