예제 #1
0
	void D3D9Texture::createHardwareResource()
	{
		IDirect3DDevice9* dev = mFatherManager->getAs<D3D9TextureManager>()
			->getD3DResourceFactory()->getMainDevice();

		// release created resources.
		releaseHardwareResource();
		D3DFORMAT texFormat = (mFormat == PF_Unknown) ? D3DFMT_A8R8G8B8 : D3D9Translator::getD3DFormat(mFormat);
		uint32 mipmap = mMipMapCount == MIPMAP_MAXCOUNT ? 0 : mMipMapCount + 1;
		if (mType == TT_1D || mType == TT_2D)
		{
			dev->CreateTexture(mWidth, mHeight, mipmap, 0,
				texFormat, D3DPOOL_MANAGED, &mTexture.p2DTexture, NULL);
			mTexture.pBaseTexture = mTexture.p2DTexture;
		}
		else if (mType == TT_3D)
		{
			dev->CreateVolumeTexture(mWidth, mHeight, mDepth, mipmap, 0, 
				texFormat, D3DPOOL_MANAGED, &mTexture.p3DTexture, NULL);
			mTexture.pBaseTexture = mTexture.p3DTexture;
		}
		else
		{
			dev-> CreateCubeTexture(mWidth, mipmap, 0,
				texFormat, D3DPOOL_MANAGED, &mTexture.pCubeTexture, NULL);
			mTexture.pBaseTexture = mTexture.pCubeTexture;
		}

		createSurfaceList();
		mTextureConstant = DGpuTextureConstantPtr(new D3D9GpuTextureConstant(mTexture.pBaseTexture));
	}
void Table::createAllLists(){
	createLegList();
	createSurfaceList();
}