当前位置: 首页>>代码示例>>C++>>正文


C++ LPDIRECT3DDEVICE9::CreateCubeTexture方法代码示例

本文整理汇总了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();
}
开发者ID:m10914,项目名称:tbill,代码行数:32,代码来源:Lights.cpp

示例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);
}
开发者ID:zxmarcos,项目名称:bg4t_monitor,代码行数:12,代码来源:D3DWrapper.cpp

示例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);

}
开发者ID:artemeliy,项目名称:inf4715,代码行数:97,代码来源:Lighting.cpp


注:本文中的LPDIRECT3DDEVICE9::CreateCubeTexture方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。