From b19671ad8e45e91b87dc8b6a0dddb3b47e0a423e Mon Sep 17 00:00:00 2001 From: JinhoBa <127280695+JinhoBa@users.noreply.github.com> Date: Tue, 11 Nov 2025 22:15:11 +0900 Subject: [PATCH 1/4] [add] MapTool Level [add] MapObject [add] MapObject Manager --- Jusin154_Team3D/Editor/Default/Editor.vcxproj | 8 + .../Editor/Default/Editor.vcxproj.filters | 61 ++- .../Editor/Private/Level_MapViewer.cpp | 12 +- Jusin154_Team3D/Editor/Private/Loader.cpp | 20 +- Jusin154_Team3D/Editor/Private/MapObject.cpp | 214 +++------- .../Editor/Private/MapObject_Manager.cpp | 374 +++++++++++++----- .../Editor/Public/Level_MapViewer.h | 2 +- Jusin154_Team3D/Editor/Public/MapObject.h | 37 +- .../Editor/Public/MapObject_Manager.h | 19 +- 9 files changed, 430 insertions(+), 317 deletions(-) diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index ab2d009b2..2fa1ba95d 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -153,6 +153,7 @@ + @@ -163,8 +164,11 @@ + + + @@ -210,6 +214,7 @@ + @@ -220,8 +225,11 @@ + + + diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index 5d5cb53ea..9239be701 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -145,9 +145,6 @@ {44a3ddc2-3993-48d6-840c-3da09daeab70} - - {584466e9-fe1a-4a7d-a4ba-54d62ee1a7c1} - {943a760b-2861-45b7-87b8-462e1309c172} @@ -166,6 +163,24 @@ {15a9dfe7-f3f7-4906-8bd4-91734f4ddc92} + + {584466e9-fe1a-4a7d-a4ba-54d62ee1a7c1} + + + {d925c13c-6d66-4632-8bef-172baa566920} + + + {9643531b-3b64-4a3b-9ba7-e372b4e4ddba} + + + {702dfe26-f6b0-4aa0-b8d5-79385c0191d1} + + + {bc80fcba-1ebd-497c-a40d-973e44ad3ef8} + + + {34fa4d78-8091-44cf-b4b4-59db9fd56d98} + @@ -303,14 +318,11 @@ 01.Level\30.MapViewer - - 02.GameObjects\Env - 02.GameObjects\Terrain - 02.GameObjects\Env\Manger + 02.GameObjects\Env\00.Manger 01.Level\60.PhysXLab @@ -327,6 +339,21 @@ 02.GameObjects\Dummys\DummyObject + + 02.GameObjects\Env\01.MapContainer + + + 02.GameObjects\Env\01.MapContainer\BuildingContainer + + + 02.GameObjects\Env\02.MapObject + + + 02.GameObjects\Env\02.MapObject\Static + + + 02.GameObjects\Env\02.MapObject\LOD + @@ -445,14 +472,11 @@ 01.Level\30.MapViewer - - 02.GameObjects\Env - 02.GameObjects\Terrain - 02.GameObjects\Env\Manger + 02.GameObjects\Env\00.Manger 01.Level\60.PhysXLab @@ -484,6 +508,21 @@ 02.GameObjects\Dummys\DummyObject + + 02.GameObjects\Env\01.MapContainer + + + 02.GameObjects\Env\01.MapContainer\BuildingContainer + + + 02.GameObjects\Env\02.MapObject + + + 02.GameObjects\Env\02.MapObject\Static + + + 02.GameObjects\Env\02.MapObject\LOD + diff --git a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp index 6b69a4dbc..6b52cdbb3 100644 --- a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp @@ -6,6 +6,7 @@ #include "DebugCamera.h" #include "Terrain.h" #include "MapObject_Manager.h" +#include "BuildingContainer.h" CLevel_MapViewer::CLevel_MapViewer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID) : CLevel{ pDevice, pContext, ENUM_CLASS(eLevelID) } @@ -38,7 +39,7 @@ HRESULT CLevel_MapViewer::Initialize() return E_FAIL; } - if (FAILED(Ready_Layer_MapObjects(TEXT("Layer_MapObject")))) { + if (FAILED(Ready_Layer_BuildingContainer(TEXT("Layer_Building")))) { return E_FAIL; } @@ -92,13 +93,10 @@ HRESULT CLevel_MapViewer::Ready_Layer_Terrain(const _wstring& strLayerTag) return S_OK; } -HRESULT CLevel_MapViewer::Ready_Layer_MapObjects(const _wstring& strLayerTag) +HRESULT CLevel_MapViewer::Ready_Layer_BuildingContainer(const _wstring& strLayerTag) { - //CMapObject::MAPOBJECT_DESC Desc = {}; - //Desc.pModelPrototypeTag = TEXT("Prototype_GameObject_SM_HW_ClockTower_Courtyard_BaseWall_A"); - - //if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL,strLayerTag, &Desc))) - // return E_FAIL; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag))) + return E_FAIL; return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index dee279c41..dbf95ca29 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -47,7 +47,9 @@ #pragma region MAP_HEADER #include "VIBuffer_Terrain.h" #include "Terrain.h" -#include "MapObject.h" +#include "BuildingContainer.h" +#include "MapObject_Static.h" +#include "MapObject_LOD.h" #include "MapObject_Manager.h" #pragma endregion @@ -676,9 +678,9 @@ HRESULT CLoader::Loading_For_MapViewer() _wstring strFileName = L"Prototype_GameObject_" + file.path().stem().wstring(); - /*For Prototype_Component_Model_Auro*/ + /*For Prototype_Component_Model_*/ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, strFileName, - CModel::Create(m_pDevice, m_pContext, szFilePath, MODEL::ENVIROMENT, XMMatrixIdentity(), 0)))) + CModel::Create(m_pDevice, m_pContext,szFilePath, MODEL::ENVIROMENT, XMMatrixIdentity(), 0)))) return E_FAIL; ModelPrototypeTags.push_back(strFileName); @@ -694,8 +696,16 @@ HRESULT CLoader::Loading_For_MapViewer() CVIBuffer_Terrain::Create(m_pDevice, m_pContext, nullptr, 100, 100)))) return E_FAIL; - /* For.Prototype_GameObject_MapObject */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapObject::Create(m_pDevice, m_pContext)))) + /* For.Prototype_GameObject_BuildingContainer */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CBuildingContainer::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_MapObject_Static */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapObject_Static::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_MapObject_LOD */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapObject_LOD::Create(m_pDevice, m_pContext)))) return E_FAIL; /* For.Prototype_GameObject_Terrain */ diff --git a/Jusin154_Team3D/Editor/Private/MapObject.cpp b/Jusin154_Team3D/Editor/Private/MapObject.cpp index ace0588d0..1385f0f6c 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject.cpp @@ -4,45 +4,20 @@ #include "GameInstance.h" #include "DebugCamera.h" #include "Layer.h" -//#include "Terrain.h" +#include "Terrain.h" +#include "VIBuffer_Terrain.h" CMapObject::CMapObject(ID3D11Device * pDevice, ID3D11DeviceContext * pContext) - : CGameObject(pDevice, pContext) + : CPartObject(pDevice, pContext) { } CMapObject::CMapObject(const CMapObject& Prototype) - : CGameObject(Prototype) + : CPartObject(Prototype) { } -HRESULT CMapObject::Initialize_Prototype() -{ - return S_OK; -} -HRESULT CMapObject::Initialize(void* pArg) -{ - MAPOBJECT_DESC* pDesc = static_cast(pArg); - - m_strModelPrototypeTag = pDesc->pModelPrototypeTag; - - if (FAILED(__super::Initialize(pArg))) - return E_FAIL; - - if (FAILED(Ready_Components())) - return E_FAIL; - - -#ifdef _DEBUG - m_bSelected = false; - m_vPosition = _float3(0.f, 0.f, 0.f); - m_vRotation = _float3(0.f, 0.f, 0.f); - m_vScale = _float3(1.f, 1.f, 1.f); -#endif // _DEBUG - - return S_OK; -} void CMapObject::Priority_Update(_float fTimeDelta) { @@ -53,15 +28,20 @@ void CMapObject::Priority_Update(_float fTimeDelta) void CMapObject::Update(_float fTimeDelta) { -#ifdef _DEBUG - 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 + } void CMapObject::Late_Update(_float fTimeDelta) { +#ifdef _DEBUG + if(m_bSelected) + { + 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 + _float4 vPos; XMStoreFloat4(&vPos, Get_WorldPostion()); m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f); @@ -73,25 +53,53 @@ HRESULT CMapObject::Render() return E_FAIL; } - _uint iNumMeshes = m_pModelCom->Get_NumMeshes(); + //_uint iNumMeshes = m_pModelCom->Get_NumMeshes(); - for (_uint i = 0; i < iNumMeshes; i++) - { - if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) { - return E_FAIL; - } - if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) { - return E_FAIL; - } + //for (_uint i = 0; i < iNumMeshes; i++) + //{ + // if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) { + // return E_FAIL; + // } + // if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) { + // return E_FAIL; + // } - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { - return E_FAIL; - } + // if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { + // return E_FAIL; + // } - if (FAILED(m_pModelCom->Render(i))) { - return E_FAIL; - } - } + // if (FAILED(m_pModelCom->Render(i))) { + // return E_FAIL; + // } + //} + + return S_OK; +} + +_wstring CMapObject::Get_PrototypeTag(_uint iLodIndex) +{ + return _wstring(); +} + +HRESULT CMapObject::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapObject::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components())) + return E_FAIL; + +#ifdef _DEBUG + m_bSelected = false; + m_vPosition = _float3(0.f, 0.f, 0.f); + m_vRotation = _float3(0.f, 0.f, 0.f); + m_vScale = _float3(1.f, 1.f, 1.f); +#endif // _DEBUG return S_OK; } @@ -100,126 +108,20 @@ HRESULT CMapObject::Ready_Components() { __super::Ready_Components(nullptr); - /* Com_Model */ - if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_strModelPrototypeTag, - reinterpret_cast(&m_pModelCom)))) - return E_FAIL; - - /* Com_Shader */ - if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH, - reinterpret_cast(&m_pShaderCom)))) - return E_FAIL; - return S_OK; } HRESULT CMapObject::Bind_ShaderResources() { - if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { - 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_RawValue("g_vCamPosition", m_pGameInstance->Get_CamPosition(), sizeof(_float4)))) { - // return E_FAIL; - //} - //if (FAILED(m_pShaderCom->Bind_RawValue("g_bRimLight", &m_bRimLight, sizeof(_bool)))) { - // return E_FAIL; - //} - //if (FAILED(m_pShaderCom->Bind_RawValue("g_fRimStrength", &m_fRimLightStrength, sizeof(_float)))) { - // return E_FAIL; - //} - //if (FAILED(m_pShaderCom->Bind_RawValue("g_fRimPower", &m_fRimLightPower, sizeof(_float)))) { - // return E_FAIL; - //} - //if (FAILED(m_pShaderCom->Bind_RawValue("g_vRimColor", &m_vRimLightColor, sizeof(_float3)))) { - // return E_FAIL; - //} return S_OK; } -CMapObject* CMapObject::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) -{ - CMapObject* pInstance = new CMapObject(pDevice, pContext); - - if (FAILED(pInstance->Initialize_Prototype())) - { - MSG_BOX("Failed to Created : CMapObject"); - Safe_Release(pInstance); - } - - return pInstance; -} - -CGameObject* CMapObject::Clone(void* pArg, CGameObject* pOwner) -{ - CMapObject* pInstance = new CMapObject(*this); - - if (FAILED(pInstance->Initialize(pArg))) - { - MSG_BOX("Failed to Cloned : CMapObject"); - Safe_Release(pInstance); - } - - return pInstance; -} void CMapObject::Free() { __super::Free(); - - Safe_Release(m_pShaderCom); - Safe_Release(m_pModelCom); } void CMapObject::Describe_Entity() { - if (m_bDead) - return; - if (nullptr == m_pGameInstance) - return; - - ImGui::Text(CMyTools::ToString(m_strModelPrototypeTag).c_str()); - ImGui::Text("----- Transfrom ----"); - ImGui::InputFloat("X##Position", &m_vPosition.x, 1.f, 10.f); - ImGui::InputFloat("Y##Position", &m_vPosition.y, 0.1f, 1.f); - ImGui::InputFloat("Z##Position", &m_vPosition.z, 1.f, 10.f); - - if (m_pGameInstance->Mouse_Down(DIM_4)) - { - /*CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object(); - if (nullptr != pTerrain) - { - pTerrain->Get_Component()->Picking(pTerrain->Get_Component(), m_vPosition); - }*/ - - } - - ImGui::Text("----- Rotation ----"); - ImGui::InputFloat("X##Rotation", &m_vRotation.x, 10.f, 45.f); - ImGui::InputFloat("Y##Rotation", &m_vRotation.y, 10.f, 45.f); - ImGui::InputFloat("Z##Rotation", &m_vRotation.z, 10.f, 45.f); - - ImGui::Text("----- Scale ----"); - ImGui::InputFloat("X##Scale", &m_vScale.x, 0.1f, 1.f); - ImGui::InputFloat("Y##Scale", &m_vScale.y, 0.1f, 1.f); - ImGui::InputFloat("Z##Scale", &m_vScale.z, 0.1f, 1.f); - - 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 (ImGui::Button("Delete")) - m_bDead = true; - - m_bSelected = true; } \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp index 65acf60aa..19ac803a6 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp @@ -5,6 +5,9 @@ #include "DebugCamera.h" #include "Layer.h" #include "MapObject.h" +#include "MapObject_LOD.h" +#include "MapObject_Static.h" +#include "BuildingContainer.h" CMapObject_Manager::CMapObject_Manager(ID3D11Device * pDevice, ID3D11DeviceContext * pContext) @@ -12,15 +15,25 @@ CMapObject_Manager::CMapObject_Manager(ID3D11Device * pDevice, ID3D11DeviceConte { } -CMapObject_Manager::CMapObject_Manager(const CMapObject_Manager& Prototype) - : CGameObject(Prototype) - , m_ModelPrototypeTags{ Prototype.m_ModelPrototypeTags } +CMapObject_Manager::CMapObject_Manager(const CMapObject_Manager& rhs) + : CGameObject(rhs) + , m_ModelPrototypeTags{ rhs.m_ModelPrototypeTags } + , m_LODModelPrototypeTags{ rhs.m_LODModelPrototypeTags } { } HRESULT CMapObject_Manager::Initialize_Prototype(vector<_wstring>& ModelPrototypeTags) { - m_ModelPrototypeTags = ModelPrototypeTags; + for (auto& Tag : ModelPrototypeTags) + { + if (_wstring::npos != Tag.find(L"Lod")) + { + m_LODModelPrototypeTags.push_back(Tag); + } + + m_ModelPrototypeTags.push_back(Tag); + + } return S_OK; } @@ -30,7 +43,9 @@ HRESULT CMapObject_Manager::Initialize(void* pArg) if (FAILED(__super::Initialize(pArg))) return E_FAIL; + m_pContainer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"))->Get_Object(); + SAFE_ADDREF(m_pContainer); return S_OK; } @@ -42,68 +57,20 @@ void CMapObject_Manager::Priority_Update(_float fTimeDelta) void CMapObject_Manager::Update(_float fTimeDelta) { - GUI::Begin("Model Prototype List"); + GUI::Begin("File"); - for (auto& Tag : m_ModelPrototypeTags) + if (GUI::Button("Save_XML")) { - if (ImGui::Button(CMyTools::ToString(Tag).c_str())) - { - CMapObject::MAPOBJECT_DESC Desc = {}; - Desc.pModelPrototypeTag = Tag.c_str(); - - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, ENUM_CLASS(LEVEL::MAP), TEXT("Layer_MapObject"), &Desc))) - { - }; - - } + Save_MapData("Test"); } GUI::End(); - CLayer* pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_MapObject")); + Update_PrototypeList(); - if (nullptr == pLayer) - return; + Update_ObjectList(); - m_pMapObjects = pLayer->Get_Objects(); - - GUI::Begin("MapObject List"); - - _uint iObjectIndex = {}; - string strSrc; - - if (nullptr != m_pMapObjects) - { - for (auto pMapObject : (*m_pMapObjects)) - { - CMapObject* pCurrentMapObject = static_cast(pMapObject); - - if (nullptr == pCurrentMapObject) - continue; - - wstring strPrototypeTag = pCurrentMapObject->Get_PrototypeTag(); - - strSrc = CMyTools::ToString(strPrototypeTag) + to_string(iObjectIndex) + "##" + to_string(iObjectIndex++); - - if (ImGui::Button(strSrc.c_str())) - { - m_pSelectObject = pCurrentMapObject; - } - } - } - - GUI::End(); - - GUI::Begin("Edit"); - - if (nullptr != m_pSelectObject) - { - m_pSelectObject->Describe_Entity(); - if (m_pSelectObject->isDead()) - m_pSelectObject = nullptr; - } - - GUI::End(); + Update_Edit(); } @@ -129,77 +96,265 @@ HRESULT CMapObject_Manager::Bind_ShaderResources() HRESULT CMapObject_Manager::Save_MapData(const _char* pFileName) { - const list* pObjectList = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_MapObject"))->Get_Objects(); + //const list* pObjectList = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_MapObject"))->Get_Objects(); - if (nullptr == pObjectList) - return E_FAIL; + //if (nullptr == pObjectList) + // return E_FAIL; - tinyxml2::XMLDocument doc; + //tinyxml2::XMLDocument doc; - doc.InsertFirstChild(doc.NewDeclaration()); + //doc.InsertFirstChild(doc.NewDeclaration()); - tinyxml2::XMLElement* land = doc.NewElement("Land"); - doc.InsertEndChild(land); + //tinyxml2::XMLElement* land = doc.NewElement("Land"); + //doc.InsertEndChild(land); - for (auto& pObjcet : *pObjectList) - { - CMapObject* pMapObject = dynamic_cast(pObjcet); + //for (auto& pObjcet : *pObjectList) + //{ + // CMapObject* pMapObject = dynamic_cast(pObjcet); - if (nullptr == pMapObject) - continue; + // if (nullptr == pMapObject) + // continue; - // - tinyxml2::XMLElement* model = doc.NewElement("Model"); - land->InsertEndChild(model); + // // + // tinyxml2::XMLElement* model = doc.NewElement("Model"); + // land->InsertEndChild(model); - // 텍스트 - tinyxml2::XMLElement* proto = doc.NewElement("PrototypeTag"); - proto->SetText(CMyTools::ToString(pMapObject->Get_PrototypeTag()).c_str()); - model->InsertEndChild(proto); + // // 텍스트 + // tinyxml2::XMLElement* proto = doc.NewElement("PrototypeTag"); + // proto->SetText(CMyTools::ToString(pMapObject->Get_PrototypeTag()).c_str()); + // model->InsertEndChild(proto); - // - tinyxml2::XMLElement* PositionElem = doc.NewElement("Position"); + // // + // tinyxml2::XMLElement* PositionElem = doc.NewElement("Position"); - _float3 vPosition = {}; - XMStoreFloat3(&vPosition, pMapObject->Get_WorldPostion()); - - PositionElem->SetAttribute("x", vPosition.x); - PositionElem->SetAttribute("y", vPosition.y); - PositionElem->SetAttribute("z", vPosition.z); - model->InsertEndChild(PositionElem); + // _float3 vPosition = {}; + // XMStoreFloat3(&vPosition, pMapObject->Get_WorldPostion()); + // + // PositionElem->SetAttribute("x", vPosition.x); + // PositionElem->SetAttribute("y", vPosition.y); + // PositionElem->SetAttribute("z", vPosition.z); + // model->InsertEndChild(PositionElem); - // - tinyxml2::XMLElement* ScaleElem = doc.NewElement("Scale"); + // // + // tinyxml2::XMLElement* ScaleElem = doc.NewElement("Scale"); - _float3 pScale = pMapObject->Get_Component()->Get_Scale(); - ScaleElem->SetAttribute("x", pScale.x); - ScaleElem->SetAttribute("y", pScale.y); - ScaleElem->SetAttribute("z", pScale.z); - model->InsertEndChild(ScaleElem); + // _float3 pScale = pMapObject->Get_Component()->Get_Scale(); + // ScaleElem->SetAttribute("x", pScale.x); + // ScaleElem->SetAttribute("y", pScale.y); + // ScaleElem->SetAttribute("z", pScale.z); + // model->InsertEndChild(ScaleElem); - // - tinyxml2::XMLElement* RotationElem = doc.NewElement("Rotation"); + // // + // tinyxml2::XMLElement* RotationElem = doc.NewElement("Rotation"); - _float3 vRotation = {}; - XMStoreFloat3(&vRotation, pMapObject->Get_Component()->Get_RollPitchYawVector()); - - RotationElem->SetAttribute("x", vRotation.x); - RotationElem->SetAttribute("y", vRotation.y); - RotationElem->SetAttribute("z", vRotation.z); - model->InsertEndChild(RotationElem); + // _float3 vRotation = {}; + // XMStoreFloat3(&vRotation, pMapObject->Get_Component()->Get_RollPitchYawVector()); + // + // RotationElem->SetAttribute("x", vRotation.x); + // RotationElem->SetAttribute("y", vRotation.y); + // RotationElem->SetAttribute("z", vRotation.z); + // model->InsertEndChild(RotationElem); - } - string strPath = "../Bin/Resources/Data/" + string(pFileName) + ".xml"; + //} + //string strPath = "../Bin/Resources/Data/Map/" + string(pFileName) + ".xml"; - // 저장 - if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) { - - return E_FAIL; - } + //// 저장 + //if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) { + // return E_FAIL; + //} return S_OK; } +HRESULT CMapObject_Manager::Load_MapData(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("Land"); + + if (nullptr == root) + { + MSG_BOX("Failed to Find root"); + return E_FAIL; + } + + ///* Map */ + //MAP_DATA Map_Data = {}; + + //for (auto* land = root->FirstChildElement("Model"); land; land = land->NextSiblingElement("Model")) + //{ + // tinyxml2::XMLElement* protoElem = land->FirstChildElement("PrototypeTag"); + + // const _char* pPrototypeTag = protoElem->GetText(); + + // if (nullptr != pPrototypeTag) + // { + // string strPtotoypeTag = pPrototypeTag; + // Map_Data.strPrototypeTag = CMyTools::ToWstring(strPtotoypeTag); + // } + // else + // { + // Map_Data.strPrototypeTag = L""; + // } + + // protoElem = land->FirstChildElement("Position"); + // if (nullptr == protoElem) + // return E_FAIL; + // protoElem->QueryFloatAttribute("x", &Map_Data.vPosition.x); + // protoElem->QueryFloatAttribute("y", &Map_Data.vPosition.y); + // protoElem->QueryFloatAttribute("z", &Map_Data.vPosition.z); + + // protoElem = land->FirstChildElement("Scale"); + // if (nullptr == protoElem) + // return E_FAIL; + // protoElem->QueryFloatAttribute("x", &Map_Data.vScale.x); + // protoElem->QueryFloatAttribute("y", &Map_Data.vScale.y); + // protoElem->QueryFloatAttribute("z", &Map_Data.vScale.z); + + // protoElem = land->FirstChildElement("Rotation"); + // if (nullptr == protoElem) + // return E_FAIL; + // protoElem->QueryFloatAttribute("x", &Map_Data.vRotation.x); + // protoElem->QueryFloatAttribute("y", &Map_Data.vRotation.y); + // protoElem->QueryFloatAttribute("z", &Map_Data.vRotation.z); + + // m_MapDatas.push_back(Map_Data); + //} + + return S_OK; +} + +void CMapObject_Manager::Update_PrototypeList() +{ + GUI::Begin("Model Prototype List"); + GUI::Checkbox("bLOD", &m_bLOD); + for (auto& Tag : m_ModelPrototypeTags) + { + if (_wstring::npos != Tag.find(L"Lod")) + continue; + + if (ImGui::Button(CMyTools::ToString(Tag).c_str())) + { + if(false == m_bLOD) + { + CMapObject_Static::MAPOBJECT_STATIC_DESC Desc = {}; + + Desc.pModelPrototypeTag = Tag.c_str(); + Desc.pParentTransform = m_pContainer->Get_Component(); + + CMapObject_Static* pMapObject = { nullptr }; + const string strKey = CMyTools::ToString(Tag); + m_pContainer->Add_Part(strKey, 0, &pMapObject, &Desc); + + m_MapObjects.push_back(pMapObject); + } + else + { + CMapObject_LOD::MAPOBJECT_LOD_DESC Desc = {}; + + vector PrototypeTags; + + PrototypeTags.push_back(Tag.c_str()); + Desc.iMaxLodLevel = 0; + Desc.ModelPrototypeTags = PrototypeTags; + Desc.pParentTransform = m_pContainer->Get_Component(); + + CMapObject_Static* pMapObject = { nullptr }; + const string strKey = CMyTools::ToString(Tag); + m_pContainer->Add_Part(strKey, 0, nullptr, &Desc); + + m_MapObjects.push_back(pMapObject); + } + } + } + GUI::End(); + + + GUI::Begin("LOD Model Prototype List"); + for (auto& Tag : m_LODModelPrototypeTags) + { + if (ImGui::Button(CMyTools::ToString(Tag).c_str())) + { + if (nullptr != m_pSelectObject) + { + CMapObject_LOD* pLodObject = dynamic_cast(m_pSelectObject); + + if (nullptr != pLodObject) + { + pLodObject->Add_LodModel(Tag.c_str()); + } + else + { + MSG_BOX("Failed to Add Lod Model"); + } + + if (m_pSelectObject->isDead()) + m_pSelectObject = nullptr; + + } + } + } + GUI::End(); + +} + +void CMapObject_Manager::Update_ObjectList() +{ + //CLayer* pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_MapObject")); + + //if (nullptr == pLayer) + // return; + + //m_pMapObjects = pLayer->Get_Objects(); + + GUI::Begin("MapObject List"); + + _uint iObjectIndex = {}; + string strSrc; + + if (false == m_MapObjects.empty()) + { + for (auto pMapObject : m_MapObjects) + { + CMapObject* pCurrentMapObject = static_cast(pMapObject); + + if (nullptr == pCurrentMapObject) + continue; + + wstring strPrototypeTag = pCurrentMapObject->Get_PrototypeTag(); + + strSrc = CMyTools::ToString(strPrototypeTag) + to_string(iObjectIndex) + "##" + to_string(iObjectIndex++); + + if (ImGui::Button(strSrc.c_str())) + { + m_pSelectObject = pCurrentMapObject; + } + } + } + + GUI::End(); +} + +void CMapObject_Manager::Update_Edit() +{ + GUI::Begin("Edit"); + + if (nullptr != m_pSelectObject) + { + m_pSelectObject->Describe_Entity(); + if (m_pSelectObject->isDead()) + m_pSelectObject = nullptr; + + } + + GUI::End(); +} + CMapObject_Manager* CMapObject_Manager::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, vector<_wstring>& ModelPrototypeTags) { @@ -231,6 +386,7 @@ void CMapObject_Manager::Free() { __super::Free(); + SAFE_RELEASE(m_pContainer); } void CMapObject_Manager::Describe_Entity() diff --git a/Jusin154_Team3D/Editor/Public/Level_MapViewer.h b/Jusin154_Team3D/Editor/Public/Level_MapViewer.h index 84319b5fe..94a6dfeae 100644 --- a/Jusin154_Team3D/Editor/Public/Level_MapViewer.h +++ b/Jusin154_Team3D/Editor/Public/Level_MapViewer.h @@ -20,7 +20,7 @@ class CLevel_MapViewer final : public CLevel HRESULT Ready_Layer_Light(); HRESULT Ready_Layer_Camera(const _wstring& strLayerTag); HRESULT Ready_Layer_Terrain(const _wstring& strLayerTag); - HRESULT Ready_Layer_MapObjects(const _wstring& strLayerTag); + HRESULT Ready_Layer_BuildingContainer(const _wstring& strLayerTag); HRESULT Ready_Layer_MapObjectManager(const _wstring& strLayerTag); diff --git a/Jusin154_Team3D/Editor/Public/MapObject.h b/Jusin154_Team3D/Editor/Public/MapObject.h index b830e36ff..cb9af64cf 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject.h +++ b/Jusin154_Team3D/Editor/Public/MapObject.h @@ -1,7 +1,7 @@ #pragma once #include "Editor_Define.h" -#include "GameObject.h" +#include "PartObject.h" NS_BEGIN(Engine) class CShader; @@ -10,50 +10,41 @@ NS_END NS_BEGIN(Editor) -class CMapObject final : public CGameObject +class CMapObject abstract : public CPartObject { -public: - typedef struct tagMapObjectDesc - { - const _tchar* pModelPrototypeTag; - }MAPOBJECT_DESC; - -private: +protected: CMapObject(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CMapObject(const CMapObject& Prototype); virtual ~CMapObject() = default; public: - virtual HRESULT Initialize_Prototype() override; - virtual HRESULT Initialize(void* pArg) override; virtual void Priority_Update(_float fTimeDelta) override; virtual void Update(_float fTimeDelta) override; virtual void Late_Update(_float fTimeDelta) override; virtual HRESULT Render() override; public: - _wstring& Get_PrototypeTag() { return m_strModelPrototypeTag; } + virtual _wstring Get_PrototypeTag(_uint iLodIndex = 0); -private: - CShader* m_pShaderCom = { nullptr }; - CModel* m_pModelCom = { nullptr }; +protected: - _wstring m_strModelPrototypeTag; + +protected: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + HRESULT Ready_Components(); #ifdef _DEBUG - _bool m_bSelected = {}; - _float3 m_vPosition = {}; - _float3 m_vRotation = {}; - _float3 m_vScale = {}; + _bool m_bSelected = {}; + _float3 m_vPosition = {}; + _float3 m_vRotation = {}; + _float3 m_vScale = {}; #endif // _DEBUG private: - HRESULT Ready_Components(); HRESULT Bind_ShaderResources(); public: - static CMapObject* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); - virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr) override; virtual void Free() override; virtual void Describe_Entity() override; }; diff --git a/Jusin154_Team3D/Editor/Public/MapObject_Manager.h b/Jusin154_Team3D/Editor/Public/MapObject_Manager.h index c38516be3..7f2be7252 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject_Manager.h +++ b/Jusin154_Team3D/Editor/Public/MapObject_Manager.h @@ -26,14 +26,23 @@ class CMapObject_Manager final : public CGameObject virtual HRESULT Render() override; private: - class CMapObject* m_pSelectObject = { nullptr }; - const list* m_pMapObjects = { nullptr }; + class CMapObject* m_pSelectObject = { nullptr }; + list m_MapObjects = { nullptr }; vector<_wstring> m_ModelPrototypeTags; + vector<_wstring> m_LODModelPrototypeTags; + + _bool m_bLOD = { false }; + class CBuildingContainer* m_pContainer = { nullptr }; private: - HRESULT Ready_Components(); - HRESULT Bind_ShaderResources(); - HRESULT Save_MapData(const _char* pFileName); + HRESULT Ready_Components(); + HRESULT Bind_ShaderResources(); + HRESULT Save_MapData(const _char* pFileName); + HRESULT Load_MapData(const _char* pFileName); + + void Update_PrototypeList(); + void Update_ObjectList(); + void Update_Edit(); public: static CMapObject_Manager* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, vector<_wstring>& ModelPrototypeTags); From 6036b1fe4e4b2fe6688b40e273530e3eb5ebed92 Mon Sep 17 00:00:00 2001 From: JinhoBa <127280695+JinhoBa@users.noreply.github.com> Date: Tue, 11 Nov 2025 22:16:34 +0900 Subject: [PATCH 2/4] [add] MapContainerObject [add] MapPartObject --- .../Editor/Bin/Resources/Data/Map/MapTest.xml | 123 +++++++++ .../Editor/Private/BuildingContainer.cpp | 100 +++++++ .../Editor/Private/MapContainer.cpp | 60 ++++ .../Editor/Private/MapObject_LOD.cpp | 256 ++++++++++++++++++ .../Editor/Private/MapObject_Static.cpp | 236 ++++++++++++++++ .../Editor/Public/BuildingContainer.h | 40 +++ Jusin154_Team3D/Editor/Public/MapContainer.h | 29 ++ Jusin154_Team3D/Editor/Public/MapObject_LOD.h | 54 ++++ .../Editor/Public/MapObject_Static.h | 51 ++++ 9 files changed, 949 insertions(+) create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Data/Map/MapTest.xml create mode 100644 Jusin154_Team3D/Editor/Private/BuildingContainer.cpp create mode 100644 Jusin154_Team3D/Editor/Private/MapContainer.cpp create mode 100644 Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp create mode 100644 Jusin154_Team3D/Editor/Private/MapObject_Static.cpp create mode 100644 Jusin154_Team3D/Editor/Public/BuildingContainer.h create mode 100644 Jusin154_Team3D/Editor/Public/MapContainer.h create mode 100644 Jusin154_Team3D/Editor/Public/MapObject_LOD.h create mode 100644 Jusin154_Team3D/Editor/Public/MapObject_Static.h diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/MapTest.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/MapTest.xml new file mode 100644 index 000000000..98d8b1513 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/MapTest.xml @@ -0,0 +1,123 @@ + + + + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_Ext_DoorFrameSide.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_MERGED_Entry_Base_Stones.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_MERGED_Side_Stone_Steps.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_MERGED_Winter_Kit_Icicles.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_MERGED_Winter_Kit_Snow.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A_Decal.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B_Decal.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_Roof_Snow_Winter.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_Window_Glass.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_Wood_Steps_B.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_Wood_Steps_C.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_int_walls.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_A.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_B.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_Stairs.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_int_windows.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_int_walls.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_int_Stairs_Upper_Floors.mo + + + + + diff --git a/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp b/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp new file mode 100644 index 000000000..755750fc7 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp @@ -0,0 +1,100 @@ +#include "pch.h" +#include "BuildingContainer.h" +#include "PartObject.h" + +CBuildingContainer::CBuildingContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CMapContainer(pDevice, pContext) +{ +} + +CBuildingContainer::CBuildingContainer(const CBuildingContainer& rhs) + :CMapContainer(rhs) +{ +} + +void CBuildingContainer::Priority_Update(_float fTimeDelta) +{ + __super::Priority_Update(fTimeDelta); +} + +void CBuildingContainer::Update(_float fTimeDelta) +{ + __super::Update(fTimeDelta); +} + +void CBuildingContainer::Late_Update(_float fTimeDelta) +{ + __super::Late_Update(fTimeDelta); +} + +HRESULT CBuildingContainer::Render() +{ + return S_OK; +} + +HRESULT CBuildingContainer::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CBuildingContainer::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) { + return E_FAIL; + } + + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CBuildingContainer::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CBuildingContainer::Bind_ShaderResources() +{ + return S_OK; +} + +CBuildingContainer* CBuildingContainer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CBuildingContainer* pInstance = new CBuildingContainer(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CBuildingContainer"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CBuildingContainer::Clone(void* pArg, CGameObject* pOwner) +{ + CBuildingContainer* pInstance = new CBuildingContainer(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CBuildingContainer"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CBuildingContainer::Free() +{ + __super::Free(); +} + +void CBuildingContainer::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/MapContainer.cpp b/Jusin154_Team3D/Editor/Private/MapContainer.cpp new file mode 100644 index 000000000..d195c2192 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/MapContainer.cpp @@ -0,0 +1,60 @@ +#include "pch.h" +#include "MapContainer.h" +#include "PartObject.h" + +CMapContainer::CMapContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CContainerObject(pDevice, pContext) +{ +} + +CMapContainer::CMapContainer(const CMapContainer& rhs) + :CContainerObject(rhs) +{ +} + +HRESULT CMapContainer::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapContainer::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) { + return E_FAIL; + } + return S_OK; +} + +HRESULT CMapContainer::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + return S_OK; +} + +void CMapContainer::Priority_Update(_float fTimeDelta) +{ + __super::Priority_Update(fTimeDelta); +} + +void CMapContainer::Update(_float fTimeDelta) +{ + __super::Update(fTimeDelta); +} + +void CMapContainer::Late_Update(_float fTimeDelta) +{ + __super::Late_Update(fTimeDelta); +} + +HRESULT CMapContainer::Render() +{ + return S_OK; +} + +void CMapContainer::Free() +{ + __super::Free(); +} diff --git a/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp new file mode 100644 index 000000000..f872a7bb9 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp @@ -0,0 +1,256 @@ +#include "pch.h" +#include "MapObject_LOD.h" + +#include "GameInstance.h" +#include "DebugCamera.h" +#include "Layer.h" +#include "Terrain.h" +#include "VIBuffer_Terrain.h" + +CMapObject_LOD::CMapObject_LOD(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CMapObject(pDevice, pContext) +{ +} + +CMapObject_LOD::CMapObject_LOD(const CMapObject_LOD& Prototype) + : CMapObject(Prototype), m_iLodIndex{ 0 } +{ +} + +HRESULT CMapObject_LOD::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapObject_LOD::Initialize(void* pArg) +{ + MAPOBJECT_LOD_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]); + } + + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components())) + return E_FAIL; + +#ifdef _DEBUG + m_bSelected = false; + m_vPosition = _float3(0.f, 0.f, 0.f); + m_vRotation = _float3(0.f, 0.f, 0.f); + m_vScale = _float3(1.f, 1.f, 1.f); +#endif // _DEBUG + + return S_OK; +} + +void CMapObject_LOD::Priority_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + m_bSelected = false; +#endif +} + +void CMapObject_LOD::Update(_float fTimeDelta) +{ + +} + +void CMapObject_LOD::Late_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + if (m_bSelected) + { + 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 + + _float4 vPos; + XMStoreFloat4(&vPos, Get_WorldPostion()); + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f); +} + +HRESULT CMapObject_LOD::Render() +{ + if (FAILED(Bind_ShaderResources())) { + return E_FAIL; + } + + _uint iNumMeshes = m_pModelComs[0]->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) { + return E_FAIL; + } + if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) { + 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; + } + } + + return S_OK; +} + +_wstring CMapObject_LOD::Get_PrototypeTag(_uint iLodIndex) +{ + if (m_iMaxLodLevel < iLodIndex) + return m_ModelPrototypeTags[0]; + + return m_ModelPrototypeTags[iLodIndex]; +} + +HRESULT CMapObject_LOD::Add_LodModel(const _tchar* pModelPrototypeTag) +{ + CModel* pModel = { nullptr }; + + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, pModelPrototypeTag, + reinterpret_cast(&pModel)))) + return E_FAIL; + + ++m_iMaxLodLevel; + m_pModelComs.push_back(pModel); + + return S_OK; +} + +HRESULT CMapObject_LOD::Ready_Components() +{ + __super::Ready_Components(); + + 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 CMapObject_LOD::Bind_ShaderResources() +{ + if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { + 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; +} + +CMapObject_LOD* CMapObject_LOD::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CMapObject_LOD* pInstance = new CMapObject_LOD(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CMapObject_LOD"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CMapObject_LOD::Clone(void* pArg, CGameObject * pOwner) +{ + CMapObject_LOD* pInstance = new CMapObject_LOD(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapObject_LOD"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CMapObject_LOD::Free() +{ + __super::Free(); + + Safe_Release(m_pShaderCom); + + for(auto& pModel : m_pModelComs) + Safe_Release(pModel); + m_pModelComs.clear(); +} + +void CMapObject_LOD::Describe_Entity() +{ + if (m_bDead) + return; + if (nullptr == m_pGameInstance) + return; + + 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 ----"); + 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); + + if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT)) + { + CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object(); + if (nullptr != pTerrain) + { + pTerrain->Get_Component()->Picking(pTerrain->Get_Component(), m_vPosition); + } + + } + + GUI::Text("----- Rotation ----"); + GUI::InputFloat("X##Rotation", &m_vRotation.x, 10.f, 45.f); + GUI::InputFloat("Y##Rotation", &m_vRotation.y, 10.f, 45.f); + GUI::InputFloat("Z##Rotation", &m_vRotation.z, 10.f, 45.f); + + GUI::Text("----- Scale ----"); + GUI::InputFloat("X##Scale", &m_vScale.x, 0.1f, 1.f); + GUI::InputFloat("Y##Scale", &m_vScale.y, 0.1f, 1.f); + GUI::InputFloat("Z##Scale", &m_vScale.z, 0.1f, 1.f); + + 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; + + m_bSelected = true; +} \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp new file mode 100644 index 000000000..b3a82059b --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp @@ -0,0 +1,236 @@ +#include "pch.h" +#include "MapObject_Static.h" + +#include "GameInstance.h" +#include "DebugCamera.h" +#include "Layer.h" +#include "Terrain.h" +#include "VIBuffer_Terrain.h" + +CMapObject_Static::CMapObject_Static(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CMapObject(pDevice, pContext) +{ +} + +CMapObject_Static::CMapObject_Static(const CMapObject_Static& Prototype) + : CMapObject(Prototype) +{ +} + +void CMapObject_Static::Priority_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + m_bSelected = false; +#endif +} + +void CMapObject_Static::Update(_float fTimeDelta) +{ + +} + +void CMapObject_Static::Late_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + if (m_bSelected) + { + 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 + + _float4 vPos; + XMStoreFloat4(&vPos, Get_WorldPostion()); + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f); +} + +HRESULT CMapObject_Static::Render() +{ + if (FAILED(Bind_ShaderResources())) { + return E_FAIL; + } + + _uint iNumMeshes = m_pModelCom->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) { + return E_FAIL; + } + if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { + return E_FAIL; + } + + if (FAILED(m_pModelCom->Render(i))) { + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT CMapObject_Static::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapObject_Static::Initialize(void* pArg) +{ + MAPOBJECT_STATIC_DESC* pDesc = static_cast(pArg); + + m_strModelPrototypeTag = pDesc->pModelPrototypeTag; + + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components())) + return E_FAIL; + + +#ifdef _DEBUG + m_bSelected = false; + m_vPosition = _float3(0.f, 0.f, 0.f); + m_vRotation = _float3(0.f, 0.f, 0.f); + m_vScale = _float3(1.f, 1.f, 1.f); +#endif // _DEBUG + + return S_OK; +} + +_wstring CMapObject_Static::Get_PrototypeTag(_uint iLodIndex) +{ + return m_strModelPrototypeTag; +} + +HRESULT CMapObject_Static::Ready_Components() +{ + __super::Ready_Components(); + + /* Com_Model */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_strModelPrototypeTag, + reinterpret_cast(&m_pModelCom)))) + return E_FAIL; + + /* Com_Shader */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH, + reinterpret_cast(&m_pShaderCom)))) + return E_FAIL; + + return S_OK; +} + +HRESULT CMapObject_Static::Bind_ShaderResources() +{ + if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { + 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_RawValue("g_vCamPosition", m_pGameInstance->Get_CamPosition(), sizeof(_float4)))) { + // return E_FAIL; + //} + //if (FAILED(m_pShaderCom->Bind_RawValue("g_bRimLight", &m_bRimLight, sizeof(_bool)))) { + // return E_FAIL; + //} + //if (FAILED(m_pShaderCom->Bind_RawValue("g_fRimStrength", &m_fRimLightStrength, sizeof(_float)))) { + // return E_FAIL; + //} + //if (FAILED(m_pShaderCom->Bind_RawValue("g_fRimPower", &m_fRimLightPower, sizeof(_float)))) { + // return E_FAIL; + //} + //if (FAILED(m_pShaderCom->Bind_RawValue("g_vRimColor", &m_vRimLightColor, sizeof(_float3)))) { + // return E_FAIL; + //} + return S_OK; +} + +CMapObject_Static* CMapObject_Static::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CMapObject_Static* pInstance = new CMapObject_Static(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CMapObject_Static"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CMapObject_Static::Clone(void* pArg, CGameObject* pOwner) +{ + CMapObject_Static* pInstance = new CMapObject_Static(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapObject_Static"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CMapObject_Static::Free() +{ + __super::Free(); + + Safe_Release(m_pShaderCom); + Safe_Release(m_pModelCom); +} + +void CMapObject_Static::Describe_Entity() +{ + if (m_bDead) + return; + if (nullptr == m_pGameInstance) + return; + + //ImGui::Text(CMyTools::ToString(m_strModelPrototypeTag).c_str()); + ImGui::Text("----- Transfrom ----"); + ImGui::InputFloat("X##Position", &m_vPosition.x, 0.1f, 1.f); + ImGui::InputFloat("Y##Position", &m_vPosition.y, 0.1f, 1.f); + ImGui::InputFloat("Z##Position", &m_vPosition.z, 0.1f, 1.f); + + if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT)) + { + CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object(); + if (nullptr != pTerrain) + { + pTerrain->Get_Component()->Picking(pTerrain->Get_Component(), m_vPosition); + } + + } + + ImGui::Text("----- Rotation ----"); + ImGui::InputFloat("X##Rotation", &m_vRotation.x, 10.f, 45.f); + ImGui::InputFloat("Y##Rotation", &m_vRotation.y, 10.f, 45.f); + ImGui::InputFloat("Z##Rotation", &m_vRotation.z, 10.f, 45.f); + + ImGui::Text("----- Scale ----"); + ImGui::InputFloat("X##Scale", &m_vScale.x, 0.1f, 1.f); + ImGui::InputFloat("Y##Scale", &m_vScale.y, 0.1f, 1.f); + ImGui::InputFloat("Z##Scale", &m_vScale.z, 0.1f, 1.f); + + 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 (ImGui::Button("Delete")) + m_bDead = true; + + m_bSelected = true; +} \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Public/BuildingContainer.h b/Jusin154_Team3D/Editor/Public/BuildingContainer.h new file mode 100644 index 000000000..bf4694f2d --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/BuildingContainer.h @@ -0,0 +1,40 @@ +#pragma once + +#include "Editor_Define.h" +#include "MapContainer.h" + +NS_BEGIN(Editor) + +class CBuildingContainer final : public CMapContainer +{ +public: + CBuildingContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CBuildingContainer(const CBuildingContainer& rhs); + ~CBuildingContainer() = 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; + +public: + template + HRESULT Add_Part(const _string& strPartKey, _uint iPrototypeLevelIndex, T** ppOut, void* pArg = nullptr) { + return Add_PartObject(strPartKey, iPrototypeLevelIndex, ppOut, pArg); + } + +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 CBuildingContainer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner = nullptr)override; + virtual void Free() override; + virtual void Describe_Entity()override; +}; + +NS_END \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Public/MapContainer.h b/Jusin154_Team3D/Editor/Public/MapContainer.h new file mode 100644 index 000000000..e5edb84ab --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/MapContainer.h @@ -0,0 +1,29 @@ +#pragma once + +#include "Editor_Define.h" +#include "ContainerObject.h" + +NS_BEGIN(Editor) + +class CMapContainer abstract : public CContainerObject +{ +public: + CMapContainer(ID3D11Device * pDevice, ID3D11DeviceContext * pContext); + CMapContainer(const CMapContainer& rhs); + ~CMapContainer() = 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; + +protected: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + +public: + virtual void Free() override; +}; + +NS_END \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Public/MapObject_LOD.h b/Jusin154_Team3D/Editor/Public/MapObject_LOD.h new file mode 100644 index 000000000..81a98cfb8 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/MapObject_LOD.h @@ -0,0 +1,54 @@ +#pragma once + +#include "Editor_Define.h" +#include "MapObject.h" + +NS_BEGIN(Editor) + +class CMapObject_LOD final : public CMapObject +{ +public: + typedef struct tagMapObjectLodDesc : public PARTOBJECT_DESC + { + _uint iMaxLodLevel{}; + vector ModelPrototypeTags; + }MAPOBJECT_LOD_DESC; + +private: + CMapObject_LOD(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMapObject_LOD(const CMapObject_LOD& Prototype); + virtual ~CMapObject_LOD() = default; + +public: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + virtual HRESULT Render() override; + +public: + virtual _wstring Get_PrototypeTag(_uint iLodIndex = 0); + HRESULT Add_LodModel(const _tchar* pModelPrototypeTag); + +private: + CShader* m_pShaderCom = { nullptr }; + vector m_pModelComs = { nullptr }; + + _uint m_iMaxLodLevel = {}; + _uint m_iLodIndex = {}; + + vector<_wstring> m_ModelPrototypeTags; + +private: + HRESULT Ready_Components(); + HRESULT Bind_ShaderResources(); + +public: + static CMapObject_LOD* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr) override; + virtual void Free() override; + virtual void Describe_Entity() override; +}; + +NS_END \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Public/MapObject_Static.h b/Jusin154_Team3D/Editor/Public/MapObject_Static.h new file mode 100644 index 000000000..6fe460bc7 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/MapObject_Static.h @@ -0,0 +1,51 @@ +#pragma once + +#include "Editor_Define.h" +#include "MapObject.h" + +NS_BEGIN(Editor) + +class CMapObject_Static final : public CMapObject +{ +public: + typedef struct tagMapObjectStaticDesc : public PARTOBJECT_DESC + { + _uint iMaxLodLevel{}; + const _tchar* pModelPrototypeTag; + }MAPOBJECT_STATIC_DESC; + +private: + CMapObject_Static(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMapObject_Static(const CMapObject_Static& Prototype); + virtual ~CMapObject_Static() = 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; + +public: + virtual _wstring Get_PrototypeTag(_uint iLodIndex = 0); + +private: + CShader* m_pShaderCom = { nullptr }; + CModel* m_pModelCom = { nullptr }; + + _wstring m_strModelPrototypeTag; + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + + HRESULT Ready_Components(); + HRESULT Bind_ShaderResources(); + +public: + static CMapObject_Static* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr) override; + virtual void Free() override; + virtual void Describe_Entity() override; +}; + +NS_END \ No newline at end of file From a83842ed92dbe739713e6eef6e491efec2c147d0 Mon Sep 17 00:00:00 2001 From: JinhoBa <127280695+JinhoBa@users.noreply.github.com> Date: Tue, 11 Nov 2025 22:29:55 +0900 Subject: [PATCH 3/4] [add] MapData Load and Save [add] MapContainerObject [add] MapPartObject NonLod and Lod --- .../Bin/Resources/Data/Map/ContainerTest.xml | 311 ++++++++ .../Editor/Bin/Resources/Data/Map/Test.xml | 320 ++++++++ .../Resources/ShaderFiles/Shader_VtxMesh.hlsl | 16 +- .../Editor/Default/Editor.vcxproj.filters | 30 + .../Editor/Private/BuildingContainer.cpp | 66 +- .../Editor/Private/Level_MapViewer.cpp | 4 +- Jusin154_Team3D/Editor/Private/Loader.cpp | 29 +- .../Editor/Private/MapContainer.cpp | 62 ++ Jusin154_Team3D/Editor/Private/MapObject.cpp | 68 +- .../Editor/Private/MapObject_LOD.cpp | 37 +- .../Editor/Private/MapObject_Manager.cpp | 726 +++++++++++++++--- .../Editor/Private/MapObject_Static.cpp | 49 +- .../Editor/Public/BuildingContainer.h | 2 + Jusin154_Team3D/Editor/Public/Editor_Define.h | 2 +- Jusin154_Team3D/Editor/Public/MapContainer.h | 21 + Jusin154_Team3D/Editor/Public/MapObject.h | 5 + Jusin154_Team3D/Editor/Public/MapObject_LOD.h | 10 +- .../Editor/Public/MapObject_Manager.h | 15 +- .../Editor/Public/MapObject_Static.h | 5 +- .../Engine/Private/GameInstance.cpp | 2 +- Jusin154_Team3D/Engine/Private/Material.cpp | 4 +- 21 files changed, 1579 insertions(+), 205 deletions(-) create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Test.xml diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml new file mode 100644 index 000000000..245aedd90 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml @@ -0,0 +1,311 @@ + + + + + + + + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim_Lod1 + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim_Lod2 + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrels + Prototype_GameObject_SM_HM_3Broom_ext_barrels_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_barrels_Lod2 + Prototype_GameObject_SM_HM_3Broom_ext_barrels_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrels_sign + Prototype_GameObject_SM_HM_3Broom_ext_barrels_sign_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrel_stands + Prototype_GameObject_SM_HM_3Broom_ext_barrel_stands_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_barrel_stands_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_chimneys_B + Prototype_GameObject_SM_HM_3Broom_ext_chimneys_B_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_chimneys_B_Lod2 + Prototype_GameObject_SM_HM_3Broom_ext_chimneys_B_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_decals + Prototype_GameObject_SM_HM_3Broom_ext_decals_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_decals_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_Decals_A + Prototype_GameObject_SM_HM_3Broom_ext_Decals_A_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_Ext_DoorFrameSide + Prototype_GameObject_SM_HM_3Broom_Ext_DoorFrameSide_Lod1 + Prototype_GameObject_SM_HM_3Broom_Ext_DoorFrameSide_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_Dormer_Wood_Slats + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_roof + Prototype_GameObject_SM_HM_3Broom_ext_roof_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_roof_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_roof_copper_tops + Prototype_GameObject_SM_HM_3Broom_ext_roof_copper_tops_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_roof_copper_tops_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_roof_decals + Prototype_GameObject_SM_HM_3Broom_ext_roof_decals_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_side_garden_box + Prototype_GameObject_SM_HM_3Broom_ext_side_garden_box_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_side_garden_box_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_trim + Prototype_GameObject_SM_HM_3Broom_ext_trim_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_trim_Lod2 + Prototype_GameObject_SM_HM_3Broom_ext_trim_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_trim_stone + Prototype_GameObject_SM_HM_3Broom_ext_trim_stone_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_trim_stone_Lod2 + Prototype_GameObject_SM_HM_3Broom_ext_trim_stone_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_walls + Prototype_GameObject_SM_HM_3Broom_ext_walls_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_walls_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_wood_Corbels + Prototype_GameObject_SM_HM_3Broom_ext_wood_Corbels_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_fireplace + Prototype_GameObject_SM_HM_3Broom_fireplace_Lod1 + Prototype_GameObject_SM_HM_3Broom_fireplace_Lod2 + Prototype_GameObject_SM_HM_3Broom_fireplace_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_Door_L + Prototype_GameObject_SM_HM_3Broom_Door_L_Lod1 + Prototype_GameObject_SM_HM_3Broom_Door_L_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_Door_R + Prototype_GameObject_SM_HM_3Broom_Door_R_Lod1 + Prototype_GameObject_SM_HM_3Broom_Door_R_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_DoorFrame + Prototype_GameObject_SM_HM_3Broom_DoorFrame_Lod1 + Prototype_GameObject_SM_HM_3Broom_DoorFrame_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_Window_Glass + Prototype_GameObject_SM_HM_3Broom_Window_Glass_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A_Lod1 + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A_Lod2 + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B_Lod1 + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B_Lod2 + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B_Lod3 + + + + + + + + + + + Prototype_GameObject_SM_HM_3Broom_int_Bar + Prototype_GameObject_SM_HM_3Broom_int_Bar_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_Bar_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_floors + Prototype_GameObject_SM_HM_3Broom_int_floors_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_floors_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_stairs_A + Prototype_GameObject_SM_HM_3Broom_int_stairs_A_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_stairs_B + Prototype_GameObject_SM_HM_3Broom_int_stairs_B_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_stairs_B_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_stairs_D + Prototype_GameObject_SM_HM_3Broom_int_stairs_D_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_Stairs_Upper_Floors + Prototype_GameObject_SM_HM_3Broom_int_Stairs_Upper_Floors_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_Stairs_Upper_Floors_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_walls + Prototype_GameObject_SM_HM_3Broom_int_walls_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_walls_Lod2 + Prototype_GameObject_SM_HM_3Broom_int_walls_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_windows + Prototype_GameObject_SM_HM_3Broom_int_windows_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_A + Prototype_GameObject_SM_HM_3Broom_int_wood_A_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_wood_A_Lod2 + Prototype_GameObject_SM_HM_3Broom_int_wood_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_B + Prototype_GameObject_SM_HM_3Broom_int_wood_B_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_wood_B_Lod2 + Prototype_GameObject_SM_HM_3Broom_int_wood_B_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_C + Prototype_GameObject_SM_HM_3Broom_int_wood_C_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_wood_C_Lod2 + Prototype_GameObject_SM_HM_3Broom_int_wood_C_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_Stairs + Prototype_GameObject_SM_HM_3Broom_int_wood_Stairs_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_wood_Stairs_Lod2 + + + + + + Prototype_GameObject_SM_Broom_01 + Prototype_GameObject_SM_Broom_01_Lod1 + Prototype_GameObject_SM_Broom_01_Lod2 + + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Test.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Test.xml new file mode 100644 index 000000000..114aea18a --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Test.xml @@ -0,0 +1,320 @@ + + + + + + + + Prototype_GameObject_SM_HM_3Broom_Ext_DoorFrameSide + Prototype_GameObject_SM_HM_3Broom_Ext_DoorFrameSide_Lod1 + Prototype_GameObject_SM_HM_3Broom_Ext_DoorFrameSide_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim_Lod1 + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim_Lod2 + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_decals + Prototype_GameObject_SM_HM_3Broom_ext_decals_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_decals_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_chimneys_B + Prototype_GameObject_SM_HM_3Broom_ext_chimneys_B_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_chimneys_B_Lod2 + Prototype_GameObject_SM_HM_3Broom_ext_chimneys_B_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrels + Prototype_GameObject_SM_HM_3Broom_ext_barrels_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_barrels_Lod2 + Prototype_GameObject_SM_HM_3Broom_ext_barrels_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrel_stands + Prototype_GameObject_SM_HM_3Broom_ext_barrel_stands_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_barrel_stands_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrels_sign + Prototype_GameObject_SM_HM_3Broom_ext_barrels_sign_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_Decals_A + Prototype_GameObject_SM_HM_3Broom_ext_Decals_A_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_DoorFrame + Prototype_GameObject_SM_HM_3Broom_DoorFrame_Lod1 + Prototype_GameObject_SM_HM_3Broom_DoorFrame_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_Dormer_Wood_Slats + + + + + + Prototype_GameObject_SM_HM_3Broom_fireplace + Prototype_GameObject_SM_HM_3Broom_fireplace_Lod1 + Prototype_GameObject_SM_HM_3Broom_fireplace_Lod2 + Prototype_GameObject_SM_HM_3Broom_fireplace_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_roof + Prototype_GameObject_SM_HM_3Broom_ext_roof_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_roof_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_roof_copper_tops + Prototype_GameObject_SM_HM_3Broom_ext_roof_copper_tops_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_roof_copper_tops_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_roof_decals + Prototype_GameObject_SM_HM_3Broom_ext_roof_decals_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_side_garden_box + Prototype_GameObject_SM_HM_3Broom_ext_side_garden_box_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_side_garden_box_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_trim + Prototype_GameObject_SM_HM_3Broom_ext_trim_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_trim_Lod2 + Prototype_GameObject_SM_HM_3Broom_ext_trim_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_trim_stone + Prototype_GameObject_SM_HM_3Broom_ext_trim_stone_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_trim_stone_Lod2 + Prototype_GameObject_SM_HM_3Broom_ext_trim_stone_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_walls + Prototype_GameObject_SM_HM_3Broom_ext_walls_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_walls_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_Door_R + Prototype_GameObject_SM_HM_3Broom_Door_R_Lod1 + Prototype_GameObject_SM_HM_3Broom_Door_R_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_wood_Corbels + Prototype_GameObject_SM_HM_3Broom_ext_wood_Corbels_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_Door_L + Prototype_GameObject_SM_HM_3Broom_Door_L_Lod1 + Prototype_GameObject_SM_HM_3Broom_Door_L_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_Window_Glass + Prototype_GameObject_SM_HM_3Broom_Window_Glass_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A_Lod1 + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A_Lod2 + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B_Lod1 + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B_Lod2 + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B_Lod3 + + + + + + Prototype_GameObject_SM_DSkull + Prototype_GameObject_SM_DSkull_Lod1 + Prototype_GameObject_SM_DSkull_Lod2 + Prototype_GameObject_SM_DSkull_Lod3 + + + + + + + + + + + Prototype_GameObject_SM_HM_3Broom_int_stairs_A + Prototype_GameObject_SM_HM_3Broom_int_stairs_A_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_Bar + Prototype_GameObject_SM_HM_3Broom_int_Bar_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_Bar_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_floors + Prototype_GameObject_SM_HM_3Broom_int_floors_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_floors_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_stairs_B + Prototype_GameObject_SM_HM_3Broom_int_stairs_B_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_stairs_B_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_windows + Prototype_GameObject_SM_HM_3Broom_int_windows_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_stairs_D + Prototype_GameObject_SM_HM_3Broom_int_stairs_D_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_Stairs_Upper_Floors + Prototype_GameObject_SM_HM_3Broom_int_Stairs_Upper_Floors_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_Stairs_Upper_Floors_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_walls + Prototype_GameObject_SM_HM_3Broom_int_walls_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_walls_Lod2 + Prototype_GameObject_SM_HM_3Broom_int_walls_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_A + Prototype_GameObject_SM_HM_3Broom_int_wood_A_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_wood_A_Lod2 + Prototype_GameObject_SM_HM_3Broom_int_wood_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_B + Prototype_GameObject_SM_HM_3Broom_int_wood_B_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_wood_B_Lod2 + Prototype_GameObject_SM_HM_3Broom_int_wood_B_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_C + Prototype_GameObject_SM_HM_3Broom_int_wood_C_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_wood_C_Lod2 + Prototype_GameObject_SM_HM_3Broom_int_wood_C_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_Stairs + Prototype_GameObject_SM_HM_3Broom_int_wood_Stairs_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_wood_Stairs_Lod2 + + + + + + Prototype_GameObject_SM_Broom_01 + Prototype_GameObject_SM_Broom_01_Lod1 + Prototype_GameObject_SM_Broom_01_Lod2 + + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl index a32c3c669..b2618d4ee 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl @@ -164,7 +164,7 @@ PS_OUT PS_MAIN(PS_IN In) PS_OUT Out; vector vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); - if (vMtrlDiffuse.a < 0.4f) + if (vMtrlDiffuse.a < 0.1f) { discard; } @@ -180,7 +180,7 @@ PS_OUT PS_MAIN(PS_IN In) return Out; } -PS_OUT PS_MAIN_OUTLINE(PS_IN In) +PS_OUT PS_MAIN_SELECT(PS_IN In) { PS_OUT Out; @@ -195,7 +195,7 @@ PS_OUT PS_MAIN_OUTLINE(PS_IN In) float3 vNormal = mul(vNormalDesc.xyz * 2.f - 1.f, WorldMatrix); - Out.vDiffuse = vMtrlDiffuse; + Out.vDiffuse = vMtrlDiffuse * float4(0.f, 1.f, 1.f, 0.3f); Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, 0.0f, 1.f); return Out; @@ -439,4 +439,14 @@ technique11 MeshTechnique11 GeometryShader = NULL; PixelShader = compile ps_5_0 PS_EFFECT_UVMOVE(); } + + pass MapToolPass // 11 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 0); + SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + VertexShader = compile vs_5_0 VS_MAIN(); + GeometryShader = NULL; + PixelShader = compile ps_5_0 PS_MAIN_SELECT(); + } } diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index 9239be701..73ced753d 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -354,6 +354,21 @@ 02.GameObjects\Env\02.MapObject\LOD + + 02.GameObjects\Env\01.MapContainer + + + 02.GameObjects\Env\01.MapContainer\BuildingContainer + + + 02.GameObjects\Env\02.MapObject + + + 02.GameObjects\Env\02.MapObject\Static + + + 02.GameObjects\Env\02.MapObject\LOD + @@ -523,6 +538,21 @@ 02.GameObjects\Env\02.MapObject\LOD + + 02.GameObjects\Env\01.MapContainer + + + 02.GameObjects\Env\01.MapContainer\BuildingContainer + + + 02.GameObjects\Env\02.MapObject + + + 02.GameObjects\Env\02.MapObject\Static + + + 02.GameObjects\Env\02.MapObject\LOD + diff --git a/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp b/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp index 755750fc7..08a091a3e 100644 --- a/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp +++ b/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp @@ -1,6 +1,9 @@ #include "pch.h" #include "BuildingContainer.h" #include "PartObject.h" +#include "Terrain.h" +#include "Layer.h" +#include "VIBuffer_Terrain.h" CBuildingContainer::CBuildingContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) :CMapContainer(pDevice, pContext) @@ -15,6 +18,8 @@ CBuildingContainer::CBuildingContainer(const CBuildingContainer& rhs) void CBuildingContainer::Priority_Update(_float fTimeDelta) { __super::Priority_Update(fTimeDelta); + + m_bSelected = false; } void CBuildingContainer::Update(_float fTimeDelta) @@ -24,6 +29,13 @@ void CBuildingContainer::Update(_float fTimeDelta) void CBuildingContainer::Late_Update(_float fTimeDelta) { + if (m_bSelected) + { + 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)); + } + __super::Late_Update(fTimeDelta); } @@ -43,10 +55,22 @@ HRESULT CBuildingContainer::Initialize(void* pArg) return E_FAIL; } - if (FAILED(__super::Ready_Components(pArg))) { + if (FAILED(Ready_Components(pArg))) { return E_FAIL; } + MAP_CONTAINER_DESC* pDesc = static_cast(pArg); + + m_strName = pDesc->strName; + + 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)); + return S_OK; } @@ -97,4 +121,44 @@ void CBuildingContainer::Free() void CBuildingContainer::Describe_Entity() { + if (m_bDead) + return; + if (nullptr == m_pGameInstance) + return; + + GUI::Text(m_strName.c_str()); + GUI::Text("----- Transfrom ----"); + 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); + + if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT)) + { + CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object(); + if (nullptr != pTerrain) + { + pTerrain->Get_Component()->Picking(pTerrain->Get_Component(), m_vPosition); + } + + } + + GUI::Text("----- Rotation ----"); + GUI::InputFloat("X##Rotation", &m_vRotation.x, 10.f, 45.f); + GUI::InputFloat("Y##Rotation", &m_vRotation.y, 10.f, 45.f); + GUI::InputFloat("Z##Rotation", &m_vRotation.z, 10.f, 45.f); + + GUI::Text("----- Scale ----"); + GUI::InputFloat("X##Scale", &m_vScale.x, 0.1f, 1.f); + GUI::InputFloat("Y##Scale", &m_vScale.y, 0.1f, 1.f); + GUI::InputFloat("Z##Scale", &m_vScale.z, 0.1f, 1.f); + + 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; + + m_bSelected = true; } diff --git a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp index 6b52cdbb3..9c53bbcad 100644 --- a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp @@ -95,8 +95,8 @@ HRESULT CLevel_MapViewer::Ready_Layer_Terrain(const _wstring& strLayerTag) HRESULT CLevel_MapViewer::Ready_Layer_BuildingContainer(const _wstring& strLayerTag) { - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag))) - return E_FAIL; + //if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag))) + // return E_FAIL; return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index dbf95ca29..f6c12a3e8 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -661,15 +661,13 @@ HRESULT CLoader::Loading_For_MapViewer() vector<_wstring> ModelPrototypeTags; for (const auto& file : filesystem::directory_iterator("C:\\Users\\82103\\Desktop\\MapRe\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Meshes")) - { if (file.is_directory()) continue; string ext = file.path().extension().string(); - if (strcmp(ext.c_str(), ".fbx")) - + if (strcmp(ext.c_str(), ".bin")) continue; _char szFilePath[MAX_PATH] = {}; @@ -680,12 +678,35 @@ HRESULT CLoader::Loading_For_MapViewer() /*For Prototype_Component_Model_*/ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, strFileName, - CModel::Create(m_pDevice, m_pContext,szFilePath, MODEL::ENVIROMENT, XMMatrixIdentity(), 0)))) + CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, szFilePath)))) return E_FAIL; ModelPrototypeTags.push_back(strFileName); } + for (const auto& file : filesystem::directory_iterator("C:\\Users\\82103\\Desktop\\MapRe\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Meshes\\3Broom_Kit")) + { + if (file.is_directory()) + continue; + + string ext = file.path().extension().string(); + + if (strcmp(ext.c_str(), ".fbx")) + continue; + + _char szFilePath[MAX_PATH] = {}; + + strcpy_s(szFilePath, MAX_PATH, file.path().string().c_str()); + + _wstring strFileName = L"Prototype_GameObject_" + file.path().stem().wstring(); + + /*For Prototype_Component_Model_*/ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, strFileName, + CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, szFilePath)))) + return E_FAIL; + + ModelPrototypeTags.push_back(strFileName); + } m_strMessage = TEXT("�뎽�씠�뜑瑜�(�쓣) 濡쒕뵫 以� �엯�땲�떎."); diff --git a/Jusin154_Team3D/Editor/Private/MapContainer.cpp b/Jusin154_Team3D/Editor/Private/MapContainer.cpp index d195c2192..cfa35c6e8 100644 --- a/Jusin154_Team3D/Editor/Private/MapContainer.cpp +++ b/Jusin154_Team3D/Editor/Private/MapContainer.cpp @@ -2,6 +2,9 @@ #include "MapContainer.h" #include "PartObject.h" +#include "MapObject_LOD.h" +#include "MapObject_Static.h" + CMapContainer::CMapContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) :CContainerObject(pDevice, pContext) { @@ -22,6 +25,7 @@ HRESULT CMapContainer::Initialize(void* pArg) if (FAILED(__super::Initialize(pArg))) { return E_FAIL; } + return S_OK; } @@ -54,6 +58,64 @@ HRESULT CMapContainer::Render() return S_OK; } +HRESULT CMapContainer::Save_PartObjects(tinyxml2::XMLDocument& Doc, tinyxml2::XMLElement* Container) +{ + for (auto& piar : m_PartObjects) + { + CMapObject* pMapObject = dynamic_cast(piar.second); + + if (nullptr == pMapObject) + return E_FAIL; + + // + tinyxml2::XMLElement* PartObject = Doc.NewElement("PartObject"); + PartObject->SetAttribute("Lod_Level", pMapObject->Get_LodLevel()); + Container->InsertEndChild(PartObject); + + for (_uint i = 0; i < pMapObject->Get_LodLevel() + 1; ++i) + { + // 텍스트 + tinyxml2::XMLElement* proto = Doc.NewElement("PrototypeTag"); + proto->SetText(CMyTools::ToString(pMapObject->Get_PrototypeTag(i)).c_str()); + PartObject->InsertEndChild(proto); + } + + // + tinyxml2::XMLElement* PositionElem = Doc.NewElement("Position"); + + _float3 vPosition = {}; + XMStoreFloat3(&vPosition, pMapObject->Get_Component()->Get_State(STATE::POSITION)); + + PositionElem->SetAttribute("x", vPosition.x); + PositionElem->SetAttribute("y", vPosition.y); + PositionElem->SetAttribute("z", vPosition.z); + PartObject->InsertEndChild(PositionElem); + + // + tinyxml2::XMLElement* ScaleElem = Doc.NewElement("Scale"); + + _float3 pScale = pMapObject->Get_Component()->Get_Scale(); + ScaleElem->SetAttribute("x", pScale.x); + ScaleElem->SetAttribute("y", pScale.y); + ScaleElem->SetAttribute("z", pScale.z); + PartObject->InsertEndChild(ScaleElem); + + // + tinyxml2::XMLElement* RotationElem = Doc.NewElement("Rotation"); + + _float3 vRotation = {}; + XMStoreFloat3(&vRotation, pMapObject->Get_Component()->Get_RollPitchYawVector()); + + RotationElem->SetAttribute("x", vRotation.x); + RotationElem->SetAttribute("y", vRotation.y); + RotationElem->SetAttribute("z", vRotation.z); + PartObject->InsertEndChild(RotationElem); + + } + + return S_OK; +} + void CMapContainer::Free() { __super::Free(); diff --git a/Jusin154_Team3D/Editor/Private/MapObject.cpp b/Jusin154_Team3D/Editor/Private/MapObject.cpp index 1385f0f6c..1f8c74daf 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject.cpp @@ -49,30 +49,6 @@ void CMapObject::Late_Update(_float fTimeDelta) HRESULT CMapObject::Render() { - if (FAILED(Bind_ShaderResources())) { - return E_FAIL; - } - - //_uint iNumMeshes = m_pModelCom->Get_NumMeshes(); - - //for (_uint i = 0; i < iNumMeshes; i++) - //{ - // if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) { - // return E_FAIL; - // } - // if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) { - // return E_FAIL; - // } - - // if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { - // return E_FAIL; - // } - - // if (FAILED(m_pModelCom->Render(i))) { - // return E_FAIL; - // } - //} - return S_OK; } @@ -91,9 +67,6 @@ HRESULT CMapObject::Initialize(void* pArg) if (FAILED(__super::Initialize(pArg))) return E_FAIL; - if (FAILED(Ready_Components())) - return E_FAIL; - #ifdef _DEBUG m_bSelected = false; m_vPosition = _float3(0.f, 0.f, 0.f); @@ -104,6 +77,32 @@ HRESULT CMapObject::Initialize(void* pArg) return S_OK; } +_wstring CMapObject::Get_PrototypeTag(_uint iLodIndex) +{ + return _wstring(); +} + + return S_OK; +} + +HRESULT CMapObject::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components())) + return E_FAIL; + +#ifdef _DEBUG + m_bSelected = false; + m_vPosition = _float3(0.f, 0.f, 0.f); + m_vRotation = _float3(0.f, 0.f, 0.f); + m_vScale = _float3(1.f, 1.f, 1.f); +#endif // _DEBUG + + //if (FAILED(m_pShaderCom->Bind_RawValue("g_vCamPosition", m_pGameInstance->Get_CamPosition(), sizeof(_float4)))) { + // return E_FAIL; + //} HRESULT CMapObject::Ready_Components() { __super::Ready_Components(nullptr); @@ -116,6 +115,21 @@ HRESULT CMapObject::Bind_ShaderResources() return S_OK; } + return pInstance; +} + +CGameObject* CMapObject::Clone(void* pArg, CGameObject* pOwner) +{ + CMapObject* pInstance = new CMapObject(*this); + + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapObject"); + Safe_Release(pInstance); + } + + return pInstance; +} void CMapObject::Free() { diff --git a/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp index f872a7bb9..34ca2a9f7 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp @@ -41,9 +41,13 @@ HRESULT CMapObject_LOD::Initialize(void* pArg) #ifdef _DEBUG m_bSelected = false; - m_vPosition = _float3(0.f, 0.f, 0.f); - m_vRotation = _float3(0.f, 0.f, 0.f); - m_vScale = _float3(1.f, 1.f, 1.f); + 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 return S_OK; @@ -72,8 +76,11 @@ void CMapObject_LOD::Late_Update(_float fTimeDelta) } #endif + XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * m_pParentTransformCom->Get_XMWorldMatrix()); + _float4 vPos; - XMStoreFloat4(&vPos, Get_WorldPostion()); + //XMStoreFloat4(&vPos, Get_WorldPostion()); + XMStoreFloat4(&vPos, m_pTransformCom->Get_State(STATE::POSITION)); m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f); } @@ -83,7 +90,7 @@ HRESULT CMapObject_LOD::Render() return E_FAIL; } - _uint iNumMeshes = m_pModelComs[0]->Get_NumMeshes(); + _uint iNumMeshes = m_pModelComs[m_iLodIndex]->Get_NumMeshes(); for (_uint i = 0; i < iNumMeshes; i++) { @@ -93,10 +100,19 @@ HRESULT CMapObject_LOD::Render() if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) { return E_FAIL; } - - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { - return E_FAIL; + if (m_bSelected) + { + 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; @@ -122,6 +138,8 @@ HRESULT CMapObject_LOD::Add_LodModel(const _tchar* pModelPrototypeTag) reinterpret_cast(&pModel)))) return E_FAIL; + m_ModelPrototypeTags.push_back(pModelPrototypeTag); + ++m_iMaxLodLevel; m_pModelComs.push_back(pModel); @@ -154,9 +172,10 @@ HRESULT CMapObject_LOD::Ready_Components() HRESULT CMapObject_LOD::Bind_ShaderResources() { - if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { + 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; } diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp index 19ac803a6..03f1e3c63 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp @@ -43,27 +43,45 @@ HRESULT CMapObject_Manager::Initialize(void* pArg) if (FAILED(__super::Initialize(pArg))) return E_FAIL; - m_pContainer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"))->Get_Object(); + if (FAILED(Ready_Components())) + return E_FAIL; - SAFE_ADDREF(m_pContainer); + m_iContainerObjectIndex = 99; + //m_pContainer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"))->Get_Object(); return S_OK; } void CMapObject_Manager::Priority_Update(_float fTimeDelta) { - + for (auto* pObject : m_MapObjects) + { + pObject->Priority_Update(fTimeDelta); + } } void CMapObject_Manager::Update(_float fTimeDelta) { GUI::Begin("File"); - - if (GUI::Button("Save_XML")) + if (GUI::Button("Save_Map")) { Save_MapData("Test"); + + } + if (GUI::Button("Load_Map")) + { + Load_MapData("Test"); + + } + GUI::InputText("Containter Name", m_szSaveContainerName, MAX_PATH); + if (GUI::Button("Save_Container")) + { + Save_ContainerData("ContainerTest", m_szSaveContainerName); + } + if (GUI::Button("Load_Container")) + { + Load_ContainerData("ContainerTest", m_szSaveContainerName); } - GUI::End(); Update_PrototypeList(); @@ -72,11 +90,31 @@ void CMapObject_Manager::Update(_float fTimeDelta) Update_Edit(); + Update_ContainerObject(); + + for (auto* pObject : m_MapObjects) + { + pObject->Update(fTimeDelta); + } } void CMapObject_Manager::Late_Update(_float fTimeDelta) { - + auto iter = m_MapObjects.begin(); + for (; iter != m_MapObjects.end();) + { + if ((*iter)->isDead()) + { + SAFE_RELEASE(*iter); + iter = m_MapObjects.erase(iter); + } + else + { + (*iter)->Late_Update(fTimeDelta); + ++iter; + } + + } } HRESULT CMapObject_Manager::Render() @@ -86,6 +124,8 @@ HRESULT CMapObject_Manager::Render() HRESULT CMapObject_Manager::Ready_Components() { + __super::Ready_Components(nullptr); + return S_OK; } @@ -96,72 +136,224 @@ HRESULT CMapObject_Manager::Bind_ShaderResources() HRESULT CMapObject_Manager::Save_MapData(const _char* pFileName) { - //const list* pObjectList = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_MapObject"))->Get_Objects(); + tinyxml2::XMLDocument doc; + string strPath = "../Bin/Resources/Data/Map/" + string(pFileName) + ".xml"; - //if (nullptr == pObjectList) - // return E_FAIL; + tinyxml2::XMLError loadResult = doc.LoadFile(strPath.c_str()); - //tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* land = {}; + tinyxml2::XMLElement* container = {}; - //doc.InsertFirstChild(doc.NewDeclaration()); + if (loadResult != tinyxml2::XML_SUCCESS) + { + doc.InsertFirstChild(doc.NewDeclaration()); - //tinyxml2::XMLElement* land = doc.NewElement("Land"); - //doc.InsertEndChild(land); + land = doc.NewElement("Land"); + doc.InsertEndChild(land); - //for (auto& pObjcet : *pObjectList) - //{ - // CMapObject* pMapObject = dynamic_cast(pObjcet); + } + else + { + land = doc.FirstChildElement("Land"); + } - // if (nullptr == pMapObject) - // continue; + CLayer* pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building")); - // // - // tinyxml2::XMLElement* model = doc.NewElement("Model"); - // land->InsertEndChild(model); + if (nullptr == pLayer) + return E_FAIL; + + const list* pList = pLayer->Get_Objects(); - // // 텍스트 - // tinyxml2::XMLElement* proto = doc.NewElement("PrototypeTag"); - // proto->SetText(CMyTools::ToString(pMapObject->Get_PrototypeTag()).c_str()); - // model->InsertEndChild(proto); - // // - // tinyxml2::XMLElement* PositionElem = doc.NewElement("Position"); + for (auto pGamObject : *pList) + { + CBuildingContainer* pContainerObject = dynamic_cast(pGamObject); - // _float3 vPosition = {}; - // XMStoreFloat3(&vPosition, pMapObject->Get_WorldPostion()); - // - // PositionElem->SetAttribute("x", vPosition.x); - // PositionElem->SetAttribute("y", vPosition.y); - // PositionElem->SetAttribute("z", vPosition.z); - // model->InsertEndChild(PositionElem); + if (nullptr == pContainerObject) + return E_FAIL; - // // - // tinyxml2::XMLElement* ScaleElem = doc.NewElement("Scale"); + string strName = pContainerObject->Get_Name(); - // _float3 pScale = pMapObject->Get_Component()->Get_Scale(); - // ScaleElem->SetAttribute("x", pScale.x); - // ScaleElem->SetAttribute("y", pScale.y); - // ScaleElem->SetAttribute("z", pScale.z); - // model->InsertEndChild(ScaleElem); + tinyxml2::XMLElement* container = doc.NewElement("Container"); + container->SetAttribute("Name", strName.c_str()); + land->InsertEndChild(container); - // // - // tinyxml2::XMLElement* RotationElem = doc.NewElement("Rotation"); + _float3 vPosition = {}; + XMStoreFloat3(&vPosition, pGamObject->Get_Component()->Get_State(STATE::POSITION)); - // _float3 vRotation = {}; - // XMStoreFloat3(&vRotation, pMapObject->Get_Component()->Get_RollPitchYawVector()); - // - // RotationElem->SetAttribute("x", vRotation.x); - // RotationElem->SetAttribute("y", vRotation.y); - // RotationElem->SetAttribute("z", vRotation.z); - // model->InsertEndChild(RotationElem); + _float3 vScale = pGamObject->Get_Component()->Get_Scale(); - //} - //string strPath = "../Bin/Resources/Data/Map/" + string(pFileName) + ".xml"; + _float3 vRotation = {}; + XMStoreFloat3(&vRotation, pGamObject->Get_Component()->Get_RollPitchYawVector()); + vRotation.x = XMConvertToDegrees(vRotation.x); + vRotation.y = XMConvertToDegrees(vRotation.y); + vRotation.z = XMConvertToDegrees(vRotation.z); - //// 저장 - //if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) { - // return E_FAIL; - //} + +#pragma region CONTAINER_TRANSFORM + tinyxml2::XMLElement* Position = doc.NewElement("Position"); + Position->SetAttribute("x", vPosition.x); + Position->SetAttribute("y", vPosition.y); + Position->SetAttribute("z", vPosition.z); + container->InsertEndChild(Position); + + tinyxml2::XMLElement* Scale = doc.NewElement("Scale"); + Scale->SetAttribute("x", vScale.x); + Scale->SetAttribute("y", vScale.y); + Scale->SetAttribute("z", vScale.z); + container->InsertEndChild(Scale); + + tinyxml2::XMLElement* Rotation = doc.NewElement("Rotation"); + Rotation->SetAttribute("x", vRotation.x); + Rotation->SetAttribute("y", vRotation.y); + Rotation->SetAttribute("z", vRotation.z); + container->InsertEndChild(Rotation); +#pragma endregion + + + +#pragma region SAVE_PARTOBJECT + + if (FAILED(pContainerObject->Save_PartObjects(doc, container))) + return E_FAIL; + } +#pragma endregion + + // 저장 + if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) { + MSG_BOX("Failed to Save File"); + } + else + { + MSG_BOX("Succeed to Save File"); + } + + return S_OK; + + + + + return S_OK; +} + +HRESULT CMapObject_Manager::Save_ContainerData(const _char* pFileName, const _char* pContainerName) +{ + if (true == m_MapObjects.empty()) + return E_FAIL; + + tinyxml2::XMLDocument doc; + string strPath = "../Bin/Resources/Data/Map/" + string(pFileName) + ".xml"; + + tinyxml2::XMLError loadResult = doc.LoadFile(strPath.c_str()); + + tinyxml2::XMLElement* land = {}; + tinyxml2::XMLElement* container = {}; + + if (loadResult != tinyxml2::XML_SUCCESS) + { + doc.InsertFirstChild(doc.NewDeclaration()); + + land = doc.NewElement("Land"); + doc.InsertEndChild(land); + + container = doc.NewElement("Container"); + container->SetAttribute("Name", pContainerName); + land->InsertEndChild(container); + } + else + { + land = doc.FirstChildElement("Land"); + container = doc.NewElement("Container"); + container->SetAttribute("Name", pContainerName); + land->InsertEndChild(container); + } + +#pragma region CONTAINER_DEFAULT_TRANSFORM + tinyxml2::XMLElement* Position = doc.NewElement("Position"); + Position->SetAttribute("x", 0.f); + Position->SetAttribute("y", 0.f); + Position->SetAttribute("z", 0.f); + container->InsertEndChild(Position); + + tinyxml2::XMLElement* Scale = doc.NewElement("Scale"); + Scale->SetAttribute("x", 1.f); + Scale->SetAttribute("y", 1.f); + Scale->SetAttribute("z", 1.f); + container->InsertEndChild(Scale); + + tinyxml2::XMLElement* Rotation = doc.NewElement("Rotation"); + Rotation->SetAttribute("x", 0.f); + Rotation->SetAttribute("y", 0.f); + Rotation->SetAttribute("z", 0.f); + container->InsertEndChild(Rotation); +#pragma endregion + +#pragma region SAVE_PARTOBJECT + for (auto& pMapObject : m_MapObjects) + { + // + tinyxml2::XMLElement* PartObject = doc.NewElement("PartObject"); + PartObject->SetAttribute("Lod_Level", pMapObject->Get_LodLevel()); + container->InsertEndChild(PartObject); + + for (_uint i = 0; i < pMapObject->Get_LodLevel() + 1; ++i) + { + // 텍스트 + tinyxml2::XMLElement* proto = doc.NewElement("PrototypeTag"); + proto->SetText(CMyTools::ToString(pMapObject->Get_PrototypeTag(i)).c_str()); + PartObject->InsertEndChild(proto); + } + + //m_pMapObjects = pLayer->Get_Objects(); + + _float3 vPosition = {}; + XMStoreFloat3(&vPosition, pMapObject->Get_Component()->Get_State(STATE::POSITION)); + + PositionElem->SetAttribute("x", vPosition.x); + PositionElem->SetAttribute("y", vPosition.y); + PositionElem->SetAttribute("z", vPosition.z); + PartObject->InsertEndChild(PositionElem); + + if (false == m_MapObjects.empty()) + { + for (auto pMapObject : m_MapObjects) + { + CMapObject* pCurrentMapObject = static_cast(pMapObject); + + _float3 pScale = pMapObject->Get_Component()->Get_Scale(); + ScaleElem->SetAttribute("x", pScale.x); + ScaleElem->SetAttribute("y", pScale.y); + ScaleElem->SetAttribute("z", pScale.z); + PartObject->InsertEndChild(ScaleElem); + + wstring strPrototypeTag = pCurrentMapObject->Get_PrototypeTag(); + + _float3 vRotation = {}; + XMStoreFloat3(&vRotation, pMapObject->Get_Component()->Get_RollPitchYawVector()); + + vRotation.x = XMConvertToDegrees(vRotation.x); + vRotation.y = XMConvertToDegrees(vRotation.y); + vRotation.z = XMConvertToDegrees(vRotation.z); + + RotationElem->SetAttribute("x", vRotation.x); + RotationElem->SetAttribute("y", vRotation.y); + RotationElem->SetAttribute("z", vRotation.z); + PartObject->InsertEndChild(RotationElem); + + SAFE_RELEASE(pMapObject); + } + m_MapObjects.clear(); + m_pSelectObject = nullptr; +#pragma endregion + + // 저장 + if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) { + MSG_BOX("Failed to Save File"); + } + else + { + MSG_BOX("Succeed to Save File"); + } return S_OK; } @@ -180,51 +372,277 @@ HRESULT CMapObject_Manager::Load_MapData(const _char* pFileName) if (nullptr == root) { MSG_BOX("Failed to Find root"); - return E_FAIL; + return S_OK; } - ///* Map */ - //MAP_DATA Map_Data = {}; + /* Container */ + for (auto* Container = root->FirstChildElement("Container"); Container; Container = Container->NextSiblingElement("Container")) + { + const _char* pName = {}; - //for (auto* land = root->FirstChildElement("Model"); land; land = land->NextSiblingElement("Model")) - //{ - // tinyxml2::XMLElement* protoElem = land->FirstChildElement("PrototypeTag"); + Container->QueryStringAttribute("Name", &pName); +#pragma region ADD_CONTAINER_OBJECT - // const _char* pPrototypeTag = protoElem->GetText(); + CBuildingContainer* pContainerObject = { nullptr }; + CMapContainer::MAP_CONTAINER_DESC ContainerDesc = {}; - // if (nullptr != pPrototypeTag) - // { - // string strPtotoypeTag = pPrototypeTag; - // Map_Data.strPrototypeTag = CMyTools::ToWstring(strPtotoypeTag); - // } - // else - // { - // Map_Data.strPrototypeTag = L""; - // } + auto* ContainerPosition = Container->FirstChildElement("Position"); + ContainerPosition->QueryFloatAttribute("x", &ContainerDesc.vPosition.x); + ContainerPosition->QueryFloatAttribute("y", &ContainerDesc.vPosition.y); + ContainerPosition->QueryFloatAttribute("z", &ContainerDesc.vPosition.z); - // protoElem = land->FirstChildElement("Position"); - // if (nullptr == protoElem) - // return E_FAIL; - // protoElem->QueryFloatAttribute("x", &Map_Data.vPosition.x); - // protoElem->QueryFloatAttribute("y", &Map_Data.vPosition.y); - // protoElem->QueryFloatAttribute("z", &Map_Data.vPosition.z); + auto* ContainerScale = Container->FirstChildElement("Scale"); + ContainerScale->QueryFloatAttribute("x", &ContainerDesc.vScale.x); + ContainerScale->QueryFloatAttribute("y", &ContainerDesc.vScale.y); + ContainerScale->QueryFloatAttribute("z", &ContainerDesc.vScale.z); - // protoElem = land->FirstChildElement("Scale"); - // if (nullptr == protoElem) - // return E_FAIL; - // protoElem->QueryFloatAttribute("x", &Map_Data.vScale.x); - // protoElem->QueryFloatAttribute("y", &Map_Data.vScale.y); - // protoElem->QueryFloatAttribute("z", &Map_Data.vScale.z); + auto* ContainerRotation = Container->FirstChildElement("Rotation"); + ContainerRotation->QueryFloatAttribute("x", &ContainerDesc.vRotation.x); + ContainerRotation->QueryFloatAttribute("y", &ContainerDesc.vRotation.y); + ContainerRotation->QueryFloatAttribute("z", &ContainerDesc.vRotation.z); - // protoElem = land->FirstChildElement("Rotation"); - // if (nullptr == protoElem) - // return E_FAIL; - // protoElem->QueryFloatAttribute("x", &Map_Data.vRotation.x); - // protoElem->QueryFloatAttribute("y", &Map_Data.vRotation.y); - // protoElem->QueryFloatAttribute("z", &Map_Data.vRotation.z); + ContainerDesc.strName = string(pName); + + m_pGameInstance->Add_GameObject_ToLayer( + g_iStaticLevel, ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"), &ContainerDesc, nullptr, reinterpret_cast(&pContainerObject)); +#pragma endregion + +#pragma region ADD_PARTOBJECT + for (auto* PartObject = Container->FirstChildElement("PartObject"); PartObject; PartObject = PartObject->NextSiblingElement("PartObject")) + { + _uint iLodLevel = {}; + + PartObject->QueryUnsignedAttribute("Lod_Level", &iLodLevel); + +#pragma region MAPOBJECT_STATIC + if (0 == iLodLevel) /* MapObject_Static */ + { + CMapObject_Static::MAPOBJECT_STATIC_DESC Desc = {}; + string strTag = {}; + auto* PrototypeTag = PartObject->FirstChildElement("PrototypeTag"); + + strTag = PrototypeTag->GetText(); + + Desc.strModelPrototypeTag = CMyTools::ToWstring(strTag); + + Desc.pParentTransform = pContainerObject->Get_Component(); + const string strKey = strTag; + + /* Position */ + tinyxml2::XMLElement* Position = PartObject->FirstChildElement("Position"); + Position->QueryFloatAttribute("x", &Desc.vPosition.x); + Position->QueryFloatAttribute("y", &Desc.vPosition.y); + Position->QueryFloatAttribute("z", &Desc.vPosition.z); + + /* Scale */ + tinyxml2::XMLElement* Scale = PartObject->FirstChildElement("Scale"); + Scale->QueryFloatAttribute("x", &Desc.vScale.x); + Scale->QueryFloatAttribute("y", &Desc.vScale.y); + Scale->QueryFloatAttribute("z", &Desc.vScale.z); + + /* Rotation */ + tinyxml2::XMLElement* Rotation = PartObject->FirstChildElement("Rotation"); + Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); + Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); + Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); + + pContainerObject->Add_Part(strKey, g_iStaticLevel, nullptr, &Desc); + } +#pragma endregion + +#pragma region MAPOBJECT_LOD + else + { + CMapObject_LOD::MAPOBJECT_LOD_DESC Desc = {}; + string strTag = {}; + for (auto* PrototypeTag = PartObject->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) + { + strTag = PrototypeTag->GetText(); + + Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); + } + + Desc.pParentTransform = pContainerObject->Get_Component(); + const string strKey = strTag; + + /* Position */ + tinyxml2::XMLElement* Position = PartObject->FirstChildElement("Position"); + Position->QueryFloatAttribute("x", &Desc.vPosition.x); + Position->QueryFloatAttribute("y", &Desc.vPosition.y); + Position->QueryFloatAttribute("z", &Desc.vPosition.z); + + /* Scale */ + tinyxml2::XMLElement* Scale = PartObject->FirstChildElement("Scale"); + Scale->QueryFloatAttribute("x", &Desc.vScale.x); + Scale->QueryFloatAttribute("y", &Desc.vScale.y); + Scale->QueryFloatAttribute("z", &Desc.vScale.z); + + /* Rotation */ + tinyxml2::XMLElement* Rotation = PartObject->FirstChildElement("Rotation"); + Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); + Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); + Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); + + pContainerObject->Add_Part(strKey, g_iStaticLevel, nullptr, &Desc); + } +#pragma endregion + + } +#pragma endregion + + } + + return S_OK; +} + +HRESULT CMapObject_Manager::Load_ContainerData(const _char* pFileName, const _char* pContainerName) +{ + 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("Land"); + + if (nullptr == root) + { + MSG_BOX("Failed to Find root"); + return S_OK; + } + + tinyxml2::XMLElement* TargetContainer = { nullptr }; + + for (auto* Container = root->FirstChildElement("Container"); Container; Container = Container->NextSiblingElement("Container")) + { + const _char* pName = {}; + + Container->QueryStringAttribute("Name", &pName); + + if (!strcmp(pContainerName, pName)) + { + TargetContainer = Container; + break; + } + } + + /* Failed to find Container */ + if (nullptr == TargetContainer) + { + xmlDoc.Clear(); + MSG_BOX("Failed to find Container"); + return S_OK; + } +#pragma region ADD_CONTAINER_OBJECT + + CBuildingContainer* pContainerObject = { nullptr }; + CMapContainer::MAP_CONTAINER_DESC ContainerDesc = {}; + + auto* ContainerPosition = TargetContainer->FirstChildElement("Position"); + ContainerPosition->QueryFloatAttribute("x", &ContainerDesc.vPosition.x); + ContainerPosition->QueryFloatAttribute("y", &ContainerDesc.vPosition.y); + ContainerPosition->QueryFloatAttribute("z", &ContainerDesc.vPosition.z); + + auto* ContainerScale = TargetContainer->FirstChildElement("Scale"); + ContainerScale->QueryFloatAttribute("x", &ContainerDesc.vScale.x); + ContainerScale->QueryFloatAttribute("y", &ContainerDesc.vScale.y); + ContainerScale->QueryFloatAttribute("z", &ContainerDesc.vScale.z); + + auto* ContainerRotation = TargetContainer->FirstChildElement("Rotation"); + ContainerRotation->QueryFloatAttribute("x", &ContainerDesc.vRotation.x); + ContainerRotation->QueryFloatAttribute("y", &ContainerDesc.vRotation.y); + ContainerRotation->QueryFloatAttribute("z", &ContainerDesc.vRotation.z); + + ContainerDesc.strName = string(pContainerName); + + m_pGameInstance->Add_GameObject_ToLayer( + g_iStaticLevel, ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"), &ContainerDesc, nullptr, reinterpret_cast(&pContainerObject)); +#pragma endregion + +#pragma region ADD_PARTOBJECT + for (auto* PartObject = TargetContainer->FirstChildElement("PartObject"); PartObject; PartObject = PartObject->NextSiblingElement("PartObject")) + { + _uint iLodLevel = {}; + + PartObject->QueryUnsignedAttribute("Lod_Level", &iLodLevel); + +#pragma region MAPOBJECT_STATIC + if (0 == iLodLevel) /* MapObject_Static */ + { + CMapObject_Static::MAPOBJECT_STATIC_DESC Desc = {}; + string strTag = {}; + auto* PrototypeTag = PartObject->FirstChildElement("PrototypeTag"); + + strTag = PrototypeTag->GetText(); + + Desc.strModelPrototypeTag = CMyTools::ToWstring(strTag); + Desc.iMaxLodLevel = iLodLevel; + Desc.pParentTransform = pContainerObject->Get_Component(); + const string strKey = strTag; + + /* Position */ + tinyxml2::XMLElement* Position = PartObject->FirstChildElement("Position"); + Position->QueryFloatAttribute("x", &Desc.vPosition.x); + Position->QueryFloatAttribute("y", &Desc.vPosition.y); + Position->QueryFloatAttribute("z", &Desc.vPosition.z); + + /* Scale */ + tinyxml2::XMLElement* Scale = PartObject->FirstChildElement("Scale"); + Scale->QueryFloatAttribute("x", &Desc.vScale.x); + Scale->QueryFloatAttribute("y", &Desc.vScale.y); + Scale->QueryFloatAttribute("z", &Desc.vScale.z); + + /* Rotation */ + tinyxml2::XMLElement* Rotation = PartObject->FirstChildElement("Rotation"); + Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); + Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); + Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); + + pContainerObject->Add_Part(strKey, g_iStaticLevel, nullptr, &Desc); + } +#pragma endregion + +#pragma region MAPOBJECT_LOD + else + { + CMapObject_LOD::MAPOBJECT_LOD_DESC Desc = {}; + string strTag = {}; + for (auto* PrototypeTag = PartObject->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) + { + strTag = PrototypeTag->GetText(); + + Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); + } + Desc.iMaxLodLevel = iLodLevel; + Desc.pParentTransform = pContainerObject->Get_Component(); + const string strKey = strTag; + + /* Position */ + tinyxml2::XMLElement* Position = PartObject->FirstChildElement("Position"); + Position->QueryFloatAttribute("x", &Desc.vPosition.x); + Position->QueryFloatAttribute("y", &Desc.vPosition.y); + Position->QueryFloatAttribute("z", &Desc.vPosition.z); + + /* Scale */ + tinyxml2::XMLElement* Scale = PartObject->FirstChildElement("Scale"); + Scale->QueryFloatAttribute("x", &Desc.vScale.x); + Scale->QueryFloatAttribute("y", &Desc.vScale.y); + Scale->QueryFloatAttribute("z", &Desc.vScale.z); + + /* Rotation */ + tinyxml2::XMLElement* Rotation = PartObject->FirstChildElement("Rotation"); + Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); + Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); + Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); + + pContainerObject->Add_Part(strKey, g_iStaticLevel, nullptr, &Desc); + } +#pragma endregion + + } +#pragma endregion - // m_MapDatas.push_back(Map_Data); - //} return S_OK; } @@ -232,7 +650,6 @@ HRESULT CMapObject_Manager::Load_MapData(const _char* pFileName) void CMapObject_Manager::Update_PrototypeList() { GUI::Begin("Model Prototype List"); - GUI::Checkbox("bLOD", &m_bLOD); for (auto& Tag : m_ModelPrototypeTags) { if (_wstring::npos != Tag.find(L"Lod")) @@ -240,16 +657,25 @@ void CMapObject_Manager::Update_PrototypeList() if (ImGui::Button(CMyTools::ToString(Tag).c_str())) { - if(false == m_bLOD) + _uint iNumLodModel = {}; + + if(false == Find_Lod_Prototype(Tag, &iNumLodModel)) { CMapObject_Static::MAPOBJECT_STATIC_DESC Desc = {}; - Desc.pModelPrototypeTag = Tag.c_str(); - Desc.pParentTransform = m_pContainer->Get_Component(); + Desc.strModelPrototypeTag = Tag; + Desc.pParentTransform = m_pTransformCom; + Desc.vPosition = _float3(0.f, 0.f, 0.f); + Desc.vRotation = _float3(0.f, 0.f, 0.f); + Desc.vScale = _float3(1.f, 1.f, 1.f); CMapObject_Static* pMapObject = { nullptr }; const string strKey = CMyTools::ToString(Tag); - m_pContainer->Add_Part(strKey, 0, &pMapObject, &Desc); + + pMapObject = m_pGameInstance->Clone_Prototype(g_iStaticLevel, &Desc); + + /* if(FAILED(m_pContainer->Add_Part(strKey, 0, &pMapObject, &Desc))) + break;*/ m_MapObjects.push_back(pMapObject); } @@ -257,45 +683,34 @@ void CMapObject_Manager::Update_PrototypeList() { CMapObject_LOD::MAPOBJECT_LOD_DESC Desc = {}; - vector PrototypeTags; + vector<_wstring> PrototypeTags; - PrototypeTags.push_back(Tag.c_str()); + PrototypeTags.push_back(Tag); Desc.iMaxLodLevel = 0; Desc.ModelPrototypeTags = PrototypeTags; - Desc.pParentTransform = m_pContainer->Get_Component(); + Desc.pParentTransform = m_pTransformCom; + Desc.vPosition = _float3(0.f, 0.f, 0.f); + Desc.vRotation = _float3(0.f, 0.f, 0.f); + Desc.vScale = _float3(1.f, 1.f, 1.f); - CMapObject_Static* pMapObject = { nullptr }; + CMapObject_LOD* pMapObject = { nullptr }; const string strKey = CMyTools::ToString(Tag); - m_pContainer->Add_Part(strKey, 0, nullptr, &Desc); + + pMapObject = m_pGameInstance->Clone_Prototype(g_iStaticLevel, &Desc); + + //if (FAILED(m_pContainer->Add_Part(strKey, 0, &pMapObject, &Desc))) + // break; m_MapObjects.push_back(pMapObject); - } - } - } - GUI::End(); - - GUI::Begin("LOD Model Prototype List"); - for (auto& Tag : m_LODModelPrototypeTags) - { - if (ImGui::Button(CMyTools::ToString(Tag).c_str())) - { - if (nullptr != m_pSelectObject) - { - CMapObject_LOD* pLodObject = dynamic_cast(m_pSelectObject); - - if (nullptr != pLodObject) + for (_uint i = 0; i < iNumLodModel; ++i) { - pLodObject->Add_LodModel(Tag.c_str()); - } - else - { - MSG_BOX("Failed to Add Lod Model"); - } - - if (m_pSelectObject->isDead()) - m_pSelectObject = nullptr; + _wstring strLodTag = Tag + L"_Lod" + to_wstring(i + 1); + pMapObject->Add_LodModel(strLodTag.c_str()); + } + + } } } @@ -355,6 +770,58 @@ void CMapObject_Manager::Update_Edit() GUI::End(); } +void CMapObject_Manager::Update_ContainerObject() +{ + GUI::Begin("Edit Container"); + + CLayer* pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building")); + + if (nullptr == pLayer) + { + GUI::End(); + return; + } + const list* pList = pLayer->Get_Objects(); + + _uint iIndex = {}; + + if (false == (*pList).empty()) + { + CGameObject* pSelectObject = { nullptr }; + + for (auto& pObject : (*pList)) + { + if (GUI::Button((dynamic_cast(pObject)->Get_Name().c_str()))) + { + m_iContainerObjectIndex = iIndex; + } + + if (iIndex == m_iContainerObjectIndex) + pSelectObject = pObject; + + ++iIndex; + } + + if (nullptr != pSelectObject) + pSelectObject->Describe_Entity(); + } + + GUI::End(); +} + +_bool CMapObject_Manager::Find_Lod_Prototype(_wstring strPrototypeTag, _uint* iCount) +{ + for (auto& Tag : m_LODModelPrototypeTags) + { + if (_wstring::npos != Tag.find(strPrototypeTag)) + (*iCount)++; + } + if (0 < *iCount) + return true; + + return false; +} + CMapObject_Manager* CMapObject_Manager::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, vector<_wstring>& ModelPrototypeTags) { @@ -386,6 +853,11 @@ void CMapObject_Manager::Free() { __super::Free(); + for (auto& pObject : m_MapObjects) + { + SAFE_RELEASE(pObject); + } + SAFE_RELEASE(m_pContainer); } diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp index b3a82059b..9872827b3 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp @@ -40,8 +40,10 @@ void CMapObject_Static::Late_Update(_float fTimeDelta) } #endif + XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * m_pParentTransformCom->Get_XMWorldMatrix()); + _float4 vPos; - XMStoreFloat4(&vPos, Get_WorldPostion()); + XMStoreFloat4(&vPos, m_pTransformCom->Get_State(STATE::POSITION)); m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f); } @@ -62,8 +64,17 @@ HRESULT CMapObject_Static::Render() return E_FAIL; } - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { - return E_FAIL; + if (m_bSelected) + { + 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_pModelCom->Render(i))) { @@ -81,9 +92,11 @@ HRESULT CMapObject_Static::Initialize_Prototype() HRESULT CMapObject_Static::Initialize(void* pArg) { + m_iMaxLodLevel = 0; + MAPOBJECT_STATIC_DESC* pDesc = static_cast(pArg); - m_strModelPrototypeTag = pDesc->pModelPrototypeTag; + m_strModelPrototypeTag = pDesc->strModelPrototypeTag; if (FAILED(__super::Initialize(pArg))) return E_FAIL; @@ -94,9 +107,13 @@ HRESULT CMapObject_Static::Initialize(void* pArg) #ifdef _DEBUG m_bSelected = false; - m_vPosition = _float3(0.f, 0.f, 0.f); - m_vRotation = _float3(0.f, 0.f, 0.f); - m_vScale = _float3(1.f, 1.f, 1.f); + 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 return S_OK; @@ -126,7 +143,7 @@ HRESULT CMapObject_Static::Ready_Components() HRESULT CMapObject_Static::Bind_ShaderResources() { - if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { + 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)))) { @@ -139,21 +156,7 @@ HRESULT CMapObject_Static::Bind_ShaderResources() if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { return E_FAIL; } - //if (FAILED(m_pShaderCom->Bind_RawValue("g_vCamPosition", m_pGameInstance->Get_CamPosition(), sizeof(_float4)))) { - // return E_FAIL; - //} - //if (FAILED(m_pShaderCom->Bind_RawValue("g_bRimLight", &m_bRimLight, sizeof(_bool)))) { - // return E_FAIL; - //} - //if (FAILED(m_pShaderCom->Bind_RawValue("g_fRimStrength", &m_fRimLightStrength, sizeof(_float)))) { - // return E_FAIL; - //} - //if (FAILED(m_pShaderCom->Bind_RawValue("g_fRimPower", &m_fRimLightPower, sizeof(_float)))) { - // return E_FAIL; - //} - //if (FAILED(m_pShaderCom->Bind_RawValue("g_vRimColor", &m_vRimLightColor, sizeof(_float3)))) { - // return E_FAIL; - //} + return S_OK; } diff --git a/Jusin154_Team3D/Editor/Public/BuildingContainer.h b/Jusin154_Team3D/Editor/Public/BuildingContainer.h index bf4694f2d..3dcd25980 100644 --- a/Jusin154_Team3D/Editor/Public/BuildingContainer.h +++ b/Jusin154_Team3D/Editor/Public/BuildingContainer.h @@ -7,6 +7,8 @@ NS_BEGIN(Editor) class CBuildingContainer final : public CMapContainer { + + public: CBuildingContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CBuildingContainer(const CBuildingContainer& rhs); diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h index f8b31c8d5..90d479c48 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Define.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Define.h @@ -16,7 +16,7 @@ namespace Editor enum class SHADER_PASS_ANIM { DEFAULT, SHADOW, CAPTURE, BLUR, END }; enum class SHADER_PASS_CUBE { DEFAULT, SHADOW, BLUR, END }; - enum class SHADER_PASS_MESH { DEFAULT, SHADOW, SKYBOX, ALPHABLEND, EFFECT_ALPHABLEND, EFFECT_BLEND, EFFECT_ALPHABLEND_CULL, EFFECT_BLEND_CULL, CAPTURE, BLUR, EFFECT_ALPHABLEND_UVMOVE, END }; + enum class SHADER_PASS_MESH { DEFAULT, SHADOW, SKYBOX, ALPHABLEND, EFFECT_ALPHABLEND, EFFECT_BLEND, EFFECT_ALPHABLEND_CULL, EFFECT_BLEND_CULL, CAPTURE, BLUR, EFFECT_ALPHABLEND_UVMOVE, MAPTOOL ,END }; enum class SHADER_PASS_NORTEX { DEFAULT, TERRAIN, END }; enum class SHADER_PASS_PARTICLE { EXPLOSION, END }; enum class SHADER_PASS_POSTEX { DEFAULT, SCISSOR, UI, UVMOVE, TRAIL, END }; diff --git a/Jusin154_Team3D/Editor/Public/MapContainer.h b/Jusin154_Team3D/Editor/Public/MapContainer.h index e5edb84ab..57095b7d3 100644 --- a/Jusin154_Team3D/Editor/Public/MapContainer.h +++ b/Jusin154_Team3D/Editor/Public/MapContainer.h @@ -7,6 +7,14 @@ NS_BEGIN(Editor) class CMapContainer abstract : public CContainerObject { +public: + typedef struct tagMapContainerDesc + { + _string strName; + _float3 vPosition; + _float3 vScale; + _float3 vRotation; + }MAP_CONTAINER_DESC; public: CMapContainer(ID3D11Device * pDevice, ID3D11DeviceContext * pContext); CMapContainer(const CMapContainer& rhs); @@ -17,11 +25,24 @@ class CMapContainer abstract : public CContainerObject virtual void Late_Update(_float fTimeDelta) override; virtual HRESULT Render() override; + virtual _string& Get_Name() { return m_strName; } + virtual HRESULT Save_PartObjects(tinyxml2::XMLDocument& Doc, tinyxml2::XMLElement* Container); + protected: virtual HRESULT Initialize_Prototype() override; virtual HRESULT Initialize(void* pArg) override; virtual HRESULT Ready_Components(void* pArg) override; +protected: + _string m_strName = {}; + _bool m_bSelected = {}; + + _uint m_iMaxLodLevel = {}; + + _float3 m_vPosition = {}; + _float3 m_vRotation = {}; + _float3 m_vScale = {}; + public: virtual void Free() override; }; diff --git a/Jusin154_Team3D/Editor/Public/MapObject.h b/Jusin154_Team3D/Editor/Public/MapObject.h index cb9af64cf..cd10f0da4 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject.h +++ b/Jusin154_Team3D/Editor/Public/MapObject.h @@ -25,6 +25,7 @@ class CMapObject abstract : public CPartObject public: virtual _wstring Get_PrototypeTag(_uint iLodIndex = 0); + virtual _uint Get_LodLevel() { return m_iMaxLodLevel; } protected: @@ -35,7 +36,11 @@ class CMapObject abstract : public CPartObject HRESULT Ready_Components(); #ifdef _DEBUG +protected: _bool m_bSelected = {}; + + _uint m_iMaxLodLevel = {}; + _float3 m_vPosition = {}; _float3 m_vRotation = {}; _float3 m_vScale = {}; diff --git a/Jusin154_Team3D/Editor/Public/MapObject_LOD.h b/Jusin154_Team3D/Editor/Public/MapObject_LOD.h index 81a98cfb8..81d3d4b03 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject_LOD.h +++ b/Jusin154_Team3D/Editor/Public/MapObject_LOD.h @@ -11,7 +11,10 @@ class CMapObject_LOD final : public CMapObject typedef struct tagMapObjectLodDesc : public PARTOBJECT_DESC { _uint iMaxLodLevel{}; - vector ModelPrototypeTags; + vector<_wstring> ModelPrototypeTags; + _float3 vPosition; + _float3 vScale; + _float3 vRotation; }MAPOBJECT_LOD_DESC; private: @@ -38,8 +41,13 @@ class CMapObject_LOD final : public CMapObject _uint m_iMaxLodLevel = {}; _uint m_iLodIndex = {}; + CShader* m_pShaderCom = { nullptr }; + vector m_pModelComs; vector<_wstring> m_ModelPrototypeTags; + + + private: HRESULT Ready_Components(); HRESULT Bind_ShaderResources(); diff --git a/Jusin154_Team3D/Editor/Public/MapObject_Manager.h b/Jusin154_Team3D/Editor/Public/MapObject_Manager.h index 7f2be7252..bc8bc4451 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject_Manager.h +++ b/Jusin154_Team3D/Editor/Public/MapObject_Manager.h @@ -27,22 +27,31 @@ class CMapObject_Manager final : public CGameObject private: class CMapObject* m_pSelectObject = { nullptr }; - list m_MapObjects = { nullptr }; + list m_MapObjects = {}; vector<_wstring> m_ModelPrototypeTags; vector<_wstring> m_LODModelPrototypeTags; - _bool m_bLOD = { false }; - class CBuildingContainer* m_pContainer = { nullptr }; + _uint m_iContainerObjectIndex = {}; + class CBuildingContainer* m_pContainer = { nullptr }; + _char m_szSaveContainerName[MAX_PATH] = {}; private: HRESULT Ready_Components(); HRESULT Bind_ShaderResources(); + +#pragma region SAVE_LOAD HRESULT Save_MapData(const _char* pFileName); + HRESULT Save_ContainerData(const _char* pFileName, const _char* pContainerName); HRESULT Load_MapData(const _char* pFileName); + HRESULT Load_ContainerData(const _char* pFileName, const _char* pContainerName); +#pragma endregion void Update_PrototypeList(); void Update_ObjectList(); void Update_Edit(); + void Update_ContainerObject(); + + _bool Find_Lod_Prototype(_wstring strPrototypeTag, _uint* iCount); public: static CMapObject_Manager* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, vector<_wstring>& ModelPrototypeTags); diff --git a/Jusin154_Team3D/Editor/Public/MapObject_Static.h b/Jusin154_Team3D/Editor/Public/MapObject_Static.h index 6fe460bc7..c2c32d05d 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject_Static.h +++ b/Jusin154_Team3D/Editor/Public/MapObject_Static.h @@ -11,7 +11,10 @@ class CMapObject_Static final : public CMapObject typedef struct tagMapObjectStaticDesc : public PARTOBJECT_DESC { _uint iMaxLodLevel{}; - const _tchar* pModelPrototypeTag; + _wstring strModelPrototypeTag; + _float3 vPosition; + _float3 vScale; + _float3 vRotation; }MAPOBJECT_STATIC_DESC; private: diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp index 1070a60d9..2ccf4fe07 100644 --- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp +++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp @@ -104,7 +104,7 @@ void CGameInstance::Update_Engine(_float fTimeDelta) m_pMouse_Manager->Update(); //m_pSound_Manager->Update(); - m_pPicking->Update(); + //m_pPicking->Update(); m_pObject_Manager->Priority_Update(fTimeDelta); diff --git a/Jusin154_Team3D/Engine/Private/Material.cpp b/Jusin154_Team3D/Engine/Private/Material.cpp index 7ad016816..6971c8a06 100644 --- a/Jusin154_Team3D/Engine/Private/Material.cpp +++ b/Jusin154_Team3D/Engine/Private/Material.cpp @@ -464,8 +464,8 @@ HRESULT CMaterial::Initialize(const _char* pModelFilePath, const SaveMaterial& _ _splitpath_s(pModelFilePath, szDrive, MAX_PATH, szDir, MAX_PATH, nullptr, 0, nullptr, 0); char szFullPath[MAX_PATH] = {}; - strcpy_s(szFullPath, szDrive); - strcat_s(szFullPath, path.c_str()); + //(szFullPath, szDrive); + strcpy_s(szFullPath, path.c_str()); _tchar szPerfectPath[MAX_PATH] = {}; MultiByteToWideChar(CP_ACP, 0, szFullPath, -1, szPerfectPath, MAX_PATH); From 5ce681240bc983e07eee71427ff29e7b339587a2 Mon Sep 17 00:00:00 2001 From: JinhoBa <127280695+JinhoBa@users.noreply.github.com> Date: Tue, 11 Nov 2025 23:08:24 +0900 Subject: [PATCH 4/4] [fix] Load MapContainer --- .../Bin/Resources/Data/Map/ContainerTest.xml | 29 +++++++++++++ Jusin154_Team3D/Editor/Private/Loader.cpp | 32 +++++++------- .../Editor/Private/MapContainer.cpp | 34 +++++++-------- Jusin154_Team3D/Editor/Private/MapObject.cpp | 42 ------------------- .../Editor/Private/MapObject_Manager.cpp | 21 ++++------ Jusin154_Team3D/Editor/Public/MapObject_LOD.h | 4 +- 6 files changed, 72 insertions(+), 90 deletions(-) diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml index 245aedd90..e8082d594 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml @@ -308,4 +308,33 @@ + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrel_stands + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrel_stands + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrels + + + + + + Prototype_GameObject_SM_HM_3Broom_Door_R + + + + + diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index f6c12a3e8..472206311 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -684,29 +684,29 @@ HRESULT CLoader::Loading_For_MapViewer() ModelPrototypeTags.push_back(strFileName); } - for (const auto& file : filesystem::directory_iterator("C:\\Users\\82103\\Desktop\\MapRe\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Meshes\\3Broom_Kit")) - { - if (file.is_directory()) - continue; + //for (const auto& file : filesystem::directory_iterator("C:\\Users\\82103\\Desktop\\MapRe\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Meshes\\3Broom_Kit")) + //{ + // if (file.is_directory()) + // continue; - string ext = file.path().extension().string(); + // string ext = file.path().extension().string(); - if (strcmp(ext.c_str(), ".fbx")) - continue; + // if (strcmp(ext.c_str(), ".fbx")) + // continue; - _char szFilePath[MAX_PATH] = {}; + // _char szFilePath[MAX_PATH] = {}; - strcpy_s(szFilePath, MAX_PATH, file.path().string().c_str()); + // strcpy_s(szFilePath, MAX_PATH, file.path().string().c_str()); - _wstring strFileName = L"Prototype_GameObject_" + file.path().stem().wstring(); + // _wstring strFileName = L"Prototype_GameObject_" + file.path().stem().wstring(); - /*For Prototype_Component_Model_*/ - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, strFileName, - CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, szFilePath)))) - return E_FAIL; + // /*For Prototype_Component_Model_*/ + // if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, strFileName, + // CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, szFilePath)))) + // return E_FAIL; - ModelPrototypeTags.push_back(strFileName); - } + // ModelPrototypeTags.push_back(strFileName); + //} m_strMessage = TEXT("�뎽�씠�뜑瑜�(�쓣) 濡쒕뵫 以� �엯�땲�떎."); diff --git a/Jusin154_Team3D/Editor/Private/MapContainer.cpp b/Jusin154_Team3D/Editor/Private/MapContainer.cpp index cfa35c6e8..484d616cb 100644 --- a/Jusin154_Team3D/Editor/Private/MapContainer.cpp +++ b/Jusin154_Team3D/Editor/Private/MapContainer.cpp @@ -6,56 +6,56 @@ #include "MapObject_Static.h" CMapContainer::CMapContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) - :CContainerObject(pDevice, pContext) + :CContainerObject(pDevice, pContext) { } CMapContainer::CMapContainer(const CMapContainer& rhs) - :CContainerObject(rhs) + :CContainerObject(rhs) { } HRESULT CMapContainer::Initialize_Prototype() { - return S_OK; + return S_OK; } HRESULT CMapContainer::Initialize(void* pArg) { - if (FAILED(__super::Initialize(pArg))) { - return E_FAIL; - } + if (FAILED(__super::Initialize(pArg))) { + return E_FAIL; + } - return S_OK; + return S_OK; } HRESULT CMapContainer::Ready_Components(void* pArg) { - if (FAILED(__super::Ready_Components(pArg))) { - return E_FAIL; - } + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } - return S_OK; + return S_OK; } void CMapContainer::Priority_Update(_float fTimeDelta) { - __super::Priority_Update(fTimeDelta); + __super::Priority_Update(fTimeDelta); } void CMapContainer::Update(_float fTimeDelta) { - __super::Update(fTimeDelta); + __super::Update(fTimeDelta); } void CMapContainer::Late_Update(_float fTimeDelta) { - __super::Late_Update(fTimeDelta); + __super::Late_Update(fTimeDelta); } HRESULT CMapContainer::Render() { - return S_OK; + return S_OK; } HRESULT CMapContainer::Save_PartObjects(tinyxml2::XMLDocument& Doc, tinyxml2::XMLElement* Container) @@ -113,10 +113,10 @@ HRESULT CMapContainer::Save_PartObjects(tinyxml2::XMLDocument& Doc, tinyxml2::XM } - return S_OK; + return S_OK; } void CMapContainer::Free() { - __super::Free(); + __super::Free(); } diff --git a/Jusin154_Team3D/Editor/Private/MapObject.cpp b/Jusin154_Team3D/Editor/Private/MapObject.cpp index 1f8c74daf..183b29636 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject.cpp @@ -77,32 +77,6 @@ HRESULT CMapObject::Initialize(void* pArg) return S_OK; } -_wstring CMapObject::Get_PrototypeTag(_uint iLodIndex) -{ - return _wstring(); -} - - return S_OK; -} - -HRESULT CMapObject::Initialize(void* pArg) -{ - if (FAILED(__super::Initialize(pArg))) - return E_FAIL; - - if (FAILED(Ready_Components())) - return E_FAIL; - -#ifdef _DEBUG - m_bSelected = false; - m_vPosition = _float3(0.f, 0.f, 0.f); - m_vRotation = _float3(0.f, 0.f, 0.f); - m_vScale = _float3(1.f, 1.f, 1.f); -#endif // _DEBUG - - //if (FAILED(m_pShaderCom->Bind_RawValue("g_vCamPosition", m_pGameInstance->Get_CamPosition(), sizeof(_float4)))) { - // return E_FAIL; - //} HRESULT CMapObject::Ready_Components() { __super::Ready_Components(nullptr); @@ -115,22 +89,6 @@ HRESULT CMapObject::Bind_ShaderResources() return S_OK; } - return pInstance; -} - -CGameObject* CMapObject::Clone(void* pArg, CGameObject* pOwner) -{ - CMapObject* pInstance = new CMapObject(*this); - - if (FAILED(pInstance->Initialize(pArg))) - { - MSG_BOX("Failed to Cloned : CMapObject"); - Safe_Release(pInstance); - } - - return pInstance; -} - void CMapObject::Free() { __super::Free(); diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp index 03f1e3c63..83937fcc8 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp @@ -304,7 +304,8 @@ HRESULT CMapObject_Manager::Save_ContainerData(const _char* pFileName, const _ch PartObject->InsertEndChild(proto); } - //m_pMapObjects = pLayer->Get_Objects(); + // + tinyxml2::XMLElement* PositionElem = doc.NewElement("Position"); _float3 vPosition = {}; XMStoreFloat3(&vPosition, pMapObject->Get_Component()->Get_State(STATE::POSITION)); @@ -314,11 +315,8 @@ HRESULT CMapObject_Manager::Save_ContainerData(const _char* pFileName, const _ch PositionElem->SetAttribute("z", vPosition.z); PartObject->InsertEndChild(PositionElem); - if (false == m_MapObjects.empty()) - { - for (auto pMapObject : m_MapObjects) - { - CMapObject* pCurrentMapObject = static_cast(pMapObject); + // + tinyxml2::XMLElement* ScaleElem = doc.NewElement("Scale"); _float3 pScale = pMapObject->Get_Component()->Get_Scale(); ScaleElem->SetAttribute("x", pScale.x); @@ -326,7 +324,8 @@ HRESULT CMapObject_Manager::Save_ContainerData(const _char* pFileName, const _ch ScaleElem->SetAttribute("z", pScale.z); PartObject->InsertEndChild(ScaleElem); - wstring strPrototypeTag = pCurrentMapObject->Get_PrototypeTag(); + // + tinyxml2::XMLElement* RotationElem = doc.NewElement("Rotation"); _float3 vRotation = {}; XMStoreFloat3(&vRotation, pMapObject->Get_Component()->Get_RollPitchYawVector()); @@ -404,7 +403,7 @@ HRESULT CMapObject_Manager::Load_MapData(const _char* pFileName) ContainerDesc.strName = string(pName); m_pGameInstance->Add_GameObject_ToLayer( - g_iStaticLevel, ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"), &ContainerDesc, nullptr, reinterpret_cast(&pContainerObject)); + g_iStaticLevel, ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"), &ContainerDesc, nullptr, &pContainerObject); #pragma endregion #pragma region ADD_PARTOBJECT @@ -489,7 +488,6 @@ HRESULT CMapObject_Manager::Load_MapData(const _char* pFileName) } #pragma endregion - } return S_OK; @@ -556,8 +554,7 @@ HRESULT CMapObject_Manager::Load_ContainerData(const _char* pFileName, const _ch ContainerDesc.strName = string(pContainerName); - m_pGameInstance->Add_GameObject_ToLayer( - g_iStaticLevel, ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"), &ContainerDesc, nullptr, reinterpret_cast(&pContainerObject)); + m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"), &ContainerDesc, nullptr, (CBuildingContainer**)(&pContainerObject)); #pragma endregion #pragma region ADD_PARTOBJECT @@ -642,7 +639,7 @@ HRESULT CMapObject_Manager::Load_ContainerData(const _char* pFileName, const _ch } #pragma endregion - + SAFE_RELEASE(pContainerObject); return S_OK; } diff --git a/Jusin154_Team3D/Editor/Public/MapObject_LOD.h b/Jusin154_Team3D/Editor/Public/MapObject_LOD.h index 81d3d4b03..ec7acf8c8 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject_LOD.h +++ b/Jusin154_Team3D/Editor/Public/MapObject_LOD.h @@ -36,13 +36,11 @@ class CMapObject_LOD final : public CMapObject private: CShader* m_pShaderCom = { nullptr }; - vector m_pModelComs = { nullptr }; + vector m_pModelComs; _uint m_iMaxLodLevel = {}; _uint m_iLodIndex = {}; - CShader* m_pShaderCom = { nullptr }; - vector m_pModelComs; vector<_wstring> m_ModelPrototypeTags;