Game Development Reference
In-Depth Information
SpotLightTexHandle,
&SpotLightTexDesc,
&count);
MultiTexCT->GetConstantDesc(
StringTexHandle,
&StringTexDesc,
&count);
MultiTexCT->SetDefaults(Device);
return true;
}
The Display function sets the pixel shader, enables the two textures,
and sets their corresponding sampler states before rendering the quad.
bool Display(float timeDelta)
{
if( Device )
{
// ...camera update code snipped
//
// Render
//
Device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
0xffffffff, 1.0f, 0);
Device->BeginScene();
// set the pixel shader
Device->SetPixelShader(MultiTexPS);
Device->SetFVF(MultiTexVertex::FVF);
Device->SetStreamSource(0, QuadVB, 0, sizeof(MultiTexVertex));
// base tex
Device->SetTexture(BaseTexDesc.RegisterIndex, BaseTex);
Device->SetSamplerState(BaseTexDesc.RegisterIndex,
D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
Device->SetSamplerState(BaseTexDesc.RegisterIndex,
D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
Device->SetSamplerState(BaseTexDesc.RegisterIndex,
D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
// spotlight tex
Device->SetTexture(SpotLightTexDesc.RegisterIndex, SpotLightTex);
Device->SetSamplerState(SpotLightTexDesc.RegisterIndex,
D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
Device->SetSamplerState(SpotLightTexDesc.RegisterIndex,
D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
Device->SetSamplerState(SpotLightTexDesc.RegisterIndex,
D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
// string tex
Device->SetTexture( StringTexDesc.RegisterIndex, StringTex);
Device->SetSamplerState(StringTexDesc.RegisterIndex,
D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
Search WWH ::




Custom Search