Graphics Reference
In-Depth Information
//Determine which encoding modes this device can support
IDirect3D9* pD3D = DXUTGetD3D9Object();
DXUTDeviceSettings settings = DXUTGetDeviceSettings();
LoadCubeTexture(g_CubeTextures[0]);
V_RETURN(g_Skybox.OnCreateDevice(pd3dDevice, 50, g_pCubeTexture,
L”skybox.fx”));
//Create the 1x1 white default texture
V_RETURN(pd3dDevice->CreateTexture(1, 1, 1, 0, D3DFMT_A8R8G8B8,
D3DPOOL_MANAGED, &g_pDefaultTex, NULL));
D3DLOCKED_RECT lr;
V_RETURN(g_pDefaultTex->LockRect(0, &lr, NULL, 0));
*(LPDWORD)lr.pBits = D3DCOLOUR_RGBA(255, 255, 255, 255);
V_RETURN(g_pDefaultTex->UnlockRect(0));
//Setup the camera's view parameters
D3DXVECTOR3 vecEye(0.0f, 0.0f, -5.0f);
D3DXVECTOR3 vecAt (0.0f, 0.0f, -0.0f);
g_Camera.SetViewParams(&vecEye, &vecAt);
return S_OK;
}
//—————————————————————————————————————————————————————————————————————————
//Create any D3D9 resources that won't live through a device reset
//(D3DPOOL_DEFAULT) or that are tied to the back buffer size
//—————————————————————————————————————————————————————————————————————————
HRESULT CALLBACK OnResetDevice(IDirect3DDevice9* pd3dDevice,
const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext)
{
HRESULT hr;
int i = 0;
V_RETURN(g_DialogResourceManager.OnD3D9ResetDevice());
V_RETURN(g_SettingsDlg.OnD3D9ResetDevice());
g_Skybox.OnResetDevice(pBackBufferSurfaceDesc);
if(g_pFont)
V_RETURN(g_pFont->OnResetDevice());
if(g_pEffect)
V_RETURN(g_pEffect->OnResetDevice());
D3DFORMAT fmt = D3DFMT_UNKNOWN;
switch(g_eEncodingMode)
{
case FP16:
fmt = D3DFMT_A16B16G16R16F; break;
case FP32:
fmt = D3DFMT_A16B16G16R16F; break;
case RGBE8:
fmt = D3DFMT_A8R8G8B8; break;
case RGB16:
fmt = D3DFMT_A16B16G16R16; break;
}
Search WWH ::




Custom Search