volumecreator.cpp

来自「java实现的简单的分形树。简单易学!是学习分形知识的很好的例子。其java语法」· C++ 代码 · 共 40 行

CPP
40
字号
// --------------------------------------------------------------------------
// Dingus project - a collection of subsystems for game/graphics applications
// --------------------------------------------------------------------------
#include "stdafx.h"

#include "VolumeCreator.h"
#include "../utils/Errors.h"
#include "../kernel/D3DDevice.h"
#include "../console/Console.h"

using namespace dingus;


IDirect3DVolumeTexture9* CFixedVolumeCreator::createTexture()
{
	IDirect3DDevice9& dxdev = CD3DDevice::getInstance().getDevice();
	HRESULT hr;
	IDirect3DVolumeTexture9* texture = NULL;

	// adjust params
	UINT width = mWidth;
	UINT height = mHeight;
	UINT depth = mDepth;
	UINT levels = mLevels;
	D3DFORMAT fmt = getFormat();
	D3DXCheckVolumeTextureRequirements( &dxdev, &width, &height, &depth, &levels, getUsage(), &fmt, getPool() );
	
	hr = CD3DDevice::getInstance().getDevice().CreateVolumeTexture(
		width, height, depth, levels,
		getUsage(), fmt, getPool(),
		&texture, NULL );
	if( FAILED( hr ) ) {
		std::string msg = "failed to create volume texture";
		CConsole::CON_ERROR.write(msg);
		THROW_DXERROR( hr, msg );
	}
	assert( texture );
	return texture;
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?