diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj b/Jusin154_Team3D/Client/Default/Client.vcxproj index a11c04c38..76223b2ea 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj @@ -168,6 +168,8 @@ call Update_Resources.bat + + @@ -275,6 +277,8 @@ call Update_Resources.bat + + diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters index 551dda844..98dedc08b 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters @@ -316,6 +316,18 @@ 02.GameObjects\UI\Spell_Canvas\Spell_Panel\Current_Slot_Number + + 02.GameObjects\Environment\03.MapElement + + + 02.GameObjects\Environment\03.MapElement\Light + + + 02.GameObjects\Environment\03.MapElement + + + 02.GameObjects\Environment\03.MapElement\Light + @@ -626,6 +638,18 @@ {2bc5b43e-0e24-49d4-95b0-549ad4428201} + + {f3f219aa-034f-4aa2-9f2e-d75d15bd1f4a} + + + {71f6a568-488d-4ec1-be79-8fcce6677e27} + + + {f3f219aa-034f-4aa2-9f2e-d75d15bd1f4a} + + + {71f6a568-488d-4ec1-be79-8fcce6677e27} + {a1b1f17d-ed4f-4b20-aa8e-c52e693683d4} @@ -934,6 +958,18 @@ 04.Mechanic\Skill\Skill_Data + + 02.GameObjects\Environment\03.MapElement + + + 02.GameObjects\Environment\03.MapElement\Light + + + 02.GameObjects\Environment\03.MapElement + + + 02.GameObjects\Environment\03.MapElement\Light + 02.GameObjects\Monster\Troll diff --git a/Jusin154_Team3D/Client/Private/BuildingContainer.cpp b/Jusin154_Team3D/Client/Private/BuildingContainer.cpp index 7d6282a29..0d8571861 100644 --- a/Jusin154_Team3D/Client/Private/BuildingContainer.cpp +++ b/Jusin154_Team3D/Client/Private/BuildingContainer.cpp @@ -25,7 +25,7 @@ void CBuildingContainer::Update(_float fTimeDelta) { __super::Update(fTimeDelta); - m_fCamDepth = XMVectorGetX(XMVector3Length(XMLoadFloat4(m_pGameInstance->Get_CamPosition()) - XMLoadFloat3(&m_vExtentWorldPosition))); + m_fCamDepth = XMVectorGetX(XMVector3LengthSq(XMLoadFloat4(m_pGameInstance->Get_CamPosition()) - XMLoadFloat3(&m_vExtentWorldPosition))); for (auto& pCollisiton : m_ColiisonPartObjects){ pCollisiton->Update(fTimeDelta); diff --git a/Jusin154_Team3D/Client/Private/InfoInstance.cpp b/Jusin154_Team3D/Client/Private/InfoInstance.cpp index b9621d7b5..b56166cc9 100644 --- a/Jusin154_Team3D/Client/Private/InfoInstance.cpp +++ b/Jusin154_Team3D/Client/Private/InfoInstance.cpp @@ -81,9 +81,9 @@ HRESULT CInfoInstance::Load_MapObjects(const _char* pFilePath) { return m_pMapInfo->Load_MapObjects(pFilePath); } -HRESULT CInfoInstance::Load_SpellInfo(const _char* pFilePath) +HRESULT CInfoInstance::Load_LightElements(const _char* pFilePath) { - return E_NOTIMPL; + return m_pMapInfo->Load_LightElements(pFilePath); } #pragma endregion LEVEL CInfoInstance::Get_RestartLevel() diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index 56bcaad5b..bd9ce3478 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -121,10 +121,13 @@ HRESULT CLevel_GamePlay::Ready_Background() /* Map Containters */ /* 테스트용 맵 */ - // CInfoInstance::GetInstance()->Load_MapObjects("ClientTest"); + //CInfoInstance::GetInstance()->Load_MapObjects("ClientTest"); /* 전체 맵 */ CInfoInstance::GetInstance()->Load_MapObjects("Map1129"); + /* 조명 오브젝트 */ + CInfoInstance::GetInstance()->Load_LightElements("LightElement"); + CInstancedProp::INSTANCE_PROP_DESC Desc = {}; diff --git a/Jusin154_Team3D/Client/Private/Light_Main.cpp b/Jusin154_Team3D/Client/Private/Light_Main.cpp index 10787ff99..6e702e463 100644 --- a/Jusin154_Team3D/Client/Private/Light_Main.cpp +++ b/Jusin154_Team3D/Client/Private/Light_Main.cpp @@ -57,8 +57,11 @@ HRESULT CLight_Main::Ready_Components() LIGHT_DESC LightDesc{}; LightDesc.eType = LIGHT::DIRECTIONAL; - LightDesc.vDiffuse = _float4(0.8f, 0.8f, 0.8f, 0.f); + /*LightDesc.vDiffuse = _float4(0.8f, 0.8f, 0.8f, 0.f); LightDesc.vAmbient = _float4(0.6f, 0.6f, 0.6f, 0.f); + LightDesc.vSpecular = _float4(0.f, 0.f, 0.f, 0.f);*/ + LightDesc.vDiffuse = _float4(0.3f, 0.3f, 0.1f, 0.f); + LightDesc.vAmbient = _float4(0.3f, 0.3f, 0.5f, 0.f); LightDesc.vSpecular = _float4(0.f, 0.f, 0.f, 0.f); LightDesc.pDirection = m_pTransformCom->Get_StatePtr(STATE::LOOK); LightDesc.iLevel = NEXT_LEVEL; @@ -70,6 +73,10 @@ HRESULT CLight_Main::Ready_Components() } m_pGameInstance->Add_Light(NEXT_LEVEL, m_pLightCom); + + _float4 vColor = _float4(0.1f, 0.1f, 0.15f, 0.5f); + m_pGameInstance->Set_FogColor(vColor); + return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 04f865b94..87d9fbe2f 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -105,6 +105,7 @@ #include "MapObject_Render.h" #include "MapObject_Collision.h" #include "InstancedProp.h" +#include "MapElement_Light.h" #pragma endregion @@ -452,6 +453,12 @@ HRESULT CLoader::Loading_For_GamePlay() ".bin", false )); } + {/* Light Objects */ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts", + ".bin", false + )); + } } #pragma endregion @@ -888,6 +895,27 @@ HRESULT CLoader::Loading_For_GamePlay() CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/Terrain/Hogsmeade_AlphaMap.dds"), 0)))) { return E_FAIL; } + + /* For.Prototype_Component_LightPost_Emissive */ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("LightPost_Emissive"), + CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, + TEXT("C:/MeshTable/Game/Environment/Hogsmeade/Common/Textures/LightPosts/T_HM_LampPost_Glass_E.png"), 0)))) { + return E_FAIL; + } + + /* For.Prototype_Component_LightPost_Mask */ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("LightPost_Mask"), + CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, + TEXT("C:/MeshTable/Game/Environment/Hogsmeade/Common/Textures/LightPosts/T_HM_LampPost_Glass_D.png"), 0)))) { + return E_FAIL; + } + + /* For.Prototype_Component_LightPost_Base */ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("LightPost_Base"), + CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, + TEXT("C:/MeshTable/Game/Environment/Hogsmeade/Common/Textures/LightPosts/T_HM_LampPost_Glass_Dark_D.png"), 0)))) { + return E_FAIL; + } #pragma endregion @@ -1728,6 +1756,8 @@ HRESULT CLoader::Loading_For_GamePlay() } } + + /* For.Prototype_Component_VIBuffer_Model_Instancel_SM_OakTree_MedA */ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_OakTree_MedA"), CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, @@ -1775,6 +1805,11 @@ HRESULT CLoader::Loading_For_GamePlay() /* For.Prototype_GameObject_CInstancedProp */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CInstancedProp::Create(m_pDevice, m_pContext)))) return E_FAIL; + + /* For.Prototype_GameObject_MapElement_Light */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Light::Create(m_pDevice, m_pContext)))) + return E_FAIL; + #pragma endregion // MAP PROTOTYPE #pragma region ACTOR PROTOTYPE diff --git a/Jusin154_Team3D/Client/Private/MapElement.cpp b/Jusin154_Team3D/Client/Private/MapElement.cpp new file mode 100644 index 000000000..73659bf3c --- /dev/null +++ b/Jusin154_Team3D/Client/Private/MapElement.cpp @@ -0,0 +1,69 @@ +#include "pch.h" +#include "MapElement.h" + +#include "GameInstance.h" + +CMapElement::CMapElement(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CGameObject{ pDevice, pContext } +{ +} + +CMapElement::CMapElement(const CMapElement& rhs) + : CGameObject(rhs) +{ +} + +void CMapElement::Priority_Update(_float fTimeDelta) +{ +} + +void CMapElement::Update(_float fTimeDelta) +{ +} + +void CMapElement::Late_Update(_float fTimeDelta) +{ +} + +HRESULT CMapElement::Render() +{ + return S_OK; +} + +HRESULT CMapElement::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapElement::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + return S_OK; +} + +HRESULT CMapElement::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CMapElement::Bind_ShaderResources() +{ + return S_OK; +} + +void CMapElement::Free() +{ + __super::Free(); +} + +#ifdef _DEBUG +void CMapElement::Describe_Entity() +{ +} +#endif diff --git a/Jusin154_Team3D/Client/Private/MapElement_Light.cpp b/Jusin154_Team3D/Client/Private/MapElement_Light.cpp new file mode 100644 index 000000000..b6b55df33 --- /dev/null +++ b/Jusin154_Team3D/Client/Private/MapElement_Light.cpp @@ -0,0 +1,310 @@ +#include "pch.h" +#include "MapElement_Light.h" + +#include "GameInstance.h" + +#include "Terrain.h" +#include "Layer.h" +#include "VIBuffer_Terrain.h" + +CMapElement_Light::CMapElement_Light(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CMapElement{ pDevice, pContext } +{ +} + +CMapElement_Light::CMapElement_Light(const CMapElement_Light& rhs) + : CMapElement(rhs) +{ +} + +HRESULT CMapElement_Light::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapElement_Light::Initialize(void* pArg) +{ + MAPELEMENT_LIGHT_DESC* pDesc = static_cast(pArg); + + m_iMaxLodLevel = pDesc->iMaxLodLevel; + m_fBloomStrength = pDesc->fBloomStregth; + m_iGlassMeshIndex = pDesc->iGlassMeshIndex; + + for (_uint i = 0; i < m_iMaxLodLevel + 1; i++) + { + m_ModelPrototypeTags.push_back(pDesc->ModelPrototypeTags[i]); + //m_ModelPathIndices.push_back((*pDesc->pModelPathIndices)[i]); + } + + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components(pArg))) + return E_FAIL; + + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pDesc->vPosition), 1.f)); + m_pTransformCom->Set_Scale(pDesc->vScale); + m_pTransformCom->Rotation(XMConvertToRadians(pDesc->vRotation.x), XMConvertToRadians(pDesc->vRotation.y), XMConvertToRadians(pDesc->vRotation.z)); + + return S_OK; +} + +void CMapElement_Light::Priority_Update(_float fTimeDelta) +{ +} + +void CMapElement_Light::Update(_float fTimeDelta) +{ +} + +void CMapElement_Light::Late_Update(_float fTimeDelta) +{ + if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) + { + if (m_isLightOn) + { + _float fDistance = XMVectorGetX(XMVector3LengthSq(XMLoadFloat4(m_pGameInstance->Get_CamPosition()) - m_pTransformCom->Get_State(STATE::POSITION))); + if (m_LightAdded_Distance > fDistance) // 카메라 범위 안 + { + if (!m_isLightAdded) + { + m_isLightAdded = true; + m_pGameInstance->Add_Light(CURRENT_LEVEL, m_pLightCom); + } + } + else + { + if (m_isLightAdded) + { + m_isLightAdded = false; + m_pGameInstance->Delete_Light(CURRENT_LEVEL, m_pLightCom); + } + } + + m_pGameInstance->Add_RenderGroup(RENDER::BLOOM, this); + } + + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); + } +} + +HRESULT CMapElement_Light::Render() +{ + if (FAILED(Bind_ShaderResources())) + return E_FAIL; + + _uint iNumMeshes = m_pModelComs[m_iLodIndex]->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + if (true == m_isLightOn && m_iGlassMeshIndex == i) + continue; + + if (m_iGlassMeshIndex == i) + { + if (FAILED(m_pModelComs[0]->Bind_Material(m_iGlassMeshIndex, m_pShaderCom))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_SRV("g_DiffuseTexture", m_pGlassTextureCom->Get_SRV(0)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_SRV("g_GlassTexture", m_pMaskTextureCom->Get_SRV(0)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_fGlassRatio", &m_fGlassRatio, sizeof(_float)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::GLASS)))) { + return E_FAIL; + } + } + else + { + if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { + return E_FAIL; + } + } + + if (FAILED(m_pModelComs[m_iLodIndex]->Render(i))) { + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT CMapElement_Light::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + for (_uint i = 0; i < m_iMaxLodLevel + 1; ++i) + { + CModel* pModel = { nullptr }; + + /* Com_Model */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_ModelPrototypeTags[i], + reinterpret_cast(&pModel)))) + return E_FAIL; + + m_pModelComs.push_back(pModel); + } + + /* Com_Shader */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH, + reinterpret_cast(&m_pShaderCom)))) + return E_FAIL; + + /* Com_Texture */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("LightPost_Emissive"), + reinterpret_cast(&m_pEmissiveTextureCom)))) + return E_FAIL; + + /* Com_Texture */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("LightPost_Mask"), + reinterpret_cast(&m_pMaskTextureCom)))) + return E_FAIL; + + /* Com_Texture */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("LightPost_Base"), + reinterpret_cast(&m_pGlassTextureCom)))) + return E_FAIL; + + + MAPELEMENT_LIGHT_DESC* pDesc = static_cast(pArg); + + LIGHT_DESC LightDesc{}; + + LightDesc.eType = LIGHT::POINT; + + memcpy(&LightDesc.vDiffuse, &pDesc->vDiffuse, sizeof(_float4)); + memcpy(&LightDesc.vAmbient, &pDesc->vAmbient, sizeof(_float4)); + memcpy(&LightDesc.vSpecular, &pDesc->vSpecular, sizeof(_float4)); + memcpy(&LightDesc.vPosOffset, &pDesc->vPosOffset, sizeof(_float4)); + + LightDesc.fRange = pDesc->fRange; + LightDesc.iLevel = NEXT_LEVEL; + LightDesc.pPosition = m_pTransformCom->Get_StatePtr(STATE::POSITION); + + /* Com_Light*/ + if (FAILED(Add_Component(g_iStaticLevel, &m_pLightCom, &LightDesc))) + { + return E_FAIL; + } + + if (false == pDesc->isPow) + m_pLightCom->Switch_LightAttenationMethod(); + + return S_OK; +} + +HRESULT CMapElement_Light::Bind_ShaderResources() +{ + if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", m_pTransformCom->Get_WorldMatrixPtr()))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CMapElement_Light::Render_Bloom() +{ + if (FAILED(Bind_ShaderResources())) + return E_FAIL; + + if (FAILED(m_pShaderCom->Bind_RawValue("g_fBloomStrength", &m_fBloomStrength, sizeof(_float)))) + return E_FAIL; + + if (FAILED(m_pShaderCom->Bind_SRV("g_EmissiveTexture", m_pEmissiveTextureCom->Get_SRV(0)))) + return E_FAIL; + if (FAILED(m_pShaderCom->Bind_SRV("g_DiffuseTexture", m_pGlassTextureCom->Get_SRV(0)))) + return E_FAIL; + + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::BLOOM)))) { + return E_FAIL; + } + + if (FAILED(m_pModelComs[m_iLodIndex]->Render(m_iGlassMeshIndex))) { + return E_FAIL; + } + + return S_OK; +} + +void CMapElement_Light::Toggle_Light() +{ + if (m_isLightOn) + m_pGameInstance->Delete_Light(CURRENT_LEVEL, m_pLightCom); + else + m_pGameInstance->Add_Light(CURRENT_LEVEL, m_pLightCom); + + m_isLightAdded = m_isLightOn = !m_isLightOn; +} + +CMapElement_Light* CMapElement_Light::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CMapElement_Light* pInstance = new CMapElement_Light(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CMapElement_Light"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CMapElement_Light::Clone(void* pArg, CGameObject* pOwner) +{ + CMapElement_Light* pInstance = new CMapElement_Light(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapElement_Light"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CMapElement_Light::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pLightCom); + SAFE_RELEASE(m_pEmissiveTextureCom); + SAFE_RELEASE(m_pMaskTextureCom); + SAFE_RELEASE(m_pGlassTextureCom); + + SAFE_RELEASE(m_pShaderCom); + for (auto& pModel : m_pModelComs) + SAFE_RELEASE(pModel); +} + +#ifdef _DEBUG +void CMapElement_Light::Describe_Entity() +{ + +} +#endif // DEBUG + + diff --git a/Jusin154_Team3D/Client/Private/MapInfo.cpp b/Jusin154_Team3D/Client/Private/MapInfo.cpp index dcc1bff64..3335b597b 100644 --- a/Jusin154_Team3D/Client/Private/MapInfo.cpp +++ b/Jusin154_Team3D/Client/Private/MapInfo.cpp @@ -7,6 +7,7 @@ #include "MAPPartObject.h" #include "MapObject_Render.h" #include "MapObject_Collision.h" +#include "MapElement_Light.h" CMapInfo::CMapInfo() { @@ -269,6 +270,96 @@ HRESULT CMapInfo::Load_MapCollisionObjects(tinyxml2::XMLElement* Container, CMap return S_OK; } +HRESULT CMapInfo::Load_LightElements(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("MapLightObjects"); + + if (nullptr == root) + { + MSG_BOX("Failed to Find root"); + return S_OK; + } + + for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) + { + CMapElement_Light::MAPELEMENT_LIGHT_DESC Desc = {}; + + /* Model Prototypes */ + Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel); + + string strTag = {}; + for (auto* PrototypeTag = Object->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) + { + strTag = PrototypeTag->GetText(); + + Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); + } + + /* Transform */ + auto* Position = Object->FirstChildElement("Position"); + Position->QueryFloatAttribute("x", &Desc.vPosition.x); + Position->QueryFloatAttribute("y", &Desc.vPosition.y); + Position->QueryFloatAttribute("z", &Desc.vPosition.z); + + auto* Scale = Object->FirstChildElement("Scale"); + Scale->QueryFloatAttribute("x", &Desc.vScale.x); + Scale->QueryFloatAttribute("y", &Desc.vScale.y); + Scale->QueryFloatAttribute("z", &Desc.vScale.z); + + auto* Rotation = Object->FirstChildElement("Rotation"); + Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); + Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); + Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); + + /* 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->QueryUnsignedAttribute("GlassIndex", &Desc.iGlassMeshIndex); + Info->QueryFloatAttribute("BloomStrength", &Desc.fBloomStregth); + Info->QueryFloatAttribute("Range", &Desc.fRange); + _uint iPow = {}; + Info->QueryUnsignedAttribute("Pow", &iPow); + + Desc.isPow = 0 == iPow ? false : true; + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Light"), &Desc))) + return E_FAIL; + } + + MSG_BOX("Successed to Load File"); + + + return S_OK; + + return S_OK; +} + HRESULT CMapInfo::Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContex) { m_pGameInstance = CGameInstance::GetInstance(); diff --git a/Jusin154_Team3D/Client/Public/Client_Enum.h b/Jusin154_Team3D/Client/Public/Client_Enum.h index 075700d80..a3b021b9a 100644 --- a/Jusin154_Team3D/Client/Public/Client_Enum.h +++ b/Jusin154_Team3D/Client/Public/Client_Enum.h @@ -8,7 +8,7 @@ namespace Client enum class SHADER_PASS_ANIM { DEFAULT, SHADOW, CAPTURE, BLUR, HAIR, EYELASH, OUTLINE_WRITE, OUTLINE_READ, 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, MAPTOOL, GLASS, OUTLINE_WRITE, OUTLINE_READ, 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, GLASS, OUTLINE_WRITE, OUTLINE_READ, BLOOM, END }; enum class SHADER_PASS_NORTEX { DEFAULT, TERRAIN, ENV_TERRAIN_ANISO, END }; enum class SHADER_PASS_PARTICLE { EXPLOSION, END }; enum class SHADER_PASS_POSTEX { DEFAULT, SCISSOR, UI, UVMOVE, TRAIL, TRAIL_BLUR, TRAIL_BLOOM, END }; diff --git a/Jusin154_Team3D/Client/Public/InfoInstance.h b/Jusin154_Team3D/Client/Public/InfoInstance.h index ede232fed..41b803282 100644 --- a/Jusin154_Team3D/Client/Public/InfoInstance.h +++ b/Jusin154_Team3D/Client/Public/InfoInstance.h @@ -40,6 +40,7 @@ class CInfoInstance final : public CBase #pragma endregion #pragma region MAP_INFO HRESULT Load_MapObjects(const _char* pFilePath); + HRESULT Load_LightElements(const _char* pFilePath); #pragma endregion #pragma region Spell_INFO HRESULT Load_SpellInfo(const _char* pFilePath); diff --git a/Jusin154_Team3D/Client/Public/MapElement.h b/Jusin154_Team3D/Client/Public/MapElement.h new file mode 100644 index 000000000..362cbd038 --- /dev/null +++ b/Jusin154_Team3D/Client/Public/MapElement.h @@ -0,0 +1,61 @@ +#pragma once + +#include "Client_Define.h" +#include "GameObject.h" + +NS_BEGIN(Engine) +class CModel; +class CShader; +NS_END + +NS_BEGIN(Client) + +class CMapElement abstract : public CGameObject +{ +public: + typedef struct tagMapElement_Desc { + _uint iRenderType{}; + CTransform* pParentTransform = { nullptr }; + _float3 vScale; + _float3 vRotation; + _float3 vPosition; + _uint iMaxLodLevel{}; + vector<_wstring> ModelPrototypeTags; + vector<_uint>* pModelPathIndices = { nullptr }; + }MAPELEMENT_DESC; + +protected: + CMapElement(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMapElement(const CMapElement& rhs); + virtual ~CMapElement() = 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: + _uint m_iMaxLodLevel = {}; + _uint m_iLodIndex = {}; + + CShader* m_pShaderCom = { nullptr }; + vector m_pModelComs; + vector<_wstring> m_ModelPrototypeTags; + +protected: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + virtual HRESULT Bind_ShaderResources() override; + +public: + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) PURE; + virtual void Free() override; +#ifdef _DEBUG + void Describe_Entity() override; +#endif // _DEBUG + +}; + +NS_END diff --git a/Jusin154_Team3D/Client/Public/MapElement_Light.h b/Jusin154_Team3D/Client/Public/MapElement_Light.h new file mode 100644 index 000000000..9f835b36e --- /dev/null +++ b/Jusin154_Team3D/Client/Public/MapElement_Light.h @@ -0,0 +1,73 @@ +#pragma once + +#include "Client_Define.h" +#include "MapElement.h" + +NS_BEGIN(Engine) +class CLight; +class CTexture; +NS_END + +NS_BEGIN(Client) + +class CMapElement_Light : public CMapElement +{ +public: + typedef struct MapElement_Light_Desc : MAPELEMENT_DESC + { + _bool isPow; + _uint iGlassMeshIndex; + _float fBloomStregth; + _float fRange; + _float4 vPosOffset; + _float4 vDiffuse; + _float4 vAmbient; + _float4 vSpecular; + }MAPELEMENT_LIGHT_DESC; + +private: + CMapElement_Light(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMapElement_Light(const CMapElement_Light& rhs); + virtual ~CMapElement_Light() = 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; + + HRESULT Render_Bloom()override; + void Toggle_Light(); + +private: + CLight* m_pLightCom = { nullptr }; + CTexture* m_pEmissiveTextureCom = { nullptr }; + CTexture* m_pMaskTextureCom = { nullptr }; + CTexture* m_pGlassTextureCom = { nullptr }; + + _bool m_isLightOn = { true }; + _bool m_isLightAdded = { false }; + _uint m_iGlassMeshIndex = {}; + _float m_fBloomStrength = { 1.f }; + _float m_fGlassRatio = { 0.5f }; + + _float m_LightAdded_Distance = { 5000.f }; + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + virtual HRESULT Bind_ShaderResources() override; + + +public: + static CMapElement_Light* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; + +#ifdef _DEBUG + void Describe_Entity() override; +#endif // _DEBUG +}; + +NS_END diff --git a/Jusin154_Team3D/Client/Public/MapInfo.h b/Jusin154_Team3D/Client/Public/MapInfo.h index e81fc6bb4..4ea323760 100644 --- a/Jusin154_Team3D/Client/Public/MapInfo.h +++ b/Jusin154_Team3D/Client/Public/MapInfo.h @@ -22,6 +22,7 @@ class CMapInfo final : public CBase HRESULT Load_StreetContainer(tinyxml2::XMLElement* Container, class CMapContainer** ppContainerObject); HRESULT Load_MapRenderObjects(tinyxml2::XMLElement* Container, class CMapContainer* pContainerObject); HRESULT Load_MapCollisionObjects(tinyxml2::XMLElement* Container, class CMapContainer* pContainerObject); + HRESULT Load_LightElements(const _char* pFileName); private: CGameInstance* m_pGameInstance = { nullptr }; diff --git a/Jusin154_Team3D/Client/Public/MapObject_Render.h b/Jusin154_Team3D/Client/Public/MapObject_Render.h index b991d3b95..d57082d19 100644 --- a/Jusin154_Team3D/Client/Public/MapObject_Render.h +++ b/Jusin154_Team3D/Client/Public/MapObject_Render.h @@ -30,7 +30,7 @@ class CMapObject_Render final : public CMapPartObject // Render PartObject private: MAPOBJECT_RENDER_TYPE m_Type = {}; - CShader* m_pShaderCom = { nullptr }; + CShader* m_pShaderCom = { nullptr }; vector m_pModelComs; _uint m_iLodIndex = {}; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_LightPost.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_LightPost.bin new file mode 100644 index 000000000..d7b8bdaa6 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_LightPost.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b8e94075725aaec1874eee3c0240c9df914e47713cda7d02d1c84de4abc1e34 +size 406128 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_LightPost_LOD_Lod1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_LightPost_LOD_Lod1.bin new file mode 100644 index 000000000..5a24c7215 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_LightPost_LOD_Lod1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aaf97eaae8f025be73022d47498eb6bfa2a71c372d3e51363ac098dbf6a64b79 +size 47621 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_LightPost_LOD_Lod2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_LightPost_LOD_Lod2.bin new file mode 100644 index 000000000..21cbf2c49 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_LightPost_LOD_Lod2.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f5b5fdfefee9934681704631db107d63f77ed9e85460a2bbf3294af1f9ae993 +size 13029 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_Light_Post_Floating.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_Light_Post_Floating.bin new file mode 100644 index 000000000..901ecc477 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_Light_Post_Floating.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0c9a3bdec85532655541b459d75dd98f6e979602cf9469d289e95148d8a3b97 +size 160300 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_Light_Post_Floating_Lod1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_Light_Post_Floating_Lod1.bin new file mode 100644 index 000000000..b77fe61de --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_Light_Post_Floating_Lod1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75046ea7cd3df1c7929505a289011040d230d44f5ab9c138119e834913b75de8 +size 60677 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_Light_Post_Floating_Lod2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_Light_Post_Floating_Lod2.bin new file mode 100644 index 000000000..f8b15a4b6 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts/SM_HM_Light_Post_Floating_Lod2.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:424ac40d753940d65ba9ba77bd9a5fc234954388fabaeca0ed42286d90ac7a68 +size 17125 diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp index d9cc056ba..1f8595953 100644 --- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp +++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp @@ -49,7 +49,7 @@ HRESULT CGameInstance::Initialize_Engine(const ENGINE_DESC& EngineDesc, ID3D11De } } } - m_pThreadHolder = CThreadHolder::Create( 12 ); + m_pThreadHolder = CThreadHolder::Create( 6 ); if (nullptr == m_pThreadHolder) { return E_FAIL; } diff --git a/Jusin154_Team3D/Engine/Private/GameObject_Manager.cpp b/Jusin154_Team3D/Engine/Private/GameObject_Manager.cpp index d60fc12ce..3483b03e8 100644 --- a/Jusin154_Team3D/Engine/Private/GameObject_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/GameObject_Manager.cpp @@ -40,7 +40,9 @@ HRESULT CGameObject_Manager::Add_GameObject_ToLayer(_uint iLayerLevelIndex, cons void CGameObject_Manager::Priority_Update(_float fTimeDelta) { #ifdef _DEBUG +#ifndef gimch Describe_Entity(); +#endif // !gimch m_pGameInstance->Compute_TimeDelta(TEXT("Timer_PriorityUpdate")); #endif // _DEBUG for (size_t i = 0; i < m_iNumLevels; i++)