Graphics Reference
In-Depth Information
V(g_pEffect->Begin(&cPasses, 0));
for(UINT p = 0; p < cPasses; ++p)
{
V(g_pEffect->BeginPass(p));
//set and draw each of the materials in the mesh
for(UINT i = 0; i < g_dwNumMaterials; i++)
{
V(g_pEffect->SetVector(“g_vDiffuse”,
(D3DXVECTOR4*)&g_pMaterials[i].MatD3D.Diffuse));
if(g_ppTextures[i])
{
V(g_pEffect->SetTexture(“g_txScene”, g_ppTextures[i]));
}
else
{
V(g_pEffect->SetTexture(“g_txScene”, g_pDefaultTex));
}
V(g_pEffect->CommitChanges());
g_pMeshEnhanced->DrawSubset(i);
}
V(g_pEffect->EndPass());
}
V(g_pEffect->End());
if(g_bUseHWNPatches)
{
pd3dDevice->SetNPatchMode(0);
}
RenderText();
V(g_HUD.OnRender(fElapsedTime));
V(g_SampleUI.OnRender(fElapsedTime));
V(pd3dDevice->EndScene());
}
#ifdef NETWORK_CONTROL
ds.data[0] = DXUTGetFPS(); //Sending the frame rate to the
Controller
//printf(“My FPS is:%f\n”, ds.data[0]);
#endif
}
//—————————————————————————————————————————————————————————————————————————
//Render the help and statistics text. This function uses the
//ID3DXFont interface for efficient text rendering.
//—————————————————————————————————————————————————————————————————————————
void RenderText()
{
//The helper object simply helps keep track of text position,
//and colour and then it calls pFont->DrawText(m_pSprite, strMsg, -1,
//&rc, DT_NOCLIP, m_clr);
//If NULL is passed in as the sprite object, then it will work
//however the pFont->DrawText() will not be batched together.
//Batching calls will improves performance.
Search WWH ::




Custom Search