From 2fa4d29b57b8f9911c04088f9b214bdb6f380e2e Mon Sep 17 00:00:00 2001 From: qordlsgur <127704460+qordlsgur@users.noreply.github.com> Date: Sat, 15 Nov 2025 22:26:03 +0900 Subject: [PATCH] =?UTF-8?q?[Modify]=20UI=EC=95=A0=EB=8B=88=EB=A9=94?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ShaderFiles/Shader_UIEditor.hlsl | 2 +- Jusin154_Team3D/Editor/Default/Editor.vcxproj | 2 - .../Editor/Private/Action_Panel.cpp | 8 ++- Jusin154_Team3D/Editor/Private/Loader.cpp | 8 --- Jusin154_Team3D/Editor/Private/Spell_Slot.cpp | 24 ++++--- Jusin154_Team3D/Editor/Public/Action_Panel.h | 1 + Jusin154_Team3D/Editor/Public/Spell_Slot.h | 2 +- .../Engine/Private/ElementObject.cpp | 62 ++++++++++++++++--- .../Engine/Private/VIBuffer_UI_Instance.cpp | 31 +++++++--- .../Engine/Public/VIBuffer_Instance.h | 4 +- .../Engine/Public/VIBuffer_UI_Instance.h | 10 ++- 11 files changed, 106 insertions(+), 48 deletions(-) diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl index 529cf9c68..f004bbf5d 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl @@ -292,7 +292,7 @@ technique11 PosTexTechnique11 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_Default, 0); - SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + SetBlendState(BS_AlphaBlend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); VertexShader = compile vs_5_0 VS_MAIN(); GeometryShader = NULL; PixelShader = compile ps_5_0 PS_MAIN(); diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index b5d4c1e6e..5dad01a2c 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -200,7 +200,6 @@ - @@ -278,7 +277,6 @@ - diff --git a/Jusin154_Team3D/Editor/Private/Action_Panel.cpp b/Jusin154_Team3D/Editor/Private/Action_Panel.cpp index eb4285286..7518cb947 100644 --- a/Jusin154_Team3D/Editor/Private/Action_Panel.cpp +++ b/Jusin154_Team3D/Editor/Private/Action_Panel.cpp @@ -2,6 +2,7 @@ #include "Action_Panel.h" #include "GameInstance.h" #include "Spell_Slot.h" +#include "LoadingWidget.h" CAction_Panel::CAction_Panel(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) :CPanelObject(pDevice, pContext) @@ -73,7 +74,7 @@ void CAction_Panel::Late_Update(_float fTimeDelta) if (m_bVisible) { _float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]); - m_pGameInstance->Add_RenderGroup(RENDER::UI, this, *vPos, m_pTransformCom->Get_Radius()); + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); } __super::Late_Update(fTimeDelta); @@ -153,6 +154,11 @@ HRESULT CAction_Panel::Ready_Element(void* pArg) return E_FAIL; } Add_Element(TEXT("Spell_Slot"), m_pSpell_Slot); + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pLoadingWidget)))) + { + return E_FAIL; + } + Add_Element(TEXT("LoadingWidget"), m_pLoadingWidget); return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index 87ed783e0..d94d796bf 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -352,14 +352,6 @@ HRESULT CLoader::Loading_For_UI() m_strMessage = TEXT("Model Loading.."); - CVIBuffer_UI_Instance::UI_INSTANCE_DESC UIDesc{}; - - UIDesc.UINum = 4; - - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_ActionSkillRect"), - CVIBuffer_UI_Instance::Create(m_pDevice, m_pContext, &UIDesc)))) - return E_FAIL; - m_strMessage = TEXT("Shader Loading.."); if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_UIEDITOR, diff --git a/Jusin154_Team3D/Editor/Private/Spell_Slot.cpp b/Jusin154_Team3D/Editor/Private/Spell_Slot.cpp index ce8527936..a4af5c36f 100644 --- a/Jusin154_Team3D/Editor/Private/Spell_Slot.cpp +++ b/Jusin154_Team3D/Editor/Private/Spell_Slot.cpp @@ -36,9 +36,6 @@ HRESULT CSpell_Slot::Initialize(void* pArg) { return E_FAIL; } - - m_pVIBuffer_UI_InstanceCom->Set_Size(m_fSizeX, m_fSizeY); - return S_OK; } @@ -57,11 +54,10 @@ void CSpell_Slot::Update(_float fTimeDelta) { return; } - - m_pVIBuffer_UI_InstanceCom->Set_Pos(m_fX, m_fY, /*m_pOwner->Get_WorldPostion().m128_f32[0], m_pOwner->Get_WorldPostion().m128_f32[1]*/0.f, 0.f, 75.f); - m_fTime += fTimeDelta * m_fTimeMult; + __super::Update(fTimeDelta); + } void CSpell_Slot::Late_Update(_float fTimeDelta) @@ -72,7 +68,7 @@ void CSpell_Slot::Late_Update(_float fTimeDelta) } if (m_bVisible) { _float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]); - m_pGameInstance->Add_RenderGroup(RENDER::UI, this, *vPos, m_pTransformCom->Get_Radius()); + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); } } @@ -85,9 +81,12 @@ HRESULT CSpell_Slot::Render() return E_FAIL; } - m_pVIBuffer_UI_InstanceCom->Bind_Resources(); - - m_pVIBuffer_UI_InstanceCom->Render(); + if (FAILED(m_pVIBufferCom->Bind_Resources())) { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Render())) { + return E_FAIL; + } return S_OK; } @@ -124,8 +123,7 @@ HRESULT CSpell_Slot::Bind_ShaderResources() HRESULT CSpell_Slot::Ready_Components(void* pArg) { - if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_ActionSkillRect"), - reinterpret_cast(&m_pVIBuffer_UI_InstanceCom)))) + if (FAILED(Add_Component(g_iStaticLevel, &m_pVIBufferCom))) { return E_FAIL; } @@ -173,7 +171,7 @@ void CSpell_Slot::Free() SAFE_RELEASE(m_pDiffuse_TextureCom); SAFE_RELEASE(m_pShaderCom); - SAFE_RELEASE(m_pVIBuffer_UI_InstanceCom); + SAFE_RELEASE(m_pVIBufferCom); } void CSpell_Slot::Describe_Entity() diff --git a/Jusin154_Team3D/Editor/Public/Action_Panel.h b/Jusin154_Team3D/Editor/Public/Action_Panel.h index e452a38be..460e83f89 100644 --- a/Jusin154_Team3D/Editor/Public/Action_Panel.h +++ b/Jusin154_Team3D/Editor/Public/Action_Panel.h @@ -36,6 +36,7 @@ class CAction_Panel final : public CPanelObject CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; CGameObject* m_pSpell_Slot = { nullptr }; + CGameObject* m_pLoadingWidget = { nullptr }; public: static CAction_Panel* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); diff --git a/Jusin154_Team3D/Editor/Public/Spell_Slot.h b/Jusin154_Team3D/Editor/Public/Spell_Slot.h index 894d4beb3..92f3d582b 100644 --- a/Jusin154_Team3D/Editor/Public/Spell_Slot.h +++ b/Jusin154_Team3D/Editor/Public/Spell_Slot.h @@ -29,7 +29,7 @@ class CSpell_Slot final : public CElementObject private: CTexture* m_pDiffuse_TextureCom = { nullptr }; CShader* m_pShaderCom = { nullptr }; - CVIBuffer_UI_Instance* m_pVIBuffer_UI_InstanceCom = { nullptr }; + CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; public: static CSpell_Slot* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); diff --git a/Jusin154_Team3D/Engine/Private/ElementObject.cpp b/Jusin154_Team3D/Engine/Private/ElementObject.cpp index 062934fc9..cc99a6147 100644 --- a/Jusin154_Team3D/Engine/Private/ElementObject.cpp +++ b/Jusin154_Team3D/Engine/Private/ElementObject.cpp @@ -2,18 +2,18 @@ #include "ElementObject.h" CElementObject::CElementObject(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) - : CUIObject{ pDevice, pContext } + : CUIObject{ pDevice, pContext } { } CElementObject::CElementObject(const CElementObject& rhs) - : CUIObject(rhs) + : CUIObject(rhs) { } HRESULT CElementObject::Initialize_Prototype() { - return S_OK; + return S_OK; } HRESULT CElementObject::Initialize(void* pArg) @@ -51,7 +51,7 @@ void CElementObject::Late_Update(_float fTimeDelta) HRESULT CElementObject::Render() { - return S_OK; + return S_OK; } _vector CElementObject::Get_WorldPostion() @@ -66,7 +66,7 @@ void CElementObject::Visible(_bool bVisible) _bool CElementObject::Chack_Visible() { - if (m_pOwner->Get_Visible() == false ) + if (m_pOwner->Get_Visible() == false) { m_bVisible = m_pOwner->Get_Visible(); } @@ -123,14 +123,56 @@ _float CElementObject::Get_Nine_Slice_Bottom() void CElementObject::Start_Lerp(_float fTimeDelta, _bool Alpha) { - m_fX = MovDir(m_fCurrent_Position.m128_f32[0], m_vLerp_Position.m128_f32[0], fTimeDelta); - m_fY = MovDir(m_fCurrent_Position.m128_f32[1], m_vLerp_Position.m128_f32[1], fTimeDelta); + _vector Pos = m_fCurrent_Position; + + _vector Target = m_vLerp_Position; + + _vector Dir = XMVectorSubtract(Target, Pos); + _vector LenVec = XMVector3Length(Dir); + _float Distance = XMVectorGetX(LenVec); + + _float move = m_fMoveSpeed * fTimeDelta; + + if (Distance <= move) + { + m_fX = m_vLerp_Position.m128_f32[0]; + m_fY = m_vLerp_Position.m128_f32[1]; + m_bLerpOn = false; + } + + else + { + XMVECTOR DirNorm = XMVector3Normalize(Dir); + m_fX = (Pos + DirNorm * move).m128_f32[0]; + m_fY = (Pos + DirNorm * move).m128_f32[1]; + } } void CElementObject::Reset_Pos(_float fTimeDelta, _bool Alpha) { - m_fX = MovDir(m_fCurrent_Position.m128_f32[0], m_fOrigin_Position.x, fTimeDelta); - m_fY = MovDir(m_fCurrent_Position.m128_f32[1], m_fOrigin_Position.y, fTimeDelta); + _vector Pos = m_fCurrent_Position; + + _vector Target = XMVectorSet(m_fOrigin_Position.x, m_fOrigin_Position.y, 0.f, 0.f); + + _vector Dir = XMVectorSubtract(Target, Pos); + _vector LenVec = XMVector3Length(Dir); + _float Distance = XMVectorGetX(LenVec); + + _float move = m_fMoveSpeed * fTimeDelta; + + if (Distance <= move) + { + m_fX = m_fOrigin_Position.x; + m_fY = m_fOrigin_Position.y; + m_bLerpOn = false; + } + + else + { + XMVECTOR DirNorm = XMVector3Normalize(Dir); + m_fX = (Pos + DirNorm * move).m128_f32[0]; + m_fY = (Pos + DirNorm * move).m128_f32[1]; + } } _vector CElementObject::Get_Lerp_Pos() @@ -145,5 +187,5 @@ HRESULT CElementObject::Ready_Components(void* pArg) void CElementObject::Free() { - __super::Free(); + __super::Free(); } diff --git a/Jusin154_Team3D/Engine/Private/VIBuffer_UI_Instance.cpp b/Jusin154_Team3D/Engine/Private/VIBuffer_UI_Instance.cpp index 9083cdb0b..6a1868346 100644 --- a/Jusin154_Team3D/Engine/Private/VIBuffer_UI_Instance.cpp +++ b/Jusin154_Team3D/Engine/Private/VIBuffer_UI_Instance.cpp @@ -10,6 +10,8 @@ CVIBuffer_UI_Instance::CVIBuffer_UI_Instance(ID3D11Device* pDevice, ID3D11Device CVIBuffer_UI_Instance::CVIBuffer_UI_Instance(const CVIBuffer_UI_Instance& Prototype) : CVIBuffer_Instance{ Prototype } , m_pInstanceVertices{ Prototype.m_pInstanceVertices } + , m_fSize{ Prototype.m_fSize } + , m_fPosition{ Prototype.m_fPosition } { } @@ -96,7 +98,7 @@ HRESULT CVIBuffer_UI_Instance::Initialize_Prototype(const INSTANCE_DESC* pInstan #pragma region INSTANCE_BUFFER const UI_INSTANCE_DESC* pDesc = static_cast(pInstanceDesc); - m_iNumInstance = pDesc->UINum; + m_iNumInstance = pDesc->iNum; m_iInstanceStride = sizeof(VTX_INSTANCE_UI); m_iNumIndexPerInstance = 6; @@ -110,6 +112,18 @@ HRESULT CVIBuffer_UI_Instance::Initialize_Prototype(const INSTANCE_DESC* pInstan m_pInstanceVertices = new VTX_INSTANCE_UI[m_iNumInstance]; ZeroMemory(m_pInstanceVertices, sizeof(VTX_INSTANCE_UI) * m_iNumInstance); + m_fSize = new _float2[m_iNumInstance]; + ZeroMemory(m_fSize, sizeof(_float2) * m_iNumInstance); + + m_fPosition = new _float2[m_iNumInstance]; + ZeroMemory(m_fPosition, sizeof(_float2) * m_iNumInstance); + + for (size_t i = 0; i < m_iNumInstance; ++i) + { + m_pInstanceVertices[i].fSize = (pDesc->vSize); + m_pInstanceVertices[i].fPos = _float2(pDesc->vPsition.x + 75 * i, pDesc->vPsition.y); + } + m_InstanceInitialDesc.pSysMem = m_pInstanceVertices; #pragma endregion @@ -126,19 +140,19 @@ HRESULT CVIBuffer_UI_Instance::Initialize(void* pArg) return S_OK; } -void CVIBuffer_UI_Instance::Set_Pos(_float fX, _float fY, _float OwnerfX, _float OwnerfY, _float Spacing) +void CVIBuffer_UI_Instance::Set_Pos(_float fX, _float fY, _float OffSet) { D3D11_MAPPED_SUBRESOURCE SubResource{}; + m_pContext->Map(m_pVBInstance, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &SubResource); VTX_INSTANCE_UI* pVertices = static_cast(SubResource.pData); for (size_t i = 0; i < m_iNumInstance; i++) { - pVertices[i].fPos.x = fX + OwnerfX + i * Spacing; // 인덱스 * 간격 - pVertices[i].fPos.y = fY + OwnerfY; + pVertices[i].fPos.x = fX + m_pInstanceVertices[i].fPos.x; // 인덱스 * 간격 + pVertices[i].fPos.y = fY; } - m_pContext->Unmap(m_pVBInstance, 0); } @@ -169,7 +183,7 @@ CVIBuffer_UI_Instance* CVIBuffer_UI_Instance::Create(ID3D11Device* pDevice, ID3D MSG_BOX("Failed to Created : CVIBuffer_UI_Instance"); Safe_Release(pInstance); } - + return pInstance; } @@ -191,7 +205,10 @@ void CVIBuffer_UI_Instance::Free() { __super::Free(); - Safe_Delete_Array(m_pInstanceVertices); + if (false == m_isCloned) + { + Safe_Delete_Array(m_pInstanceVertices); + } } void CVIBuffer_UI_Instance::Describe_Entity() diff --git a/Jusin154_Team3D/Engine/Public/VIBuffer_Instance.h b/Jusin154_Team3D/Engine/Public/VIBuffer_Instance.h index d9533523d..e82650657 100644 --- a/Jusin154_Team3D/Engine/Public/VIBuffer_Instance.h +++ b/Jusin154_Team3D/Engine/Public/VIBuffer_Instance.h @@ -9,9 +9,9 @@ class ENGINE_DLL CVIBuffer_Instance abstract : public CVIBuffer public: typedef struct tagInstanceDesc { - _uint UINum = {}; + _uint iNum = {}; _float2 vSize = { }; - _float2 vCenter = {}; + _float2 vPsition = {}; }INSTANCE_DESC; protected: CVIBuffer_Instance(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); diff --git a/Jusin154_Team3D/Engine/Public/VIBuffer_UI_Instance.h b/Jusin154_Team3D/Engine/Public/VIBuffer_UI_Instance.h index 77d512684..757d892c0 100644 --- a/Jusin154_Team3D/Engine/Public/VIBuffer_UI_Instance.h +++ b/Jusin154_Team3D/Engine/Public/VIBuffer_UI_Instance.h @@ -9,7 +9,6 @@ class ENGINE_DLL CVIBuffer_UI_Instance final : public CVIBuffer_Instance public: typedef struct tagUIInstanceDesc final : public CVIBuffer_Instance::INSTANCE_DESC { - }UI_INSTANCE_DESC; private: CVIBuffer_UI_Instance(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); @@ -21,11 +20,16 @@ class ENGINE_DLL CVIBuffer_UI_Instance final : public CVIBuffer_Instance virtual HRESULT Initialize(void* pArg) override; public: - virtual void Set_Pos(_float fX, _float fY, _float OwnerfX, _float OwnerfY, _float Spacing); + virtual void Set_Pos(_float fX, _float fY,_float OffSet); virtual void Set_Size(_float fSizeX, _float fSizeY); + virtual void Set_Cloned(_bool isCloned) { m_isCloned = isCloned; } private: - VTX_INSTANCE_UI* m_pInstanceVertices = { nullptr }; + VTX_INSTANCE_UI* m_pInstanceVertices = { nullptr }; + _bool m_isCloned = { false }; + _float2* m_fSize{ nullptr }; + _float2* m_fPosition{ nullptr }; + _float m_fAddPosition{}; public: static CVIBuffer_UI_Instance* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const INSTANCE_DESC* pInstanceDesc);