diff --git a/Jusin154_Team3D/Client/Private/BuildingContainer.cpp b/Jusin154_Team3D/Client/Private/BuildingContainer.cpp index c07d27a4e..872fedece 100644 --- a/Jusin154_Team3D/Client/Private/BuildingContainer.cpp +++ b/Jusin154_Team3D/Client/Private/BuildingContainer.cpp @@ -25,7 +25,7 @@ void CBuildingContainer::Update(_float fTimeDelta) { __super::Update(fTimeDelta); - m_fCamDepth = XMVectorGetX(XMVector3LengthSq(XMLoadFloat4(m_pGameInstance->Get_CamPosition()) - XMLoadFloat3(&m_vExtentWorldPosition))); + m_fCamDepth = XMVectorGetX(XMVector3LengthSq(XMLoadFloat4(m_pGameInstance->Get_CamPosition()) - XMVectorSetW(XMLoadFloat3(&m_vExtentWorldPosition), 1.f))); for (auto& pCollisiton : m_ColiisonPartObjects){ pCollisiton->Update(fTimeDelta); @@ -34,15 +34,21 @@ void CBuildingContainer::Update(_float fTimeDelta) void CBuildingContainer::Late_Update(_float fTimeDelta) { - // if (m_pOcclusionQueryCom->isDraw()){ - __super::Late_Update(fTimeDelta); - //} + if (m_pGameInstance->isIn_WorldFrustum(XMVectorSetW(XMLoadFloat3(&m_vExtentWorldPosition), 1.f), m_fRadius)) { + if (m_fCamDepth > 3000.f) + { + if (m_pOcclusionQueryCom->isDraw()) + __super::Late_Update(fTimeDelta); + } + else + __super::Late_Update(fTimeDelta); - for (auto& pCollisiton : m_ColiisonPartObjects){ - pCollisiton->Late_Update(fTimeDelta); + m_pGameInstance->Add_RenderGroup(RENDER::OCCLUSION, this); + + for (auto& pCollisiton : m_ColiisonPartObjects) { + pCollisiton->Late_Update(fTimeDelta); + } } - - //m_pGameInstance->Add_RenderGroup(RENDER::OCCLUSION, this); } HRESULT CBuildingContainer::Render() @@ -142,6 +148,9 @@ HRESULT CBuildingContainer::Ready_Components(void* pArg) vRadius.y = (pDesc->vContainerMax.y - pDesc->vContainerMin.y) * 0.5f; vRadius.z = (pDesc->vContainerMax.z - pDesc->vContainerMin.z) * 0.5f; + m_fRadius = max(vRadius.x, vRadius.y); + m_fRadius = max(m_fRadius, vRadius.z); + m_vExtentWorldPosition.x = pDesc->vContainerMin.x + vRadius.x; m_vExtentWorldPosition.y = pDesc->vContainerMin.y + vRadius.y; m_vExtentWorldPosition.z = pDesc->vContainerMin.z + vRadius.z; diff --git a/Jusin154_Team3D/Client/Private/Goblin.cpp b/Jusin154_Team3D/Client/Private/Goblin.cpp index ddc9b5b0e..ae034b5a6 100644 --- a/Jusin154_Team3D/Client/Private/Goblin.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin.cpp @@ -157,7 +157,6 @@ HRESULT CGoblin::Render() } } #endif - return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index 2c7554d5f..ae55df7fb 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -185,6 +185,66 @@ HRESULT CLevel_GamePlay::Ready_Background() // return E_FAIL; //} + /* SM_HM_OwlPost_Window_A */ + Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_SM_HM_OwlPost_Window_A"; + Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/OwlPost_Window.bin"; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_BACKGROUND, &Desc))) + return E_FAIL; + + ///* WA_Rectangle_Double_A */ + Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_WA_Rectangle_Double_A"; + Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Rectangle_Double_A.bin"; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_BACKGROUND, &Desc))) + return E_FAIL; + + ///* WC_Retangle_Double_A */ + Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_WC_Retangle_Double_A"; + Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/WC_Retangle_Double_A.bin"; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_BACKGROUND, &Desc))) + return E_FAIL; + + ///* WA_Square_Double_C */ + Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_WA_Square_Double_C"; + Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/WA_Square_Double_C.bin"; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_BACKGROUND, &Desc))) + return E_FAIL; + + /* Quid_Window_A */ + Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_Quid_Window_A"; + Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Quid_Window_A.bin"; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_BACKGROUND, &Desc))) + return E_FAIL; + + /* Ollivanders_Box_Window */ + Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_Ollivanders_Box_Window"; + Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Ollivanders_Box.bin"; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_BACKGROUND, &Desc))) + return E_FAIL; + + /* WC_L_DoubleS_A */ + Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_WC_L_DoubleS_A"; + Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/WC_L_DoubleS_A.bin"; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_BACKGROUND, &Desc))) + return E_FAIL; + + /* WC_Round_Double_A */ + Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_WC_Round_Double_A"; + Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/WC_Round_Double_A.bin"; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_BACKGROUND, &Desc))) + return E_FAIL; + + /* SM_HM_Door1a */ + Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door1a"; + Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Door1a.bin"; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_BACKGROUND, &Desc))) + return E_FAIL; + + /* SM_HM_Door1a */ + Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door2b"; + Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Door2b.bin"; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_BACKGROUND, &Desc))) + return E_FAIL; + return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 7506a28fa..51344ee0d 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -284,192 +284,198 @@ HRESULT CLoader::Loading_For_GamePlay() //} - //{ /* BLDG_QuidditchShop */ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_QuidditchShop/Meshes", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_QuidditchShop/Collision", - // ".bin", false - // )); - //} - //{ /* BLDG_HogsheadInn */ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_HogsheadInn/Meshes", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_HogsheadInn/Collision", - // ".bin", false - // )); - //} - //{ /* BLDG_Honeydukes */ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Honeydukes/Meshes", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Honeydukes/Collision", - // ".bin", false - // )); - //} - //{ /* BLDG_OwlPost */ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_OwlPost/Meshes", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_OwlPost/Collision", - // ".bin", false - // )); - //} - //{ /* BLDG_TeaShop */ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_TeaShop/Meshes", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_TeaShop/Collision", - // ".bin", false - // )); - //} - //{ /* BLDG_Zonkos */ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Zonkos/Meshes", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Zonkos/Collision", - // ".bin", false - // )); - //} - //{ /* BLDG_DB_GR */ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_DB_GR/Meshes", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_DB_GR/Collision", - // ".bin", false - // )); - //} - //{ /* BLDG_Potions */ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Potions/Meshes", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Potions/Collisions", - // ".bin", false - // )); - //} - //{ /* BLDG_Salon */ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Salon/Meshes", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Salon/Collision", - // ".bin", false - // )); - //} - //{ /* Hengist_Tree */ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Vegetation/Hengist_Tree", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Collision/Vegetation", - // ".bin", false - // )); - //} - //{ /* GEN A*/ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_A/Meshes", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_A/Collision", - // ".bin", false - // )); - //} - //{ /* GEN B*/ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_B/Meshes", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_B/Collision", - // ".bin", false - // )); - //} - //{ /* GEN C*/ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_C/Meshes", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_C/Collision", - // ".bin", false - // )); - //} - //{ /* GEN E*/ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_E/Meshes", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_E/Collision", - // ".bin", false - // )); - //} - //{ /* GEN F*/ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_F/Meshes", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_F/Collision", - // ".bin", false - // )); - //} - //{ /* GEN G*/ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_G/Meshes", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_G/Collision", - // ".bin", false - // )); - //} - //{ /* GEN H*/ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_H/Meshes", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_H/Collision", - // ".bin", false - // )); - //} - //{ /* GEN J*/ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_J/Meshes", - // ".bin", false - // )); - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_J/Collision", - // ".bin", false - // )); - //} - //{/* Light Objects */ - // jobMapModels.emplace_back(Deferred_FolderLoad( - // "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts", - // ".bin", false - // )); - //} + { /* BLDG_QuidditchShop */ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_QuidditchShop/Meshes", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_QuidditchShop/Collision", + ".bin", false + )); + } + { /* BLDG_HogsheadInn */ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_HogsheadInn/Meshes", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_HogsheadInn/Collision", + ".bin", false + )); + } + { /* BLDG_Honeydukes */ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Honeydukes/Meshes", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Honeydukes/Collision", + ".bin", false + )); + } + { /* BLDG_OwlPost */ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_OwlPost/Meshes", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_OwlPost/Collision", + ".bin", false + )); + } + { /* BLDG_TeaShop */ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_TeaShop/Meshes", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_TeaShop/Collision", + ".bin", false + )); + } + { /* BLDG_Zonkos */ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Zonkos/Meshes", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Zonkos/Collision", + ".bin", false + )); + } + { /* BLDG_DB_GR */ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_DB_GR/Meshes", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_DB_GR/Collision", + ".bin", false + )); + } + { /* BLDG_Potions */ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Potions/Meshes", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Potions/Collisions", + ".bin", false + )); + } + { /* BLDG_Salon */ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Salon/Meshes", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Salon/Collision", + ".bin", false + )); + } + { /* Hengist_Tree */ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Vegetation/Hengist_Tree", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Collision/Vegetation", + ".bin", false + )); + } + { /* GEN A*/ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_A/Meshes", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_A/Collision", + ".bin", false + )); + } + { /* GEN B*/ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_B/Meshes", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_B/Collision", + ".bin", false + )); + } + { /* GEN C*/ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_C/Meshes", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_C/Collision", + ".bin", false + )); + } + { /* GEN E*/ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_E/Meshes", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_E/Collision", + ".bin", false + )); + } + { /* GEN F*/ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_F/Meshes", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_F/Collision", + ".bin", false + )); + } + { /* GEN G*/ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_G/Meshes", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_G/Collision", + ".bin", false + )); + } + { /* GEN H*/ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_H/Meshes", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_H/Collision", + ".bin", false + )); + } + { /* GEN J*/ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_J/Meshes", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_GEN_J/Collision", + ".bin", false + )); + } + {/* Light Objects */ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts", + ".bin", false + )); + } + {/* Doors */ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Doors", + ".bin", false + )); + } } #pragma endregion @@ -1832,21 +1838,83 @@ HRESULT CLoader::Loading_For_GamePlay() } - +#pragma region MAP_INSTANCE /* For.Prototype_Component_VIBuffer_Model_Instancel_SM_OakTree_MedA */ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_OakTree_MedA"), CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, - "../Bin/Resources/Models/InstanceProp/SM_OakTree_MedA.bin", + "../Bin/Resources/Models/InstanceProp/SM_OakTree_MedA.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) return E_FAIL; /* For.Prototype_Component_VIBuffer_Model_Instancel_SM_BearBerry_A */ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_BearBerry_A"), - CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, "../Bin/Resources/Models/InstanceProp/SM_BearBerry_A.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) return E_FAIL; + /* For.Prototype_Component_VIBuffer_Model_Instancel_SM_HM_OwlPost_Window_A*/ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_HM_OwlPost_Window_A"), + CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_HM_OwlPost_Window_A.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) + return E_FAIL; + + /* For.Prototype_Component_VIBuffer_Model_Instancel_WA_Rectangle_Double_A*/ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_WA_Rectangle_Double_A"), + CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_HM_WindowsStyleA_L_Rectangle_Double_A.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) + return E_FAIL; + + /* For.Prototype_Component_VIBuffer_Model_Instancel_WC_Retangle_Double_A*/ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_WC_Retangle_Double_A"), + CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_HM_WindowsStyleC_Retangle_Double_A.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) + return E_FAIL; + + /* For.Prototype_Component_VIBuffer_Model_Instancel_WA_Square_Double_C*/ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_WA_Square_Double_C"), + CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_HM_WindowsStyleA_L_Square_Double_C.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) + return E_FAIL; + + /* For.Prototype_Component_VIBuffer_Model_Instancel_Quid_Window_A*/ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_Quid_Window_A"), + CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_HM_Quid_Window_A.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) + return E_FAIL; + + /* For.Prototype_Component_VIBuffer_Model_Instancel_Ollivanders_Box_Window*/ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_Ollivanders_Box_Window"), + CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_HM_Ollivanders_Box_Window.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) + return E_FAIL; + + /* For.Prototype_Component_VIBuffer_Model_Instancel_WC_L_DoubleS_A*/ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_WC_L_DoubleS_A"), + CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_HM_WindowsStyleC_L_Double_Single_A.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) + return E_FAIL; + + /* For.Prototype_Component_VIBuffer_Model_Instancel_WC_Round_Double_A*/ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_WC_Round_Double_A"), + CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_HM_WindowsStyleC_Round_Double_A.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) + return E_FAIL; + + /* For.Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door1a*/ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door1a"), + CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_HM_Door1a.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) + return E_FAIL; + + /* For.Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door2b*/ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door2b"), + CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_HM_Door2b.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) + return E_FAIL; +#pragma endregion + + /* For.Prototype_Component_VIBuffer_Box */ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Box"), CVIBuffer_Box::Create(m_pDevice, m_pContext)))) diff --git a/Jusin154_Team3D/Client/Private/NomalJap.cpp b/Jusin154_Team3D/Client/Private/NomalJap.cpp index 40ef644f5..455c5cca2 100644 --- a/Jusin154_Team3D/Client/Private/NomalJap.cpp +++ b/Jusin154_Team3D/Client/Private/NomalJap.cpp @@ -57,7 +57,7 @@ HRESULT CNomalJap::Initialize(void* pArg) void CNomalJap::Priority_Update(_float fTimeDelta) { __super::Priority_Update(fTimeDelta); - + XMStoreFloat4(&m_vSrcPos, m_pProjectile->Get_Component()->Get_State(STATE::POSITION)); } void CNomalJap::Update(_float fTimeDelta) @@ -128,52 +128,134 @@ void CNomalJap::Late_Update(_float fTimeDelta) if (m_bVisible == false) { return; } - if (nullptr != m_pTargetUnit && false == m_pTargetUnit->isDead()) { - _vector vStartPos = m_pProjectile->Get_WorldPostion(); + _vector vSrcPos = XMLoadFloat4(&m_vSrcPos); + _vector vDstPos = m_pProjectile->Get_Component()->Get_State(STATE::POSITION); + _vector vDir = vDstPos - vSrcPos; + _float vDistance = XMVectorGetX(XMVector3Length(vDir)); + vDir = XMVector4Normalize(vDir); + PSX::PxSweepBufferN<12> pxBuffer = {}; // 쿼리할 갯수를 템플릿 인자로 넣ㅇ름 + _bool bHit = m_pGameInstance->SphereCast(0.5f, vSrcPos, vDir, vDistance, PSX::PxHitFlag::ePOSITION | PSX::PxHitFlag::eNORMAL, PSX::PxQueryFlag::eDYNAMIC, pxBuffer); - _vector vEndPos = m_pTargetUnit->Get_WorldPostion(); + // 가장 가까운 block (있으면) + //if (true == bHit) { + // const PSX::PxSweepHit& hit = pxBuffer.block; + // PSX::PxRigidActor* pActor = hit.actor; + // PSX::PxShape* pShape = hit.shape; + // if (nullptr != pActor && nullptr != pActor->userData) { + // PhsXUserData* pUserData = static_cast(pActor->userData); + // switch (pUserData->eKind) + // { + // case PHYSX_KIND::CCTActor: + // { + // switch (PXOBJECT(pUserData->iSubKind)) + // { + // case PXOBJECT::MONSTER: + // case PXOBJECT::GOBLIN_WARRIOR: + // case PXOBJECT::TROLL: + // { + // ON_COLLISION_INFO Desc; + // pUserData->pOwner->OnCollision(); + // GUI::Text("HitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHit"); + // } break; + // case PXOBJECT::PLAYER: + // GUI::Text("ㅛㄸㄴㅛㄸㄴㅛㄸㄴㅛㄸㄴㅛㄸㄴㅛㄸㄴㅛㄸㄴㅛㄸㄴㅛㄸㄴㅛㄸㄴㅛㄸㄴㅛㄸㄴㅛㄸㄴㅛㄸㄴㅛㄸㄴㅛㄸㄴㅛㄸㄴㅛㄸㄴㅛㄸㄴㅛㄸㄴ"); + // break; + // default: + // break; + // } + // } break; + // default: + // break; + // } + // } + //} - _vector vDir = { vEndPos - vStartPos }; + // 건드린 친구들 순서대로 다 가져옴 ( 정렬은 안되어있음 ) + for (PSX::PxU32 i = 0; i < pxBuffer.nbTouches; ++i) + { + const PSX::PxSweepHit& Hit = pxBuffer.touches[i]; + /* 기타 로직 */ - _float fDistance = XMVectorGetX(XMVector3Length(vEndPos - vStartPos)); + PSX::PxRigidActor* pActor = Hit.actor; + PSX::PxShape* pShape = Hit.shape; - PSX::PxSweepBuffer pxBuffer = {}; + if (nullptr != pActor && nullptr != pActor->userData) { + PhsXUserData* pUserData = static_cast(pActor->userData); - _bool bHit = m_pGameInstance->SphereCast(0.1f, vStartPos, vDir, fDistance, PSX::PxHitFlag::ePOSITION | PSX::PxHitFlag::eNORMAL, PSX::PxQueryFlag::eDYNAMIC, pxBuffer); - - if (bHit) { - const PSX::PxSweepHit& hit = pxBuffer.block; - PSX::PxRigidActor* pActor = hit.actor; - PSX::PxShape* pShape = hit.shape; - - if (nullptr != pActor && nullptr != pActor->userData) + switch (pUserData->eKind) { - PhsXUserData* pUserData = static_cast(pActor->userData); - - switch (pUserData->eKind) + case PHYSX_KIND::CCTActor: + { + switch (PXOBJECT(pUserData->iSubKind)) { - case PHYSX_KIND::CCTActor: + case PXOBJECT::MONSTER: + case PXOBJECT::GOBLIN_WARRIOR: + case PXOBJECT::TROLL: { - switch (PXOBJECT(pUserData->iSubKind)) - { - case PXOBJECT::MONSTER: - case PXOBJECT::GOBLIN_WARRIOR: - break; - case PXOBJECT::TROLL: - { - ON_COLLISION_INFO Desc; - pUserData->pOwner->OnCollision(); - } - break; - } - } + ON_COLLISION_INFO Desc; + pUserData->pOwner->OnCollision(); + GUI::Text("HitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHitHit"); + } break; + case PXOBJECT::PLAYER: + GUI::Text("NONONONONONONONONONONONONONONONONONONONONONONONONONONONONONONONONONONONONONONONONONONONONONONO"); + break; + default: + break; } + } break; + default: + break; } } - } + //if (nullptr != m_pTargetUnit && false == m_pTargetUnit->isDead()) { + // _vector vStartPos = m_pProjectile->Get_WorldPostion(); + + // _vector vEndPos = m_pTargetUnit->Get_WorldPostion(); + + // _vector vDir = { vEndPos - vStartPos }; + + // _float fDistance = XMVectorGetX(XMVector3Length(vEndPos - vStartPos)); + + // PSX::PxSweepBuffer pxBuffer = {}; + + // _bool bHit = m_pGameInstance->SphereCast(0.1f, vStartPos, vDir, fDistance, PSX::PxHitFlag::ePOSITION | PSX::PxHitFlag::eNORMAL, PSX::PxQueryFlag::eDYNAMIC, pxBuffer); + + // if (bHit) { + // const PSX::PxSweepHit& hit = pxBuffer.block; + // PSX::PxRigidActor* pActor = hit.actor; + // PSX::PxShape* pShape = hit.shape; + + // if (nullptr != pActor && nullptr != pActor->userData) + // { + // PhsXUserData* pUserData = static_cast(pActor->userData); + + // switch (pUserData->eKind) + // { + // case PHYSX_KIND::CCTActor: + // { + // switch (PXOBJECT(pUserData->iSubKind)) + // { + // case PXOBJECT::MONSTER: + // case PXOBJECT::GOBLIN_WARRIOR: + // break; + // case PXOBJECT::TROLL: + // { + // ON_COLLISION_INFO Desc; + // pUserData->pOwner->OnCollision(); + // } + // break; + // } + // } + // } + // } + // } + + //} + + Get_PartObject()->Trail_Update(m_pProjectile->Get_Component()->Get_XMWorldMatrix(), fTimeDelta); __super::Late_Update(fTimeDelta); diff --git a/Jusin154_Team3D/Client/Private/Terrain.cpp b/Jusin154_Team3D/Client/Private/Terrain.cpp index dbeda66f9..648f5723d 100644 --- a/Jusin154_Team3D/Client/Private/Terrain.cpp +++ b/Jusin154_Team3D/Client/Private/Terrain.cpp @@ -64,7 +64,6 @@ void CTerrain::Late_Update(_float fTimeDelta) { //if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) { m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); - m_pGameInstance->Add_RenderGroup(RENDER::SHADOW, this); //} } diff --git a/Jusin154_Team3D/Client/Public/BuildingContainer.h b/Jusin154_Team3D/Client/Public/BuildingContainer.h index 81d97bc6b..0c33ad548 100644 --- a/Jusin154_Team3D/Client/Public/BuildingContainer.h +++ b/Jusin154_Team3D/Client/Public/BuildingContainer.h @@ -37,6 +37,7 @@ class CBuildingContainer final : public CMapContainer // OCCLUSION CONTAINER CVIBuffer_Box* m_pVIBufferCom = { nullptr }; COcclusionQuery* m_pOcclusionQueryCom = { nullptr }; + _float m_fRadius = {}; _float3 m_vExtentWorldPosition = {}; private: diff --git a/Jusin154_Team3D/Client/Public/NomalJap.h b/Jusin154_Team3D/Client/Public/NomalJap.h index e306bc935..a1857a2bd 100644 --- a/Jusin154_Team3D/Client/Public/NomalJap.h +++ b/Jusin154_Team3D/Client/Public/NomalJap.h @@ -32,24 +32,25 @@ class CNomalJap final : public CEffect_Container HRESULT Bind_ShaderResources() override; virtual void OnCollision(CGameObject* pOther = nullptr, void* pDesc = nullptr) override; private: - CInfoInstance* m_pInfoInstance = { nullptr }; - _wstring m_wstrEffectName = {}; + CInfoInstance* m_pInfoInstance = { nullptr }; + _wstring m_wstrEffectName = {}; - class CPartObject* m_pProjectile = {}; - class CPartObject* m_pProjectile_Side = {}; + class CPartObject* m_pProjectile = {}; + class CPartObject* m_pProjectile_Side = {}; - _float3 m_vRotateUp = {}; - _float m_fAccMoveTime = {}; - _float m_fLerpAmount = {}; - _float m_fTurnValue = {}; + _float3 m_vRotateUp = {}; + _float m_fAccMoveTime = {}; + _float m_fLerpAmount = {}; + _float m_fTurnValue = {}; - CUnit* m_pTargetUnit = { nullptr }; // 발사될 당시 대상 - _float3 m_vDirection = { 0.f, 0.f, 1.f }; - _float4 m_vStartPos = { 0.f, 0.f, 0.f, 1.f }; // 현재 발사 된 위치 - _float4 m_vTargetPos = { 0.f, 0.f, 10.f, 1.f }; // 현재 타게팅 된 위치 - _float m_fAngularSpeed = XM_2PI / 0.3f; - _float m_fLinearSpeed = 1.f; - _bool m_bTrailPulseEnded = false; + CUnit* m_pTargetUnit = { nullptr }; // 발사될 당시 대상 + _float3 m_vDirection = { 0.f, 0.f, 1.f }; + _float4 m_vStartPos = { 0.f, 0.f, 0.f, 1.f }; // 현재 발사 된 위치 + _float4 m_vTargetPos = { 0.f, 0.f, 10.f, 1.f }; // 현재 타게팅 된 위치 + _float m_fAngularSpeed = XM_2PI / 0.3f; + _float m_fLinearSpeed = 1.f; + _bool m_bTrailPulseEnded = false; + _float4 m_vSrcPos = {}; public: static CNomalJap* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual void Free() override; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPos.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPos.hlsl index c8162a6e7..136b32a9e 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPos.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPos.hlsl @@ -76,7 +76,7 @@ technique11 NorTechnique11 pass BoundingDebugPass { SetRasterizerState(RS_Nocull); - SetDepthStencilState(DSS_None, 0); + SetDepthStencilState(DSS_Default, 0); SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); VertexShader = compile vs_5_0 VS_MAIN(); GeometryShader = NULL; diff --git a/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp b/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp index 87a48e91a..5592a5ba8 100644 --- a/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp +++ b/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp @@ -45,7 +45,7 @@ void CBuildingContainer::Update(_float fTimeDelta) _vector vCamPosition = XMLoadFloat4(m_pGameInstance->Get_CamPosition()); // m_fCamDepth = XMVectorGetX(XMVector3LengthSq(vCamPosition - XMVectorSetW(XMLoadFloat3(&m_vExtentPosition), 1.f))); - m_fCamDepth = XMVectorGetX(XMVector3Length(vCamPosition - XMLoadFloat3(&m_vExtentPosition))); + m_fCamDepth = XMVectorGetX(XMVector3LengthSq(vCamPosition - WorldPosition)); } } @@ -66,15 +66,15 @@ void CBuildingContainer::Late_Update(_float fTimeDelta) if (m_bOcclusionPassed) { - if(m_fCamDepth > 80.f) + if(m_fCamDepth > 3000.f) { if (m_pOcclusionQueryCom->isDraw()) __super::Late_Update(fTimeDelta); - - m_pGameInstance->Add_RenderGroup(RENDER::OCCLUSION, this); } else __super::Late_Update(fTimeDelta); + + m_pGameInstance->Add_RenderGroup(RENDER::OCCLUSION, this); } else { diff --git a/Jusin154_Team3D/Engine/Default/Engine.vcxproj b/Jusin154_Team3D/Engine/Default/Engine.vcxproj index 24acea968..b87aad2df 100644 --- a/Jusin154_Team3D/Engine/Default/Engine.vcxproj +++ b/Jusin154_Team3D/Engine/Default/Engine.vcxproj @@ -211,6 +211,7 @@ call Update_Lib.bat + true true @@ -428,6 +429,7 @@ call Update_Lib.bat + true true diff --git a/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters b/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters index 832872375..0f0ec0991 100644 --- a/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters +++ b/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters @@ -49,9 +49,6 @@ {1cc7e2f7-559a-4b58-9e84-bbfafb84f81c} - - {685d2cc6-b29a-4018-b72f-d66a2807463d} - {beb918fe-e798-41b2-8076-6d0cbc525ada} @@ -295,6 +292,9 @@ {d566d9e6-6183-48dc-a196-25fd47a10c48} + + {685d2cc6-b29a-4018-b72f-d66a2807463d} + @@ -561,6 +561,9 @@ 01.Utility\01.Renderer + + 03.Management\02.Resource_Manager + @@ -1193,6 +1196,9 @@ 01.Utility\01.Renderer + + 03.Management\02.Resource_Manager + diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp index 5bcfa06f7..aaf34c9e3 100644 --- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp +++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp @@ -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); } diff --git a/Jusin154_Team3D/Engine/Private/Material.cpp b/Jusin154_Team3D/Engine/Private/Material.cpp index f1e65cdd6..aca39b20c 100644 --- a/Jusin154_Team3D/Engine/Private/Material.cpp +++ b/Jusin154_Team3D/Engine/Private/Material.cpp @@ -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); diff --git a/Jusin154_Team3D/Engine/Private/OcclusionQuery.cpp b/Jusin154_Team3D/Engine/Private/OcclusionQuery.cpp index 13e485623..44742260c 100644 --- a/Jusin154_Team3D/Engine/Private/OcclusionQuery.cpp +++ b/Jusin154_Team3D/Engine/Private/OcclusionQuery.cpp @@ -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() diff --git a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp index 9d13b66b6..e8649f278 100644 --- a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp @@ -163,20 +163,7 @@ PSX::PxMaterial* CPhysX_Manager::Create_Material(const _float3* vMatInfo) _bool CPhysX_Manager::SphereCast(_float fRadius, _float3 vStartPos, _float3 vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer) { - PSX::PxSphereGeometry sphereGeom(fRadius); - - PSX::PxVec3 startPos(vStartPos.x, vStartPos.y, vStartPos.z); - PSX::PxQuat startRot(PSX::PxIdentity); - - PSX::PxTransform startPose(startPos, startRot); - - PSX::PxVec3 sweepDir(vDir.x, vDir.y, vDir.z); - - sweepDir.normalize(); - - PSX::PxQueryFilterData filterData(flagQuery); - - return m_pScene->sweep(sphereGeom, startPose, sweepDir, fDistance, hitBuffer, flagHitsData, filterData); + return SphereCast(fRadius, XMLoadFloat3(&vStartPos), XMLoadFloat3(&vDir), fDistance, flagHitsData, flagQuery, hitBuffer); } _bool CPhysX_Manager::SphereCast(_float fRadius, _fvector _vStartPos, _fvector _vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer) @@ -199,6 +186,7 @@ _bool CPhysX_Manager::SphereCast(_float fRadius, _fvector _vStartPos, _fvector _ sweepDir.normalize(); PSX::PxQueryFilterData filterData(flagQuery); + _bool bHit = m_pScene->sweep(sphereGeom, startPose, sweepDir, fDistance, hitBuffer, flagHitsData, filterData); return bHit; diff --git a/Jusin154_Team3D/Engine/Private/Renderer.cpp b/Jusin154_Team3D/Engine/Private/Renderer.cpp index a106608fc..66c43767f 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer.cpp @@ -91,6 +91,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(); }); @@ -107,6 +111,10 @@ void CRenderer::Render_Occlusion() } m_RenderObjects[ENUM_CLASS(RENDER::OCCLUSION)].clear(); + + if (FAILED(m_pGameInstance->End_MRT())) { + return; + } } void CRenderer::Render_Priority() diff --git a/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp b/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp index e69ded6d0..43a0c225f 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp @@ -122,7 +122,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; } diff --git a/Jusin154_Team3D/Engine/Private/Resource_Manager.cpp b/Jusin154_Team3D/Engine/Private/Resource_Manager.cpp new file mode 100644 index 000000000..cab730328 --- /dev/null +++ b/Jusin154_Team3D/Engine/Private/Resource_Manager.cpp @@ -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 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(); +} diff --git a/Jusin154_Team3D/Engine/Private/Texture.cpp b/Jusin154_Team3D/Engine/Private/Texture.cpp index 3d8f84653..f6070ff79 100644 --- a/Jusin154_Team3D/Engine/Private/Texture.cpp +++ b/Jusin154_Team3D/Engine/Private/Texture.cpp @@ -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); } diff --git a/Jusin154_Team3D/Engine/Private/VIBuffer_Model_Instance.cpp b/Jusin154_Team3D/Engine/Private/VIBuffer_Model_Instance.cpp index a9ce649d9..d267d8180 100644 --- a/Jusin154_Team3D/Engine/Private/VIBuffer_Model_Instance.cpp +++ b/Jusin154_Team3D/Engine/Private/VIBuffer_Model_Instance.cpp @@ -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); } diff --git a/Jusin154_Team3D/Engine/Public/GameInstance.h b/Jusin154_Team3D/Engine/Public/GameInstance.h index 4712e22fd..92e3a963a 100644 --- a/Jusin154_Team3D/Engine/Public/GameInstance.h +++ b/Jusin154_Team3D/Engine/Public/GameInstance.h @@ -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 diff --git a/Jusin154_Team3D/Engine/Public/Resource_Manager.h b/Jusin154_Team3D/Engine/Public/Resource_Manager.h new file mode 100644 index 000000000..485d71ce3 --- /dev/null +++ b/Jusin154_Team3D/Engine/Public/Resource_Manager.h @@ -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 diff --git a/Jusin154_Team3D/Engine/Public/Texture.h b/Jusin154_Team3D/Engine/Public/Texture.h index 842e8ecce..6b94232cd 100644 --- a/Jusin154_Team3D/Engine/Public/Texture.h +++ b/Jusin154_Team3D/Engine/Public/Texture.h @@ -32,8 +32,12 @@ class ENGINE_DLL CTexture final : HRESULT ParseTexturePathToSRVs(const _tchar* pTextureFolderPath); private: - vector m_SRVs = { }; + vector 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;