add texture
This commit is contained in:
@@ -1,15 +1,23 @@
|
||||
#include "Material.h"
|
||||
#include "Utilities.h"
|
||||
#include "WICTextureLoader9.h"
|
||||
|
||||
UINT Material::init(IDirect3DDevice9* pD3DDevice, LPCTSTR textureFileName)
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user