Graphics Reference
In-Depth Information
g_SampleUI.SetLocation(pBackBufferSurfaceDesc->Width - 170,
pBackBufferSurfaceDesc->Height - 350);
g_SampleUI.SetSize(170, 300);
return S_OK;
}
//—————————————————————————————————————————————————————————————————————————
//Handle updates to the scene. This is called regardless of which
//D3D API is used
//—————————————————————————————————————————————————————————————————————————
void CALLBACK OnFrameMove(double fTime, float fElapsedTime,
void* pUserContext)
{
IDirect3DDevice9* pd3dDevice = DXUTGetD3D9Device();
//Update the camera's position based on user input
g_Camera.FrameMove(fElapsedTime);
pd3dDevice->SetTransform(D3DTS_WORLD, g_Camera.GetWorldMatrix());
pd3dDevice->SetTransform(D3DTS_VIEW, g_Camera.GetViewMatrix());
g_pEffect->SetValue(“g_vEyePt”, g_Camera.GetEyePt(),
sizeof(D3DXVECTOR3));
}
//—————————————————————————————————————————————————————————————————————————
//Render the scene using the D3D9 device
//—————————————————————————————————————————————————————————————————————————
void CALLBACK OnFrameRender(IDirect3DDevice9* pd3dDevice, double
fTime, float fElapsedTime, void* pUserContext)
{
//If the settings dialog is being shown, then
//render it instead of rendering the app's scene
if(g_SettingsDlg.IsActive())
{
g_SettingsDlg.OnRender(fElapsedTime);
return;
}
HRESULT hr;
D3DXMATRIXA16 mWorld;
D3DXMATRIXA16 mWorldI;
D3DXMATRIXA16 mView;
D3DXMATRIXA16 mProj;
D3DXMATRIXA16 mWorldViewProjection;
//Clear the render target and the zbuffer
V(pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
D3DCOLOUR_ARGB(0, 0, 0, 0), 1.0f, 0));
//Render the scene
if(SUCCEEDED(pd3dDevice->BeginScene()))
{
#ifdef NETWORK_CONTROL
//Control actions
Search WWH ::




Custom Search