#include "d3dx8.h"

#ifndef _D3DX8EFFECT_H
#define _D3DX8EFFECT_H

/* D3DX effect types and functions */

#ifndef __PODX8API
#if __POCC__ >= 274
#define __PODX8API  __declspec(dllimport)
#else
#define __PODX8API
#endif
#endif /* __PODX8API */

#define D3DXFX_DONOTSAVESTATE  (1<<0)

typedef enum _D3DXPARAMETERTYPE {
    D3DXPT_DWORD = 0,
    D3DXPT_FLOAT = 1,
    D3DXPT_VECTOR = 2,
    D3DXPT_MATRIX = 3,
    D3DXPT_TEXTURE = 4,
    D3DXPT_VERTEXSHADER = 5,
    D3DXPT_PIXELSHADER = 6,
    D3DXPT_CONSTANT = 7,
    D3DXPT_STRING = 8,
    D3DXPT_FORCE_DWORD = 0x7fffffff
} D3DXPARAMETERTYPE;

typedef struct _D3DXEFFECT_DESC {
    UINT Parameters;
    UINT Techniques;
} D3DXEFFECT_DESC;

typedef struct _D3DXPARAMETER_DESC {
    LPCSTR Name;
    LPCSTR Index;
    D3DXPARAMETERTYPE Type;
} D3DXPARAMETER_DESC;

typedef struct _D3DXTECHNIQUE_DESC {
    LPCSTR Name;
    LPCSTR Index;
    UINT   Passes;
} D3DXTECHNIQUE_DESC;

typedef struct _D3DXPASS_DESC {
    LPCSTR Name;
    LPCSTR Index;
} D3DXPASS_DESC;

typedef interface ID3DXEffect ID3DXEffect;
typedef interface ID3DXEffect *LPD3DXEFFECT;

DEFINE_GUID(IID_ID3DXEffect,0x648b1ceb,0x8d4e,0x4d66,0xb6,0xfa,0xe4,0x49,0x69,0xe8,0x2e,0x89);

#undef INTERFACE
#define INTERFACE ID3DXEffect
DECLARE_INTERFACE_(ID3DXEffect, IUnknown)
{
    STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE;
    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
    STDMETHOD_(ULONG, Release)(THIS) PURE;
    STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8*) PURE;
    STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC*) PURE;
    STDMETHOD(GetParameterDesc)(THIS_ LPCSTR,D3DXPARAMETER_DESC*) PURE;
    STDMETHOD(GetTechniqueDesc)(THIS_ LPCSTR,D3DXTECHNIQUE_DESC*) PURE;
    STDMETHOD(GetPassDesc)(THIS_ LPCSTR,LPCSTR,D3DXPASS_DESC*) PURE;
    STDMETHOD(FindNextValidTechnique)(THIS_ LPCSTR,D3DXTECHNIQUE_DESC*) PURE;
    STDMETHOD(CloneEffect)(THIS_ LPDIRECT3DDEVICE8,LPD3DXEFFECT*) PURE;
    STDMETHOD(GetCompiledEffect)(THIS_ LPD3DXBUFFER*) PURE;
    STDMETHOD(SetTechnique)(THIS_ LPCSTR) PURE;
    STDMETHOD(GetTechnique)(THIS_ LPCSTR*) PURE;
    STDMETHOD(SetDword)(THIS_ LPCSTR,DWORD) PURE;
    STDMETHOD(GetDword)(THIS_ LPCSTR,DWORD*) PURE;
    STDMETHOD(SetFloat)(THIS_ LPCSTR,FLOAT) PURE;
    STDMETHOD(GetFloat)(THIS_ LPCSTR,FLOAT*) PURE;
    STDMETHOD(SetVector)(THIS_ LPCSTR,D3DXVECTOR4*) PURE;
    STDMETHOD(GetVector)(THIS_ LPCSTR,D3DXVECTOR4*) PURE;
    STDMETHOD(SetMatrix)(THIS_ LPCSTR,D3DXMATRIX*) PURE;
    STDMETHOD(GetMatrix)(THIS_ LPCSTR,D3DXMATRIX*) PURE;
    STDMETHOD(SetTexture)(THIS_ LPCSTR,LPDIRECT3DBASETEXTURE8) PURE;
    STDMETHOD(GetTexture)(THIS_ LPCSTR,LPDIRECT3DBASETEXTURE8*) PURE;
    STDMETHOD(SetVertexShader)(THIS_ LPCSTR,DWORD) PURE;
    STDMETHOD(GetVertexShader)(THIS_ LPCSTR,DWORD*) PURE;
    STDMETHOD(SetPixelShader)(THIS_ LPCSTR,DWORD) PURE;
    STDMETHOD(GetPixelShader)(THIS_ LPCSTR,DWORD*) PURE;
    STDMETHOD(SetString)(THIS_ LPCSTR,LPCSTR) PURE;
    STDMETHOD(GetString)(THIS_ LPCSTR,LPCSTR*) PURE;
    STDMETHOD_(BOOL, IsParameterUsed)(THIS_ LPCSTR) PURE;
    STDMETHOD(Validate)(THIS) PURE;
    STDMETHOD(Begin)(THIS_ UINT*,DWORD) PURE;
    STDMETHOD(Pass)(THIS_ UINT) PURE;
    STDMETHOD(End)(THIS) PURE;
    STDMETHOD(OnLostDevice)(THIS) PURE;
    STDMETHOD(OnResetDevice)(THIS) PURE;
};

#ifdef __cplusplus
extern "C" {
#endif

__PODX8API HRESULT WINAPI D3DXCreateEffectFromFileA(LPDIRECT3DDEVICE8,LPCSTR,LPD3DXEFFECT*,LPD3DXBUFFER*);
__PODX8API HRESULT WINAPI D3DXCreateEffectFromFileW(LPDIRECT3DDEVICE8,LPCWSTR,LPD3DXEFFECT*,LPD3DXBUFFER*);
__PODX8API HRESULT WINAPI D3DXCreateEffectFromResourceA(LPDIRECT3DDEVICE8,HMODULE,LPCSTR,LPD3DXEFFECT*,LPD3DXBUFFER*);
__PODX8API HRESULT WINAPI D3DXCreateEffectFromResourceW(LPDIRECT3DDEVICE8,HMODULE,LPCWSTR,LPD3DXEFFECT*,LPD3DXBUFFER*);
__PODX8API HRESULT WINAPI D3DXCreateEffect(LPDIRECT3DDEVICE8,LPCVOID,UINT,LPD3DXEFFECT*,LPD3DXBUFFER*);

#ifdef UNICODE
#define D3DXCreateEffectFromFile D3DXCreateEffectFromFileW
#define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceW
#else
#define D3DXCreateEffectFromFile D3DXCreateEffectFromFileA
#define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceA
#endif

#ifdef __cplusplus
}
#endif

#endif /* _D3DX8EFFECT_H */
