Game Development Reference
In-Depth Information
LightTexEffect->SetMatrix(ViewMatrixHandle, &V);
//
// Activate the technique and render
//
Device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
0xffffffff, 1.0f, 0);
Device->BeginScene();
// set the technique to use
LightTexEffect->SetTechnique( LightTexTechHandle );
UINT numPasses = 0;
LightTexEffect->Begin(&numPasses, 0);
for(inti=0;i<numPasses; i++)
{
LightTexEffect->Pass(i);
for(intj=0;j<Mtrls.size(); j++)
{
Mesh->DrawSubset(j);
}
}
LightTexEffect->End();
Device->EndScene();
Device->Present(0, 0, 0, 0);
}
return true;
}
19.8 Sample Application: Fog Effect
One of the topics we regret not devoting a chapter to is Direct3D fog.
Fog effects add a new level of realism to the scene and can be used to
simulate certain types of weather conditions. Furthermore, fog can
greatly diminish far-clip plane visual artifacts.
Although we can't give it the attention it deserves, we do squeeze
in a brief fog sample here. Although we do not go into detail, we do
show and explain the Direct3D code, which is fairly intuitive.
Direct3D fog is part of the fixed function pipeline, as is controlled
through render states. The following effect file sets the necessary fog
states for vertex fog.
Note: Direct3D also supports pixel fog (also called table fog), which
is more accurate than vertex fog.
//
// File: fog.txt
//
Search WWH ::




Custom Search