Merge branch 'Develope' into Bloom

This commit is contained in:
kimnuri
2025-12-04 15:03:22 +09:00
35 changed files with 601 additions and 165 deletions
@@ -211,6 +211,7 @@ call Update_Lib.bat
<ClCompile Include="..\private\QuadTree.cpp" />
<ClCompile Include="..\private\OcclusionQuery.cpp" />
<ClCompile Include="..\Private\Renderer_Declare.cpp" />
<ClCompile Include="..\private\Resource_Manager.cpp" />
<ClCompile Include="..\Private\RigidBody_Dynamic_Joint.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
@@ -428,6 +429,7 @@ call Update_Lib.bat
<ClInclude Include="..\public\FSM.h" />
<ClInclude Include="..\public\QuadTree.h" />
<ClInclude Include="..\public\OcclusionQuery.h" />
<ClInclude Include="..\public\Resource_Manager.h" />
<ClInclude Include="..\Public\RigidBody_Dynamic_Joint.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
@@ -49,9 +49,6 @@
<Filter Include="03.Management\00.GameObject_Manager">
<UniqueIdentifier>{1cc7e2f7-559a-4b58-9e84-bbfafb84f81c}</UniqueIdentifier>
</Filter>
<Filter Include="03.Management\02.Asset_Manager">
<UniqueIdentifier>{685d2cc6-b29a-4018-b72f-d66a2807463d}</UniqueIdentifier>
</Filter>
<Filter Include="02.Element\00.Level">
<UniqueIdentifier>{beb918fe-e798-41b2-8076-6d0cbc525ada}</UniqueIdentifier>
</Filter>
@@ -295,6 +292,9 @@
<Filter Include="01.Utility\07.Fog">
<UniqueIdentifier>{d566d9e6-6183-48dc-a196-25fd47a10c48}</UniqueIdentifier>
</Filter>
<Filter Include="03.Management\02.Resource_Manager">
<UniqueIdentifier>{685d2cc6-b29a-4018-b72f-d66a2807463d}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\Private\Base.cpp">
@@ -561,6 +561,9 @@
<ClCompile Include="..\Private\Renderer_Declare.cpp">
<Filter>01.Utility\01.Renderer</Filter>
</ClCompile>
<ClCompile Include="..\private\Resource_Manager.cpp">
<Filter>03.Management\02.Resource_Manager</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Public\Base.h">
@@ -1193,6 +1196,9 @@
<ClInclude Include="..\Public\Renderer.h">
<Filter>01.Utility\01.Renderer</Filter>
</ClInclude>
<ClInclude Include="..\public\Resource_Manager.h">
<Filter>03.Management\02.Resource_Manager</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\Public\Assimp\color4.inl">
@@ -18,6 +18,7 @@
#include "PhysX_Manager.h"
#include "ThreadHolder.h"
#include "Fog.h"
#include "Resource_Manager.h"
IMPLEMENT_SINGLETON(CGameInstance)
@@ -108,6 +109,11 @@ HRESULT CGameInstance::Initialize_Engine(const ENGINE_DESC& EngineDesc, ID3D11De
return E_FAIL;
}
m_pResource_Manager = CResource_Manager::Create(*ppDevice, 500);
if (nullptr == m_pResource_Manager) {
return E_FAIL;
}
return S_OK;
}
@@ -783,6 +789,10 @@ HRESULT CGameInstance::Bind_FogValue(class CShader* pShader)
{
return m_pFog->Bind_FogValue(pShader);
}
ID3D11ShaderResourceView* CGameInstance::Add_Resource(const _char* pFilePath)
{
return m_pResource_Manager->Add_Texture(pFilePath);
}
#pragma endregion // FOG
bool CGameInstance::Key_Pressing(int _iKey)
@@ -910,6 +920,7 @@ void CGameInstance::Release_Engine()
SAFE_RELEASE(m_pLevel_Manager);
SAFE_RELEASE(m_pPrototype_Manager);
SAFE_RELEASE(m_pLight_Manager); // Light Manager�� m_pObject_Manager ���� ���� �ҷ�����
SAFE_RELEASE(m_pResource_Manager);
SAFE_RELEASE(m_pGraphic_Device);
}
+2 -7
View File
@@ -536,15 +536,10 @@ HRESULT CMaterial::Initialize(const _char* pModelFilePath, const SaveMaterial& _
const char* ext = strrchr(szFullPath, '.');
if (ext)
{
if (strcmp(ext, ".dds") == 0)
hr = CreateDDSTextureFromFile(m_pDevice, szPerfectPath, nullptr, &pSRV);
else if (strcmp(ext, ".tga") == 0)
hr = S_OK;
else
hr = CreateWICTextureFromFile(m_pDevice, szPerfectPath, nullptr, &pSRV);
pSRV = m_pGameInstance->Add_Resource(szFullPath);
}
if (FAILED(hr)) {
if (nullptr == pSRV) {
return E_FAIL;
}
m_SRVs[type].push_back(pSRV);
@@ -13,34 +13,27 @@ COcclusionQuery::COcclusionQuery(const COcclusionQuery& rhs)
void COcclusionQuery::Begin_Query()
{
if(0 == m_iCheckFrame)
m_pContext->Begin(m_pQuery[0]);
m_pContext->Begin(m_pQuery[m_iCheckFrame]);
}
_bool COcclusionQuery::isDraw()
{
bool bVisible = m_bPreFrameDraw;
if (++m_iCheckFrame >= 5)
_uint iIndex = (m_iCheckFrame + 3) % 5;
UINT64 iSampleCount = 0;
HRESULT hr = m_pContext->GetData(
m_pQuery[iIndex],
&iSampleCount,
sizeof(UINT64),
D3D11_ASYNC_GETDATA_DONOTFLUSH
);
if (hr == S_OK)
{
UINT64 iSampleCount = 0;
HRESULT hr = m_pContext->GetData(
m_pQuery[0],
&iSampleCount,
sizeof(UINT64),
D3D11_ASYNC_GETDATA_DONOTFLUSH
);
m_iCheckFrame = 0;
if (hr == S_OK)
{
bVisible = (iSampleCount > 0);
bVisible = (iSampleCount > 0);
}
else
return m_bPreFrameDraw;
}
else
return m_bPreFrameDraw;
@@ -52,10 +45,10 @@ _bool COcclusionQuery::isDraw()
void COcclusionQuery::End_Query()
{
if (0 == m_iCheckFrame)
m_pContext->End(m_pQuery[0]);
m_pContext->End(m_pQuery[m_iCheckFrame++]);
if (5 <= m_iCheckFrame)
m_iCheckFrame = 0;
}
HRESULT COcclusionQuery::Initialize_Prototype()
@@ -93,6 +93,10 @@ void CRenderer::Render_PreShadow()
void CRenderer::Render_Occlusion()
{
if (FAILED(m_pGameInstance->Begin_MRT_NonClear(TEXT("MRT_Combined")))) {
return;
}
m_RenderObjects[ENUM_CLASS(RENDER::OCCLUSION)].sort([](CGameObject* pSour, CGameObject* pDest)->_bool {
return pSour->Get_Depth() < pDest->Get_Depth();
});
@@ -109,6 +113,10 @@ void CRenderer::Render_Occlusion()
}
m_RenderObjects[ENUM_CLASS(RENDER::OCCLUSION)].clear();
if (FAILED(m_pGameInstance->End_MRT())) {
return;
}
}
void CRenderer::Render_Priority()
@@ -196,7 +196,7 @@ HRESULT CRenderer::Initialize()
return E_FAIL;
}
/* Target_Shadow_Near */
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Shadow_Near"), (_uint)g_iMaxShadowWidth, (_uint)g_iMaxShadowHeight,
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Shadow_Near"), (_uint)g_iMaxShadowWidth >> 2, (_uint)g_iMaxShadowHeight >> 2,
DXGI_FORMAT_R32_FLOAT, _float4(1.f, 1.f, 1.f, 1.f)))) {
return E_FAIL;
}
@@ -0,0 +1,122 @@
#include "pch.h"
#include "Resource_Manager.h"
CResource_Manager::CResource_Manager(ID3D11Device* pDevice)
:m_pDevice{ pDevice }
{
SAFE_ADDREF(pDevice);
}
ID3D11ShaderResourceView* CResource_Manager::Add_Texture(const _char* pFilePath)
{
lock_guard<mutex> lock(m_mtxTexture);
ID3D11ShaderResourceView* pSRV = Find_SRV(pFilePath);
if (nullptr == pSRV)
{
pSRV = Load_SRV(pFilePath);
if (nullptr == pSRV)
{
return nullptr;
}
}
SAFE_ADDREF(pSRV);
return pSRV;
}
HRESULT CResource_Manager::Initialize(_uint iResourceCount)
{
m_Resources.reserve(iResourceCount);
return S_OK;
}
ID3D11ShaderResourceView* CResource_Manager::Find_SRV(const _char* pFilePath)
{
_char szFileName[MAX_PATH] = {};
_splitpath_s(pFilePath, nullptr, 0, nullptr, 0, szFileName, MAX_PATH, nullptr, 0);
auto iter = m_Resources.find(CMyTools::ToWstring(szFileName));
if (iter == m_Resources.end())
return nullptr;
return iter->second;
}
ID3D11ShaderResourceView* CResource_Manager::Load_SRV(const _char* pFilePath)
{
ID3D11ShaderResourceView* pSRV = 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(pFilePath, szDrive, MAX_PATH, szDir, MAX_PATH, szFileName, MAX_PATH, szEXT, MAX_PATH);
strcpy_s(szTextureFileName, szDrive);
strcat_s(szTextureFileName, szDir);
strcat_s(szTextureFileName, szFileName);
strcat_s(szTextureFilePath, szTextureFileName);
strcat_s(szTextureFilePath, ".dds");
HRESULT hr = {};
hr = CreateDDSTextureFromFile(m_pDevice, CMyTools::ToWstring(szTextureFilePath).c_str(), nullptr, &pSRV, 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, &pSRV);
}
}
if (E_FAIL == hr)
return nullptr;
m_Resources.emplace(CMyTools::ToWstring(szFileName), pSRV);
++m_iCount;
return pSRV;
}
CResource_Manager* CResource_Manager::Create(ID3D11Device* pDevice, _uint iResourceCount)
{
CResource_Manager* pInstance = new CResource_Manager(pDevice);
if (FAILED(pInstance->Initialize(iResourceCount)))
{
MSG_BOX("Failed to Create CResource_Manager");
return nullptr;
}
return pInstance;
}
void CResource_Manager::Free()
{
__super::Free();
SAFE_RELEASE(m_pDevice);
unordered_map<_wstring, ID3D11ShaderResourceView*>::iterator iter = m_Resources.begin();
for (; iter != m_Resources.end();)
{
SAFE_RELEASE(iter->second);
iter = m_Resources.erase(iter);
}
m_Resources.clear();
}
+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);
}
@@ -1,5 +1,7 @@
#include "pch.h"
#include "VIBuffer_Model_Instance.h"
#include "GameInstance.h"
#include "Mesh.h"
#include "Bone.h"
#include "Model.h"
@@ -268,11 +270,10 @@ HRESULT CVIBuffer_Model_Instance::Ready_Materials()
{
ID3D11ShaderResourceView* pSRV = { nullptr };
if (FAILED(CreateDDSTextureFromFile(m_pDevice, CMyTools::ToWstring(m_MeshMaterialPathes[i][j]).c_str(), nullptr, &pSRV)))
{
if (FAILED(CreateWICTextureFromFile(m_pDevice, CMyTools::ToWstring(m_MeshMaterialPathes[i][j]).c_str(), nullptr, &pSRV)))
return E_FAIL;
}
pSRV = m_pGameInstance->Add_Resource(m_MeshMaterialPathes[i][j].c_str());
if (nullptr == pSRV)
return E_FAIL;
SRVs.push_back(pSRV);
}
+1
View File
@@ -30,6 +30,7 @@ enum ESTATE : _u64Flag
THROW_ROCK = 1ULL << 23,
BACKHAND_SWING = 1ULL << 24,
SWING = 1ULL << 25,
SLAM = 1ULL << 26,
END
};
NS_END
@@ -237,6 +237,11 @@ class ENGINE_DLL CGameInstance final : public CBase
HRESULT Bind_FogValue(class CShader* pShader);
#pragma endregion
#pragma region RESOURCE_MANGER
public:
ID3D11ShaderResourceView* Add_Resource(const _char* pFilePath);
#pragma endregion
public:
void Add_ModelToMap(const _char* filePath, CModel* pModel);
@@ -272,6 +277,7 @@ class ENGINE_DLL CGameInstance final : public CBase
class CPicking* m_pPicking = { nullptr };
class CThreadHolder* m_pThreadHolder = { nullptr };
class CFog* m_pFog = { nullptr };
class CResource_Manager* m_pResource_Manager = { nullptr };
#ifdef _DEBUG
@@ -0,0 +1,33 @@
#pragma once
#include "Base.h"
NS_BEGIN(Engine)
class CResource_Manager final : public CBase
{
private:
CResource_Manager(ID3D11Device* pDevice);
virtual ~CResource_Manager() = default;
mutex m_mtxTexture = {};
public:
ID3D11ShaderResourceView* Add_Texture(const _char* pFilePath);
private:
HRESULT Initialize(_uint iResourceCount);
ID3D11ShaderResourceView* Find_SRV(const _char* pFilePath);
ID3D11ShaderResourceView* Load_SRV(const _char* pFilePath);
private:
_uint m_iCount = {};
ID3D11Device* m_pDevice = { nullptr };
unordered_map<_wstring, ID3D11ShaderResourceView*> m_Resources;
public:
static CResource_Manager* Create(ID3D11Device* pDevice, _uint iResourceCount);
virtual void Free() override;
};
NS_END
+2 -2
View File
@@ -6,7 +6,7 @@ enum ESTATE
{
IDLE,IDLE_AIM, IDLE_TURN_L, IDLE_TURN_R, IDLE_TURN_BWD, IDLE_COMBAT_TURN_BWD,IDLE_BREAK1,IDLE_BREAK2,IDLE_BREAK3,IDLE_BREAK4,
MOVE,
WALK, WALK_FWD,WALK_RIGHT,WALK_LEFT, WALK_BWD,WALK_STOP,
WALK, WALK_FWD,WALK_RIGHT,WALK_LEFT, WALK_BWD,WALK_START,WALK_STOP,
JOG,JOG_START, JOG_FWD, JOG_RIGHT, JOG_LEFT, JOG_BWD, JOG_STOP, JOG_AIM_LEFT, JOG_AIM_RIGHT, JOG_AIM_BWD, JOG_AIM_STOP_L, JOG_AIM_STOP_R, JOG_AIM_STOP_BWD,
SPRINT,
JUMP,JUMP_JOG,JUMP_SPRINT,
@@ -18,7 +18,7 @@ enum ESTATE
BROOM_IDLE,BROOM_FWD,BROOM_LEFT,BROOM_RIGHT,BROOM_DOWN,BROOM_UP, BROOM_HOVER_IDLE, BROOM_HOVER_FWD, BROOM_HOVER_LEFT, BROOM_HOVER_RIGHT, BROOM_HOVER_START,BROOM_MOUNT, BROOM_MOUNT_END,BROOM_DISMOUNT,
RUSH_START,RUSH_LOOP,RUSH_END,
THROW_ROCK_START,THROW_ROCK,
BACKHAND_SWING_JOG,SWING_FWD,
BACKHAND_SWING_JOG,SWING_FWD,SLAM,
HIT, HIT_FWD, HIT_BWD, HIT_BWD2, HIT_BWD3, HIT_BWD4, HIT_L, HIT_R,HIT_FACE,HIT_FACE_END,
KNOCKDOWN, KNOCKDOWN_FWD, KNOCKDOWN_FWD_SPLT, KNOCKDOWN_FWD_SPLT_HOLD, KNOCKDOWN_BWD, KNOCKDOWN_BWD_SPLT, KNOCKDOWN_BWD_SPLT_HOLD,
GETUP, GETUP_BWD, GETUP_FWD, GETUP_L, GETUP_L_FD, GETUP_L_FU, GETUP_R, GETUP_R_FD, GETUP_R_FU, GETUP_SLOUCH,
+5 -1
View File
@@ -32,8 +32,12 @@ class ENGINE_DLL CTexture final :
HRESULT ParseTexturePathToSRVs(const _tchar* pTextureFolderPath);
private:
vector<ID3D11ShaderResourceView*> m_SRVs = { };
vector<ID3D11ShaderResourceView*> m_SRVs = {};
#ifdef EDITOR_PROJECT
_wstring m_wstrPrototypeName = {};
#endif //
public:
static CTexture* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, TEXTURE_LOAD_TYPE eType, const _tchar* pTextureFilePath, _uint iNumTextures, _wstring wstrPrototypeName = L"");
virtual CComponent* Clone(void* pArg, class CGameObject* pOwner = nullptr) override;