[Modify] UI애니메이션 수정

This commit is contained in:
qordlsgur
2025-11-15 22:26:03 +09:00
parent 5b377ba97e
commit 2fa4d29b57
11 changed files with 106 additions and 48 deletions
@@ -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();
@@ -200,7 +200,6 @@
<ClInclude Include="..\Public\MainLight.h" />
<ClInclude Include="..\public\MapObject_Collision.h" />
<ClInclude Include="..\Public\Dummy_PhysXDoor.h" />
<ClInclude Include="..\public\MapObject_Static.h" />
<ClInclude Include="..\public\Spell_Slot.h" />
<ClInclude Include="..\public\Terrain.h" />
<ClInclude Include="..\Public\Level_PhysXLab.h" />
@@ -278,7 +277,6 @@
<ClCompile Include="..\Private\MainLight.cpp" />
<ClCompile Include="..\private\MapObject_Collision.cpp" />
<ClCompile Include="..\Private\Dummy_PhysXDoor.cpp" />
<ClCompile Include="..\private\MapObject_Static.cpp" />
<ClCompile Include="..\private\Spell_Slot.cpp" />
<ClCompile Include="..\private\Terrain.cpp" />
<ClCompile Include="..\Private\Level_PhysXLab.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<CLoadingWidget>(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast<CLoadingWidget**>(&m_pLoadingWidget))))
{
return E_FAIL;
}
Add_Element(TEXT("LoadingWidget"), m_pLoadingWidget);
return S_OK;
}
@@ -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,
+11 -13
View File
@@ -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<CComponent**>(&m_pVIBuffer_UI_InstanceCom))))
if (FAILED(Add_Component<CVIBuffer_Rect>(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()
@@ -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);
+1 -1
View File
@@ -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);
@@ -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();
}
@@ -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<const UI_INSTANCE_DESC*>(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<VTX_INSTANCE_UI*>(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()
@@ -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);
@@ -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);