[add] Qcculsion Client 적용

[add] MapContainer 분리
This commit is contained in:
Chanbin Kim
2025-11-29 16:21:12 +09:00
parent 1c39c02f9b
commit 02305c9d74
12 changed files with 397 additions and 292 deletions
+175 -110
View File
@@ -3,6 +3,7 @@
#include "GameInstance.h"
#include "InfoInstance.h"
#include "BuildingContainer.h"
#include "StreetContainer.h"
#include "MAPPartObject.h"
#include "MapObject_Render.h"
#include "MapObject_Collision.h"
@@ -40,123 +41,28 @@ HRESULT CMapInfo::Load_MapObjects(const _char* pFileName)
for (auto* Container = root->FirstChildElement("Container"); Container; Container = Container->NextSiblingElement("Container"))
{
const _char* pName = {};
_uint iMapContainerType = {};
Container->QueryStringAttribute("Name", &pName);
#pragma region ADD_CONTAINER_OBJECT
Container->QueryUnsignedAttribute("MapContainerType", &iMapContainerType);
CBuildingContainer* pContainerObject = { nullptr };
CMapContainer::MAP_CONTAINER_DESC ContainerDesc = {};
CMapContainer* pContainerObject = nullptr;
auto* ContainerPosition = Container->FirstChildElement("Position");
ContainerPosition->QueryFloatAttribute("x", &ContainerDesc.vPosition.x);
ContainerPosition->QueryFloatAttribute("y", &ContainerDesc.vPosition.y);
ContainerPosition->QueryFloatAttribute("z", &ContainerDesc.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);
auto* ContainerRotation = Container->FirstChildElement("Rotation");
ContainerRotation->QueryFloatAttribute("x", &ContainerDesc.vRotation.x);
ContainerRotation->QueryFloatAttribute("y", &ContainerDesc.vRotation.y);
ContainerRotation->QueryFloatAttribute("z", &ContainerDesc.vRotation.z);
m_pGameInstance->Add_GameObject_ToLayer<CBuildingContainer>(
g_iStaticLevel, ENUM_CLASS(LEVEL::GAMEPLAY), LAYER_BACKGROUND, &ContainerDesc, nullptr, &pContainerObject);
#pragma endregion
#pragma region ADD_PARTOBJECT
for (auto* PartObject = Container->FirstChildElement("PartObject"); PartObject; PartObject = PartObject->NextSiblingElement("PartObject"))
if (0 == iMapContainerType)
{
_uint iLodLevel = {};
_uint iKeyIndex = {};
PartObject->QueryUnsignedAttribute("Lod_Level", &iLodLevel);
PartObject->QueryUnsignedAttribute("Key_Index", &iKeyIndex);
#pragma region MAPOBJECT_RENDER
CMapPartObject::MAPOBJECT_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<CTransform>();
const string strKey = CMyTools::ToString(Desc.ModelPrototypeTags.front()) + to_string(iKeyIndex);
/* 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);
if (FAILED(pContainerObject->Add_Part<CMapObject_Render>(strKey, g_iStaticLevel, nullptr, &Desc)))
return E_FAIL;
#pragma endregion
Load_BuildingContainer(Container, &pContainerObject);
}
#pragma endregion
#pragma region ADD_COLLISION
for (auto* Collision = Container->FirstChildElement("Collision"); Collision; Collision = Collision->NextSiblingElement("Collision"))
else if (1 == iMapContainerType)
{
_uint iLodLevel = {};
_uint iKeyIndex = {};
Collision->QueryUnsignedAttribute("Lod_Level", &iLodLevel);
Collision->QueryUnsignedAttribute("Key_Index", &iKeyIndex);
#pragma region MAPOBJECT_LOD
CMapPartObject::MAPOBJECT_DESC Desc = {};
string strTag = {};
for (auto* PrototypeTag = Collision->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag"))
{
Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(PrototypeTag->GetText()));
}
Desc.iMaxLodLevel = iLodLevel;
Desc.pParentTransform = pContainerObject->Get_Component<CTransform>();
/* Position */
tinyxml2::XMLElement* Position = Collision->FirstChildElement("Position");
Position->QueryFloatAttribute("x", &Desc.vPosition.x);
Position->QueryFloatAttribute("y", &Desc.vPosition.y);
Position->QueryFloatAttribute("z", &Desc.vPosition.z);
/* Scale */
tinyxml2::XMLElement* Scale = Collision->FirstChildElement("Scale");
Scale->QueryFloatAttribute("x", &Desc.vScale.x);
Scale->QueryFloatAttribute("y", &Desc.vScale.y);
Scale->QueryFloatAttribute("z", &Desc.vScale.z);
/* Rotation */
tinyxml2::XMLElement* Rotation = Collision->FirstChildElement("Rotation");
Rotation->QueryFloatAttribute("x", &Desc.vRotation.x);
Rotation->QueryFloatAttribute("y", &Desc.vRotation.y);
Rotation->QueryFloatAttribute("z", &Desc.vRotation.z);
pContainerObject->Add_Collision<CMapObject_Collision>(g_iStaticLevel, &Desc);
#pragma endregion
Load_StreetContainer(Container, &pContainerObject);
}
#pragma endregion
else
return E_FAIL;
if (FAILED(Load_MapRenderObjects(Container, pContainerObject)))
return E_FAIL;
if (FAILED(Load_MapCollisionObjects(Container, pContainerObject)))
return E_FAIL;
}
for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object"))
@@ -201,6 +107,165 @@ HRESULT CMapInfo::Load_MapObjects(const _char* pFileName)
return S_OK;
}
HRESULT CMapInfo::Load_BuildingContainer(tinyxml2::XMLElement* Container, CMapContainer** ppContainerObject)
{
CBuildingContainer::MAP_CONTAINER_DESC ContainerDesc = {};
auto* ContainerPosition = Container->FirstChildElement("Position");
ContainerPosition->QueryFloatAttribute("x", &ContainerDesc.vPosition.x);
ContainerPosition->QueryFloatAttribute("y", &ContainerDesc.vPosition.y);
ContainerPosition->QueryFloatAttribute("z", &ContainerDesc.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);
auto* ContainerRotation = Container->FirstChildElement("Rotation");
ContainerRotation->QueryFloatAttribute("x", &ContainerDesc.vRotation.x);
ContainerRotation->QueryFloatAttribute("y", &ContainerDesc.vRotation.y);
ContainerRotation->QueryFloatAttribute("z", &ContainerDesc.vRotation.z);
auto* BoundingBox_Min = Container->FirstChildElement("BoundingBox_Min");
BoundingBox_Min->QueryFloatAttribute("x", &ContainerDesc.vContainerMin.x);
BoundingBox_Min->QueryFloatAttribute("y", &ContainerDesc.vContainerMin.y);
BoundingBox_Min->QueryFloatAttribute("z", &ContainerDesc.vContainerMin.z);
auto* BoundingBox_Max = Container->FirstChildElement("BoundingBox_Max");
BoundingBox_Max->QueryFloatAttribute("x", &ContainerDesc.vContainerMax.x);
BoundingBox_Max->QueryFloatAttribute("y", &ContainerDesc.vContainerMax.y);
BoundingBox_Max->QueryFloatAttribute("z", &ContainerDesc.vContainerMax.z);
m_pGameInstance->Add_GameObject_ToLayer<CBuildingContainer>(
g_iStaticLevel, ENUM_CLASS(LEVEL::GAMEPLAY), LAYER_BACKGROUND, &ContainerDesc, nullptr, reinterpret_cast<CBuildingContainer**>(ppContainerObject));
return S_OK;
}
HRESULT CMapInfo::Load_StreetContainer(tinyxml2::XMLElement* Container, CMapContainer** ppContainerObject)
{
CMapContainer::MAP_CONTAINER_DESC ContainerDesc = {};
auto* ContainerPosition = Container->FirstChildElement("Position");
ContainerPosition->QueryFloatAttribute("x", &ContainerDesc.vPosition.x);
ContainerPosition->QueryFloatAttribute("y", &ContainerDesc.vPosition.y);
ContainerPosition->QueryFloatAttribute("z", &ContainerDesc.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);
auto* ContainerRotation = Container->FirstChildElement("Rotation");
ContainerRotation->QueryFloatAttribute("x", &ContainerDesc.vRotation.x);
ContainerRotation->QueryFloatAttribute("y", &ContainerDesc.vRotation.y);
ContainerRotation->QueryFloatAttribute("z", &ContainerDesc.vRotation.z);
m_pGameInstance->Add_GameObject_ToLayer<CStreetContainer>(
g_iStaticLevel, ENUM_CLASS(LEVEL::GAMEPLAY), LAYER_BACKGROUND, &ContainerDesc, nullptr, reinterpret_cast<CStreetContainer**>(ppContainerObject));
return S_OK;
}
HRESULT CMapInfo::Load_MapRenderObjects(tinyxml2::XMLElement* Container, CMapContainer* pContainerObject)
{
#pragma region ADD_PARTOBJECT
for (auto* PartObject = Container->FirstChildElement("PartObject"); PartObject; PartObject = PartObject->NextSiblingElement("PartObject"))
{
_uint iLodLevel = {};
_uint iKeyIndex = {};
PartObject->QueryUnsignedAttribute("Lod_Level", &iLodLevel);
PartObject->QueryUnsignedAttribute("Key_Index", &iKeyIndex);
#pragma region MAPOBJECT_RENDER
CMapPartObject::MAPOBJECT_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<CTransform>();
const string strKey = CMyTools::ToString(Desc.ModelPrototypeTags.front()) + to_string(iKeyIndex);
/* 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);
if (FAILED(pContainerObject->Add_Part<CMapObject_Render>(strKey, g_iStaticLevel, nullptr, &Desc)))
return E_FAIL;
#pragma endregion
}
return S_OK;
}
HRESULT CMapInfo::Load_MapCollisionObjects(tinyxml2::XMLElement* Container, CMapContainer* pContainerObject)
{
#pragma region ADD_COLLISION
for (auto* Collision = Container->FirstChildElement("Collision"); Collision; Collision = Collision->NextSiblingElement("Collision"))
{
_uint iLodLevel = {};
_uint iKeyIndex = {};
Collision->QueryUnsignedAttribute("Lod_Level", &iLodLevel);
Collision->QueryUnsignedAttribute("Key_Index", &iKeyIndex);
#pragma region MAPOBJECT_LOD
CMapPartObject::MAPOBJECT_DESC Desc = {};
string strTag = {};
for (auto* PrototypeTag = Collision->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag"))
{
Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(PrototypeTag->GetText()));
}
Desc.iMaxLodLevel = iLodLevel;
Desc.pParentTransform = pContainerObject->Get_Component<CTransform>();
/* Position */
tinyxml2::XMLElement* Position = Collision->FirstChildElement("Position");
Position->QueryFloatAttribute("x", &Desc.vPosition.x);
Position->QueryFloatAttribute("y", &Desc.vPosition.y);
Position->QueryFloatAttribute("z", &Desc.vPosition.z);
/* Scale */
tinyxml2::XMLElement* Scale = Collision->FirstChildElement("Scale");
Scale->QueryFloatAttribute("x", &Desc.vScale.x);
Scale->QueryFloatAttribute("y", &Desc.vScale.y);
Scale->QueryFloatAttribute("z", &Desc.vScale.z);
/* Rotation */
tinyxml2::XMLElement* Rotation = Collision->FirstChildElement("Rotation");
Rotation->QueryFloatAttribute("x", &Desc.vRotation.x);
Rotation->QueryFloatAttribute("y", &Desc.vRotation.y);
Rotation->QueryFloatAttribute("z", &Desc.vRotation.z);
pContainerObject->Add_Collision<CMapObject_Collision>(g_iStaticLevel, &Desc);
#pragma endregion
}
#pragma endregion
return S_OK;
}
HRESULT CMapInfo::Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContex)
{
m_pGameInstance = CGameInstance::GetInstance();