[fix] OcclusionQuery

[add] Client Door and Window Instance
[add] Resource Manager
This commit is contained in:
Chanbin Kim
2025-12-04 12:43:44 +09:00
parent a7e6e8a189
commit 4274dadd86
20 changed files with 385 additions and 94 deletions
+9 -36
View File
@@ -2,6 +2,8 @@
#include "Texture.h"
#include "Shader.h"
#include "GameInstance.h"
CTexture::CTexture(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: CComponent(pDevice, pContext)
{
@@ -89,39 +91,14 @@ HRESULT CTexture::Initialize(void* pArg)
HRESULT CTexture::Load_SRV(const _char* szPath, ID3D11ShaderResourceView** ppSRV)
{
*ppSRV = nullptr;
_char szTextureFileName[MAX_PATH] = {};
_char szTextureFilePath[MAX_PATH] = {};
_char szDrive[MAX_PATH] = {};
_char szDir[MAX_PATH] = {};
_char szFileName[MAX_PATH] = {};
_char szEXT[MAX_PATH] = {};
_splitpath_s(szPath, szDrive, MAX_PATH, szDir, MAX_PATH, szFileName, MAX_PATH, szEXT, MAX_PATH);
strcpy_s(szTextureFileName, szDrive);
strcat_s(szTextureFileName, szDir);
strcat_s(szTextureFileName, szFileName);
ID3D11ShaderResourceView* pSRV = m_pGameInstance->Add_Resource(szPath);
strcat_s(szTextureFilePath, szTextureFileName);
strcat_s(szTextureFilePath, ".dds");
if (nullptr == pSRV)
return E_FAIL;
HRESULT hr = {};
*ppSRV = pSRV;
hr = CreateDDSTextureFromFile(m_pDevice, CMyTools::ToWstring(szTextureFilePath).c_str(), nullptr, ppSRV, 1024); // 일단 dds로 시도하고
if (FAILED(hr)) {
memset(szTextureFilePath, 0, sizeof(_char) * MAX_PATH); // 실패하면 원래 확장자로 다시 시도
strcat_s(szTextureFilePath, szTextureFileName);
strcat_s(szTextureFilePath, szEXT);
if (false == strcmp(".tga", szEXT)) {
assert(false); // trying to Load TGA
hr = S_OK;
}
else {
hr = CreateWICTextureFromFile(m_pDevice, CMyTools::ToWstring(szTextureFilePath).c_str(), nullptr, ppSRV);
}
}
return hr;
return S_OK;
}
HRESULT CTexture::ParseTextureIncrementalToSRVs(_uint iNumTextures, const _tchar* pTextureFilePath)
@@ -182,15 +159,11 @@ HRESULT CTexture::ParseTexturePathToSRVs(const _tchar* pTextureFolderPath)
HRESULT hr;
for (const auto& filePath : files)
{
hr = CreateDDSTextureFromFile(m_pDevice, filePath.c_str(), nullptr, &pSRV);
if (FAILED(hr)) {
hr = CreateWICTextureFromFile(m_pDevice, filePath.c_str(), nullptr, &pSRV);
}
hr = Load_SRV(CMyTools::ToString(filePath).c_str(), &pSRV);
if (FAILED(hr)) {
return hr;
return E_FAIL;
}
m_SRVs.push_back(pSRV);
}