diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj b/Jusin154_Team3D/Client/Default/Client.vcxproj index b4cf14b63..089b8a6d2 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj @@ -174,6 +174,7 @@ call Update_Resources.bat + @@ -298,6 +299,7 @@ call Update_Resources.bat + diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters index 965d42bdd..cf81f2bbc 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters @@ -367,6 +367,9 @@ 02.GameObjects\Item\Goblin_Dagger + + 02.GameObjects\Environment\03.MapElement\Interactable + @@ -782,6 +785,9 @@ {7e641382-9dfa-4da7-a8c8-a3ee06360e7a} + + {17eaf081-6fbf-4965-b04d-10749e6032c6} + @@ -1142,6 +1148,10 @@ 02.GameObjects\UI\Spell_Canvas\Spell_Panel\Spell_Drag + + + 02.GameObjects\Environment\03.MapElement\Interactable + diff --git a/Jusin154_Team3D/Client/Private/InfoInstance.cpp b/Jusin154_Team3D/Client/Private/InfoInstance.cpp index cc8f75d38..a9f9795b2 100644 --- a/Jusin154_Team3D/Client/Private/InfoInstance.cpp +++ b/Jusin154_Team3D/Client/Private/InfoInstance.cpp @@ -88,6 +88,10 @@ HRESULT CInfoInstance::Load_LightElements(const _char* pFilePath) { return m_pMapInfo->Load_LightElements(pFilePath); } +HRESULT CInfoInstance::Load_InteractableElements(const _char* pFileName) +{ + return m_pMapInfo->Load_InteractableElements(pFileName); +} #pragma endregion #pragma region SPELL_INFO diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index b669575bb..3c1bef61e 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -168,7 +168,13 @@ HRESULT CLevel_GamePlay::Ready_Background() /* 조명 오브젝트 */ CInfoInstance::GetInstance()->Load_LightElements("LightElement"); - + /* 상호작용 오브젝트 */ + CInfoInstance::GetInstance()->Load_InteractableElements("E_INTER_Barrel"); + CInfoInstance::GetInstance()->Load_InteractableElements("E_INTER_PostPackage_B"); + CInfoInstance::GetInstance()->Load_InteractableElements("E_INTER_PostPackage_F"); + CInfoInstance::GetInstance()->Load_InteractableElements("E_INTER_TeaShopTable"); + CInfoInstance::GetInstance()->Load_InteractableElements("E_INTER_TeaShopChair"); + CInstancedProp::INSTANCE_PROP_DESC Desc = {}; /* InstanceProp Oak_Tree*/ diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 319634a25..e1ebc67ef 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -124,6 +124,7 @@ #include "MapObject_Collision.h" #include "InstancedProp.h" #include "MapElement_Light.h" +#include "MapElement_Interactable.h" #pragma endregion @@ -493,6 +494,27 @@ HRESULT CLoader::Loading_For_GamePlay() ".bin", false )); } + {/* Barrel */ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Objects/Meshes", + ".bin", false + )); + /* Box */ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/MiscProps", + ".bin", false + )); + /* TeaShop Table */ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Tables", + ".bin", false + )); + /* TeaShop Chair*/ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Chairs", + ".bin", false + )); + } } #pragma endregion @@ -1201,6 +1223,11 @@ HRESULT CLoader::Loading_For_GamePlay() return E_FAIL; } + Desc.ePxRigidBodyFlags = { PSX::PxRigidBodyFlag::eKINEMATIC }; + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX_KIN"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Box"), CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Box/Box.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity())))) { return E_FAIL; @@ -1976,6 +2003,10 @@ HRESULT CLoader::Loading_For_GamePlay() if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Light::Create(m_pDevice, m_pContext)))) return E_FAIL; + /* For.Prototype_GameObject_MapElement_Interactable */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Interactable::Create(m_pDevice, m_pContext)))) + return E_FAIL; + #pragma endregion // MAP PROTOTYPE #pragma region ACTOR PROTOTYPE diff --git a/Jusin154_Team3D/Client/Private/MapElement_Interactable.cpp b/Jusin154_Team3D/Client/Private/MapElement_Interactable.cpp new file mode 100644 index 000000000..11fd2cd25 --- /dev/null +++ b/Jusin154_Team3D/Client/Private/MapElement_Interactable.cpp @@ -0,0 +1,201 @@ +#include "pch.h" +#include "MapElement_Interactable.h" + +#include "GameInstance.h" + +CMapElement_Interactable::CMapElement_Interactable(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CMapElement{ pDevice, pContext } +{ +} + +CMapElement_Interactable::CMapElement_Interactable(const CMapElement_Interactable& rhs) + : CMapElement(rhs) +{ +} + +HRESULT CMapElement_Interactable::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapElement_Interactable::Initialize(void* pArg) +{ + ELEMENT_INTERACTABLE_DESC* pDesc = static_cast(pArg); + + m_iMaxLodLevel = pDesc->iMaxLodLevel; + + for (_uint i = 0; i < m_iMaxLodLevel + 1; i++) + { + m_ModelPrototypeTags.push_back(pDesc->ModelPrototypeTags[i]); + //m_ModelPathIndices.push_back((*pDesc->pModelPathIndices)[i]); + } + + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components(pArg))) + return E_FAIL; + + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pDesc->vPosition), 1.f)); + m_pTransformCom->Set_Scale(pDesc->vScale); + m_pTransformCom->Rotation(XMConvertToRadians(pDesc->vRotation.x), XMConvertToRadians(pDesc->vRotation.y), XMConvertToRadians(pDesc->vRotation.z)); + + m_pActor = static_cast(m_pRigidBody->Get_Actor()); + + static_cast(m_pRigidBody)->Set_HalfGeometryInfo(pDesc->vBoxSize); + static_cast(m_pRigidBody)->Move_LocalPos(_float4(0.f, 0.f, 0.f, 0.f), pDesc->vBoxLocalPosition); + + return S_OK; +} + +void CMapElement_Interactable::Priority_Update(_float fTimeDelta) +{ +} + +void CMapElement_Interactable::Update(_float fTimeDelta) +{ +} + +void CMapElement_Interactable::Late_Update(_float fTimeDelta) +{ + + if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) { + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); + } +} + +HRESULT CMapElement_Interactable::Render() +{ + if (FAILED(Bind_ShaderResources())) + return E_FAIL; + + _uint iNumMeshes = m_pModelComs[m_iLodIndex]->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { + return E_FAIL; + } + + if (FAILED(m_pModelComs[m_iLodIndex]->Render(i))) { + return E_FAIL; + } + } + +#ifdef _DEBUG + if (FAILED(m_pRigidBody->Render())) { + return E_FAIL; + } +#endif // _DEBUG + + return S_OK; +} + +HRESULT CMapElement_Interactable::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + for (_uint i = 0; i < m_iMaxLodLevel + 1; ++i) + { + CModel* pModel = { nullptr }; + + /* Com_Model */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_ModelPrototypeTags[i], + reinterpret_cast(&pModel)))) + return E_FAIL; + + m_pModelComs.push_back(pModel); + } + + /* Com_Shader */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH, + reinterpret_cast(&m_pShaderCom)))) + return E_FAIL; + + + ELEMENT_INTERACTABLE_DESC* pPhysXDummyDesc = static_cast(pArg); + + // RIGID_BODY + CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; + Desc.iSubKind = ENUM_CLASS(PXOBJECT::BOX);//pPhysXDummyDesc->iSubKind; + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX_KIN"), (CComponent**)&m_pRigidBody, &Desc))) { + return E_FAIL; + } + + + return S_OK; +} + +HRESULT CMapElement_Interactable::Bind_ShaderResources() +{ + if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", m_pTransformCom->Get_WorldMatrixPtr()))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { + return E_FAIL; + } + + return S_OK; +} + +CMapElement_Interactable* CMapElement_Interactable::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CMapElement_Interactable* pInstance = new CMapElement_Interactable(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CMapElement_Interactable"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CMapElement_Interactable::Clone(void* pArg, CGameObject* pOwner) +{ + CMapElement_Interactable* pInstance = new CMapElement_Interactable(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapElement_Interactable"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CMapElement_Interactable::Free() +{ + if (nullptr != m_pRigidBody) { + m_pGameInstance->Release_Actor(*m_pRigidBody->Get_Actor()); + } + __super::Free(); + + SAFE_RELEASE(m_pRigidBody); + SAFE_RELEASE(m_pShaderCom); + + for (auto& pModel : m_pModelComs) + SAFE_RELEASE(pModel); +} + +#ifdef _DEBUG +void CMapElement_Interactable::Describe_Entity() +{ + +} +#endif // _DEBUG + + diff --git a/Jusin154_Team3D/Client/Private/MapInfo.cpp b/Jusin154_Team3D/Client/Private/MapInfo.cpp index 013927b3b..0a63ce306 100644 --- a/Jusin154_Team3D/Client/Private/MapInfo.cpp +++ b/Jusin154_Team3D/Client/Private/MapInfo.cpp @@ -8,6 +8,7 @@ #include "MapObject_Render.h" #include "MapObject_Collision.h" #include "MapElement_Light.h" +#include "MapElement_Interactable.h" #include "Layer.h" CMapInfo::CMapInfo() @@ -392,8 +393,72 @@ HRESULT CMapInfo::Load_LightElements(const _char* pFileName) MSG_BOX("Successed to Load File"); #endif - return S_OK; +} + +HRESULT CMapInfo::Load_InteractableElements(const _char* pFileName) +{ + tinyxml2::XMLDocument xmlDoc; + + string strPath = "../Bin/Resources/Data/Map/" + string(pFileName) + ".xml"; + + if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) + return E_FAIL; + + tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("Element_Interactable"); + + if (nullptr == root) + { + MSG_BOX("Failed to Find root"); + return S_OK; + } + + for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) + { + CMapElement_Interactable::ELEMENT_INTERACTABLE_DESC Desc = {}; + + /* Model Prototypes */ + Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel); + Object->QueryUnsignedAttribute("Lod_Level", &Desc.iInteractableID); + + string strTag = {}; + for (auto* PrototypeTag = Object->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) + { + strTag = PrototypeTag->GetText(); + + Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); + } + + /* Transform */ + auto* Position = Object->FirstChildElement("Position"); + Position->QueryFloatAttribute("x", &Desc.vPosition.x); + Position->QueryFloatAttribute("y", &Desc.vPosition.y); + Position->QueryFloatAttribute("z", &Desc.vPosition.z); + + auto* Scale = Object->FirstChildElement("Scale"); + Scale->QueryFloatAttribute("x", &Desc.vScale.x); + Scale->QueryFloatAttribute("y", &Desc.vScale.y); + Scale->QueryFloatAttribute("z", &Desc.vScale.z); + + auto* Rotation = Object->FirstChildElement("Rotation"); + Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); + Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); + Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); + + auto* HalfGeometryInfo = Object->FirstChildElement("HalfGeometryInfo"); + HalfGeometryInfo->QueryFloatAttribute("x", &Desc.vBoxSize.x); + HalfGeometryInfo->QueryFloatAttribute("y", &Desc.vBoxSize.y); + HalfGeometryInfo->QueryFloatAttribute("z", &Desc.vBoxSize.z); + + auto* LocalTranslation = Object->FirstChildElement("LocalTranslation"); + LocalTranslation->QueryFloatAttribute("x", &Desc.vBoxLocalPosition.x); + LocalTranslation->QueryFloatAttribute("y", &Desc.vBoxLocalPosition.y); + LocalTranslation->QueryFloatAttribute("z", &Desc.vBoxLocalPosition.z); + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_INTERACTABLE, &Desc))) + return E_FAIL; + } + //MSG_BOX("Successed to Create Interactalbe Element"); return S_OK; } diff --git a/Jusin154_Team3D/Client/Public/Client_Enum.h b/Jusin154_Team3D/Client/Public/Client_Enum.h index c24ca3e7d..0107bfddb 100644 --- a/Jusin154_Team3D/Client/Public/Client_Enum.h +++ b/Jusin154_Team3D/Client/Public/Client_Enum.h @@ -41,6 +41,7 @@ namespace Client INPUT_TAB, END }; + enum class ELEMENT_INTERACTABLE_ID { BARREL, BOX, TABLE, END }; } diff --git a/Jusin154_Team3D/Client/Public/Client_Macro.h b/Jusin154_Team3D/Client/Public/Client_Macro.h index ba1ad6980..0da552f43 100644 --- a/Jusin154_Team3D/Client/Public/Client_Macro.h +++ b/Jusin154_Team3D/Client/Public/Client_Macro.h @@ -58,6 +58,7 @@ namespace Client { #define LAYER_ITEM TEXT("Layer_Item") #define LAYER_EFFECTPOOL TEXT("Layer_EffectPool") #define LAYER_LIGHT TEXT("Layer_Light") +#define LAYER_INTERACTABLE TEXT("Layer_Interactable") #define LAYER_MAPOBJECTMANAGER TEXT("Layer_MapObjectManager") diff --git a/Jusin154_Team3D/Client/Public/InfoInstance.h b/Jusin154_Team3D/Client/Public/InfoInstance.h index 0627b0aa9..9d72c0303 100644 --- a/Jusin154_Team3D/Client/Public/InfoInstance.h +++ b/Jusin154_Team3D/Client/Public/InfoInstance.h @@ -41,6 +41,7 @@ DECLARE_SINGLETON(CInfoInstance) #pragma region MAP_INFO HRESULT Load_MapObjects(const _char* pFilePath); HRESULT Load_LightElements(const _char* pFilePath); + HRESULT Load_InteractableElements(const _char* pFileName); #pragma endregion #pragma region Spell_INFO HRESULT Load_SpellInfo(const _char* pFilePath); diff --git a/Jusin154_Team3D/Client/Public/MapElement_Interactable.h b/Jusin154_Team3D/Client/Public/MapElement_Interactable.h new file mode 100644 index 000000000..deb85b2f9 --- /dev/null +++ b/Jusin154_Team3D/Client/Public/MapElement_Interactable.h @@ -0,0 +1,52 @@ +#pragma once + +#include "Client_Define.h" +#include "MapElement.h" + +NS_BEGIN(Client) + +class CMapElement_Interactable final : public CMapElement +{ +public: + typedef struct tagElement_Interactable_Desc : MAPELEMENT_DESC + { + _uint iInteractableID = {}; + _uint iSubKind = {}; + _float3 vBoxLocalPosition; + _float3 vBoxSize; + }ELEMENT_INTERACTABLE_DESC; + +private: + CMapElement_Interactable(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMapElement_Interactable(const CMapElement_Interactable& rhs); + virtual ~CMapElement_Interactable() = default; + +public: + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + virtual HRESULT Render() override; + +private: + ELEMENT_INTERACTABLE_ID m_eInteractableID = { ELEMENT_INTERACTABLE_ID::END }; + + class CRigidBody* m_pRigidBody = { nullptr }; + PSX::PxRigidDynamic* m_pActor = { nullptr }; + + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + virtual HRESULT Bind_ShaderResources() override; + +public: + static CMapElement_Interactable* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; +#ifdef _DEBUG + void Describe_Entity() override; +#endif // _DEBUG +}; + +NS_END diff --git a/Jusin154_Team3D/Client/Public/MapInfo.h b/Jusin154_Team3D/Client/Public/MapInfo.h index a72033c42..8e03b9dac 100644 --- a/Jusin154_Team3D/Client/Public/MapInfo.h +++ b/Jusin154_Team3D/Client/Public/MapInfo.h @@ -23,6 +23,7 @@ class CMapInfo final : public CBase HRESULT Load_MapRenderObjects(tinyxml2::XMLElement* Container, class CMapContainer* pContainerObject); HRESULT Load_MapCollisionObjects(tinyxml2::XMLElement* Container, class CMapContainer* pContainerObject); HRESULT Load_LightElements(const _char* pFileName); + HRESULT Load_InteractableElements(const _char* pFileName); private: CGameInstance* m_pGameInstance = { nullptr }; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml index 386f62b61..dde679061 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml @@ -3902,4 +3902,73 @@ + + + + + + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo_Lod1 + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo_Lod2 + + + + + + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo_Lod1 + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo_Lod2 + + + + + + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo_Lod1 + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo_Lod2 + + + + + + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo_Lod1 + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo_Lod2 + + + + + + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo_Lod1 + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo_Lod2 + + + + + + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo_Lod1 + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo_Lod2 + + + + + + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo_Lod1 + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo_Lod2 + + + + + + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo_Lod1 + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo_Lod2 + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/E_INTER_Barrel.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/E_INTER_Barrel.xml new file mode 100644 index 000000000..2b16f504e --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/E_INTER_Barrel.xml @@ -0,0 +1,43 @@ + + + + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo + + + + + + + + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo + + + + + + + + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo + + + + + + + + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo + + + + + + + + Prototype_GameObject_SM_Prop_Barrel_Breakable_B_Oppungo + + + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/E_INTER_PostPackage_B.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/E_INTER_PostPackage_B.xml new file mode 100644 index 000000000..cd5db78f6 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/E_INTER_PostPackage_B.xml @@ -0,0 +1,59 @@ + + + + Prototype_GameObject_SM_HM_OwlPost_Package_B + + + + + + + + Prototype_GameObject_SM_HM_OwlPost_Package_B + + + + + + + + Prototype_GameObject_SM_HM_OwlPost_Package_B + + + + + + + + Prototype_GameObject_SM_HM_OwlPost_Package_B + + + + + + + + Prototype_GameObject_SM_HM_OwlPost_Package_B + + + + + + + + Prototype_GameObject_SM_HM_OwlPost_Package_B + + + + + + + + Prototype_GameObject_SM_HM_OwlPost_Package_B + + + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/E_INTER_PostPackage_F.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/E_INTER_PostPackage_F.xml new file mode 100644 index 000000000..f77fec9b3 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/E_INTER_PostPackage_F.xml @@ -0,0 +1,35 @@ + + + + Prototype_GameObject_SM_HM_OwlPost_Package_F + + + + + + + + Prototype_GameObject_SM_HM_OwlPost_Package_F + + + + + + + + Prototype_GameObject_SM_HM_OwlPost_Package_F + + + + + + + + Prototype_GameObject_SM_HM_OwlPost_Package_F + + + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/E_INTER_TeaShopChair.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/E_INTER_TeaShopChair.xml new file mode 100644 index 000000000..dfba86b5d --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/E_INTER_TeaShopChair.xml @@ -0,0 +1,59 @@ + + + + Prototype_GameObject_SM_HM_TeaShop_Chair_B + + + + + + + + Prototype_GameObject_SM_HM_TeaShop_Chair_B + + + + + + + + Prototype_GameObject_SM_HM_TeaShop_Chair_B + + + + + + + + Prototype_GameObject_SM_HM_TeaShop_Chair_B + + + + + + + + Prototype_GameObject_SM_HM_TeaShop_Chair_B + + + + + + + + Prototype_GameObject_SM_HM_TeaShop_Chair_B + + + + + + + + Prototype_GameObject_SM_HM_TeaShop_Chair_B + + + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/E_INTER_TeaShopTable.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/E_INTER_TeaShopTable.xml new file mode 100644 index 000000000..eb311f46d --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/E_INTER_TeaShopTable.xml @@ -0,0 +1,27 @@ + + + + Prototype_GameObject_SM_HM_TeaShop_Table_B + + + + + + + + Prototype_GameObject_SM_HM_TeaShop_Table_B + + + + + + + + Prototype_GameObject_SM_HM_TeaShop_Table_B + + + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hogsmeade_HeightMap2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hogsmeade_HeightMap2.bin new file mode 100644 index 000000000..624d8db9d --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hogsmeade_HeightMap2.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:70a00e80f048ff149ec44044d738d5bbbbbc7e3d6adf4877de62ab209bc4dea2 +size 1052676 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Chairs/SM_HM_TeaShop_Chair_B.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Chairs/SM_HM_TeaShop_Chair_B.bin new file mode 100644 index 000000000..71fb0af92 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Chairs/SM_HM_TeaShop_Chair_B.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4fdf04ce62e9407d3a9a362c28e5704f2ccb5e99b0458b477b63bc073b09fa7b +size 431391 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Chairs/SM_HM_TeaShop_Chair_B_Lod1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Chairs/SM_HM_TeaShop_Chair_B_Lod1.bin new file mode 100644 index 000000000..ab0d44b40 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Chairs/SM_HM_TeaShop_Chair_B_Lod1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8bd607b0db198906140c1809a00ee225e1e7b917a5a8d171c25c8b6850d9e80f +size 157255 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Chairs/SM_HM_TeaShop_Chair_B_Lod2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Chairs/SM_HM_TeaShop_Chair_B_Lod2.bin new file mode 100644 index 000000000..37ce5a810 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Chairs/SM_HM_TeaShop_Chair_B_Lod2.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c18bf5f9036a582206d5d7ded4d7778a62c439bad577b5ef182a7de43dbffc51 +size 8511 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/MiscProps/SM_HM_OwlPost_Package_B.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/MiscProps/SM_HM_OwlPost_Package_B.bin new file mode 100644 index 000000000..0cac5c5fa --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/MiscProps/SM_HM_OwlPost_Package_B.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9874e7229faa095ec85620fc0b0620fb1e4304f657328166015d61675dd327e2 +size 5699 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/MiscProps/SM_HM_OwlPost_Package_F.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/MiscProps/SM_HM_OwlPost_Package_F.bin new file mode 100644 index 000000000..b75b7c252 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/MiscProps/SM_HM_OwlPost_Package_F.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:967fedd63e5b3d465e8750832d054e853a2dc14587ff038cb3bfee863f43c55f +size 5883 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Tables/SM_HM_TeaShop_Table_B.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Tables/SM_HM_TeaShop_Table_B.bin new file mode 100644 index 000000000..447f92f76 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Tables/SM_HM_TeaShop_Table_B.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2921d9385273ff333d8a91e6cec35309480f37d5c85c618f92e0a2c3942f8834 +size 233311 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Tables/SM_HM_TeaShop_Table_B_Lod1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Tables/SM_HM_TeaShop_Table_B_Lod1.bin new file mode 100644 index 000000000..28e000c3d --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Tables/SM_HM_TeaShop_Table_B_Lod1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8af8d2236c9a5d29458969d941d9518f3881ade1714ada553a2c8f35bd9d945a +size 83527 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Tables/SM_HM_TeaShop_Table_B_Lod2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Tables/SM_HM_TeaShop_Table_B_Lod2.bin new file mode 100644 index 000000000..5a646dff6 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Tables/SM_HM_TeaShop_Table_B_Lod2.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2d1ed811956229a6e22ff2fc9edbbcb6178a8ef374a8a7879b2a523de40bb8ea +size 11103 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Meshes/SM_Prop_Barrel_Breakable_B_Oppungo.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Meshes/SM_Prop_Barrel_Breakable_B_Oppungo.bin new file mode 100644 index 000000000..6df5e8e97 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Meshes/SM_Prop_Barrel_Breakable_B_Oppungo.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:788ad940203fadfe3bc5196afc8857f23cf71425c3d3e338c9ed8abb29419734 +size 354976 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Meshes/SM_Prop_Barrel_Breakable_B_Oppungo_Lod1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Meshes/SM_Prop_Barrel_Breakable_B_Oppungo_Lod1.bin new file mode 100644 index 000000000..4803b435d --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Meshes/SM_Prop_Barrel_Breakable_B_Oppungo_Lod1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f353b39be460a378eb7a893f5f747eddd7166259e23d7607387b61e851470255 +size 120204 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Meshes/SM_Prop_Barrel_Breakable_B_Oppungo_Lod2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Meshes/SM_Prop_Barrel_Breakable_B_Oppungo_Lod2.bin new file mode 100644 index 000000000..71909f020 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Meshes/SM_Prop_Barrel_Breakable_B_Oppungo_Lod2.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:41da0c215ca52b7d7173a83eea0563fe965a2e1c612c5c547ce5c2e206fa973b +size 23572 diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index 0b8d8ca7c..2c23583a1 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -2439,17 +2439,32 @@ HRESULT CLoader::Loading_For_MapViewer() ".bin", false, ModelPrototypeTags, ModelPrototypePath))) return E_FAIL; + /* Step */ + if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\GroundSurfaces", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Collision\\GroundSurfaces", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + /* Barrel */ if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Objects\\Meshes", ".bin", false, ModelPrototypeTags, ModelPrototypePath))) return E_FAIL; - /* Step */ - if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\GroundSurfaces", - ".fbx", true, ModelPrototypeTags, ModelPrototypePath))) + /* Box */ + if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\MiscProps", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) return E_FAIL; - if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Collision\\GroundSurfaces", - ".fbx", true, ModelPrototypeTags, ModelPrototypePath))) + + /* TeaShop Table */ + if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Tables", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + + /* TeaShop Chair*/ + if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Chairs", + ".bin", true, ModelPrototypeTags, ModelPrototypePath))) return E_FAIL; #pragma endregion @@ -2810,10 +2825,32 @@ vector*> Contents(iLoadCount); CCollider::Create(m_pDevice, m_pContext)))) return E_FAIL; - /* For.Prototype_Component_VIBuffer_Terrain */ - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Terrain"), - CVIBuffer_Terrain::Create(m_pDevice, m_pContext, "../Bin/Resources/Data/Map/T_LandscapeStreamingProxy_0_LOD1_D.png")))) - return E_FAIL; + ///* For.Prototype_Component_VIBuffer_Terrain */ + //if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Terrain"), + // CVIBuffer_Terrain::Create(m_pDevice, m_pContext, "../Bin/Resources/Data/Map/T_LandscapeStreamingProxy_0_LOD1_D.png")))) + // return E_FAIL; + + { + CVIBuffer_Terrain* pTerrain = CVIBuffer_Terrain::Create(m_pDevice, m_pContext, "Hogsmeade_HeightMap.bin", 512, 512); + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Terrain"), pTerrain))) { + return E_FAIL; + } + pTerrain->ConvertToHeightField(TEXT("Hogsmeade_HeightMap")); + + CRigidBody_Static::RIGIDBODY_STATIC_PROTOTYPEDESC Desc{}; // 터레인 리지드 지형 추가 + { + Desc.eType = ACTOR::HEIGHTFIELD; + Desc.ePxRigidBodyFlags = {}; + Desc.ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE }; + Desc.ePxMaterialTypes = PXMATERIAL::DEFAULT; + Desc.vMatInfo = _float3(0.5f, 0.5f, 0.6f); + Desc.fContactOffset = 0.f; + } + CRigidBody_Static* pRigid = CRigidBody_Static::Create(m_pDevice, m_pContext, Desc); + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_RigidBody_Static_Terrain_Hogsmeade"), pRigid))) { + return E_FAIL; + } + } CVIBuffer_Model_Instance::INSTANCE_DESC InstanceDesc = {}; diff --git a/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp index 32621886f..125839f0e 100644 --- a/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp +++ b/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp @@ -23,7 +23,7 @@ HRESULT CMapElement_Interactable::Initialize_Prototype() HRESULT CMapElement_Interactable::Initialize(void* pArg) { - MAPOBJECT_LOD_DESC* pDesc = static_cast(pArg); + ELEMENT_INTERACTABLE_DESC* pDesc = static_cast(pArg); m_iMaxLodLevel = pDesc->iMaxLodLevel; @@ -52,6 +52,9 @@ HRESULT CMapElement_Interactable::Initialize(void* pArg) m_vBoxSize = _float3(1.f, 1.f, 1.f); m_pActor = static_cast(m_pRigidBody->Get_Actor()); + + static_cast(m_pRigidBody)->Set_HalfGeometryInfo(pDesc->vBoxSize); + static_cast(m_pRigidBody)->Move_LocalPos(_float4(0.f, 0.f, 0.f, 0.f), pDesc->vBoxLocalPosition); return S_OK; } @@ -260,8 +263,6 @@ void CMapElement_Interactable::Describe_Entity() m_pActor->setMass(m_fMass); m_pRigidBody->Describe_Entity(); - - } @@ -278,11 +279,11 @@ void CMapElement_Interactable::Describe_Entity() GUI::InputFloat("Up", &vMove.y, 0.05f, 0.1f); GUI::InputFloat("Look", &vMove.z, 0.05f, 0.1f); - //m_pTransformCom->Move_Right(vMove.x); - //m_pTransformCom->Move_Up(vMove.y); - //m_pTransformCom->Move_Look(vMove.z); + m_pTransformCom->Move_Right(vMove.x); + m_pTransformCom->Move_Up(vMove.y); + m_pTransformCom->Move_Look(vMove.z); - //XMStoreFloat3(&m_vPosition, m_pTransformCom->Get_State(STATE::POSITION)); + XMStoreFloat3(&m_vPosition, m_pTransformCom->Get_State(STATE::POSITION)); if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT)) { @@ -290,7 +291,7 @@ void CMapElement_Interactable::Describe_Entity() if (m_pGameInstance->isPicking(&vPosition)) { memcpy(&m_vPosition, &vPosition, sizeof(_float3)); - m_pTransformCom->Set_State(STATE::POSITION, XMLoadFloat3(&m_vPosition)); + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); } } @@ -299,6 +300,8 @@ void CMapElement_Interactable::Describe_Entity() GUI::InputFloat("Y##Rotation", &m_vRotation.y, 1.f, 15.f); GUI::InputFloat("Z##Rotation", &m_vRotation.z, 1.f, 15.f); + m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); + GUI::Text("----- Scale ----"); GUI::InputFloat("X##Scale", &m_vScale.x, 0.05f, 0.1f); GUI::InputFloat("Y##Scale", &m_vScale.y, 0.05f, 0.1f); @@ -360,8 +363,22 @@ HRESULT CMapElement_Interactable::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2: Rotation->SetAttribute("y", vRotation.y); Rotation->SetAttribute("z", vRotation.z); object->InsertEndChild(Rotation); -#pragma endregion + _float3 vHalfGeometryInfo = static_cast(m_pRigidBody)->Get_HalfGeometryInfo(); + tinyxml2::XMLElement* HalfGeometryInfo = doc.NewElement("HalfGeometryInfo"); + HalfGeometryInfo->SetAttribute("x", vHalfGeometryInfo.x); + HalfGeometryInfo->SetAttribute("y", vHalfGeometryInfo.y); + HalfGeometryInfo->SetAttribute("z", vHalfGeometryInfo.z); + object->InsertEndChild(HalfGeometryInfo); + + _float3 vLocalTranslation = static_cast(m_pRigidBody)->Get_LocalTranslation(); + tinyxml2::XMLElement* LocalTranslation = doc.NewElement("LocalTranslation"); + LocalTranslation->SetAttribute("x", vLocalTranslation.x); + LocalTranslation->SetAttribute("y", vLocalTranslation.y); + LocalTranslation->SetAttribute("z", vLocalTranslation.z); + object->InsertEndChild(LocalTranslation); + +#pragma endregion return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp index 996723a33..9711db808 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp @@ -63,6 +63,19 @@ HRESULT CMapObject_Manager::Initialize(void* pArg) if (FAILED(Load_LightObject("LightElement"))) return E_FAIL; + + if (FAILED(Load_InteractObject("E_INTER_Barrel"))) + return E_FAIL; + if (FAILED(Load_InteractObject("E_INTER_PostPackage_B"))) + return E_FAIL; + if (FAILED(Load_InteractObject("E_INTER_PostPackage_F"))) + return E_FAIL; + if (FAILED(Load_InteractObject("E_INTER_TeaShopTable"))) + return E_FAIL; + if (FAILED(Load_InteractObject("E_INTER_TeaShopChair"))) + return E_FAIL; + + /*if (FAILED(Load_LightObject("LightElement"))) return E_FAIL; */ @@ -128,6 +141,17 @@ void CMapObject_Manager::Update(_float fTimeDelta) Load_LightObject(m_szSaveContainerName); } } + else if (ADD_TYPE::ELEMENT_INTERACT == m_eType) + { + if (GUI::Button("Save_InteractElements")) + { + Save_InteractObject(m_szSaveContainerName); + } + if (GUI::Button("Load_InteractElements")) + { + Load_InteractObject(m_szSaveContainerName); + } + } if (GUI::Button("Load_Container")) { @@ -848,7 +872,7 @@ HRESULT CMapObject_Manager::Load_MapData(const _char* pFileName) if(MAPOBJECT_TYPE::ELEMENT_STATIC == eType) m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Static"), &Desc); else if(MAPOBJECT_TYPE::ELEMENT_INTERACT == eType) - m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Interact"), &Desc); + m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Interactable"), &Desc); } return S_OK; @@ -1306,7 +1330,7 @@ HRESULT CMapObject_Manager::Save_InteractObject(const _char* pFileName) { CLayer* pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Element_Interactable")); - if (nullptr != pLayer) + if (nullptr == pLayer) return S_OK; tinyxml2::XMLDocument doc; @@ -1339,6 +1363,11 @@ HRESULT CMapObject_Manager::Save_InteractObject(const _char* pFileName) } #pragma endregion // ELEMENT_INTERACTABEL + if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) { + MSG_BOX("Failed to Save File"); + } + + return S_OK; } HRESULT CMapObject_Manager::Load_InteractObject(const _char* pFileName) @@ -1350,7 +1379,7 @@ HRESULT CMapObject_Manager::Load_InteractObject(const _char* pFileName) if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) return E_FAIL; - tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("MapLightObjects"); + tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("Element_Interactable"); if (nullptr == root) { @@ -1365,7 +1394,7 @@ HRESULT CMapObject_Manager::Load_InteractObject(const _char* pFileName) /* Model Prototypes */ Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel); Object->QueryUnsignedAttribute("Lod_Level", &Desc.iInteractableID); - + string strTag = {}; for (auto* PrototypeTag = Object->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) { @@ -1390,10 +1419,20 @@ HRESULT CMapObject_Manager::Load_InteractObject(const _char* pFileName) Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Interactable"), &Desc))) + auto* HalfGeometryInfo = Object->FirstChildElement("HalfGeometryInfo"); + HalfGeometryInfo->QueryFloatAttribute("x", &Desc.vBoxSize.x); + HalfGeometryInfo->QueryFloatAttribute("y", &Desc.vBoxSize.y); + HalfGeometryInfo->QueryFloatAttribute("z", &Desc.vBoxSize.z); + + auto* LocalTranslation = Object->FirstChildElement("LocalTranslation"); + LocalTranslation->QueryFloatAttribute("x", &Desc.vBoxLocalPosition.x); + LocalTranslation->QueryFloatAttribute("y", &Desc.vBoxLocalPosition.y); + LocalTranslation->QueryFloatAttribute("z", &Desc.vBoxLocalPosition.z); + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Interactable_Test"), &Desc))) return E_FAIL; } - MSG_BOX("Successed to Create Interactalbe Element"); + //MSG_BOX("Successed to Create Interactalbe Element"); return S_OK; } @@ -1533,7 +1572,7 @@ void CMapObject_Manager::Update_ObjectList() if (ADD_TYPE::ELEMENT_STATIC == m_eType) pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Element_Static")); else if (ADD_TYPE::ELEMENT_INTERACT == m_eType) - pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Element_Interact")); + pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Element_Interactable")); else if (ADD_TYPE::ELEMENT_LIGHT == m_eType) pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Element_Light")); @@ -1717,9 +1756,12 @@ void CMapObject_Manager::Create_Elemnt(_wstring& strPrototypeTag) } else if (ADD_TYPE::ELEMENT_INTERACT == m_eType) { - Interactable_Desc.iInteractableID = 0; + Interactable_Desc.iInteractableID = 1; + Interactable_Desc.vBoxSize = _float3(0.3f, 0.33f, 0.27f); + Interactable_Desc.vBoxLocalPosition = _float3(-0.01f, 0.455f, 0.f); + - m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Interact"), &Desc); + m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Interactable"), &Interactable_Desc); } else if (ADD_TYPE::ELEMENT_LIGHT == m_eType) { diff --git a/Jusin154_Team3D/Editor/Private/Terrain.cpp b/Jusin154_Team3D/Editor/Private/Terrain.cpp index a869ffdb1..80a160dc5 100644 --- a/Jusin154_Team3D/Editor/Private/Terrain.cpp +++ b/Jusin154_Team3D/Editor/Private/Terrain.cpp @@ -40,8 +40,26 @@ HRESULT CTerrain::Initialize(void* pArg) m_pAlphaMap->Load_ToFile("Hogsmeade_AlphaMap.bin"); - if (FAILED(m_pVIBufferCom->Load_HeightMap("Hogsmeade_HeightMap.bin"))) - return E_FAIL; + + // Psx 적용할지 안할지 + m_bUsePsx = true; + + if(!m_bUsePsx) + { + if (FAILED(m_pVIBufferCom->Load_HeightMap("Hogsmeade_HeightMap.bin"))) + return E_FAIL; + } + else + { + CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc{}; + Desc.pMeshName = TEXT("Hogsmeade_HeightMap"); + Desc.iSubKind = ENUM_CLASS(PXOBJECT::TERRAIN); + /* Com_RigidBody */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_RigidBody_Static_Terrain_Hogsmeade"), + reinterpret_cast(&m_pRigidBody), &Desc))) { + return E_FAIL; + } + } return S_OK; } @@ -273,6 +291,7 @@ void CTerrain::Free() { __super::Free(); + SAFE_RELEASE(m_pRigidBody); SAFE_RELEASE(m_pAlphaMap); SAFE_RELEASE(m_pShaderCom); SAFE_RELEASE(m_pVIBufferCom); diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h index 008672f98..f40f0e05e 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Define.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Define.h @@ -46,7 +46,7 @@ namespace Editor enum class BLOOM_TYPE { NONE, BASIC, MULTIPLY, END }; - enum class ELEMENT_INTERACTABLE_ID { BARREL, END }; + enum class ELEMENT_INTERACTABLE_ID {BARREL, BOX, END}; } using namespace Editor; diff --git a/Jusin154_Team3D/Editor/Public/MapElement_Interactable.h b/Jusin154_Team3D/Editor/Public/MapElement_Interactable.h index 9fe03d66e..56de561d9 100644 --- a/Jusin154_Team3D/Editor/Public/MapElement_Interactable.h +++ b/Jusin154_Team3D/Editor/Public/MapElement_Interactable.h @@ -12,6 +12,8 @@ class CMapElement_Interactable final : public CMapElement { _uint iInteractableID = {}; _uint iSubKind = {}; + _float3 vBoxLocalPosition; + _float3 vBoxSize; }ELEMENT_INTERACTABLE_DESC; private: diff --git a/Jusin154_Team3D/Editor/Public/Terrain.h b/Jusin154_Team3D/Editor/Public/Terrain.h index bf82379b1..bb316dae2 100644 --- a/Jusin154_Team3D/Editor/Public/Terrain.h +++ b/Jusin154_Team3D/Editor/Public/Terrain.h @@ -6,6 +6,7 @@ NS_BEGIN(Engine) class CShader; class CVIBuffer_Terrain; +class CRigidBody_Static; class CTexture; NS_END @@ -34,6 +35,10 @@ class CTerrain final : public CGameObject CTexture* m_pMROTextureCom = { nullptr }; CTexture* m_pMaskTextureCom = { nullptr }; + CRigidBody_Static* m_pRigidBody = { nullptr }; + + _bool m_bUsePsx = { false }; + _float m_fUsingSurfaceParams = {}; _float m_fHeightRatio = {1.f}; _float3 m_vPickingPosition = {}; diff --git a/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp b/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp index 8c3d19d67..6402d980a 100644 --- a/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp +++ b/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp @@ -20,7 +20,7 @@ CRigidBody_Dynamic::CRigidBody_Dynamic(const CRigidBody_Dynamic& rhs) : #ifdef _DEBUG HRESULT CRigidBody_Dynamic::Render() { - _matrix WorldMatrix = m_pTransform->Get_XMWorldMatrix(); + _matrix WorldMatrix = XMMatrixTranslation(m_vLocalTranslation.x, m_vLocalTranslation.y, m_vLocalTranslation.z) * m_pTransform->Get_XMWorldMatrix(); _matrix ViewMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW); _matrix ProjMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ); _vector vColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0x2fc48000, 1.f); @@ -90,11 +90,11 @@ void CRigidBody_Dynamic::Set_HalfGeometryInfo(_float3 vhalfGeometryInfo) } #ifdef _DEBUG if (nullptr != m_pMainShape) { - m_pMainShape.release(); + m_pMainShape.reset(); m_pMainShape = nullptr; } if (nullptr != m_pSubShape) { - m_pSubShape.release(); + m_pSubShape.reset(); m_pSubShape = nullptr; } Add_DebugShape(); @@ -107,6 +107,7 @@ void CRigidBody_Dynamic::Move_LocalPos(_float4 vNewRotQ, _float3 vNewTranslation PSX::PxShape* pShape = { nullptr }; m_pRigidBody->getShapes(&pShape, m_pRigidBody->getNbShapes()); pShape->setLocalPose(PSX::PxTransform(vNewTranslation.x, vNewTranslation.y, vNewTranslation.z, PSX::PxQuat(vNewRotQ.x, vNewRotQ.y, vNewRotQ.z, vNewRotQ.w))); + Add_DebugShape(); } // _DEBUG void CRigidBody_Dynamic::Add_Force(_fvector vForce, PSX::PxForceMode::Enum eType) @@ -223,6 +224,9 @@ HRESULT CRigidBody_Dynamic::Initialize(void* pArg) #ifdef _DEBUG HRESULT CRigidBody_Dynamic::Add_DebugShape() { + if(nullptr != m_pMainShape) + m_pMainShape.reset(); + switch (m_eActorType) { case ACTOR::BOX: @@ -280,6 +284,9 @@ void CRigidBody_Dynamic::Describe_Entity() GUI::BeginChild(("Child ID: " + to_string((size_t)(this))).c_str()); GUI::Text("ReSize"); GUI::SameLine(); if (GUI::DragFloat3("##Size", (_float*)&m_vhalfGeometryInfo, 0.01f, 0.01f, 10.f, "%.3f")) { + m_vhalfGeometryInfo.x = max(0.01f, m_vhalfGeometryInfo.x); + m_vhalfGeometryInfo.y = max(0.01f, m_vhalfGeometryInfo.y); + m_vhalfGeometryInfo.z = max(0.01f, m_vhalfGeometryInfo.z); Set_HalfGeometryInfo(m_vhalfGeometryInfo); } GUI::Text("Translation"); GUI::SameLine(); diff --git a/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h b/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h index b66fbf9e9..9d8736c75 100644 --- a/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h +++ b/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h @@ -29,6 +29,7 @@ class ENGINE_DLL CRigidBody_Dynamic : public CRigidBody public: #ifdef _DEBUG + _float3 Get_LocalTranslation() {return m_vLocalTranslation; } virtual HRESULT Render()override; #endif // _DEBUG