diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj b/Jusin154_Team3D/Client/Default/Client.vcxproj index b9fad64cb..49dd2a365 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj @@ -198,6 +198,7 @@ call Update_Resources.bat + @@ -372,6 +373,7 @@ call Update_Resources.bat + diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters index 87d452564..519fe9a6b 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters @@ -551,6 +551,9 @@ 04.Mechanic\State\State_Combat\State_Shield + + 02.GameObjects\Environment\03.MapElement\Door + @@ -1164,6 +1167,9 @@ {02cb243a-f63e-4e55-9d55-b47e31a4c13e} + + {b09f9ada-6cf4-41a4-ad28-f00855509825} + @@ -1659,6 +1665,9 @@ 02.GameObjects\NPC\Ally\Shopper + + 02.GameObjects\Environment\03.MapElement\Door + diff --git a/Jusin154_Team3D/Client/Private/InfoInstance.cpp b/Jusin154_Team3D/Client/Private/InfoInstance.cpp index a8a9027b5..ff405a87d 100644 --- a/Jusin154_Team3D/Client/Private/InfoInstance.cpp +++ b/Jusin154_Team3D/Client/Private/InfoInstance.cpp @@ -123,6 +123,10 @@ HRESULT CInfoInstance::Load_WaterElemet(const _char* pFileName) { return m_pMapInfo->Load_WaterElemet(pFileName); } +HRESULT CInfoInstance::Load_DoorElemet(const _char* pFileName) +{ + return m_pMapInfo->Load_DoorElemet(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 055710513..8569730fe 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -277,6 +277,10 @@ HRESULT CLevel_GamePlay::Ready_Background() CInfoInstance::GetInstance()->Load_InteractableElements("E_INTER_TeaShopTable"); CInfoInstance::GetInstance()->Load_InteractableElements("E_INTER_TeaShopChair"); + /* Doors */ + CInfoInstance::GetInstance()->Load_DoorElemet("Element_Door_Info"); + + if (FAILED(Ready_IntstanceProp())) return E_FAIL; } diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index c1811a8c2..f472d6cd8 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -162,6 +162,7 @@ #include "MapElement_Light.h" #include "MapElement_Interactable.h" #include "MapElement_Lake.h" +#include "MapElement_Door.h" #include "Land.h" #include "Unified.h" @@ -2110,6 +2111,10 @@ HRESULT CLoader::Loading_For_GamePlay() if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Interactable::Create(m_pDevice, m_pContext)))) return E_FAIL; + /* For.Prototype_GameObject_MapElement_Door */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Door::Create(m_pDevice, m_pContext)))) + return E_FAIL; + /* For.Prototype_GameObject_Unified */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Lake::Create(m_pDevice, m_pContext)))) return E_FAIL; diff --git a/Jusin154_Team3D/Client/Private/MapElement_Door.cpp b/Jusin154_Team3D/Client/Private/MapElement_Door.cpp new file mode 100644 index 000000000..8d6a22b82 --- /dev/null +++ b/Jusin154_Team3D/Client/Private/MapElement_Door.cpp @@ -0,0 +1,205 @@ +#include "pch.h" +#include "MapElement_Door.h" + +#include "GameInstance.h" +#include "Terrain.h" +#include "Layer.h" +#include "VIBuffer_Terrain.h" + +CMapElement_Door::CMapElement_Door(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CMapElement{ pDevice, pContext } +{ +} + +CMapElement_Door::CMapElement_Door(const CMapElement_Door& rhs) + : CMapElement(rhs) +{ +} + +HRESULT CMapElement_Door::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapElement_Door::Initialize(void* pArg) +{ + ELEMENT_DOOR_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_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; +} + +void CMapElement_Door::Priority_Update(_float fTimeDelta) +{ +} + +void CMapElement_Door::Update(_float fTimeDelta) +{ +} + +void CMapElement_Door::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_Door::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_Door::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_DOOR_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"), (CComponent**)&m_pRigidBody, &Desc))) { + // return E_FAIL; + //} + + + return S_OK; +} + +HRESULT CMapElement_Door::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_Door* CMapElement_Door::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CMapElement_Door* pInstance = new CMapElement_Door(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CMapElement_Door"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CMapElement_Door::Clone(void* pArg, CGameObject* pOwner) +{ + CMapElement_Door* pInstance = new CMapElement_Door(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapElement_Door"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CMapElement_Door::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_Door::Describe_Entity() +{ + +} +#endif // _DEBUG + + diff --git a/Jusin154_Team3D/Client/Private/MapInfo.cpp b/Jusin154_Team3D/Client/Private/MapInfo.cpp index 4989b5f12..754bad348 100644 --- a/Jusin154_Team3D/Client/Private/MapInfo.cpp +++ b/Jusin154_Team3D/Client/Private/MapInfo.cpp @@ -10,6 +10,7 @@ #include "MapElement_Light.h" #include "MapElement_Interactable.h" #include "MapElement_Lake.h" +#include "MapElement_Door.h" #include "Layer.h" CMapInfo::CMapInfo() @@ -573,6 +574,71 @@ HRESULT CMapInfo::Load_WaterElemet(const _char* pFileName) return S_OK; } +HRESULT CMapInfo::Load_DoorElemet(const _char* pFileName) +{ + tinyxml2::XMLDocument xmlDoc; + + string strPath = "../Bin/Resources/Data/Map/Door/" + string(pFileName) + ".xml"; + + if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) + return E_FAIL; + + tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("Doors"); + + if (nullptr == root) + { + MSG_BOX("Failed to Find root"); + return S_OK; + } + + for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) + { + CMapElement_Door::ELEMENT_DOOR_DESC Desc = {}; + + /* Model Prototypes */ + Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel); + + 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_DOOR, &Desc))) + return E_FAIL; + } + + return S_OK; +} + HRESULT CMapInfo::Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContex) { m_pGameInstance = CGameInstance::GetInstance(); diff --git a/Jusin154_Team3D/Client/Public/Client_Macro.h b/Jusin154_Team3D/Client/Public/Client_Macro.h index cd522d1de..06643d5d0 100644 --- a/Jusin154_Team3D/Client/Public/Client_Macro.h +++ b/Jusin154_Team3D/Client/Public/Client_Macro.h @@ -61,6 +61,7 @@ namespace Client { #define LAYER_LIGHT TEXT("Layer_Light") #define LAYER_INTERACTABLE TEXT("Layer_Interactable") #define LAYER_UNIFIED TEXT("Layer_Unified") +#define LAYER_DOOR TEXT("Layer_Door") #define LAYER_MAPOBJECTMANAGER TEXT("Layer_MapObjectManager") diff --git a/Jusin154_Team3D/Client/Public/InfoInstance.h b/Jusin154_Team3D/Client/Public/InfoInstance.h index c20e42e11..57ac8e23a 100644 --- a/Jusin154_Team3D/Client/Public/InfoInstance.h +++ b/Jusin154_Team3D/Client/Public/InfoInstance.h @@ -49,6 +49,7 @@ DECLARE_SINGLETON(CInfoInstance) HRESULT Load_LightElements(const _char* pFilePath); HRESULT Load_InteractableElements(const _char* pFileName); HRESULT Load_WaterElemet(const _char* pFileName); + HRESULT Load_DoorElemet(const _char* pFileName); #pragma endregion #pragma region Spell_INFO HRESULT Load_SpellInfo(const _char* pFilePath); diff --git a/Jusin154_Team3D/Client/Public/MapElement_Door.h b/Jusin154_Team3D/Client/Public/MapElement_Door.h new file mode 100644 index 000000000..a69c966d0 --- /dev/null +++ b/Jusin154_Team3D/Client/Public/MapElement_Door.h @@ -0,0 +1,59 @@ +#pragma once + +#include "Client_Define.h" +#include "MapElement.h" + +NS_BEGIN(Client) + +class CMapElement_Door final : public CMapElement +{ +public: + typedef struct tagElement_Interactable_Desc : MAPELEMENT_DESC + { + _uint iSubKind = {}; + _float3 vBoxLocalPosition; + _float3 vBoxSize; + }ELEMENT_DOOR_DESC; + +private: + CMapElement_Door(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMapElement_Door(const CMapElement_Door& rhs); + virtual ~CMapElement_Door() = 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: + + CRigidBody* m_pRigidBody = { nullptr }; + PSX::PxRigidDynamic* m_pActor = { nullptr }; + +#ifdef _DEBUG + _bool m_bUseSelectColor = { true }; + + _float m_fPower = {}; + _float m_fMass = {}; + _float3 m_vBoxSize = {}; +#endif // _DEBUG + + +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_Door* 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 002387d42..30c76227e 100644 --- a/Jusin154_Team3D/Client/Public/MapInfo.h +++ b/Jusin154_Team3D/Client/Public/MapInfo.h @@ -25,6 +25,7 @@ class CMapInfo final : public CBase HRESULT Load_LightElements(const _char* pFileName); HRESULT Load_InteractableElements(const _char* pFileName); HRESULT Load_WaterElemet(const _char* pFileName); + HRESULT Load_DoorElemet(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 dde679061..c2e2ce2c8 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml @@ -3971,4 +3971,64 @@ + + + + + + Prototype_GameObject_SM_HM_Streets_SideStreet_D + Prototype_GameObject_SM_HM_Streets_SideStreet_D_Lod1 + Prototype_GameObject_SM_HM_Streets_SideStreet_D_Lod2 + + + + + + Prototype_GameObject_SM_HM_Streets_SideStreet_D_Wall + Prototype_GameObject_SM_HM_Streets_SideStreet_D_Wall_Lod1 + Prototype_GameObject_SM_HM_Streets_SideStreet_D_Wall_Lod2 + + + + + + Prototype_GameObject_SM_HW_Streets_SideStreet_G_COL + Prototype_GameObject_SM_HW_Streets_SideStreet_G_COL_Lod1 + + + + + + Prototype_GameObject_SM_HW_Streets_SideStreet_G_Wall_COL + Prototype_GameObject_SM_HW_Streets_SideStreet_G_Wall_COL_Lod1 + + + + + + + + + + + Prototype_GameObject_SM_HM_Ollivanders_INT_APL_COL + Prototype_GameObject_SM_HM_Ollivanders_INT_APL_COL_Lod1 + + + + + + Prototype_GameObject_SM_HM_Ollivanders_INT_Floors_COL + + + + + + Prototype_GameObject_SM_HM_Ollivanders_INT_PL_COL + Prototype_GameObject_SM_HM_Ollivanders_INT_PL_COL_Lod1 + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Door/Element_Door_Info.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Door/Element_Door_Info.xml new file mode 100644 index 000000000..073c045fd --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Door/Element_Door_Info.xml @@ -0,0 +1,11 @@ + + + + Prototype_GameObject_SM_HM_Ollivanders_Front_Door + Prototype_GameObject_SM_HM_Ollivanders_Front_Door_Lod1 + Prototype_GameObject_SM_HM_Ollivanders_Front_Door_Lod2 + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hogsmeade_MapContainer_Data.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hogsmeade_MapContainer_Data.xml index dd693609e..17561263c 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hogsmeade_MapContainer_Data.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hogsmeade_MapContainer_Data.xml @@ -364,6 +364,26 @@ + + Prototype_GameObject_SM_HM_Ollivanders_INT_APL_COL + Prototype_GameObject_SM_HM_Ollivanders_INT_APL_COL_Lod1 + + + + + + Prototype_GameObject_SM_HM_Ollivanders_INT_Floors_COL + + + + + + Prototype_GameObject_SM_HM_Ollivanders_INT_PL_COL + Prototype_GameObject_SM_HM_Ollivanders_INT_PL_COL_Lod1 + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Ollivanders/Meshes/SM_HM_Ollivanders_Int_Floors.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Ollivanders/Meshes/SM_HM_Ollivanders_Int_Floors.bin index 9f212f5c7..5884b4faa 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Ollivanders/Meshes/SM_HM_Ollivanders_Int_Floors.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Ollivanders/Meshes/SM_HM_Ollivanders_Int_Floors.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e5467187dc79b734f4cfb622bd1ec22865663eb6eef322f761389a438406505e +oid sha256:d80d339078c231d2d743b32868fe72160f86098d4f9165952a1a9d1bf4681ffb size 4920 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Ollivanders/Meshes/SM_HM_Ollivanders_Int_Walls.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Ollivanders/Meshes/SM_HM_Ollivanders_Int_Walls.bin index 45bd4c704..333cbbf10 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Ollivanders/Meshes/SM_HM_Ollivanders_Int_Walls.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Ollivanders/Meshes/SM_HM_Ollivanders_Int_Walls.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bd0b9a72ae59e41d29d5c1b9e1cf18e47a4d20345b50915ea185844664800afa +oid sha256:32a2f3580d915d16d0ce3bc194852929c7645271e6d5764bf43615caa0f8fcd8 size 33656 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Doors/SM_HM_Ollivanders_Front_Door.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Doors/SM_HM_Ollivanders_Front_Door.bin new file mode 100644 index 000000000..e09262ba6 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Doors/SM_HM_Ollivanders_Front_Door.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ee1a0ea11213b20594e3757a20371273b4f6d299bb9e005077eb631b5a20891 +size 122127 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Doors/SM_HM_Ollivanders_Front_Door_Lod1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Doors/SM_HM_Ollivanders_Front_Door_Lod1.bin new file mode 100644 index 000000000..73844e029 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Doors/SM_HM_Ollivanders_Front_Door_Lod1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9fb45e58433c264cf39ed9560d39a301cadae90829b6a3e58a23082ea6e717ce +size 45313 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Doors/SM_HM_Ollivanders_Front_Door_Lod2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Doors/SM_HM_Ollivanders_Front_Door_Lod2.bin new file mode 100644 index 000000000..bcdb31e10 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Doors/SM_HM_Ollivanders_Front_Door_Lod2.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:609476a851ec915e2a46617d539bf56267b9fee1a96da6787c90005bfc60b916 +size 20165 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl index bae2d8601..c43261149 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl @@ -720,6 +720,52 @@ PS_OUT PS_SPECTOR_WEAPON_MAIN(PS_IN In) return Out; } +PS_OUT PS_LEVIOSO(PS_IN In) +{ + PS_OUT Out; + + float4 vMtrlDiffuse = g_DiffuseTexture.Sample(AnisoTropy_BLUR_Sampler, In.vTexcoord); + float4 vSurface = g_SurfaceParamsTexture.Sample(AnisoTropy_BLUR_Sampler, In.vTexcoord); + float4 vNoise = g_NoiseTexture.Sample(AnisoTropy_BLUR_Sampler, In.vTexcoord).r; + + if (g_iBinded_Texture[AI_TEXTURE_TYPE_TRANSMISSION] != 0) + { + float4 vTransmission = g_TransmissionTexture.Sample(AnisoTropy_BLUR_Sampler, In.vTexcoord); + vMtrlDiffuse *= vTransmission; + } + if (g_iBinded_Texture[AI_TEXTURE_TYPE_EMISSIVE] != 0) + { + float4 vEmissive = g_EmissiveTexture.Sample(AnisoTropy_BLUR_Sampler, In.vTexcoord); + vMtrlDiffuse += vEmissive; + } + if (vMtrlDiffuse.a < 0.2f) + { + discard; + } + + + float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, AnisoTropy_BLUR_Sampler, In.vTexcoord); + float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); + + float3 vNormal = normalize(mul(vNormalDecoded, WorldMatrix)); + + Out.vAlbedo = vMtrlDiffuse * float4(1.f, 1.f, 0.3f, 1.f) * vNoise; + Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); + float fSurfaceParam = g_fUsingSurfaceParams; + if (true == AlmostEqual7(g_fUsingSurfaceParams, 0.f)) + { + fSurfaceParam = 0; + } + Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), // NDC 깊이 ( 0~ 1) + (In.vProjPos.w / g_fFar), // 뷰 스페이스 Z + fSurfaceParam, // 서페이스 파라미터 + 1.f); + Out.vColor = float4(0.f, 0.f, 0.f, 1.f); + Out.vSurface = vSurface; + + return Out; +} + technique11 MeshTechnique11 { @@ -928,4 +974,14 @@ technique11 MeshTechnique11 GeometryShader = NULL; PixelShader = compile ps_5_0 PS_GLASS_CUBE(); } + + pass LeviosoPass // 21 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_None, 0); + SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + VertexShader = compile vs_5_0 VS_MAIN(); + GeometryShader = NULL; + PixelShader = compile ps_5_0 PS_LEVIOSO(); + } } diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index b77eaaaf2..10a9b7259 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -182,6 +182,9 @@ call Update_Shaders.bat + + + @@ -386,6 +389,9 @@ call Update_Shaders.bat + + + diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index 9daa90333..513346fe3 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -568,6 +568,15 @@ {81c6b163-6c8b-47ac-a4b6-e86088ce709f} + + {6cb94611-9a4c-4b22-897c-6a2ff662c59a} + + + {18ff4d8b-a5fd-4c67-a864-5340e31391a2} + + + {a1e789e1-dce1-4069-8c61-b9f9c89f795d} + @@ -1134,6 +1143,15 @@ 50.UI\GamePlay_Canvas\Enemy_Panel\Enemy_Detection + + 02.GameObjects\Env\03.MapElement\Door + + + 02.GameObjects\Env\03.MapElement\Chest + + + 02.GameObjects\Env\03.MapElement\Chest\Lid + @@ -1702,6 +1720,15 @@ 50.UI\GamePlay_Canvas\Enemy_Panel\Enemy_Detection + + 02.GameObjects\Env\03.MapElement\Door + + + 02.GameObjects\Env\03.MapElement\Chest + + + 02.GameObjects\Env\03.MapElement\Chest\Lid + diff --git a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp index 6ae7bcc59..bf20bb5b1 100644 --- a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp @@ -14,6 +14,8 @@ #include "Player.h" #include "Unified.h" #include "MapElement_Lake.h" +#include "MapElement_Door.h" +#include "MapElement_Chest.h" CLevel_MapViewer::CLevel_MapViewer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID) : CLevel{ pDevice, pContext, ENUM_CLASS(eLevelID) } @@ -48,6 +50,7 @@ HRESULT CLevel_MapViewer::Initialize() if (FAILED(Ready_Layer_Terrain(TEXT("Layer_Terrain")))) { return E_FAIL; } + if (FAILED(Ready_Layer_Land(TEXT("Layer_Land")))) { return E_FAIL; } @@ -64,6 +67,14 @@ HRESULT CLevel_MapViewer::Initialize() return E_FAIL; } + //if (FAILED(Ready_Layer_Door(TEXT("Layer_Door")))) { + // return E_FAIL; + //} + + if (FAILED(Ready_Layer_Chest(TEXT("Layer_Chest")))) { + return E_FAIL; + } + if (FAILED(Ready_Layer_MapObjectManager(LAYER_MAPOBJECTMANAGER))) { return E_FAIL; } @@ -416,6 +427,64 @@ HRESULT CLevel_MapViewer::Ready_Layer_Unified(const _wstring& strLayerTag) return S_OK; } +HRESULT CLevel_MapViewer::Ready_Layer_Door(const _wstring& strLayerTag) +{ + vector<_wstring> ModelPrototypeTags; + + ModelPrototypeTags.push_back(TEXT("Prototype_GameObject_SM_HM_Ollivanders_Front_Door")); + ModelPrototypeTags.push_back(TEXT("Prototype_GameObject_SM_HM_Ollivanders_Front_Door_Lod1")); + ModelPrototypeTags.push_back(TEXT("Prototype_GameObject_SM_HM_Ollivanders_Front_Door_Lod2")); + + CMapElement_Door::ELEMENT_DOOR_DESC Door_Desc = {}; + Door_Desc.isEdit = true; + Door_Desc.iSubKind = {}; + Door_Desc.vBoxLocalPosition = {}; + Door_Desc.vBoxSize = {}; + Door_Desc.iMaxLodLevel = 2; + Door_Desc.ModelPrototypeTags = ModelPrototypeTags; + Door_Desc.vPosition = _float3(0.f, 0.f, 0.f); + Door_Desc.vRotation = _float3(0.f, 0.f, 0.f); + Door_Desc.vScale = _float3(1.f, 1.f, 1.f); + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &Door_Desc))) + return E_FAIL; + + return S_OK; +} + +HRESULT CLevel_MapViewer::Ready_Layer_Chest(const _wstring& strLayerTag) +{ + vector<_wstring> ModelPrototypeTags = {}; + vector<_wstring> ModelPrototypeTagsLid = {}; + + ModelPrototypeTags.push_back(TEXT("Prototype_GameObject_SM_Chest_RewardContainer_C")); + ModelPrototypeTags.push_back(TEXT("Prototype_GameObject_SM_Chest_RewardContainer_C_Lod1")); + ModelPrototypeTags.push_back(TEXT("Prototype_GameObject_SM_Chest_RewardContainer_C_Lod2")); + ModelPrototypeTags.push_back(TEXT("Prototype_GameObject_SM_Chest_RewardContainer_C_Lod3")); + + ModelPrototypeTagsLid.push_back(TEXT("Prototype_GameObject_SM_Chest_RewardContainer_C_Lid")); + ModelPrototypeTagsLid.push_back(TEXT("Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod1")); + ModelPrototypeTagsLid.push_back(TEXT("Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod2")); + + + CMapElement_Chest::ELEMENT_CHEST_DESC Chest_Desc = {}; + Chest_Desc.iMaxLodLevel = 3; + Chest_Desc.iSubKind = ENUM_CLASS(PXOBJECT::BOX); + Chest_Desc.ModelPrototypeTags = ModelPrototypeTags; + Chest_Desc.vPosition = _float3(0.f, 0.f, 0.f); + Chest_Desc.vRotation = _float3(0.f, 0.f, 0.f); + Chest_Desc.vScale = _float3(1.f, 1.f, 1.f); + Chest_Desc.vBoxSize = _float3(0.3f, 0.25f, 0.27f); + Chest_Desc.vBoxLocalPosition = _float3(-0.01f, 0.3f, -0.25f); + + Chest_Desc.iMaxLodLevel_Lid = 2; + Chest_Desc.ModelPrototypeTags_Lid= ModelPrototypeTagsLid; + Chest_Desc.vLid_Offset = _float3(0.f, 0.3f, 0.f); + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &Chest_Desc))) + return E_FAIL; + return S_OK; +} + HRESULT CLevel_MapViewer::Ready_Layer_MapObjectManager(const _wstring& strLayerTag) { if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag))) diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index e9e7f6fdc..13fc18866 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -115,6 +115,7 @@ #include "MapElement_Interactable.h" #include "MapElement_Static.h" #include "MapElement_Light.h" +#include "MapElement_Door.h" #include "Land.h" #include "Collider.h" #include "VIBuffer_Model_Instance.h" @@ -122,6 +123,8 @@ #include "InstancedProp.h" #include "Unified.h" #include "MapElement_Lake.h" +#include "MapElement_Chest.h" +#include "MapElement_Chest_Lid.h" #pragma endregion @@ -2422,6 +2425,11 @@ HRESULT CLoader::Loading_For_MapViewer() return E_FAIL; } + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Levioso_Noise"), + CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/Effect/Noises/VFX_T_NoiseCaustics02_Color_D.png"), 0)))) { + return E_FAIL; + } + /* For.Prototype_Component_LightPost_Emissive */ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("LightPost_Emissive"), CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, @@ -2489,7 +2497,7 @@ HRESULT CLoader::Loading_For_MapViewer() /* For.Prototype_Component_SkyboxModel */ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_SkyboxModel"), - CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/SkyBox/SM_SkyCard.fbx", XMMatrixIdentity())))) + CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/SkyBox/SkyBox.bin", XMMatrixIdentity())))) return E_FAIL; #pragma region MAP_LANDS @@ -2552,10 +2560,10 @@ HRESULT CLoader::Loading_For_MapViewer() ///* Terrain*/ //if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Collision\\Terrain", - // ".bin", true, ModelPrototypeTags, ModelPrototypePath))) + // ".bin", false, ModelPrototypeTags, ModelPrototypePath))) // return E_FAIL; //if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Terrain", - // ".bin", true, ModelPrototypeTags, ModelPrototypePath))) + // ".bin", false, ModelPrototypeTags, ModelPrototypePath))) // return E_FAIL; ///* TScrolls*/ @@ -2582,7 +2590,7 @@ HRESULT CLoader::Loading_For_MapViewer() // ".fbx", false, ModelPrototypeTags, ModelPrototypePath))) // return E_FAIL; //if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Ollivanders\\Collision", - // ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + // ".fbx", true, ModelPrototypeTags, ModelPrototypePath))) // return E_FAIL; ///* Gatehouse*/ @@ -2734,6 +2742,11 @@ HRESULT CLoader::Loading_For_MapViewer() // ".bin", false, ModelPrototypeTags, ModelPrototypePath))) // return E_FAIL; + /* Fences */ + if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\fences", + ".fbx", true, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + /* Light */ if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\LightPosts", ".bin", false, ModelPrototypeTags, ModelPrototypePath))) @@ -2741,7 +2754,7 @@ HRESULT CLoader::Loading_For_MapViewer() /* Doors */ if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Doors", - ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + ".bin", true, ModelPrototypeTags, ModelPrototypePath))) return E_FAIL; /* Step */ @@ -2777,6 +2790,12 @@ HRESULT CLoader::Loading_For_MapViewer() ".fbx", false, ModelPrototypeTags, ModelPrototypePath))) return E_FAIL; + /* Object Interactables */ + /* Chest */ + if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Objects\\Interactables", + ".fbx", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + #pragma endregion #ifdef gimch @@ -3328,6 +3347,18 @@ if(isLoad_Map) if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Interactable::Create(m_pDevice, m_pContext)))) return E_FAIL; + /* For.Prototype_GameObject_MapElement_Door */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Door::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_MapElement_Chest */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Chest::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_MapElement_Chest_Lid */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Chest_Lid::Create(m_pDevice, m_pContext)))) + return E_FAIL; + /* For.Prototype_GameObject_MapElement_Static */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Static::Create(m_pDevice, m_pContext)))) return E_FAIL; diff --git a/Jusin154_Team3D/Editor/Private/MapElement_Chest.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Chest.cpp new file mode 100644 index 000000000..216cfb67a --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/MapElement_Chest.cpp @@ -0,0 +1,468 @@ +#include "pch.h" +#include "MapElement_Chest.h" + +#include "GameInstance.h" +#include "Terrain.h" +#include "Layer.h" +#include "MapElement_Chest_Lid.h" + +CMapElement_Chest::CMapElement_Chest(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CMapElement{ pDevice, pContext } +{ +} + +CMapElement_Chest::CMapElement_Chest(const CMapElement_Chest& rhs) + : CMapElement(rhs) +{ +} + +HRESULT CMapElement_Chest::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapElement_Chest::Initialize(void* pArg) +{ + ELEMENT_CHEST_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; + + if (FAILED(Ready_Lid(pDesc))) + return E_FAIL; + + m_eCurState = m_ePreState = CHEST_STATE::IDLE; + +#ifdef _DEBUG + m_bSelected = false; + m_vPosition = pDesc->vPosition; + m_vScale = pDesc->vScale; + m_vRotation = pDesc->vRotation; + + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + m_pTransformCom->Set_Scale(m_vScale); + m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); +#endif // _DEBUG + + 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; +} + +void CMapElement_Chest::Priority_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + m_bSelected = false; +#endif + + m_pLid->Priority_Update(fTimeDelta); +} + +void CMapElement_Chest::Update(_float fTimeDelta) +{ + switch (m_eCurState) + { + case Editor::CMapElement_Chest::CHEST_STATE::IDLE: + break; + + case Editor::CMapElement_Chest::CHEST_STATE::FOUND: + break; + + case Editor::CMapElement_Chest::CHEST_STATE::OPENED: + break; + + default: + break; + } + + Chage_State(); + + m_pLid->Update(fTimeDelta); +} + +void CMapElement_Chest::Late_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + Describe_Entity(); + m_pLid->Describe_Entity(); +#endif + + if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) { + + if(CMapElement_Chest::CHEST_STATE::FOUND == m_eCurState) + m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this); + else + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); + + m_pLid->Late_Update(fTimeDelta); + } +} + +HRESULT CMapElement_Chest::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(m_iShaderPass_Index))) { + 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 + + if (FAILED(m_pLid->Render(m_iShaderPass_Index))) + return E_FAIL; + + return S_OK; +} + +HRESULT CMapElement_Chest::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; + + /* Com_Texture */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Levioso_Noise"), + reinterpret_cast(&m_pNoiseTextureCom)))) + return E_FAIL; + + + ELEMENT_CHEST_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"), (CComponent**)&m_pRigidBody, &Desc))) { + return E_FAIL; + } + + + return S_OK; +} + +HRESULT CMapElement_Chest::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; + } + + if (FAILED(m_pShaderCom->Bind_SRV("g_NoiseTexture", m_pNoiseTextureCom->Get_SRV(0)))) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CMapElement_Chest::Ready_Lid(ELEMENT_CHEST_DESC* pArg) +{ + m_pLid = m_pGameInstance->Clone_Prototype(g_iStaticLevel, pArg, this); + + if (nullptr == m_pLid) + return E_FAIL; + + return S_OK; +} + +void CMapElement_Chest::Chage_State() +{ + if (m_ePreState != m_eCurState) + { + switch (m_eCurState) + { + case Editor::CMapElement_Chest::CHEST_STATE::IDLE: + m_iShaderPass_Index = ENUM_CLASS(SHADER_PASS_MESH::DEFAULT); + break; + + case Editor::CMapElement_Chest::CHEST_STATE::FOUND: + m_iShaderPass_Index = 21; //ENUM_CLASS(SHADER_PASS_MESH::DEFAULT); + break; + + case Editor::CMapElement_Chest::CHEST_STATE::OPENED: + m_iShaderPass_Index = ENUM_CLASS(SHADER_PASS_MESH::DEFAULT); + break; + + default: + break; + } + m_ePreState = m_eCurState; + } +} + +CMapElement_Chest* CMapElement_Chest::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CMapElement_Chest* pInstance = new CMapElement_Chest(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CMapElement_Chest"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CMapElement_Chest::Clone(void* pArg, CGameObject* pOwner) +{ + CMapElement_Chest* pInstance = new CMapElement_Chest(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapElement_Chest"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CMapElement_Chest::Free() +{ + if (nullptr != m_pRigidBody) { + m_pGameInstance->Release_Actor(*m_pRigidBody->Get_Actor()); + } + __super::Free(); + + if (m_bCloned) + SAFE_RELEASE(m_pLid); + + SAFE_RELEASE(m_pRigidBody); + SAFE_RELEASE(m_pNoiseTextureCom); + SAFE_RELEASE(m_pShaderCom); + + for (auto& pModel : m_pModelComs) + SAFE_RELEASE(pModel); +} + +void CMapElement_Chest::Describe_Entity() +{ + if (m_bDead) + return; + if (nullptr == m_pGameInstance) + return; + + PSX::PxVec3 vDir = PSX::PxVec3(0.f, 1.f, 0.f); + + if (GUI::CollapsingHeader("Rigid Body")) + { + GUI::InputFloat("Power", &m_fPower); + + if (GUI::Button("Move Test")) + { + + m_pActor = static_cast(m_pRigidBody->Get_Actor()); + if (nullptr != m_pActor) + { + m_pActor->wakeUp(); + m_pActor->addForce(vDir * m_fPower * 100000.f, PSX::PxForceMode::eFORCE); + } + } + if (GUI::Button("OFF_Kinematic")) + { + m_pActor = static_cast(m_pRigidBody->Get_Actor()); + if (nullptr != m_pActor) + m_pActor->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, false); + } + if (GUI::Button("ON_Kinematic")) + { + m_pActor = static_cast(m_pRigidBody->Get_Actor()); + if (nullptr != m_pActor) + m_pActor->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, true); + } + + if (GUI::InputFloat("Mass", &m_fMass)) + m_pActor->setMass(m_fMass); + + m_pRigidBody->Describe_Entity(); + } + + + GUI::Text(CMyTools::ToString(m_ModelPrototypeTags[m_iLodIndex]).c_str()); + GUI::InputInt("Lod Level", (_int*)(&m_iLodIndex)); + m_iLodIndex = max(0, m_iLodIndex); + m_iLodIndex = min(m_iMaxLodLevel, m_iLodIndex); + + GUI::Checkbox("Select Color ON / OFF", &m_bUseSelectColor); + + GUI::Text("----- Transfrom ----"); + _float3 vMove = {}; + GUI::InputFloat("Right", &vMove.x, 0.05f, 0.1f); + 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); + + XMStoreFloat3(&m_vPosition, m_pTransformCom->Get_State(STATE::POSITION)); + + if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT)) + { + _float3 vPosition = {}; + if (m_pGameInstance->isPicking(&vPosition)) + { + memcpy(&m_vPosition, &vPosition, sizeof(_float3)); + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + } + } + + GUI::Text("----- Rotation ----"); + GUI::InputFloat("X##Rotation", &m_vRotation.x, 1.f, 15.f); + 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); + GUI::InputFloat("Z##Scale", &m_vScale.z, 0.05f, 0.1f); + + m_vScale.x = max(0.01f, m_vScale.x); + m_vScale.y = max(0.01f, m_vScale.y); + m_vScale.z = max(0.01f, m_vScale.z); + + if (GUI::Button("IDLE")) + { + m_eCurState = CHEST_STATE::IDLE; + } + if (GUI::Button("FOUND")) + { + m_eCurState = CHEST_STATE::FOUND; + } + if (GUI::Button("OPENED")) + { + m_eCurState = CHEST_STATE::OPENED; + } + + if (GUI::Button("Delete")) + m_bDead = true; + + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + m_pTransformCom->Set_Scale(m_vScale); + m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); +} + +HRESULT CMapElement_Chest::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root) +{ + tinyxml2::XMLElement* object = doc.NewElement("Object"); + object->SetAttribute("Type", ENUM_CLASS(MAPOBJECT_TYPE::ELEMENT_INTERACT)); + object->SetAttribute("ID", ENUM_CLASS(m_eInteractableID)); + object->SetAttribute("Lod_Level", m_iLodIndex); + root->InsertEndChild(object); + +#pragma region PROTOTYPETAG + for (_uint i = 0; i < m_iLodIndex + 1; ++i) + { + tinyxml2::XMLElement* prototype = doc.NewElement("PrototypeTag"); + prototype->SetText(CMyTools::ToString(m_ModelPrototypeTags[i]).c_str()); + object->InsertEndChild(prototype); + } +#pragma endregion + +#pragma region TRANSFORM + _float3 vPosition = {}; + XMStoreFloat3(&vPosition, m_pTransformCom->Get_State(STATE::POSITION)); + + _float3 vScale = m_pTransformCom->Get_Scale(); + + _float3 vRotation = {}; + XMStoreFloat3(&vRotation, m_pTransformCom->Get_RollPitchYawVector()); + vRotation.x = XMConvertToDegrees(vRotation.x); + vRotation.y = XMConvertToDegrees(vRotation.y); + vRotation.z = XMConvertToDegrees(vRotation.z); + + tinyxml2::XMLElement* Position = doc.NewElement("Position"); + Position->SetAttribute("x", vPosition.x); + Position->SetAttribute("y", vPosition.y); + Position->SetAttribute("z", vPosition.z); + object->InsertEndChild(Position); + + tinyxml2::XMLElement* Scale = doc.NewElement("Scale"); + Scale->SetAttribute("x", vScale.x); + Scale->SetAttribute("y", vScale.y); + Scale->SetAttribute("z", vScale.z); + object->InsertEndChild(Scale); + + tinyxml2::XMLElement* Rotation = doc.NewElement("Rotation"); + Rotation->SetAttribute("x", vRotation.x); + Rotation->SetAttribute("y", vRotation.y); + Rotation->SetAttribute("z", vRotation.z); + object->InsertEndChild(Rotation); + + _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/MapElement_Chest_Lid.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Chest_Lid.cpp new file mode 100644 index 000000000..d50ca3d60 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/MapElement_Chest_Lid.cpp @@ -0,0 +1,314 @@ +#include "pch.h" +#include "MapElement_Chest_Lid.h" +#include "MapElement_Chest.h" + +#include "GameInstance.h" + +CMapElement_Chest_Lid::CMapElement_Chest_Lid(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CMapElement{ pDevice, pContext } +{ +} + +CMapElement_Chest_Lid::CMapElement_Chest_Lid(const CMapElement_Chest_Lid& rhs) + : CMapElement(rhs) +{ +} + +HRESULT CMapElement_Chest_Lid::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapElement_Chest_Lid::Initialize(void* pArg) +{ + CMapElement_Chest::ELEMENT_CHEST_DESC* pDesc = static_cast(pArg); + + m_iMaxLodLevel = pDesc->iMaxLodLevel_Lid; + + for (_uint i = 0; i < m_iMaxLodLevel + 1; i++) + { + m_ModelPrototypeTags.push_back(pDesc->ModelPrototypeTags_Lid[i]); + } + + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components(pArg))) + return E_FAIL; + + + m_fOpenDuration = 1.f; + m_fRotationAngle = 30.f; + m_vPosition = pDesc->vLid_Offset; + m_vRotation = _float3(0.f, 0.f, 0.f); + m_vScale = _float3(1.f, 1.f, 1.f); + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + + m_pParentWorldMatrix = m_pOwner->Get_Component()->Get_WorldMatrixPtr(); + XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * XMLoadFloat4x4(m_pParentWorldMatrix)); + + return S_OK; +} + +void CMapElement_Chest_Lid::Priority_Update(_float fTimeDelta) +{ +} + +void CMapElement_Chest_Lid::Update(_float fTimeDelta) +{ + switch (m_eState) + { + case Editor::CMapElement_Chest_Lid::LID_STATE::IDLE: + break; + + case Editor::CMapElement_Chest_Lid::LID_STATE::OPENING: + if (Opening(fTimeDelta)) + m_eState = LID_STATE::OPENED; + break; + + case Editor::CMapElement_Chest_Lid::LID_STATE::OPENED: + break; + + default: + break; + } +} + +void CMapElement_Chest_Lid::Late_Update(_float fTimeDelta) +{ + /* 부모에서 Render 호출 */ + + +} + +HRESULT CMapElement_Chest_Lid::Render(_uint iShaderPass) +{ + 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(iShaderPass))) { + return E_FAIL; + } + + if (FAILED(m_pModelComs[m_iLodIndex]->Render(i))) { + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT CMapElement_Chest_Lid::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; + + + return S_OK; +} + +HRESULT CMapElement_Chest_Lid::Bind_ShaderResources() +{ + if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", &m_CombinedWorldMatrix))) { + 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; +} + +_bool CMapElement_Chest_Lid::Opening(_float fTimeDelta) +{ + m_fTimeAcc += fTimeDelta; + + if (m_fTimeAcc >= m_fOpenDuration) + { + m_fTimeAcc = m_fOpenDuration; + m_pTransformCom->Rotation(XMConvertToRadians(m_fRotationAngle), 0.f, 0.f); + return true; + } + + m_pTransformCom->Rotation(XMConvertToRadians(m_fRotationAngle * m_fTimeAcc / m_fOpenDuration), 0.f, 0.f); + + XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * XMLoadFloat4x4(m_pParentWorldMatrix)); + + return false; +} + +void CMapElement_Chest_Lid::Reset() +{ + m_fTimeAcc = 0.f; + + m_pTransformCom->Rotation(0.f, 0.f, 0.f); + + XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * XMLoadFloat4x4(m_pParentWorldMatrix)); +} + +CMapElement_Chest_Lid* CMapElement_Chest_Lid::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CMapElement_Chest_Lid* pInstance = new CMapElement_Chest_Lid(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CMapElement_Chest_Lid"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CMapElement_Chest_Lid::Clone(void* pArg, CGameObject* pOwner) +{ + CMapElement_Chest_Lid* pInstance = new CMapElement_Chest_Lid(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapElement_Chest_Lid"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CMapElement_Chest_Lid::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pShaderCom); + + for (auto& pModel : m_pModelComs) + SAFE_RELEASE(pModel); +} + +void CMapElement_Chest_Lid::Describe_Entity() +{ + if (m_bDead) + return; + if (nullptr == m_pGameInstance) + return; + + GUI::Begin("Lid"); + + GUI::Text(CMyTools::ToString(m_ModelPrototypeTags[m_iLodIndex]).c_str()); + GUI::InputInt("Lod Level", (_int*)(&m_iLodIndex)); + m_iLodIndex = max(0, m_iLodIndex); + m_iLodIndex = min(m_iMaxLodLevel, m_iLodIndex); + + GUI::Text("----- Transfrom ----"); + _float3 vMove = {}; + GUI::InputFloat("Right", &vMove.x, 0.05f, 0.1f); + 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); + + XMStoreFloat3(&m_vPosition, m_pTransformCom->Get_State(STATE::POSITION)); + + GUI::Text("----- Rotation ----"); + GUI::InputFloat("X##Rotation", &m_vTargetRotation.x, 1.f, 15.f); + GUI::InputFloat("Y##Rotation", &m_vTargetRotation.y, 1.f, 15.f); + GUI::InputFloat("Z##Rotation", &m_vTargetRotation.z, 1.f, 15.f); + + GUI::InputFloat("m_fRotationAngle", &m_fRotationAngle, 1.f, 5.f); + GUI::InputFloat("m_fOpenDuration", &m_fOpenDuration, 0.1f, 1.f); + + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * XMLoadFloat4x4(m_pParentWorldMatrix)); + + if (GUI::Button("Open")) + m_eState = LID_STATE::OPENING; + + if (GUI::Button("Reset")) + Reset(); + + GUI::End(); +} + +HRESULT CMapElement_Chest_Lid::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root) +{ + tinyxml2::XMLElement* object = doc.NewElement("Object"); + object->SetAttribute("Lod_Level", m_iMaxLodLevel); + root->InsertEndChild(object); + +#pragma region PROTOTYPETAG + for (_uint i = 0; i < m_iLodIndex + 1; ++i) + { + tinyxml2::XMLElement* prototype = doc.NewElement("PrototypeTag"); + prototype->SetText(CMyTools::ToString(m_ModelPrototypeTags[i]).c_str()); + object->InsertEndChild(prototype); + } +#pragma endregion + +#pragma region TRANSFORM + _float3 vPosition = {}; + XMStoreFloat3(&vPosition, m_pTransformCom->Get_State(STATE::POSITION)); + + _float3 vScale = m_pTransformCom->Get_Scale(); + + _float3 vRotation = {}; + XMStoreFloat3(&vRotation, m_pTransformCom->Get_RollPitchYawVector()); + vRotation.x = XMConvertToDegrees(vRotation.x); + vRotation.y = XMConvertToDegrees(vRotation.y); + vRotation.z = XMConvertToDegrees(vRotation.z); + + tinyxml2::XMLElement* Position = doc.NewElement("Position"); + Position->SetAttribute("x", vPosition.x); + Position->SetAttribute("y", vPosition.y); + Position->SetAttribute("z", vPosition.z); + object->InsertEndChild(Position); + + tinyxml2::XMLElement* Scale = doc.NewElement("Scale"); + Scale->SetAttribute("x", vScale.x); + Scale->SetAttribute("y", vScale.y); + Scale->SetAttribute("z", vScale.z); + object->InsertEndChild(Scale); + + tinyxml2::XMLElement* Rotation = doc.NewElement("Rotation"); + Rotation->SetAttribute("x", vRotation.x); + Rotation->SetAttribute("y", vRotation.y); + Rotation->SetAttribute("z", vRotation.z); + object->InsertEndChild(Rotation); + + + +#pragma endregion + + return S_OK; +} diff --git a/Jusin154_Team3D/Editor/Private/MapElement_Door.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Door.cpp new file mode 100644 index 000000000..cd80c8c9e --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/MapElement_Door.cpp @@ -0,0 +1,416 @@ +#include "pch.h" +#include "MapElement_Door.h" + +#include "GameInstance.h" +#include "Terrain.h" +#include "Layer.h" +#include "VIBuffer_Terrain.h" + +CMapElement_Door::CMapElement_Door(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CMapElement{ pDevice, pContext } +{ +} + +CMapElement_Door::CMapElement_Door(const CMapElement_Door& rhs) + : CMapElement(rhs) +{ +} + +HRESULT CMapElement_Door::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapElement_Door::Initialize(void* pArg) +{ + ELEMENT_DOOR_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; + +#ifdef _DEBUG + m_isEdit = pDesc->isEdit; + m_bSelected = false; + m_vPosition = pDesc->vPosition; + m_vScale = pDesc->vScale; + m_vRotation = pDesc->vRotation; + + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + m_pTransformCom->Set_Scale(m_vScale); + m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); +#endif // _DEBUG + + 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; +} + +void CMapElement_Door::Priority_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + m_bSelected = false; +#endif +} + +void CMapElement_Door::Update(_float fTimeDelta) +{ + if (m_isEdit) + { + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + m_pTransformCom->Set_Scale(m_vScale); + m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); + } +} + +void CMapElement_Door::Late_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + if(m_isEdit) + Describe_Entity(); +#endif + + if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) { + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); + } +} + +HRESULT CMapElement_Door::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 (m_bSelected && m_bUseSelectColor) + { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::MAPTOOL)))) { + return E_FAIL; + } + } + else + { + 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_Door::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_DOOR_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"), (CComponent**)&m_pRigidBody, &Desc))) { + // return E_FAIL; + //} + + + return S_OK; +} + +HRESULT CMapElement_Door::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_Door* CMapElement_Door::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CMapElement_Door* pInstance = new CMapElement_Door(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CMapElement_Door"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CMapElement_Door::Clone(void* pArg, CGameObject* pOwner) +{ + CMapElement_Door* pInstance = new CMapElement_Door(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapElement_Door"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CMapElement_Door::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); +} + +void CMapElement_Door::Describe_Entity() +{ + if (m_bDead) + return; + if (nullptr == m_pGameInstance) + return; + + GUI::Begin("Door"); + + PSX::PxVec3 vDir = PSX::PxVec3(0.f, 1.f, 0.f); + + /*if (GUI::CollapsingHeader("Rigid Body")) + { + GUI::InputFloat("Power", &m_fPower); + + if (GUI::Button("Move Test")) + { + + m_pActor = static_cast(m_pRigidBody->Get_Actor()); + if (nullptr != m_pActor) + { + m_pActor->wakeUp(); + m_pActor->addForce(vDir * m_fPower * 100000.f, PSX::PxForceMode::eFORCE); + } + } + if (GUI::Button("OFF_Kinematic")) + { + m_pActor = static_cast(m_pRigidBody->Get_Actor()); + if (nullptr != m_pActor) + m_pActor->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, false); + } + if (GUI::Button("ON_Kinematic")) + { + m_pActor = static_cast(m_pRigidBody->Get_Actor()); + if (nullptr != m_pActor) + m_pActor->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, true); + } + + if (GUI::InputFloat("Mass", &m_fMass)) + m_pActor->setMass(m_fMass); + + m_pRigidBody->Describe_Entity(); + }*/ + + + GUI::Text(CMyTools::ToString(m_ModelPrototypeTags[m_iLodIndex]).c_str()); + GUI::InputInt("Lod Level", (_int*)(&m_iLodIndex)); + m_iLodIndex = max(0, m_iLodIndex); + m_iLodIndex = min(m_iMaxLodLevel, m_iLodIndex); + + if (GUI::Button("Save_DoorData")) + { + tinyxml2::XMLDocument doc; + string strPath = "../Bin/Resources/Data/Map/Door/Element_Door_Info.xml"; + + tinyxml2::XMLError loadResult = doc.LoadFile(strPath.c_str()); + + tinyxml2::XMLElement* root = {}; + + if (loadResult == tinyxml2::XML_SUCCESS) + { + root = doc.FirstChildElement("Doors"); + Save_XML(doc, root); + + if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) { + MSG_BOX("Failed to Save DoorInfo File"); + } + } + else + MSG_BOX("Failed to Save Data"); + } + + GUI::Checkbox("Select Color ON / OFF", &m_bUseSelectColor); + + GUI::Text("----- Transfrom ----"); + _float3 vMove = {}; + GUI::InputFloat("Right", &vMove.x, 0.05f, 0.1f); + 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); + + XMStoreFloat3(&m_vPosition, m_pTransformCom->Get_State(STATE::POSITION)); + + GUI::InputFloat("X##Position", &m_vPosition.x, 0.1f, 1.f); + GUI::InputFloat("Y##Position", &m_vPosition.y, 0.1f, 1.f); + GUI::InputFloat("Z##Position", &m_vPosition.z, 0.1f, 1.f); + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + + + if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT)) + { + _float3 vPosition = {}; + if (m_pGameInstance->isPicking(&vPosition)) + { + memcpy(&m_vPosition, &vPosition, sizeof(_float3)); + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + } + } + + GUI::Text("----- Rotation ----"); + GUI::InputFloat("X##Rotation", &m_vRotation.x, 1.f, 15.f); + 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); + GUI::InputFloat("Z##Scale", &m_vScale.z, 0.05f, 0.1f); + + m_vScale.x = max(0.01f, m_vScale.x); + m_vScale.y = max(0.01f, m_vScale.y); + m_vScale.z = max(0.01f, m_vScale.z); + + if (GUI::Button("Delete")) + m_bDead = true; + + GUI::End(); + + //m_bSelected = true; +} + +HRESULT CMapElement_Door::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root) +{ + tinyxml2::XMLElement* object = doc.NewElement("Object"); + object->SetAttribute("Lod_Level", m_iMaxLodLevel); + root->InsertEndChild(object); + +#pragma region PROTOTYPETAG + for (_uint i = 0; i < m_iMaxLodLevel + 1; ++i) + { + tinyxml2::XMLElement* prototype = doc.NewElement("PrototypeTag"); + prototype->SetText(CMyTools::ToString(m_ModelPrototypeTags[i]).c_str()); + object->InsertEndChild(prototype); + } +#pragma endregion + +#pragma region TRANSFORM + _float3 vPosition = {}; + XMStoreFloat3(&vPosition, m_pTransformCom->Get_State(STATE::POSITION)); + + _float3 vScale = m_pTransformCom->Get_Scale(); + + _float3 vRotation = {}; + XMStoreFloat3(&vRotation, m_pTransformCom->Get_RollPitchYawVector()); + vRotation.x = XMConvertToDegrees(vRotation.x); + vRotation.y = XMConvertToDegrees(vRotation.y); + vRotation.z = XMConvertToDegrees(vRotation.z); + + tinyxml2::XMLElement* Position = doc.NewElement("Position"); + Position->SetAttribute("x", vPosition.x); + Position->SetAttribute("y", vPosition.y); + Position->SetAttribute("z", vPosition.z); + object->InsertEndChild(Position); + + tinyxml2::XMLElement* Scale = doc.NewElement("Scale"); + Scale->SetAttribute("x", vScale.x); + Scale->SetAttribute("y", vScale.y); + Scale->SetAttribute("z", vScale.z); + object->InsertEndChild(Scale); + + tinyxml2::XMLElement* Rotation = doc.NewElement("Rotation"); + Rotation->SetAttribute("x", vRotation.x); + Rotation->SetAttribute("y", vRotation.y); + Rotation->SetAttribute("z", vRotation.z); + object->InsertEndChild(Rotation); + + //_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/MapElement_Interactable.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp index 125839f0e..2a106cf05 100644 --- a/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp +++ b/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp @@ -78,9 +78,6 @@ void CMapElement_Interactable::Update(_float fTimeDelta) void CMapElement_Interactable::Late_Update(_float fTimeDelta) { -#ifdef _DEBUG - -#endif if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) { m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Collision.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Collision.cpp index f1ca463d7..d91735087 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_Collision.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_Collision.cpp @@ -43,9 +43,8 @@ void CMapObject_Collision::Late_Update(_float fTimeDelta) XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * m_pParentTransformCom->Get_XMWorldMatrix()); if (m_bVisible){ - if (m_pGameInstance->isIn_WorldFrustum(XMLoadFloat4(reinterpret_cast<_float4*>(m_CombinedWorldMatrix.m[3])), m_pTransformCom->Get_Radius())) { - m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); - } + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); + } } diff --git a/Jusin154_Team3D/Editor/Public/Level_MapViewer.h b/Jusin154_Team3D/Editor/Public/Level_MapViewer.h index e60633190..b45917775 100644 --- a/Jusin154_Team3D/Editor/Public/Level_MapViewer.h +++ b/Jusin154_Team3D/Editor/Public/Level_MapViewer.h @@ -25,6 +25,8 @@ class CLevel_MapViewer final : public CLevel HRESULT Ready_Layer_InstanceProp(const _wstring& strLayerTag); HRESULT Ready_Layer_BuildingContainer(const _wstring& strLayerTag); HRESULT Ready_Layer_Unified(const _wstring& strLayerTag); + HRESULT Ready_Layer_Door(const _wstring& strLayerTag); + HRESULT Ready_Layer_Chest(const _wstring& strLayerTag); HRESULT Ready_Layer_MapObjectManager(const _wstring& strLayerTag); diff --git a/Jusin154_Team3D/Editor/Public/MapElement_Chest.h b/Jusin154_Team3D/Editor/Public/MapElement_Chest.h new file mode 100644 index 000000000..cd71f5122 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/MapElement_Chest.h @@ -0,0 +1,76 @@ +#pragma once + +#include "Editor_Define.h" +#include "MapElement.h" + +NS_BEGIN(Editor) + +class CMapElement_Chest final : public CMapElement +{ +public: + enum class CHEST_STATE { IDLE, FOUND, OPENED, END }; + +public: + typedef struct tagElement_Chest_Desc : MAPOBJECT_LOD_DESC + { + _uint iInteractableID = {}; + _uint iSubKind = {}; + _float3 vBoxLocalPosition; + _float3 vBoxSize; + + _uint iMaxLodLevel_Lid{}; + vector<_wstring> ModelPrototypeTags_Lid; + _float3 vLid_Offset = {}; + }ELEMENT_CHEST_DESC; + +private: + CMapElement_Chest(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMapElement_Chest(const CMapElement_Chest& rhs); + virtual ~CMapElement_Chest() = 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 }; + CHEST_STATE m_ePreState = {}; + CHEST_STATE m_eCurState = {}; + + _uint m_iShaderPass_Index = {}; + + class CMapElement_Chest_Lid* m_pLid = { nullptr }; + CRigidBody* m_pRigidBody = { nullptr }; + PSX::PxRigidDynamic* m_pActor = { nullptr }; + + CTexture* m_pNoiseTextureCom = { nullptr }; +#ifdef _DEBUG + _bool m_bUseSelectColor = { true }; + + _float m_fPower = {}; + _float m_fMass = {}; + _float3 m_vBoxSize = {}; +#endif // _DEBUG + + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + virtual HRESULT Bind_ShaderResources() override; + HRESULT Ready_Lid(ELEMENT_CHEST_DESC* pArg); + + void Chage_State(); + +public: + static CMapElement_Chest* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; + void Describe_Entity() override; + virtual HRESULT Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root)override; +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Public/MapElement_Chest_Lid.h b/Jusin154_Team3D/Editor/Public/MapElement_Chest_Lid.h new file mode 100644 index 000000000..9977a1911 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/MapElement_Chest_Lid.h @@ -0,0 +1,65 @@ +#pragma once + +#include "Editor_Define.h" +#include "MapElement.h" + +NS_BEGIN(Editor) + +class CMapElement_Chest_Lid final : public CMapElement +{ +public: + enum class LID_STATE{IDLE, OPENING, OPENED, END}; + +private: + CMapElement_Chest_Lid(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMapElement_Chest_Lid(const CMapElement_Chest_Lid& rhs); + virtual ~CMapElement_Chest_Lid() = 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(_uint iShaderPass); + +private: + LID_STATE m_eState = { LID_STATE::END }; + + _bool m_isRotationAnim = {}; + _float m_fOpenDuration = {}; + _float m_fTimeAcc = {}; + _float m_fRotationAngle = {}; + + _float3 m_vTargetPosition = {}; + _float3 m_vTargetRotation = {}; + + _float4x4 m_CombinedWorldMatrix = {}; + +#ifdef _DEBUG + _bool m_isOpen = {}; + _float3 m_vDefaultPos = {}; + const _float4x4* m_pParentWorldMatrix = { nullptr }; +#endif // _DEBUG + + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + virtual HRESULT Bind_ShaderResources() override; + + _bool Opening(_float fTimeDelta); + +#ifdef _DEBUG + void Reset(); +#endif // _DEBUG + + +public: + static CMapElement_Chest_Lid* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; + void Describe_Entity() override; + virtual HRESULT Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root)override; +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Public/MapElement_Door.h b/Jusin154_Team3D/Editor/Public/MapElement_Door.h new file mode 100644 index 000000000..63f65ae23 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/MapElement_Door.h @@ -0,0 +1,59 @@ +#pragma once + +#include "Editor_Define.h" +#include "MapElement.h" + +NS_BEGIN(Editor) + +class CMapElement_Door final : public CMapElement +{ +public: + typedef struct tagElement_Interactable_Desc : MAPOBJECT_LOD_DESC + { + _bool isEdit = {}; // Editor 용 + _uint iSubKind = {}; + _float3 vBoxLocalPosition; + _float3 vBoxSize; + }ELEMENT_DOOR_DESC; + +private: + CMapElement_Door(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMapElement_Door(const CMapElement_Door& rhs); + virtual ~CMapElement_Door() = 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: + + CRigidBody* m_pRigidBody = { nullptr }; + PSX::PxRigidDynamic* m_pActor = { nullptr }; + +#ifdef _DEBUG + _bool m_isEdit = {}; + _bool m_bUseSelectColor = { true }; + + _float m_fPower = {}; + _float m_fMass = {}; + _float3 m_vBoxSize = {}; +#endif // _DEBUG + + +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_Door* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; + void Describe_Entity() override; + virtual HRESULT Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root)override; +}; + +NS_END diff --git a/Jusin154_Team3D/Engine/Private/GameObject.cpp b/Jusin154_Team3D/Engine/Private/GameObject.cpp index 0c5d52f2f..e31aac465 100644 --- a/Jusin154_Team3D/Engine/Private/GameObject.cpp +++ b/Jusin154_Team3D/Engine/Private/GameObject.cpp @@ -18,6 +18,7 @@ CGameObject::CGameObject(const CGameObject& rhs) , m_pContext(rhs.m_pContext) , m_pGameInstance(rhs.m_pGameInstance) , m_bDead(rhs.m_bDead) + , m_bCloned(true) { SAFE_ADDREF(m_pGameInstance); SAFE_ADDREF(m_pDevice); diff --git a/Jusin154_Team3D/Engine/Public/GameObject.h b/Jusin154_Team3D/Engine/Public/GameObject.h index 1510482e5..cd21e9287 100644 --- a/Jusin154_Team3D/Engine/Public/GameObject.h +++ b/Jusin154_Team3D/Engine/Public/GameObject.h @@ -107,6 +107,7 @@ class ENGINE_DLL CGameObject abstract _float m_fCamDepth = { FLT_MAX }; _bool m_bDead = { false }; _bool m_bVisible = { true }; + _bool m_bCloned = { false }; protected: virtual HRESULT Bind_ShaderResources()PURE; virtual HRESULT Ready_Components(void* pArg);