24 lines
540 B
C++
24 lines
540 B
C++
#include "Material.h"
|
|
#include "Utilities.h"
|
|
#include "WICTextureLoader9.h"
|
|
|
|
UINT Material::init(IDirect3DDevice9* pD3DDevice, LPCWSTR textureFileName)
|
|
{
|
|
// load texture
|
|
// https://github.com/microsoft/DirectXTex/tree/main/WICTextureLoader
|
|
HRESULT hr = DirectX::CreateWICTextureFromFile(pD3DDevice, textureFileName, &_pTexture);
|
|
CheckFailed(hr, 600);
|
|
|
|
return 0;
|
|
}
|
|
|
|
void Material::render(IDirect3DDevice9* pD3DDevice)
|
|
{
|
|
pD3DDevice->SetTexture(0, _pTexture);
|
|
}
|
|
|
|
void Material::deInit()
|
|
{
|
|
safeRelease(_pTexture);
|
|
}
|