diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj b/Jusin154_Team3D/Client/Default/Client.vcxproj index 9b89c04a8..e25130553 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj @@ -196,6 +196,8 @@ call Update_Resources.bat + + @@ -375,6 +377,8 @@ call Update_Resources.bat + + diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters index 65a1fb3e5..272017214 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters @@ -554,6 +554,12 @@ 02.GameObjects\Environment\03.MapElement\Door + + 02.GameObjects\Environment\03.MapElement\Chest + + + 02.GameObjects\Environment\03.MapElement\Chest\Chest_Lid + 02.GameObjects\Item\Potion @@ -1176,6 +1182,12 @@ {b09f9ada-6cf4-41a4-ad28-f00855509825} + + {160d0631-ff04-40ee-b27b-b2ea167b8da5} + + + {70c01ca8-ae1b-43aa-b4f4-efa40994e3e9} + {ace6c64f-901a-424e-99da-53f281413d77} @@ -1680,6 +1692,12 @@ 02.GameObjects\Environment\03.MapElement\Door + + 02.GameObjects\Environment\03.MapElement\Chest + + + 02.GameObjects\Environment\03.MapElement\Chest\Chest_Lid + 02.GameObjects\Item\Potion diff --git a/Jusin154_Team3D/Client/Private/Effect_Container.cpp b/Jusin154_Team3D/Client/Private/Effect_Container.cpp index fb9f1c131..e19971e54 100644 --- a/Jusin154_Team3D/Client/Private/Effect_Container.cpp +++ b/Jusin154_Team3D/Client/Private/Effect_Container.cpp @@ -38,7 +38,6 @@ HRESULT CEffect_Container::Initialize(void* pArg) if (FAILED(Ready_Child())) return E_FAIL; - m_bVisible = false; return S_OK; diff --git a/Jusin154_Team3D/Client/Private/InfoInstance.cpp b/Jusin154_Team3D/Client/Private/InfoInstance.cpp index ff405a87d..ba6775b4e 100644 --- a/Jusin154_Team3D/Client/Private/InfoInstance.cpp +++ b/Jusin154_Team3D/Client/Private/InfoInstance.cpp @@ -127,6 +127,10 @@ HRESULT CInfoInstance::Load_DoorElemet(const _char* pFileName) { return m_pMapInfo->Load_DoorElemet(pFileName); } +HRESULT CInfoInstance::Load_ChestElemet(const _char* pFileName) +{ + return m_pMapInfo->Load_ChestElemet(pFileName); +} #pragma endregion #pragma region SPELL_INFO diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index e620c010d..3a0483b0a 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -280,7 +280,9 @@ HRESULT CLevel_GamePlay::Ready_Background() /* Doors */ CInfoInstance::GetInstance()->Load_DoorElemet("Element_Door_Info"); - + /* Chests */ + CInfoInstance::GetInstance()->Load_ChestElemet("Element_Chest_Info"); + if (FAILED(Ready_IntstanceProp())) return E_FAIL; } diff --git a/Jusin154_Team3D/Client/Private/Light_Main.cpp b/Jusin154_Team3D/Client/Private/Light_Main.cpp index 92375b4cf..2d456f634 100644 --- a/Jusin154_Team3D/Client/Private/Light_Main.cpp +++ b/Jusin154_Team3D/Client/Private/Light_Main.cpp @@ -79,9 +79,9 @@ HRESULT CLight_Main::Ready_Components() } m_pGameInstance->Add_Light(NEXT_LEVEL, m_pLightCom); - - _float4 vColor = _float4(0.1f, 0.1f, 0.15f, 0.5f); + _float4 vColor = _float4(0.7f, 0.7f, 0.7f, 0.3f); m_pGameInstance->Set_FogColor(vColor); + m_pGameInstance->Set_FogDensity(5.f); return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 369f5e58d..9848585ba 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -166,6 +166,8 @@ #include "MapElement_Door.h" #include "Land.h" #include "Unified.h" +#include "MapElement_Chest.h" +#include "MapElement_Chest_Lid.h" #pragma endregion @@ -613,6 +615,11 @@ HRESULT CLoader::Loading_For_GamePlay() "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Chairs", ".bin", false )); + /* Object Interactables (Chest)*/ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables", + ".bin", false + )); } } } @@ -1166,6 +1173,10 @@ HRESULT CLoader::Loading_For_GamePlay() } #pragma endregion + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Levioso_Noise"), + CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/Effect/Noises/VFX_T_NoiseCaustics02_Color_D.png"), 0)))) { + return E_FAIL; + } #pragma region EFFECT @@ -1422,7 +1433,7 @@ HRESULT CLoader::Loading_For_GamePlay() return E_FAIL; } - //Desc.ePxRigidBodyFlags = { PSX::PxRigidBodyFlag::eKINEMATIC }; + Desc.ePxRigidBodyFlags = { PSX::PxRigidBodyFlag::eKINEMATIC }; if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX_KIN"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { return E_FAIL; } @@ -2157,6 +2168,14 @@ HRESULT CLoader::Loading_For_GamePlay() if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Door::Create(m_pDevice, m_pContext)))) return E_FAIL; + /* For.Prototype_GameObject_MapElement_Chest */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Chest::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_MapElement_Chest_Lid */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Chest_Lid::Create(m_pDevice, m_pContext)))) + return E_FAIL; + /* For.Prototype_GameObject_Unified */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Lake::Create(m_pDevice, m_pContext)))) return E_FAIL; diff --git a/Jusin154_Team3D/Client/Private/MapElement_Chest.cpp b/Jusin154_Team3D/Client/Private/MapElement_Chest.cpp new file mode 100644 index 000000000..4d7d802b7 --- /dev/null +++ b/Jusin154_Team3D/Client/Private/MapElement_Chest.cpp @@ -0,0 +1,340 @@ +#include "pch.h" +#include "MapElement_Chest.h" + +#include "GameInstance.h" +#include "Terrain.h" +#include "Layer.h" +#include "MapElement_Chest_Lid.h" +#include "Player.h" + +CMapElement_Chest::CMapElement_Chest(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CMapElement{ pDevice, pContext } +{ +} + +CMapElement_Chest::CMapElement_Chest(const CMapElement_Chest& rhs) + : CMapElement(rhs) +{ +} + +HRESULT CMapElement_Chest::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapElement_Chest::Initialize(void* pArg) +{ + ELEMENT_CHEST_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]); + //m_ModelPathIndices.push_back((*pDesc->pModelPathIndices)[i]); + } + + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components(pArg))) + return E_FAIL; + + m_eCurState = m_ePreState = CHEST_STATE::IDLE; + m_fRimLightPower = pDesc->fRimLightPow; + m_fRimLightStrength = pDesc->fRimLightStrength; + m_vRimLightColor = pDesc->vRimLightColor; + + 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)); + + /* 뚜껑 */ + if (FAILED(Ready_Lid(pDesc))) + return E_FAIL; + + m_pActor = static_cast(m_pRigidBody->Get_Actor()); + + static_cast(m_pRigidBody)->Set_HalfGeometryInfo(pDesc->vBoxSize); + static_cast(m_pRigidBody)->Move_LocalPos(_float4(0.f, 0.f, 0.f, 0.f), pDesc->vBoxLocalPosition); + + return S_OK; +} + +void CMapElement_Chest::Priority_Update(_float fTimeDelta) +{ + m_pLid->Priority_Update(fTimeDelta); +} + +void CMapElement_Chest::Update(_float fTimeDelta) +{ +#ifdef _DEBUG + /*if(CHEST_STATE::OPENED != m_eCurState) + { + _vector vPlayerPos = m_pGameInstance->Get_Layer(g_iStaticLevel, LAYER_PLAYER)->Get_Object()->Get_WorldPostion(); + + _float fDistance = XMVectorGetX(XMVector3Length(vPlayerPos - m_pTransformCom->Get_State(STATE::POSITION))); + + if (CHEST_STATE::IDLE == m_eCurState && fDistance < 10.f) + m_eCurState = CHEST_STATE::FOUND; + else if (fDistance < 1.5f) + m_eCurState = CHEST_STATE::OPENED; + }*/ +#endif // _DEBUG + + switch (m_eCurState) + { + case CMapElement_Chest::CHEST_STATE::IDLE: + break; + + case CMapElement_Chest::CHEST_STATE::FOUND: + m_fTimeAcc += fTimeDelta * 0.03f; + + if (0.f <= m_fTimeAcc && 0.06f > m_fTimeAcc) + { + m_fCurRimLightStrength = m_fRimLightStrength * m_fTimeAcc / 0.06f; + } + else if (0.3f <= m_fTimeAcc) + { + m_fTimeAcc = 0.f; + m_fCurRimLightStrength = 0.f; + m_eCurState = CHEST_STATE::IDLE; + } + else + { + m_fCurRimLightStrength = m_fRimLightStrength; + } + break; + + case CMapElement_Chest::CHEST_STATE::OPENED: + break; + + default: + break; + } + + Chage_State(); + + m_pLid->Update(fTimeDelta); +} + +void CMapElement_Chest::Late_Update(_float fTimeDelta) +{ + if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) { + + if (CMapElement_Chest::CHEST_STATE::FOUND == m_eCurState) + { + m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this); + m_pGameInstance->Add_RenderGroup(RENDER::BLUR, this); + } + else + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); + + m_pLid->Late_Update(fTimeDelta); + } +} + +HRESULT CMapElement_Chest::Render() +{ + if (FAILED(Bind_ShaderResources())) + return E_FAIL; + + _uint iNumMeshes = m_pModelComs[m_iLodIndex]->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Begin(m_iShaderPass_Index))) { + return E_FAIL; + } + + if (FAILED(m_pModelComs[m_iLodIndex]->Render(i))) { + return E_FAIL; + } + } + +#ifdef _DEBUG + if (FAILED(m_pRigidBody->Render())) { + return E_FAIL; + } +#endif // _DEBUG + + if (FAILED(m_pLid->Render(m_iShaderPass_Index))) + return E_FAIL; + + return S_OK; +} + +HRESULT CMapElement_Chest::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("Levioso_Noise"), + reinterpret_cast(&m_pNoiseTextureCom)))) + return E_FAIL; + + ELEMENT_CHEST_DESC* pPhysXDummyDesc = static_cast(pArg); + + // RIGID_BODY + CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; + Desc.iSubKind = ENUM_CLASS(PXOBJECT::BOX); + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX_KIN"), (CComponent**)&m_pRigidBody, &Desc))) { + return E_FAIL; + } + + + return S_OK; +} + +HRESULT CMapElement_Chest::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; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_fTime", &m_fTimeAcc, 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_fRimPower", &m_fRimLightPower, sizeof(_float)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fRimStrength", &m_fCurRimLightStrength, sizeof(_float)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_vRimColor", &m_vRimLightColor, sizeof(_float4)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_SRV("g_NoiseTexture", m_pNoiseTextureCom->Get_SRV(0)))) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CMapElement_Chest::Ready_Lid(ELEMENT_CHEST_DESC* pArg) +{ + m_pLid = m_pGameInstance->Clone_Prototype(g_iStaticLevel, pArg, this); + + if (nullptr == m_pLid) + return E_FAIL; + + return S_OK; +} + +void CMapElement_Chest::Chage_State() +{ + if (m_ePreState != m_eCurState) + { + switch (m_eCurState) + { + case CMapElement_Chest::CHEST_STATE::IDLE: + m_fCurRimLightStrength = 0.f; + m_fTimeAcc = 0.f; + m_iShaderPass_Index = ENUM_CLASS(SHADER_PASS_MESH::DEFAULT); + break; + + case CMapElement_Chest::CHEST_STATE::FOUND: + m_iShaderPass_Index = 21; //ENUM_CLASS(SHADER_PASS_MESH::DEFAULT); + break; + + case CMapElement_Chest::CHEST_STATE::OPENED: + m_iShaderPass_Index = ENUM_CLASS(SHADER_PASS_MESH::DEFAULT); + m_pLid->Open(); + break; + + default: + break; + } + m_ePreState = m_eCurState; + } +} + +CMapElement_Chest* CMapElement_Chest::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CMapElement_Chest* pInstance = new CMapElement_Chest(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CMapElement_Chest"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CMapElement_Chest::Clone(void* pArg, CGameObject* pOwner) +{ + CMapElement_Chest* pInstance = new CMapElement_Chest(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapElement_Chest"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CMapElement_Chest::Free() +{ + if (nullptr != m_pRigidBody) { + m_pGameInstance->Release_Actor(*m_pRigidBody->Get_Actor()); + } + __super::Free(); + + if (m_bCloned) + SAFE_RELEASE(m_pLid); + + SAFE_RELEASE(m_pRigidBody); + SAFE_RELEASE(m_pNoiseTextureCom); + SAFE_RELEASE(m_pShaderCom); + + for (auto& pModel : m_pModelComs) + SAFE_RELEASE(pModel); +} + +#ifdef _DEBUG +void CMapElement_Chest::Describe_Entity() +{ +} +#endif // _DEBUG + + diff --git a/Jusin154_Team3D/Client/Private/MapElement_Chest_Lid.cpp b/Jusin154_Team3D/Client/Private/MapElement_Chest_Lid.cpp new file mode 100644 index 000000000..fe65f2a7e --- /dev/null +++ b/Jusin154_Team3D/Client/Private/MapElement_Chest_Lid.cpp @@ -0,0 +1,207 @@ +#include "pch.h" +#include "MapElement_Chest_Lid.h" +#include "MapElement_Chest.h" + +#include "GameInstance.h" + +CMapElement_Chest_Lid::CMapElement_Chest_Lid(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CMapElement{ pDevice, pContext } +{ +} + +CMapElement_Chest_Lid::CMapElement_Chest_Lid(const CMapElement_Chest_Lid& rhs) + : CMapElement(rhs) +{ +} + +HRESULT CMapElement_Chest_Lid::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapElement_Chest_Lid::Initialize(void* pArg) +{ + CMapElement_Chest::ELEMENT_CHEST_DESC* pDesc = static_cast(pArg); + + m_iMaxLodLevel = pDesc->iMaxLodLevel_Lid; + + for (_uint i = 0; i < m_iMaxLodLevel + 1; i++) + { + m_ModelPrototypeTags.push_back(pDesc->ModelPrototypeTags_Lid[i]); + } + + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components(pArg))) + return E_FAIL; + + m_fOpenDuration = 0.1f; + m_fRotationAngle = pDesc->fRotaitionAngle; + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pDesc->vLid_Offset), 1.f)); + + m_pParentWorldMatrix = m_pOwner->Get_Component()->Get_WorldMatrixPtr(); + XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * XMLoadFloat4x4(m_pParentWorldMatrix)); + + return S_OK; +} + +void CMapElement_Chest_Lid::Priority_Update(_float fTimeDelta) +{ +} + +void CMapElement_Chest_Lid::Update(_float fTimeDelta) +{ + switch (m_eState) + { + case CMapElement_Chest_Lid::LID_STATE::IDLE: + break; + + case CMapElement_Chest_Lid::LID_STATE::OPENING: + if (Opening(fTimeDelta)) + m_eState = LID_STATE::OPENED; + break; + + case CMapElement_Chest_Lid::LID_STATE::OPENED: + break; + + default: + break; + } +} + +void CMapElement_Chest_Lid::Late_Update(_float fTimeDelta) +{ + /* 부모에서 Render 호출 */ +} + +HRESULT CMapElement_Chest_Lid::Render(_uint iShaderPass) +{ + if (FAILED(Bind_ShaderResources())) + return E_FAIL; + + _uint iNumMeshes = m_pModelComs[m_iLodIndex]->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Begin(iShaderPass))) { + return E_FAIL; + } + + if (FAILED(m_pModelComs[m_iLodIndex]->Render(i))) { + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT CMapElement_Chest_Lid::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; + + + return S_OK; +} + +HRESULT CMapElement_Chest_Lid::Bind_ShaderResources() +{ + 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; + } + 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; +} + +_bool CMapElement_Chest_Lid::Opening(_float fTimeDelta) +{ + m_fTimeAcc += fTimeDelta; + + if (m_fTimeAcc >= m_fOpenDuration) + { + m_fTimeAcc = m_fOpenDuration; + m_pTransformCom->Rotation(XMConvertToRadians(m_fRotationAngle), 0.f, 0.f); + return true; + } + + m_pTransformCom->Rotation(XMConvertToRadians(m_fRotationAngle * m_fTimeAcc / m_fOpenDuration), 0.f, 0.f); + + XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * XMLoadFloat4x4(m_pParentWorldMatrix)); + + return false; +} + +CMapElement_Chest_Lid* CMapElement_Chest_Lid::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CMapElement_Chest_Lid* pInstance = new CMapElement_Chest_Lid(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CMapElement_Chest_Lid"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CMapElement_Chest_Lid::Clone(void* pArg, CGameObject* pOwner) +{ + CMapElement_Chest_Lid* pInstance = new CMapElement_Chest_Lid(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapElement_Chest_Lid"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CMapElement_Chest_Lid::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pShaderCom); + + for (auto& pModel : m_pModelComs) + SAFE_RELEASE(pModel); +} + +#ifdef _DEBUG +void CMapElement_Chest_Lid::Describe_Entity() +{ +} +#endif // _DEBUG diff --git a/Jusin154_Team3D/Client/Private/MapInfo.cpp b/Jusin154_Team3D/Client/Private/MapInfo.cpp index 4bd73d904..b33e6a3b9 100644 --- a/Jusin154_Team3D/Client/Private/MapInfo.cpp +++ b/Jusin154_Team3D/Client/Private/MapInfo.cpp @@ -11,6 +11,7 @@ #include "MapElement_Interactable.h" #include "MapElement_Lake.h" #include "MapElement_Door.h" +#include "MapElement_Chest.h" #include "Layer.h" CMapInfo::CMapInfo() @@ -639,6 +640,97 @@ HRESULT CMapInfo::Load_DoorElemet(const _char* pFileName) return S_OK; } +HRESULT CMapInfo::Load_ChestElemet(const _char* pFileName) +{ + tinyxml2::XMLDocument xmlDoc; + + string strPath = "../Bin/Resources/Data/Map/Hiden/" + string(pFileName) + ".xml"; + + if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) + return E_FAIL; + + tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("Chests"); + + if (nullptr == root) + { + MSG_BOX("Failed to Find root"); + return S_OK; + } + + for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) + { + CMapElement_Chest::ELEMENT_CHEST_DESC Desc = {}; + + /* Model Prototypes */ + Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel); + Desc.iSubKind = ENUM_CLASS(PXOBJECT::BOX); + 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); + + auto* HalfGeometryInfo = Object->FirstChildElement("HalfGeometryInfo"); + HalfGeometryInfo->QueryFloatAttribute("x", &Desc.vBoxSize.x); + HalfGeometryInfo->QueryFloatAttribute("y", &Desc.vBoxSize.y); + HalfGeometryInfo->QueryFloatAttribute("z", &Desc.vBoxSize.z); + + auto* LocalTranslation = Object->FirstChildElement("LocalTranslation"); + LocalTranslation->QueryFloatAttribute("x", &Desc.vBoxLocalPosition.x); + LocalTranslation->QueryFloatAttribute("y", &Desc.vBoxLocalPosition.y); + LocalTranslation->QueryFloatAttribute("z", &Desc.vBoxLocalPosition.z); + + auto* RimLight = Object->FirstChildElement("RimLight"); + RimLight->QueryFloatAttribute("pow", &Desc.fRimLightPow); + RimLight->QueryFloatAttribute("strength", &Desc.fRimLightStrength); + RimLight->QueryFloatAttribute("colorR", &Desc.vRimLightColor.x); + RimLight->QueryFloatAttribute("colorG", &Desc.vRimLightColor.y); + RimLight->QueryFloatAttribute("colorB", &Desc.vRimLightColor.z); + RimLight->QueryFloatAttribute("colorA", &Desc.vRimLightColor.w); + + + auto* Lid = Object->FirstChildElement("Lid"); + Lid->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel_Lid); + for (auto* PrototypeTag = Lid->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) + { + strTag = PrototypeTag->GetText(); + + Desc.ModelPrototypeTags_Lid.push_back(CMyTools::ToWstring(strTag)); + } + + auto* LidPosition = Lid->FirstChildElement("Position"); + LidPosition->QueryFloatAttribute("x", &Desc.vLid_Offset.x); + LidPosition->QueryFloatAttribute("y", &Desc.vLid_Offset.y); + LidPosition->QueryFloatAttribute("z", &Desc.vLid_Offset.z); + + auto* RotationAngle = Lid->FirstChildElement("RotationAngle"); + RotationAngle->QueryFloatAttribute("RotationAngle", &Desc.fRotaitionAngle); + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_HIDDEN, &Desc))) + return E_FAIL; + } + + return S_OK; +} + HRESULT CMapInfo::Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContex) { m_pGameInstance = CGameInstance::GetInstance(); diff --git a/Jusin154_Team3D/Client/Public/Client_Macro.h b/Jusin154_Team3D/Client/Public/Client_Macro.h index 06643d5d0..b0bfa9821 100644 --- a/Jusin154_Team3D/Client/Public/Client_Macro.h +++ b/Jusin154_Team3D/Client/Public/Client_Macro.h @@ -62,6 +62,7 @@ namespace Client { #define LAYER_INTERACTABLE TEXT("Layer_Interactable") #define LAYER_UNIFIED TEXT("Layer_Unified") #define LAYER_DOOR TEXT("Layer_Door") +#define LAYER_HIDDEN TEXT("Layer_HIDDEN") #define LAYER_MAPOBJECTMANAGER TEXT("Layer_MapObjectManager") diff --git a/Jusin154_Team3D/Client/Public/InfoInstance.h b/Jusin154_Team3D/Client/Public/InfoInstance.h index 57ac8e23a..80542594f 100644 --- a/Jusin154_Team3D/Client/Public/InfoInstance.h +++ b/Jusin154_Team3D/Client/Public/InfoInstance.h @@ -50,6 +50,7 @@ DECLARE_SINGLETON(CInfoInstance) HRESULT Load_InteractableElements(const _char* pFileName); HRESULT Load_WaterElemet(const _char* pFileName); HRESULT Load_DoorElemet(const _char* pFileName); + HRESULT Load_ChestElemet(const _char* pFileName); #pragma endregion #pragma region Spell_INFO HRESULT Load_SpellInfo(const _char* pFilePath); diff --git a/Jusin154_Team3D/Client/Public/MapElement_Chest.h b/Jusin154_Team3D/Client/Public/MapElement_Chest.h new file mode 100644 index 000000000..19a1b18ed --- /dev/null +++ b/Jusin154_Team3D/Client/Public/MapElement_Chest.h @@ -0,0 +1,79 @@ +#pragma once + +#include "Client_Define.h" +#include "MapElement.h" + +NS_BEGIN(Client) + +class CMapElement_Chest final : public CMapElement +{ +public: + enum class CHEST_STATE { IDLE, FOUND, OPENED, END }; + +public: + typedef struct tagElement_Chest_Desc : MAPELEMENT_DESC + { + _uint iInteractableID = {}; + _uint iSubKind = {}; + _float3 vBoxLocalPosition; + _float3 vBoxSize; + + _uint iMaxLodLevel_Lid{}; + vector<_wstring> ModelPrototypeTags_Lid; + _float3 vLid_Offset = {}; + _float fRotaitionAngle = {}; + + _float fRimLightPow; + _float fRimLightStrength; + _float4 vRimLightColor; + }ELEMENT_CHEST_DESC; + +private: + CMapElement_Chest(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMapElement_Chest(const CMapElement_Chest& rhs); + virtual ~CMapElement_Chest() = 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; + +private: + ELEMENT_INTERACTABLE_ID m_eInteractableID = { ELEMENT_INTERACTABLE_ID::END }; + CHEST_STATE m_ePreState = {}; + CHEST_STATE m_eCurState = {}; + + _uint m_iShaderPass_Index = {}; + + _float m_fTimeAcc = {}; + _float m_fRimLightPower = { 0.7f }; + _float m_fRimLightStrength = { 3.7f }; + _float m_fCurRimLightStrength = { 0.f }; + _float4 m_vRimLightColor = { 0.71f, 0.39f, 0.02f, 1.f }; + + CTexture* m_pNoiseTextureCom = { nullptr }; + CRigidBody* m_pRigidBody = { nullptr }; + PSX::PxRigidDynamic* m_pActor = { nullptr }; + + class CMapElement_Chest_Lid* m_pLid = { nullptr }; + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + virtual HRESULT Bind_ShaderResources() override; + HRESULT Ready_Lid(ELEMENT_CHEST_DESC* pArg); + + void Chage_State(); + +public: + static CMapElement_Chest* 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/MapElement_Chest_Lid.h b/Jusin154_Team3D/Client/Public/MapElement_Chest_Lid.h new file mode 100644 index 000000000..51ad32ba1 --- /dev/null +++ b/Jusin154_Team3D/Client/Public/MapElement_Chest_Lid.h @@ -0,0 +1,60 @@ +#pragma once + +#include "Client_Define.h" +#include "MapElement.h" + +NS_BEGIN(Client) + +class CMapElement_Chest_Lid final : public CMapElement +{ +public: + enum class LID_STATE { IDLE, OPENING, OPENED, END }; + +private: + CMapElement_Chest_Lid(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMapElement_Chest_Lid(const CMapElement_Chest_Lid& rhs); + virtual ~CMapElement_Chest_Lid() = 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(_uint iShaderPass); + + void Open() { m_eState = LID_STATE::OPENING; } + +private: + LID_STATE m_eState = { LID_STATE::END }; + + _bool m_isRotationAnim = {}; + _float m_fOpenDuration = {}; + _float m_fTimeAcc = {}; + _float m_fRotationAngle = {}; + + _float3 m_vTargetPosition = {}; + _float3 m_vTargetRotation = {}; + + _float4x4 m_CombinedWorldMatrix = {}; + + _bool m_isOpen = {}; + const _float4x4* m_pParentWorldMatrix = { nullptr }; + + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + virtual HRESULT Bind_ShaderResources() override; + + _bool Opening(_float fTimeDelta); + +public: + static CMapElement_Chest_Lid* 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 30c76227e..beeaa6b94 100644 --- a/Jusin154_Team3D/Client/Public/MapInfo.h +++ b/Jusin154_Team3D/Client/Public/MapInfo.h @@ -26,6 +26,7 @@ class CMapInfo final : public CBase HRESULT Load_InteractableElements(const _char* pFileName); HRESULT Load_WaterElemet(const _char* pFileName); HRESULT Load_DoorElemet(const _char* pFileName); + HRESULT Load_ChestElemet(const _char* pFileName); private: CGameInstance* m_pGameInstance = { nullptr }; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hiden/Element_Chest_Info.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hiden/Element_Chest_Info.xml new file mode 100644 index 000000000..2c8094a41 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hiden/Element_Chest_Info.xml @@ -0,0 +1,60 @@ + + + + Prototype_GameObject_SM_Chest_RewardContainer_C + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod1 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod2 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod3 + + + + + + + + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod1 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod2 + + + + + + Prototype_GameObject_SM_Chest_RewardContainer_C + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod1 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod2 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod3 + + + + + + + + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod1 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod2 + + + + + + Prototype_GameObject_SM_Chest_RewardContainer_C + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod1 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod2 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod3 + + + + + + + + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod1 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod2 + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C.bin new file mode 100644 index 000000000..339dd05bf --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d63f7c5b3ad543514aace353ee709c251c06e2c76e4280d2b2ad29ca56d1b8e6 +size 505472 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid.bin new file mode 100644 index 000000000..7a660734b --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c59d5191ed66ed8d9cab7c9d0a2feed02df56d6991ded53d9da45ef55e3f8e9d +size 297088 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid_Lod1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid_Lod1.bin new file mode 100644 index 000000000..cc0a4138a --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid_Lod1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b25aa3d241fcb9b345f313c080865dfe6912b0acb997a674648953c4efd7fb5b +size 103736 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid_Lod2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid_Lod2.bin new file mode 100644 index 000000000..1b3d90172 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid_Lod2.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:612e3945956c54dc0a014ca76c0533c51f5cbedc4a50984a8bea79e13913a4aa +size 17052 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod1.bin new file mode 100644 index 000000000..75dcf9e83 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:951c28e20cfa13c1a41ce5fb4aad9fd0f8cf6b160327b78e3f73c0e15c38cb54 +size 177072 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod2.bin new file mode 100644 index 000000000..7276a3141 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod2.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df925e597f41bfa9a9f7268d67f4a280af93ee5a93d05824387ec8ff9f9c5daa +size 57444 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod3.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod3.bin new file mode 100644 index 000000000..7571b3b58 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod3.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6b84123ecd65829eda3a768ff95315a12156198fd0584d8958aeb31098ff2a9 +size 14056 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 5dcc23f6f..becdedb5d 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -895,13 +895,15 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In) float fViewZ = vDepthDesc.y * g_fFar; float fRatio; + + + fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow); - fRatio = clamp(pow(exp(-(g_fFogDensity * fViewZ)), g_fFogPow), 0.f, 1.f); - - vFinalColor = lerp(g_vFogColor, vColor, max(fRatio, 0.2f)); + vFinalColor = lerp(vColor, g_vFogColor, fRatio); vFinalColor.a = 1.f; - if (1.f == vDepthDesc.y) { + if (1.f == vDepthDesc.y) + { vFinalColor = float4(g_vFogColor); } Out.vSingleTarget = vFinalColor; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl index c43261149..13d866b16 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl @@ -92,6 +92,11 @@ float g_fRefractionPow; float4 g_vDiffuseColor; float4 g_vSurfaceColor; +float g_fRimPower; +float g_fRimStrength; +float4 g_vRimColor; + + struct VS_IN { float3 vPosition : POSITION; @@ -726,7 +731,7 @@ PS_OUT PS_LEVIOSO(PS_IN In) float4 vMtrlDiffuse = g_DiffuseTexture.Sample(AnisoTropy_BLUR_Sampler, In.vTexcoord); float4 vSurface = g_SurfaceParamsTexture.Sample(AnisoTropy_BLUR_Sampler, In.vTexcoord); - float4 vNoise = g_NoiseTexture.Sample(AnisoTropy_BLUR_Sampler, In.vTexcoord).r; + float fNoise = g_NoiseTexture.Sample(AnisoTropy_BLUR_Sampler, float2(In.vTexcoord.x + sin(g_fTime), In.vTexcoord.y)).r; if (g_iBinded_Texture[AI_TEXTURE_TYPE_TRANSMISSION] != 0) { @@ -749,7 +754,13 @@ PS_OUT PS_LEVIOSO(PS_IN In) float3 vNormal = normalize(mul(vNormalDecoded, WorldMatrix)); - Out.vAlbedo = vMtrlDiffuse * float4(1.f, 1.f, 0.3f, 1.f) * vNoise; + + float4 vRimLight = 1.f - saturate(dot(normalize(g_vCamPosition - In.vWorldPos), float4(In.vNormal, 0.f))); + + vRimLight = pow(vRimLight, g_fRimPower); + vRimLight = vRimLight * g_vRimColor * g_fRimStrength * fNoise; + + Out.vAlbedo = vMtrlDiffuse + vRimLight; Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); float fSurfaceParam = g_fUsingSurfaceParams; if (true == AlmostEqual7(g_fUsingSurfaceParams, 0.f)) diff --git a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp index bf20bb5b1..8e97331ad 100644 --- a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp @@ -478,7 +478,7 @@ HRESULT CLevel_MapViewer::Ready_Layer_Chest(const _wstring& strLayerTag) Chest_Desc.iMaxLodLevel_Lid = 2; Chest_Desc.ModelPrototypeTags_Lid= ModelPrototypeTagsLid; - Chest_Desc.vLid_Offset = _float3(0.f, 0.3f, 0.f); + Chest_Desc.vLid_Offset = _float3(0.f, 0.5f, 0.f); if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &Chest_Desc))) return E_FAIL; diff --git a/Jusin154_Team3D/Editor/Private/MainLight.cpp b/Jusin154_Team3D/Editor/Private/MainLight.cpp index d38833c15..1fc4dab78 100644 --- a/Jusin154_Team3D/Editor/Private/MainLight.cpp +++ b/Jusin154_Team3D/Editor/Private/MainLight.cpp @@ -150,9 +150,9 @@ HRESULT CMainLight::Ready_Components() m_pGameInstance->Add_Light(NEXT_LEVEL, m_pLightCom); - _float4 vColor = _float4(0.1f, 0.1f, 0.15f, 0.5f); + _float4 vColor = _float4(0.7f, 0.7f, 0.7f, 0.3f); m_pGameInstance->Set_FogColor(vColor); - + m_pGameInstance->Set_FogDensity(5.f); return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/MapElement_Chest.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Chest.cpp index 216cfb67a..2c98183c5 100644 --- a/Jusin154_Team3D/Editor/Private/MapElement_Chest.cpp +++ b/Jusin154_Team3D/Editor/Private/MapElement_Chest.cpp @@ -5,6 +5,7 @@ #include "Terrain.h" #include "Layer.h" #include "MapElement_Chest_Lid.h" +#include "Player.h" CMapElement_Chest::CMapElement_Chest(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) : CMapElement{ pDevice, pContext } @@ -75,12 +76,42 @@ void CMapElement_Chest::Priority_Update(_float fTimeDelta) void CMapElement_Chest::Update(_float fTimeDelta) { +#ifdef _DEBUG + /*if(CHEST_STATE::OPENED != m_eCurState) + { + _vector vPlayerPos = m_pGameInstance->Get_Layer(g_iStaticLevel, LAYER_PLAYER)->Get_Object()->Get_WorldPostion(); + + _float fDistance = XMVectorGetX(XMVector3Length(vPlayerPos - m_pTransformCom->Get_State(STATE::POSITION))); + + if (CHEST_STATE::IDLE == m_eCurState && fDistance < 10.f) + m_eCurState = CHEST_STATE::FOUND; + else if (fDistance < 1.5f) + m_eCurState = CHEST_STATE::OPENED; + }*/ +#endif // _DEBUG + switch (m_eCurState) { case Editor::CMapElement_Chest::CHEST_STATE::IDLE: break; case Editor::CMapElement_Chest::CHEST_STATE::FOUND: + m_fTimeAcc += fTimeDelta * 0.03f; + + if (0.f <= m_fTimeAcc && 0.06f > m_fTimeAcc) + { + m_fCurRimLightStrength = m_fRimLightStrength * m_fTimeAcc / 0.06f; + } + else if (0.3f <= m_fTimeAcc) + { + m_fTimeAcc = 0.f; + m_fCurRimLightStrength = 0.f; + m_eCurState = CHEST_STATE::IDLE; + } + else + { + m_fCurRimLightStrength = m_fRimLightStrength; + } break; case Editor::CMapElement_Chest::CHEST_STATE::OPENED: @@ -105,7 +136,10 @@ void CMapElement_Chest::Late_Update(_float fTimeDelta) if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) { if(CMapElement_Chest::CHEST_STATE::FOUND == m_eCurState) + { m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this); + m_pGameInstance->Add_RenderGroup(RENDER::BLUR, this); + } else m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); @@ -175,7 +209,6 @@ HRESULT CMapElement_Chest::Ready_Components(void* pArg) reinterpret_cast(&m_pNoiseTextureCom)))) return E_FAIL; - ELEMENT_CHEST_DESC* pPhysXDummyDesc = static_cast(pArg); // RIGID_BODY @@ -205,6 +238,23 @@ HRESULT CMapElement_Chest::Bind_ShaderResources() return E_FAIL; } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fTime", &m_fTimeAcc, 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_fRimPower", &m_fRimLightPower, sizeof(_float)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fRimStrength", &m_fCurRimLightStrength, sizeof(_float)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_vRimColor", &m_vRimLightColor, sizeof(_float4)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_SRV("g_NoiseTexture", m_pNoiseTextureCom->Get_SRV(0)))) { return E_FAIL; } @@ -229,6 +279,8 @@ void CMapElement_Chest::Chage_State() switch (m_eCurState) { case Editor::CMapElement_Chest::CHEST_STATE::IDLE: + m_fCurRimLightStrength = 0.f; + m_fTimeAcc = 0.f; m_iShaderPass_Index = ENUM_CLASS(SHADER_PASS_MESH::DEFAULT); break; @@ -238,6 +290,7 @@ void CMapElement_Chest::Chage_State() case Editor::CMapElement_Chest::CHEST_STATE::OPENED: m_iShaderPass_Index = ENUM_CLASS(SHADER_PASS_MESH::DEFAULT); + m_pLid->Open(); break; default: @@ -299,7 +352,7 @@ void CMapElement_Chest::Describe_Entity() return; PSX::PxVec3 vDir = PSX::PxVec3(0.f, 1.f, 0.f); - + GUI::Begin("Chest"); if (GUI::CollapsingHeader("Rigid Body")) { GUI::InputFloat("Power", &m_fPower); @@ -334,11 +387,38 @@ void CMapElement_Chest::Describe_Entity() } + if (GUI::Button("Save_ChestData")) + { + tinyxml2::XMLDocument doc; + string strPath = "../Bin/Resources/Data/Map/Hiden/Element_Chest_Info.xml"; + + tinyxml2::XMLError loadResult = doc.LoadFile(strPath.c_str()); + + tinyxml2::XMLElement* root = {}; + + if (loadResult == tinyxml2::XML_SUCCESS) + { + root = doc.FirstChildElement("Chests"); + + Save_XML(doc, root); + + if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) { + MSG_BOX("Failed to Save DoorInfo File"); + } + } + else + MSG_BOX("Failed to Save Data"); + } + 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::InputFloat("m_fRimLightPower", &m_fRimLightPower, 0.1f, 1.f); + GUI::InputFloat("m_fRimLightStrength", &m_fRimLightStrength, 0.1f, 1.f); + GUI::ColorEdit4("m_vRimLightColor", (_float*) & m_vRimLightColor); + GUI::Checkbox("Select Color ON / OFF", &m_bUseSelectColor); GUI::Text("----- Transfrom ----"); @@ -395,6 +475,8 @@ void CMapElement_Chest::Describe_Entity() if (GUI::Button("Delete")) m_bDead = true; + GUI::End(); + 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)); @@ -405,11 +487,11 @@ HRESULT CMapElement_Chest::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLEle tinyxml2::XMLElement* object = doc.NewElement("Object"); object->SetAttribute("Type", ENUM_CLASS(MAPOBJECT_TYPE::ELEMENT_INTERACT)); object->SetAttribute("ID", ENUM_CLASS(m_eInteractableID)); - object->SetAttribute("Lod_Level", m_iLodIndex); + object->SetAttribute("Lod_Level", m_iMaxLodLevel); root->InsertEndChild(object); #pragma region PROTOTYPETAG - for (_uint i = 0; i < m_iLodIndex + 1; ++i) + for (_uint i = 0; i < m_iMaxLodLevel + 1; ++i) { tinyxml2::XMLElement* prototype = doc.NewElement("PrototypeTag"); prototype->SetText(CMyTools::ToString(m_ModelPrototypeTags[i]).c_str()); @@ -461,8 +543,18 @@ HRESULT CMapElement_Chest::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLEle LocalTranslation->SetAttribute("z", vLocalTranslation.z); object->InsertEndChild(LocalTranslation); + tinyxml2::XMLElement* RimLight = doc.NewElement("RimLight"); + RimLight->SetAttribute("pow", m_fRimLightPower); + RimLight->SetAttribute("strength", m_fRimLightStrength); + RimLight->SetAttribute("colorR", m_vRimLightColor.x); + RimLight->SetAttribute("colorG", m_vRimLightColor.y); + RimLight->SetAttribute("colorB", m_vRimLightColor.z); + RimLight->SetAttribute("colorA", m_vRimLightColor.w); + object->InsertEndChild(RimLight); #pragma endregion + m_pLid->Save_XML(doc, object); + return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/MapElement_Chest_Lid.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Chest_Lid.cpp index d50ca3d60..a407648ea 100644 --- a/Jusin154_Team3D/Editor/Private/MapElement_Chest_Lid.cpp +++ b/Jusin154_Team3D/Editor/Private/MapElement_Chest_Lid.cpp @@ -37,8 +37,8 @@ HRESULT CMapElement_Chest_Lid::Initialize(void* pArg) return E_FAIL; - m_fOpenDuration = 1.f; - m_fRotationAngle = 30.f; + m_fOpenDuration = 0.1f; + m_fRotationAngle = 10.f; m_vPosition = pDesc->vLid_Offset; m_vRotation = _float3(0.f, 0.f, 0.f); m_vScale = _float3(1.f, 1.f, 1.f); @@ -263,12 +263,12 @@ void CMapElement_Chest_Lid::Describe_Entity() HRESULT CMapElement_Chest_Lid::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root) { - tinyxml2::XMLElement* object = doc.NewElement("Object"); + tinyxml2::XMLElement* object = doc.NewElement("Lid"); object->SetAttribute("Lod_Level", m_iMaxLodLevel); root->InsertEndChild(object); #pragma region PROTOTYPETAG - for (_uint i = 0; i < m_iLodIndex + 1; ++i) + for (_uint i = 0; i < m_iMaxLodLevel + 1; ++i) { tinyxml2::XMLElement* prototype = doc.NewElement("PrototypeTag"); prototype->SetText(CMyTools::ToString(m_ModelPrototypeTags[i]).c_str()); @@ -294,19 +294,10 @@ HRESULT CMapElement_Chest_Lid::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XM Position->SetAttribute("z", vPosition.z); object->InsertEndChild(Position); - tinyxml2::XMLElement* Scale = doc.NewElement("Scale"); - Scale->SetAttribute("x", vScale.x); - Scale->SetAttribute("y", vScale.y); - Scale->SetAttribute("z", vScale.z); - object->InsertEndChild(Scale); - - tinyxml2::XMLElement* Rotation = doc.NewElement("Rotation"); - Rotation->SetAttribute("x", vRotation.x); - Rotation->SetAttribute("y", vRotation.y); - Rotation->SetAttribute("z", vRotation.z); - object->InsertEndChild(Rotation); - + tinyxml2::XMLElement* RotationAngle = doc.NewElement("RotationAngle"); + RotationAngle->SetAttribute("RotationAngle", m_fRotationAngle); + object->InsertEndChild(RotationAngle); #pragma endregion diff --git a/Jusin154_Team3D/Editor/Public/MapElement_Chest.h b/Jusin154_Team3D/Editor/Public/MapElement_Chest.h index cd71f5122..0f886b789 100644 --- a/Jusin154_Team3D/Editor/Public/MapElement_Chest.h +++ b/Jusin154_Team3D/Editor/Public/MapElement_Chest.h @@ -42,6 +42,12 @@ class CMapElement_Chest final : public CMapElement _uint m_iShaderPass_Index = {}; + _float m_fTimeAcc = {}; + _float m_fRimLightPower = { 0.7f }; + _float m_fRimLightStrength = { 3.7f }; + _float m_fCurRimLightStrength = { 0.f }; + _float4 m_vRimLightColor = {0.71f, 0.39f, 0.02f, 1.f}; + class CMapElement_Chest_Lid* m_pLid = { nullptr }; CRigidBody* m_pRigidBody = { nullptr }; PSX::PxRigidDynamic* m_pActor = { nullptr }; diff --git a/Jusin154_Team3D/Editor/Public/MapElement_Chest_Lid.h b/Jusin154_Team3D/Editor/Public/MapElement_Chest_Lid.h index 9977a1911..155e7088a 100644 --- a/Jusin154_Team3D/Editor/Public/MapElement_Chest_Lid.h +++ b/Jusin154_Team3D/Editor/Public/MapElement_Chest_Lid.h @@ -21,6 +21,7 @@ class CMapElement_Chest_Lid final : public CMapElement virtual void Late_Update(_float fTimeDelta) override; virtual HRESULT Render(_uint iShaderPass); + void Open() { m_eState = LID_STATE::OPENING; } private: LID_STATE m_eState = { LID_STATE::END }; diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 5dcc23f6f..becdedb5d 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -895,13 +895,15 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In) float fViewZ = vDepthDesc.y * g_fFar; float fRatio; + + + fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow); - fRatio = clamp(pow(exp(-(g_fFogDensity * fViewZ)), g_fFogPow), 0.f, 1.f); - - vFinalColor = lerp(g_vFogColor, vColor, max(fRatio, 0.2f)); + vFinalColor = lerp(vColor, g_vFogColor, fRatio); vFinalColor.a = 1.f; - if (1.f == vDepthDesc.y) { + if (1.f == vDepthDesc.y) + { vFinalColor = float4(g_vFogColor); } Out.vSingleTarget = vFinalColor; diff --git a/Jusin154_Team3D/Engine/Private/Fog.cpp b/Jusin154_Team3D/Engine/Private/Fog.cpp index 9899ec743..569343e6a 100644 --- a/Jusin154_Team3D/Engine/Private/Fog.cpp +++ b/Jusin154_Team3D/Engine/Private/Fog.cpp @@ -3,7 +3,7 @@ #include "Shader.h" CFog::CFog() - : m_bVisible{ true } + : m_bVisible{ true }, m_fFogPow{30.f} { } @@ -30,7 +30,7 @@ HRESULT CFog::Bind_FogValue(CShader* pShader) _float fValue = 0.f; _float4 vColor = { 0.f, 0.f,0.f,0.f }; pShader->Bind_RawValue("g_fFogDensity", &fValue, sizeof(_float)); - pShader->Bind_RawValue("g_fFogDensity", &fValue, sizeof(_float)); + pShader->Bind_RawValue("g_fFogPow", &fValue, sizeof(_float)); pShader->Bind_RawValue("g_vFogColor", &vColor, sizeof(_float4)); } #else