Graphics Reference
In-Depth Information
//For each scale stage, create a texture to hold the intermediate
//results of the luminance calculation
int nSampleLen = 1;
for(i = 0; i < NUM_TONEMAP_TEXTURES; i++)
{
fmt = D3DFMT_UNKNOWN;
switch(g_eEncodingMode)
{
case FP16:
fmt = D3DFMT_R16F; break;
case FP32:
fmt = D3DFMT_R32F; break;
case RGBE8:
fmt = D3DFMT_A8R8G8B8; break;
case RGB16:
fmt = D3DFMT_A16B16G16R16; break;
}
hr = pd3dDevice->CreateTexture(nSampleLen, nSampleLen, 1,
D3DUSAGE_RENDERTARGET, fmt, D3DPOOL_DEFAULT, &g_apTexToneMap[i], NULL);
if(FAILED(hr))
return hr;
nSampleLen * = 3;
}
//Create the temporary blooming effect textures
for(i = 0; i < NUM_BLOOM_TEXTURES; i++)
{
hr = pd3dDevice->CreateTexture(pBackBufferSurfaceDesc->Width/8,
pBackBufferSurfaceDesc->Height/8, 1, D3DUSAGE_RENDERTARGET,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &g_apTexBloom[i], NULL);
if(FAILED(hr))
return hr;
}
//Create a sprite to help batch calls when drawing many lines of text
V_RETURN(D3DXCreateSprite(pd3dDevice, &g_pTextSprite));
V_RETURN(GenerateEnhancedMesh(pd3dDevice, g_dwNumSegs));
if(g_bWireframe)
pd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
else
pd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
//Setup the camera's projection parameters
float fAspectRatio = pBackBufferSurfaceDesc->Width/(FLOAT)
pBackBufferSurfaceDesc->Height;
g_Camera.SetProjParams(D3DX_PI/4, fAspectRatio, 0.1f, 1000.0f);
g_Camera.SetWindow(pBackBufferSurfaceDesc->Width,
pBackBufferSurfaceDesc->Height);
g_HUD.SetLocation(pBackBufferSurfaceDesc->Width - 170, 0);
g_HUD.SetSize(170, 170);
Search WWH ::




Custom Search