[add] DungeonMap Decal, 조명 추가
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
#include "MapElement_Door.h"
|
||||
#include "MapElement_Chest.h"
|
||||
#include "MapElement_Static.h"
|
||||
#include "WorldDecal.h"
|
||||
#include "PointLight.h"
|
||||
#include "Layer.h"
|
||||
|
||||
CMapInfo::CMapInfo()
|
||||
@@ -733,6 +735,139 @@ HRESULT CMapInfo::Load_ChestElemet(const _char* pFileName, const _wchar* pLayerT
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapInfo::Load_WorldDecal(const _char* pFileName, const _wchar* pLayerTag)
|
||||
{
|
||||
tinyxml2::XMLDocument xmlDoc;
|
||||
|
||||
string strPath = "../Bin/Resources/Data/Map/Decal/" + string(pFileName) + ".xml";
|
||||
|
||||
if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str())))
|
||||
return E_FAIL;
|
||||
|
||||
tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("Decal");
|
||||
|
||||
if (nullptr == root)
|
||||
{
|
||||
MSG_BOX("Failed to Find root");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object"))
|
||||
{
|
||||
CWorldDecal::WORLD_DECAL_DESC Desc = {};
|
||||
|
||||
/* Transform */
|
||||
auto* Rotation = Object->FirstChildElement("Scale");
|
||||
Rotation->QueryFloatAttribute("x", &Desc.vScale.x);
|
||||
Rotation->QueryFloatAttribute("y", &Desc.vScale.y);
|
||||
Rotation->QueryFloatAttribute("z", &Desc.vScale.z);
|
||||
|
||||
auto* Scale = Object->FirstChildElement("Rotation");
|
||||
Scale->QueryFloatAttribute("x", &Desc.vRotation.x);
|
||||
Scale->QueryFloatAttribute("y", &Desc.vRotation.y);
|
||||
Scale->QueryFloatAttribute("z", &Desc.vRotation.z);
|
||||
|
||||
auto* Position = Object->FirstChildElement("Position");
|
||||
Position->QueryFloatAttribute("x", &Desc.vPosition.x);
|
||||
Position->QueryFloatAttribute("y", &Desc.vPosition.y);
|
||||
Position->QueryFloatAttribute("z", &Desc.vPosition.z);
|
||||
|
||||
/* Decal Desc */
|
||||
auto* Shader_Value = Object->FirstChildElement("Shader_Value");
|
||||
Shader_Value->QueryFloatAttribute("UVTiling", &Desc.fUVTiling);
|
||||
Shader_Value->QueryFloatAttribute("UVSpeedX", &Desc.vUVSpeed.x);
|
||||
Shader_Value->QueryFloatAttribute("UVSpeedY", &Desc.vUVSpeed.y);
|
||||
|
||||
/* MaskRed */
|
||||
auto* MaskRed = Object->FirstChildElement("MaskRed");
|
||||
MaskRed->QueryFloatAttribute("r", &Desc.vMaskRed.x);
|
||||
MaskRed->QueryFloatAttribute("g", &Desc.vMaskRed.y);
|
||||
MaskRed->QueryFloatAttribute("b", &Desc.vMaskRed.z);
|
||||
MaskRed->QueryFloatAttribute("a", &Desc.vMaskRed.w);
|
||||
|
||||
/* MaskGreen */
|
||||
auto* MaskGreen = Object->FirstChildElement("MaskGreen");
|
||||
MaskGreen->QueryFloatAttribute("r", &Desc.vMaskGreen.x);
|
||||
MaskGreen->QueryFloatAttribute("g", &Desc.vMaskGreen.y);
|
||||
MaskGreen->QueryFloatAttribute("b", &Desc.vMaskGreen.z);
|
||||
MaskGreen->QueryFloatAttribute("a", &Desc.vMaskGreen.w);
|
||||
|
||||
/* MaskBlue */
|
||||
auto* MaskBlue = Object->FirstChildElement("MaskBlue");
|
||||
MaskBlue->QueryFloatAttribute("r", &Desc.vMaskBlue.x);
|
||||
MaskBlue->QueryFloatAttribute("g", &Desc.vMaskBlue.y);
|
||||
MaskBlue->QueryFloatAttribute("b", &Desc.vMaskBlue.z);
|
||||
MaskBlue->QueryFloatAttribute("a", &Desc.vMaskBlue.w);
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CWorldDecal>(NEXT_LEVEL, NEXT_LEVEL, pLayerTag, &Desc)))
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapInfo::Load_PointLights(const _char* pFilePath, const _wchar* pLayerTag)
|
||||
{
|
||||
tinyxml2::XMLDocument xmlDoc;
|
||||
|
||||
string strPath = "../Bin/Resources/Data/Map/Light/" + string(pFilePath) + ".xml";
|
||||
|
||||
if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str())))
|
||||
return E_FAIL;
|
||||
|
||||
tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("MapLightObjects");
|
||||
|
||||
if (nullptr == root)
|
||||
{
|
||||
MSG_BOX("Failed to Find root");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object"))
|
||||
{
|
||||
CPointLight::POINTLIGHT_DESC Desc = {};
|
||||
|
||||
/* Transform */
|
||||
auto* Position = Object->FirstChildElement("Position");
|
||||
Position->QueryFloatAttribute("x", &Desc.vPosition.x);
|
||||
Position->QueryFloatAttribute("y", &Desc.vPosition.y);
|
||||
Position->QueryFloatAttribute("z", &Desc.vPosition.z);
|
||||
|
||||
/* Light Desc */
|
||||
auto* Diffuse = Object->FirstChildElement("Diffuse");
|
||||
Diffuse->QueryFloatAttribute("x", &Desc.vDiffuse.x);
|
||||
Diffuse->QueryFloatAttribute("y", &Desc.vDiffuse.y);
|
||||
Diffuse->QueryFloatAttribute("z", &Desc.vDiffuse.z);
|
||||
|
||||
auto* Ambient = Object->FirstChildElement("Ambient");
|
||||
Ambient->QueryFloatAttribute("x", &Desc.vAmbient.x);
|
||||
Ambient->QueryFloatAttribute("y", &Desc.vAmbient.y);
|
||||
Ambient->QueryFloatAttribute("z", &Desc.vAmbient.z);
|
||||
|
||||
auto* Specular = Object->FirstChildElement("Specular");
|
||||
Specular->QueryFloatAttribute("x", &Desc.vSpecular.x);
|
||||
Specular->QueryFloatAttribute("y", &Desc.vSpecular.y);
|
||||
Specular->QueryFloatAttribute("z", &Desc.vSpecular.z);
|
||||
|
||||
auto* PosOffset = Object->FirstChildElement("PosOffset");
|
||||
PosOffset->QueryFloatAttribute("x", &Desc.vPosOffset.x);
|
||||
PosOffset->QueryFloatAttribute("y", &Desc.vPosOffset.y);
|
||||
PosOffset->QueryFloatAttribute("z", &Desc.vPosOffset.z);
|
||||
|
||||
auto* Info = Object->FirstChildElement("Info");
|
||||
Info->QueryFloatAttribute("LightAttRange", &Desc.fLightAttRange);
|
||||
Info->QueryFloatAttribute("LightAttSpeed", &Desc.fLightAttSpeed);
|
||||
Info->QueryFloatAttribute("Range", &Desc.fRange);
|
||||
_uint iPow = {};
|
||||
Info->QueryUnsignedAttribute("Pow", &iPow);
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CPointLight>(NEXT_LEVEL, NEXT_LEVEL, pLayerTag, &Desc)))
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapInfo::Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContex)
|
||||
{
|
||||
m_pGameInstance = CGameInstance::GetInstance();
|
||||
|
||||
Reference in New Issue
Block a user