Here's code:
Code: Select all
class MyMaterialRenderer : public video::IMaterialRenderer
{
public:
MyMaterialRenderer(IDirect3DDevice9* d3ddev, video::IVideoDriver* driver)
: pID3DDevice(d3ddev), Driver(driver)
{
}
~MyMaterialRenderer()
{
}
virtual bool setVariable(bool vertexShader, const c8* name, const f32* floats, int count)
{
os::Printer::log("Invalid material to set variable in.");
return false;
}
virtual void OnSetMaterial(video::SMaterial& material, const video::SMaterial& lastMaterial,
bool resetAllRenderstates, video::IMaterialRendererServices* services)
{
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
{
pID3DDevice->SetTextureStageState (0, D3DTSS_COLOROP, D3DTOP_MODULATE);
pID3DDevice->SetTextureStageState (0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pID3DDevice->SetTextureStageState (0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
pID3DDevice->SetTextureStageState (0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
pID3DDevice->SetTextureStageState (0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
pID3DDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
pID3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
pID3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
}
material.ZWriteEnable = false;
services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
}
virtual bool isTransparent()
{
return true;
}
protected:
IDirect3DDevice9* pID3DDevice;
video::IVideoDriver* Driver;
};
However if I try compile code, I get bunch of compile error messages which relate to IDirect3DDevice9 as it seems to be undefined for compiler.
Howe to correct it? Is it defined in d3d9.h file? ...If yes where can I find that file?37 main.cpp invalid use of undefined type `struct IDirect3DDevice9'
10 irrlicht-1.3\include\SExposedVideoData.h forward declaration of `struct IDirect3DDevice9'
37 main.cpp `D3DTSS_COLOROP' undeclared (first use this function)
37 main.cpp `D3DTOP_MODULATE' undeclared (first use this function)
...and so on...