Graphics Reference
In-Depth Information
void LoadCubeTexture(LPCWSTR FileName)
{
WCHAR strPath[MAX_PATH];
DXUTFindDXSDKMediaFileCch(strPath, MAX_PATH, FileName);
IDirect3DCubeTexture9* cubeTexture;
D3DXCreateCubeTextureFromFileEx(g_pd3dDevice, strPath, D3DX_DEFAULT,
1, 0, D3DFMT_A16B16G16R16F, D3DPOOL_MANAGED, D3DX_FILTER_NONE,
D3DX_FILTER_NONE, 0, NULL, NULL, &cubeTexture);
SAFE_RELEASE(g_pCubeTexture);
g_pCubeTexture = cubeTexture;
}
inline float GaussianDistribution(float x, float y, float rho)
{
float g = 1.0f/sqrtf(2.0f * D3DX_PI * rho * rho);
g * = expf(-(x * x + y * y)/(2 * rho * rho));
return g;
}
//Auxiliary helper functions
inline int log2_ceiling(float val)
{
int iMax = 256;
int iMin = 0;
while(iMax - iMin > 1)
{
int iMiddle = (iMax + iMin)/2;
if(val > g_aPowsOfTwo[iMiddle])
iMin = iMiddle;
else
iMax = iMiddle;
}
return iMax - 128;
}
inline VOID EncodeRGBE8(D3DXFLOAT16* pSrc, BYTE** ppDest)
{
FLOAT r, g, b;
r = (FLOAT)*(pSrc + 0);
g = (FLOAT)*(pSrc + 1);
b = (FLOAT)*(pSrc + 2);
//Determine the largest colour component
float maxComponent = max(max(r, g), b);
Search WWH ::




Custom Search