Switching on dynamic lighting for EMT_SOLID_2_LAYER?
Posted: Wed May 17, 2006 9:24 am
Hi,
I have looked into the source code of the file C3D9MaterialRenderer.h and wanted to modify the shader properties for the material EMT_SOLID_2_LAYER. I want to have the material being lit by dynamic light. By default, the material ignores the material flag EMF_LIGHTING = true. The material blends to textures based on the vertex alpha of the first texture. The source code that comes with irrlicht is the following:
I wanted to add the following line according to the directx9 documentation, but it didn't have any effect. Probably because this parameter is true by default.
Does anyone of you know how I could switch on dynamic light?
I have looked into the source code of the file C3D9MaterialRenderer.h and wanted to modify the shader properties for the material EMT_SOLID_2_LAYER. I want to have the material being lit by dynamic light. By default, the material ignores the material flag EMF_LIGHTING = true. The material blends to textures based on the vertex alpha of the first texture. The source code that comes with irrlicht is the following:
Code: Select all
//! Solid 2 layer material renderer
class CD3D9MaterialRenderer_SOLID_2_LAYER : public CD3D9MaterialRenderer
{
public:
CD3D9MaterialRenderer_SOLID_2_LAYER(IDirect3DDevice9* p, video::IVideoDriver* d)
: CD3D9MaterialRenderer(p, d) {}
virtual void OnSetMaterial(SMaterial& material, const SMaterial& lastMaterial,
bool resetAllRenderstates, IMaterialRendererServices* services)
{
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
{
pID3DDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
pID3DDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pID3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
pID3DDevice->SetTextureStageState( 1, D3DTSS_TEXCOORDINDEX, 0);
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_BLENDDIFFUSEALPHA);
pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
}
services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
}
};
Code: Select all
//added by Robert
pID3DDevice->SetRenderState(D3DRS_LIGHTING, TRUE);