Merge pull request #805 from SpicyGangjeong/MapTool

Map tool
This commit is contained in:
JinhoBa
2026-01-15 00:03:33 +09:00
committed by GitHub
6 changed files with 19 additions and 8 deletions
+9 -3
View File
@@ -92,6 +92,7 @@ HRESULT CMapInfo::Load_MapObjects(const _char* pFileName, const _wchar* pLayerTa
/* Container */ /* Container */
for (auto* Container = root->FirstChildElement("Container"); Container; Container = Container->NextSiblingElement("Container")) for (auto* Container = root->FirstChildElement("Container"); Container; Container = Container->NextSiblingElement("Container"))
{ {
_bool hasCollisionMesh = false;
const _char* pName = {}; const _char* pName = {};
_uint iMapContainerType = {}; _uint iMapContainerType = {};
Container->QueryUnsignedAttribute("MapContainerType", &iMapContainerType); Container->QueryUnsignedAttribute("MapContainerType", &iMapContainerType);
@@ -108,11 +109,16 @@ HRESULT CMapInfo::Load_MapObjects(const _char* pFileName, const _wchar* pLayerTa
{ {
Load_StreetContainer(Container, &pContainerObject, pLayerTag); Load_StreetContainer(Container, &pContainerObject, pLayerTag);
} }
else if (2 == iMapContainerType)
{
hasCollisionMesh = true;
Load_BuildingContainer(Container, &pContainerObject, pLayerTag);
}
else { else {
return E_FAIL; return E_FAIL;
} }
if (FAILED(Load_MapRenderObjects(Container, pContainerObject, pLayerTag))){ if (FAILED(Load_MapRenderObjects(Container, pContainerObject, pLayerTag, hasCollisionMesh))){
return E_FAIL; return E_FAIL;
} }
@@ -172,7 +178,7 @@ HRESULT CMapInfo::Load_MapObjects(const _char* pFileName, const _wchar* pLayerTa
return S_OK; return S_OK;
} }
HRESULT CMapInfo::Load_MapRenderObjects(tinyxml2::XMLElement* Container, CMapContainer* pContainerObject, const _wchar* pLayerTag) HRESULT CMapInfo::Load_MapRenderObjects(tinyxml2::XMLElement* Container, CMapContainer* pContainerObject, const _wchar* pLayerTag, _bool hasCollisionMesh)
{ {
#pragma region ADD_PARTOBJECT #pragma region ADD_PARTOBJECT
for (auto* PartObject = Container->FirstChildElement("PartObject"); PartObject; PartObject = PartObject->NextSiblingElement("PartObject")) for (auto* PartObject = Container->FirstChildElement("PartObject"); PartObject; PartObject = PartObject->NextSiblingElement("PartObject"))
@@ -192,7 +198,7 @@ HRESULT CMapInfo::Load_MapRenderObjects(tinyxml2::XMLElement* Container, CMapCon
Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag));
} }
Desc.hasCollisionMesh = hasCollisionMesh;
Desc.iMaxLodLevel = iLodLevel; Desc.iMaxLodLevel = iLodLevel;
Desc.pParentTransform = pContainerObject->Get_Component<CTransform>(); Desc.pParentTransform = pContainerObject->Get_Component<CTransform>();
const string strKey = CMyTools::ToString(Desc.ModelPrototypeTags.front()) + to_string(iKeyIndex); const string strKey = CMyTools::ToString(Desc.ModelPrototypeTags.front()) + to_string(iKeyIndex);
@@ -30,7 +30,7 @@ HRESULT CMapObject_Render::Initialize(void* pArg)
//m_Type = static_cast<MAPOBJECT_RENDER_TYPE>(pDesc->iRenderType); //m_Type = static_cast<MAPOBJECT_RENDER_TYPE>(pDesc->iRenderType);
m_iMaxLodLevel = pDesc->iMaxLodLevel; m_iMaxLodLevel = pDesc->iMaxLodLevel;
m_hasCollisionMesh = pDesc->hasCollisionMesh;
for (_uint i = 0; i < m_iMaxLodLevel + 1; i++) for (_uint i = 0; i < m_iMaxLodLevel + 1; i++)
{ {
m_ModelPrototypeTags.push_back(pDesc->ModelPrototypeTags[i]); m_ModelPrototypeTags.push_back(pDesc->ModelPrototypeTags[i]);
@@ -60,8 +60,11 @@ HRESULT CMapObject_Render::Initialize(void* pArg)
_matrix ColliderMatrix = XMMatrixTranslation(vOffset.x, vOffset.y, vOffset.z) * XMLoadFloat4x4(&m_CombinedWorldMatrix); _matrix ColliderMatrix = XMMatrixTranslation(vOffset.x, vOffset.y, vOffset.z) * XMLoadFloat4x4(&m_CombinedWorldMatrix);
XMStoreFloat4(&m_vExtentPosition, ColliderMatrix.r[3]); XMStoreFloat4(&m_vExtentPosition, ColliderMatrix.r[3]);
ReadyForPhysX(); if(false == m_hasCollisionMesh)
ConvertToPhysX(); {
ReadyForPhysX();
ConvertToPhysX();
}
return S_OK; return S_OK;
} }
+1 -1
View File
@@ -20,7 +20,7 @@ class CMapInfo final : public CBase
public: public:
HRESULT Load_MapObjects(const _char* pFilePath, const _wchar* pLayerTag); HRESULT Load_MapObjects(const _char* pFilePath, const _wchar* pLayerTag);
HRESULT Load_MapRenderObjects(tinyxml2::XMLElement* Container, class CMapContainer* pContainerObject, const _wchar* pLayerTag); HRESULT Load_MapRenderObjects(tinyxml2::XMLElement* Container, class CMapContainer* pContainerObject, const _wchar* pLayerTag, _bool hasCollisionMesh);
HRESULT Load_LightElements(const _char* pFileName, const _wchar* pLayerTag); HRESULT Load_LightElements(const _char* pFileName, const _wchar* pLayerTag);
HRESULT Load_InteractableElements(const _char* pFileName, const _wchar* pLayerTag); HRESULT Load_InteractableElements(const _char* pFileName, const _wchar* pLayerTag);
@@ -32,6 +32,7 @@ class CMapObject_Render final : public CMapPartObject // Render PartObject
HRESULT Add_LodModel(const _tchar* pModelPrototypeTag); HRESULT Add_LodModel(const _tchar* pModelPrototypeTag);
private: private:
_bool m_hasCollisionMesh = {};
_bool m_bReadyToCreatePhysX = { false }; _bool m_bReadyToCreatePhysX = { false };
_bool m_bConverted = { false }; _bool m_bConverted = { false };
@@ -14,6 +14,7 @@ class CMapPartObject abstract : public CPartObject
{ {
public: public:
typedef struct tagMapObject_Desc { typedef struct tagMapObject_Desc {
_bool hasCollisionMesh{};
_uint iRenderType{}; _uint iRenderType{};
CTransform* pParentTransform = { nullptr }; CTransform* pParentTransform = { nullptr };
_float3 vScale; _float3 vScale;
@@ -2683,7 +2683,7 @@
<Position x="115.97964" y="15.399979" z="127.5776"/> <Position x="115.97964" y="15.399979" z="127.5776"/>
<Scale x="1" y="1" z="1"/> <Scale x="1" y="1" z="1"/>
<Rotation x="0" y="0" z="0"/> <Rotation x="0" y="0" z="0"/>
<MapContainerType type="0"/> <MapContainerType type="2"/>
<BoundingBox_Min x="-5.1330199" y="-0.31850505" z="-3.73068"/> <BoundingBox_Min x="-5.1330199" y="-0.31850505" z="-3.73068"/>
<BoundingBox_Max x="3.1891599" y="12.063789" z="5.5602298"/> <BoundingBox_Max x="3.1891599" y="12.063789" z="5.5602298"/>
<PartObject Lod_Level="3" Key_Index="0"> <PartObject Lod_Level="3" Key_Index="0">