#ifndef D3DTextureItem_h_
#define D3DTextureItem_h_
#if defined(D3D9_SUPPORTED)
#include <maya/MObjectHandle.h>
#include <maya/MMessage.h>
#include <list>
#include <d3d9.h>
#include <d3dx9.h>
class D3DTexture
{
public:
{
mipFilter = magFilter = minFilter = D3DTEXF_LINEAR;
wrapU = D3DRS_WRAP0;
wrapV = D3DRS_WRAP1;
wrapW = D3DRS_WRAP2;
}
inline ~D3DTexture() { Release(); }
void Populate(
MObject MayaTextureNode) { Release(); MayaTexture = MayaTextureNode; }
void Release() { if( HwTexture) { HwTexture->Release(); HwTexture = NULL; } }
inline MObject Node()
const {
return MayaTexture; }
inline LPDIRECT3DTEXTURE9 Texture( LPDIRECT3DDEVICE9 D3D) { if( !HwTexture) Bind( D3D); return HwTexture; }
void setTextureState( LPDIRECT3DDEVICE9 D3D );
D3DTEXTUREFILTERTYPE minFilter;
D3DTEXTUREFILTERTYPE magFilter;
D3DTEXTUREFILTERTYPE mipFilter;
D3DRENDERSTATETYPE wrapU;
D3DRENDERSTATETYPE wrapV;
D3DRENDERSTATETYPE wrapW;
private:
void Bind( LPDIRECT3DDEVICE9 D3D);
LPDIRECT3DTEXTURE9 HwTexture;
};
struct TextureItem {
D3DTexture* m_texture;
MCallbackId m_objectDeleteMonitor;
MCallbackId m_objectChangeMonitor;
};
typedef std::list<TextureItem*> TextureItemList;
#endif
#endif