本文整理汇总了C++中LPDIRECT3DDEVICE9::CreateCubeTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DDEVICE9::CreateCubeTexture方法的具体用法?C++ LPDIRECT3DDEVICE9::CreateCubeTexture怎么用?C++ LPDIRECT3DDEVICE9::CreateCubeTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECT3DDEVICE9
的用法示例。
在下文中一共展示了LPDIRECT3DDEVICE9::CreateCubeTexture方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateShadowMap
void DXPointLight::CreateShadowMap(LPDIRECT3DDEVICE9 device, DWORD type, DWORD size)
{
HRESULT hr;
DXLight::CreateShadowMap(device, type, size);
hr = device->CreateCubeTexture(size, 1, D3DUSAGE_RENDERTARGET, D3DFMT_G32R32F, D3DPOOL_DEFAULT, &shadowmap, NULL);
if( SUCCEEDED(hr) )
hr = device->CreateCubeTexture(size, 1, D3DUSAGE_RENDERTARGET, D3DFMT_G32R32F, D3DPOOL_DEFAULT, &blur, NULL);
if( FAILED(hr) )
{
if( shadowmap )
shadowmap->Release();
shadowmap = blur = NULL;
}
if( !blurdeclforpoint )
{
D3DVERTEXELEMENT9 elem[] =
{
{ 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
{ 0, 16, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },
D3DDECL_END()
};
device->CreateVertexDeclaration(elem, &blurdeclforpoint);
}
else
blurdeclforpoint->AddRef();
}
示例2:
HRESULT HookIDirect3DDevice9::CreateCubeTexture(LPVOID _this,
UINT EdgeLength,
UINT Levels,
DWORD Usage,
D3DFORMAT Format,
D3DPOOL Pool,
IDirect3DCubeTexture9** ppCubeTexture,
HANDLE* pSharedHandle)
{
LOG_API();
return pD3Dev->CreateCubeTexture(EdgeLength, Levels, Usage, Format, Pool, ppCubeTexture, pSharedHandle);
}
示例3: CreateNormalizationCubeMap
bool Lighting::CreateNormalizationCubeMap(LPDIRECT3DDEVICE9 Device,
unsigned long Size)
{
HRESULT Hr;
unsigned long i,x,y;
LPDIRECT3DSURFACE9 CubeMapFace;
D3DXVECTOR3 N;
float W,H;
unsigned long *Pixel;
D3DLOCKED_RECT Lock;
if(FAILED(Hr = Device->CreateCubeTexture(Size,1,0,D3DFMT_X8R8G8B8,
D3DPOOL_MANAGED,&m_CubeNormal,NULL)))
{
return(false);
}
for(i=0; i < 6; i++)
{
m_CubeNormal->GetCubeMapSurface((D3DCUBEMAP_FACES)i,0,&CubeMapFace);
Hr = CubeMapFace->LockRect(&Lock,NULL,0);
if(FAILED(Hr))
{
return(false);
}
Pixel = (unsigned long *)Lock.pBits;
for(y = 0; y < Size; y++)
{
H = (float)y / (float)(Size - 1);
H = (H * 2.0f) - 1.0f;
for(x = 0; x < Size; x++)
{
W = (float)x / (float)(Size - 1);
W = (W * 2.0f) - 1.0f;
switch(i)
{
case D3DCUBEMAP_FACE_POSITIVE_X:
N.x = +1.0f;
N.y = -H;
N.z = -W;
break;
case D3DCUBEMAP_FACE_NEGATIVE_X:
N.x = -1.0f;
N.y = -H;
N.z = +W;
break;
case D3DCUBEMAP_FACE_POSITIVE_Y:
N.x = +W;
N.y = +1.0f;
N.z = +H;
break;
case D3DCUBEMAP_FACE_NEGATIVE_Y:
N.x = +W;
N.y = -1.0f;
N.z = -H;
break;
case D3DCUBEMAP_FACE_POSITIVE_Z:
N.x = +W;
N.y = -H;
N.z = +1.0f;
break;
case D3DCUBEMAP_FACE_NEGATIVE_Z:
N.x = -W;
N.y = -H;
N.z = -1.0f;
break;
}
D3DXVec3Normalize(&N,&N);
*Pixel++ = VectorToRGBA(&N);
}
}
CubeMapFace->UnlockRect();
CubeMapFace->Release();
}
return(true);
}