Merge pull request #455 from SpicyGangjeong/MapTool

Map tool
This commit is contained in:
JinhoBa
2025-12-14 14:57:09 +09:00
committed by GitHub
33 changed files with 1053 additions and 40 deletions
@@ -196,6 +196,8 @@ call Update_Resources.bat
<ClInclude Include="..\Public\Mage_Nomal_Attack.h" />
<ClInclude Include="..\Public\MageSide.h" />
<ClInclude Include="..\Public\Mage_Down_Attack.h" />
<ClInclude Include="..\public\MapElement_Chest.h" />
<ClInclude Include="..\public\MapElement_Chest_Lid.h" />
<ClInclude Include="..\Public\NPC_Ollivander.h" />
<ClInclude Include="..\Public\Box_Splesh.h" />
<ClInclude Include="..\Public\StunEffect.h" />
@@ -375,6 +377,8 @@ call Update_Resources.bat
<ClCompile Include="..\Private\Logo.cpp" />
<ClCompile Include="..\Private\Logo_Glow.cpp" />
<ClCompile Include="..\Private\Logo_Text.cpp" />
<ClCompile Include="..\private\MapElement_Chest.cpp" />
<ClCompile Include="..\private\MapElement_Chest_Lid.cpp" />
<ClCompile Include="..\Private\NPC_Ollivander.cpp" />
<ClCompile Include="..\private\MapElement_Door.cpp" />
<ClCompile Include="..\Private\State_Broom_Dismount.cpp" />
@@ -554,6 +554,12 @@
<ClInclude Include="..\public\MapElement_Door.h">
<Filter>02.GameObjects\Environment\03.MapElement\Door</Filter>
</ClInclude>
<ClInclude Include="..\public\MapElement_Chest.h">
<Filter>02.GameObjects\Environment\03.MapElement\Chest</Filter>
</ClInclude>
<ClInclude Include="..\public\MapElement_Chest_Lid.h">
<Filter>02.GameObjects\Environment\03.MapElement\Chest\Chest_Lid</Filter>
</ClInclude>
<ClInclude Include="..\Public\Item_Potion.h">
<Filter>02.GameObjects\Item\Potion</Filter>
</ClInclude>
@@ -1176,6 +1182,12 @@
<Filter Include="02.GameObjects\Environment\03.MapElement\Door">
<UniqueIdentifier>{b09f9ada-6cf4-41a4-ad28-f00855509825}</UniqueIdentifier>
</Filter>
<Filter Include="02.GameObjects\Environment\03.MapElement\Chest">
<UniqueIdentifier>{160d0631-ff04-40ee-b27b-b2ea167b8da5}</UniqueIdentifier>
</Filter>
<Filter Include="02.GameObjects\Environment\03.MapElement\Chest\Chest_Lid">
<UniqueIdentifier>{70c01ca8-ae1b-43aa-b4f4-efa40994e3e9}</UniqueIdentifier>
</Filter>
<Filter Include="02.GameObjects\Item\Potion">
<UniqueIdentifier>{ace6c64f-901a-424e-99da-53f281413d77}</UniqueIdentifier>
</Filter>
@@ -1680,6 +1692,12 @@
<ClCompile Include="..\private\MapElement_Door.cpp">
<Filter>02.GameObjects\Environment\03.MapElement\Door</Filter>
</ClCompile>
<ClCompile Include="..\private\MapElement_Chest.cpp">
<Filter>02.GameObjects\Environment\03.MapElement\Chest</Filter>
</ClCompile>
<ClCompile Include="..\private\MapElement_Chest_Lid.cpp">
<Filter>02.GameObjects\Environment\03.MapElement\Chest\Chest_Lid</Filter>
</ClCompile>
<ClCompile Include="..\Private\Item_Potion.cpp">
<Filter>02.GameObjects\Item\Potion</Filter>
</ClCompile>
@@ -38,7 +38,6 @@ HRESULT CEffect_Container::Initialize(void* pArg)
if (FAILED(Ready_Child()))
return E_FAIL;
m_bVisible = false;
return S_OK;
@@ -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
@@ -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;
}
@@ -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;
}
+20 -1
View File
@@ -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<CMapElement_Door>(g_iStaticLevel, CMapElement_Door::Create(m_pDevice, m_pContext))))
return E_FAIL;
/* For.Prototype_GameObject_MapElement_Chest */
if (FAILED(m_pGameInstance->Add_Prototype<CMapElement_Chest>(g_iStaticLevel, CMapElement_Chest::Create(m_pDevice, m_pContext))))
return E_FAIL;
/* For.Prototype_GameObject_MapElement_Chest_Lid */
if (FAILED(m_pGameInstance->Add_Prototype<CMapElement_Chest_Lid>(g_iStaticLevel, CMapElement_Chest_Lid::Create(m_pDevice, m_pContext))))
return E_FAIL;
/* For.Prototype_GameObject_Unified */
if (FAILED(m_pGameInstance->Add_Prototype<CMapElement_Lake>(g_iStaticLevel, CMapElement_Lake::Create(m_pDevice, m_pContext))))
return E_FAIL;
@@ -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<ELEMENT_CHEST_DESC*>(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<PSX::PxRigidDynamic*>(m_pRigidBody->Get_Actor());
static_cast<CRigidBody_Dynamic*>(m_pRigidBody)->Set_HalfGeometryInfo(pDesc->vBoxSize);
static_cast<CRigidBody_Dynamic*>(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<CPlayer>()->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<CComponent**>(&pModel))))
return E_FAIL;
m_pModelComs.push_back(pModel);
}
/* Com_Shader */
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH,
reinterpret_cast<CComponent**>(&m_pShaderCom))))
return E_FAIL;
/* Com_Texture */
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Levioso_Noise"),
reinterpret_cast<CComponent**>(&m_pNoiseTextureCom))))
return E_FAIL;
ELEMENT_CHEST_DESC* pPhysXDummyDesc = static_cast<ELEMENT_CHEST_DESC*>(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<CMapElement_Chest_Lid>(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
@@ -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<CMapElement_Chest::ELEMENT_CHEST_DESC*>(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<CTransform>()->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<CComponent**>(&pModel))))
return E_FAIL;
m_pModelComs.push_back(pModel);
}
/* Com_Shader */
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH,
reinterpret_cast<CComponent**>(&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
@@ -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<CMapElement_Chest>(g_iStaticLevel, NEXT_LEVEL, LAYER_HIDDEN, &Desc)))
return E_FAIL;
}
return S_OK;
}
HRESULT CMapInfo::Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContex)
{
m_pGameInstance = CGameInstance::GetInstance();
@@ -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")
@@ -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);
@@ -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
@@ -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
+1
View File
@@ -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 };
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<Chests>
<Object Type="2" ID="2" Lod_Level="3">
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lod1</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lod2</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lod3</PrototypeTag>
<Position x="76.562943" y="3.6033077" z="63.712246"/>
<Scale x="1" y="1" z="1"/>
<Rotation x="-0" y="-30" z="-0"/>
<HalfGeometryInfo x="0.30000001" y="0.25" z="0.27000001"/>
<LocalTranslation x="-0.0099999998" y="0.30000001" z="-0.25"/>
<RimLight pow="0.69999999" strength="3.7" colorR="0.70999998" colorG="0.38999999" colorB="0.02" colorA="1"/>
<Lid Lod_Level="2">
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lid</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod1</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod2</PrototypeTag>
<Position x="0" y="0.5" z="0"/>
<RotationAngle RotationAngle="10"/>
</Lid>
</Object>
<Object Type="2" ID="2" Lod_Level="3">
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lod1</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lod2</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lod3</PrototypeTag>
<Position x="129.29819" y="15.70473" z="144.45197"/>
<Scale x="0.99999988" y="1" z="0.99999988"/>
<Rotation x="0" y="74.999985" z="0"/>
<HalfGeometryInfo x="0.30000001" y="0.25" z="0.27000001"/>
<LocalTranslation x="-0.0099999998" y="0.30000001" z="-0.25"/>
<RimLight pow="0.69999999" strength="3.7" colorR="0.70999998" colorG="0.38999999" colorB="0.02" colorA="1"/>
<Lid Lod_Level="2">
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lid</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod1</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod2</PrototypeTag>
<Position x="0" y="0.5" z="0"/>
<RotationAngle RotationAngle="10"/>
</Lid>
</Object>
<Object Type="2" ID="2" Lod_Level="3">
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lod1</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lod2</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lod3</PrototypeTag>
<Position x="75.051727" y="14.536825" z="130.8075"/>
<Scale x="0.99999988" y="1" z="0.99999988"/>
<Rotation x="0" y="74.999985" z="0"/>
<HalfGeometryInfo x="0.30000001" y="0.25" z="0.27000001"/>
<LocalTranslation x="-0.0099999998" y="0.30000001" z="-0.25"/>
<RimLight pow="0.69999999" strength="3.7" colorR="0.70999998" colorG="0.38999999" colorB="0.02" colorA="1"/>
<Lid Lod_Level="2">
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lid</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod1</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod2</PrototypeTag>
<Position x="0" y="0.5" z="0"/>
<RotationAngle RotationAngle="10"/>
</Lid>
</Object>
</Chests>
@@ -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;
@@ -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))
@@ -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<CMapElement_Chest>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &Chest_Desc)))
return E_FAIL;
+2 -2
View File
@@ -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;
}
@@ -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<CPlayer>()->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<CComponent**>(&m_pNoiseTextureCom))))
return E_FAIL;
ELEMENT_CHEST_DESC* pPhysXDummyDesc = static_cast<ELEMENT_CHEST_DESC*>(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;
}
@@ -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
@@ -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 };
@@ -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 };
@@ -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;
+2 -2
View File
@@ -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