From 6b83edfcd9a238c4e3b57734bbe47e9a0895601c Mon Sep 17 00:00:00 2001 From: hyunbin14 Date: Sun, 28 Dec 2025 10:05:40 +0900 Subject: [PATCH] =?UTF-8?q?=EC=88=98=EC=A0=95=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jusin154_Team3D/Client/Private/Ranrok.cpp | 6 +++-- .../Client/Private/Ranrok_FireBall.cpp | 2 -- .../Client/Private/Ranrok_States.cpp | 8 +++---- .../ShaderFiles/Shader_Local_Compute.hlsl | 9 +++++--- .../ShaderFiles/Shader_Mesh_Compute.hlsl | 7 +++++- .../ShaderFiles/Shader_Local_Compute.hlsl | 11 ++++++--- .../ShaderFiles/Shader_Mesh_Compute.hlsl | 7 +++++- Jusin154_Team3D/Engine/Private/Model.cpp | 23 +++++++++++++++++++ Jusin154_Team3D/Engine/Public/Engine_Enum.h | 2 +- Jusin154_Team3D/Engine/Public/Model.h | 13 +++++++++-- 10 files changed, 69 insertions(+), 19 deletions(-) diff --git a/Jusin154_Team3D/Client/Private/Ranrok.cpp b/Jusin154_Team3D/Client/Private/Ranrok.cpp index 741617bc3..09a6abacc 100644 --- a/Jusin154_Team3D/Client/Private/Ranrok.cpp +++ b/Jusin154_Team3D/Client/Private/Ranrok.cpp @@ -160,9 +160,11 @@ void CRanrok::Late_Update(_float fTimeDelta) if (!m_pFSM->IsEnable(FSMSTATE::TUCKED)) { - if (true == m_bLookAt) { + /* if (true == m_bLookAt) { m_pTransformCom->LookAt_Horizontal_Lerp(XMLoadFloat4(&m_vTargetPos), fTimeDelta, 3.f); - } + + }*/ + m_pModelCom->Set_TargetPos((XMLoadFloat4(&m_vTargetPos))); } m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); diff --git a/Jusin154_Team3D/Client/Private/Ranrok_FireBall.cpp b/Jusin154_Team3D/Client/Private/Ranrok_FireBall.cpp index 503b3d11e..313eb4932 100644 --- a/Jusin154_Team3D/Client/Private/Ranrok_FireBall.cpp +++ b/Jusin154_Team3D/Client/Private/Ranrok_FireBall.cpp @@ -111,7 +111,6 @@ HRESULT CRanrok_FireBall::Pre_Setting(CGameObject* pObject, void* pArg) m_pFireBall->Set_Visible(true); m_pFireBall_PT->Set_Visible(true); m_pFireBall_Surface->Set_Visible(true); - m_pFireBall_Tail->Set_Visible(true); /* 초기 객체 위치 초기화*/ @@ -132,7 +131,6 @@ HRESULT CRanrok_FireBall::Pre_Setting(CGameObject* pObject, void* pArg) m_pFireBall->Get_Component()->Set_State(STATE::POSITION, vStartPos); m_pFireBall_PT->Get_Component()->Set_State(STATE::POSITION, vStartPos); m_pFireBall_Surface->Get_Component()->Set_State(STATE::POSITION, vStartPos); - m_pFireBall_Tail->Get_Component()->Set_State(STATE::POSITION, vStartPos); /* 플레이어 위치 받기 */ diff --git a/Jusin154_Team3D/Client/Private/Ranrok_States.cpp b/Jusin154_Team3D/Client/Private/Ranrok_States.cpp index fdb96edfb..cb4028dd8 100644 --- a/Jusin154_Team3D/Client/Private/Ranrok_States.cpp +++ b/Jusin154_Team3D/Client/Private/Ranrok_States.cpp @@ -292,12 +292,12 @@ void CRanrok::Behavior_FireBreathEnter() Add_Event(pairAnimInfo.first, [&]() { pairAnimInfo = m_Animation[STATEANIM::FIREBREATH_A]; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); - m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBREATH)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBREATH)]; }, + m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBREATH)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBREATH)];}, 0.95f); Add_Event(m_Animation[STATEANIM::FIREBREATH_A].first, [&]() { pairAnimInfo = m_Animation[STATEANIM::FIREBREATH_COOLDOWN_A]; - m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); }, + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);}, 0.95f); } else if (m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_GROUND)) @@ -405,10 +405,10 @@ void CRanrok::Behavior_FireBallEnter() break; } - Add_Event(pairAnimInfo.first, + /*Add_Event(pairAnimInfo.first, [this]() { m_pEffectPool->Use_Skill(SKILL_TYPE::RANROK_FIREBALL, this); - }, 0.1f); + }, 0.1f);*/ } else if (m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_GROUND)) diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl index a8ac33933..dd8cb9381 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl @@ -42,7 +42,12 @@ cbuffer AnimCB : register(b0) float BlendRatio; int RootBoneIndex; - float3 _pad0; + int HeadBoneIndex; + float HeadAimWeight; + float paddding1; + + float3 TargetDir_Local; + float padding; row_major float4x4 PreTransformMatrix; float4 RootInitRot; @@ -315,8 +320,6 @@ row_major float4x4 SampleBlendedLocal(uint bone) prevT = CurrentTime; } - - SampleLocalTRS_Prev(bone, prevT, sA, rA, tA); SampleLocalTRS_Cur(bone, CurrentTime, sB, rB, tB); diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl index e87c7476e..de4ca9daf 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl @@ -24,7 +24,12 @@ cbuffer AnimCB : register(b0) float BlendRatio; int RootBoneIndex; - float3 _pad0; + int HeadBoneIndex; + float HeadAimWeight; + float paddding1; + + float3 TargetDir_Local; + float padding; row_major float4x4 PreTransformMatrix; float4 RootInitRot; diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl index a8ac33933..d82a9ea23 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl @@ -42,7 +42,12 @@ cbuffer AnimCB : register(b0) float BlendRatio; int RootBoneIndex; - float3 _pad0; + int HeadBoneIndex; + float HeadAimWeight; + float paddding1; + + float3 TargetDir_Local; + float padding; row_major float4x4 PreTransformMatrix; float4 RootInitRot; @@ -315,8 +320,6 @@ row_major float4x4 SampleBlendedLocal(uint bone) prevT = CurrentTime; } - - SampleLocalTRS_Prev(bone, prevT, sA, rA, tA); SampleLocalTRS_Cur(bone, CurrentTime, sB, rB, tB); @@ -329,6 +332,8 @@ row_major float4x4 SampleBlendedLocal(uint bone) T = 0; R = RootInitRot; } + + return MakeAffine(S, R, T); } diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl index e87c7476e..de4ca9daf 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl @@ -24,7 +24,12 @@ cbuffer AnimCB : register(b0) float BlendRatio; int RootBoneIndex; - float3 _pad0; + int HeadBoneIndex; + float HeadAimWeight; + float paddding1; + + float3 TargetDir_Local; + float padding; row_major float4x4 PreTransformMatrix; float4 RootInitRot; diff --git a/Jusin154_Team3D/Engine/Private/Model.cpp b/Jusin154_Team3D/Engine/Private/Model.cpp index 7a42d8cb7..e13ef7e13 100644 --- a/Jusin154_Team3D/Engine/Private/Model.cpp +++ b/Jusin154_Team3D/Engine/Private/Model.cpp @@ -1341,6 +1341,10 @@ void CModel::InItialize_BoneIndex() { m_iBoneIndex[ENUM_CLASS(BLEND_BONE::NECK)] = i; } + if (m_Bones[i]->Compare_Name("head")) + { + m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HEAD)] = i; + } } } @@ -1685,6 +1689,8 @@ void CModel::ComputeAnimation(_uint AnimIndex,_uint MeshIndex) void CModel::ComputeLocal(_uint AnimIndex, _uint MeshIndex) { + + D3D11_MAPPED_SUBRESOURCE ConstantSubResource = {}; auto* anim = m_Animations[AnimIndex]; @@ -1702,6 +1708,23 @@ void CModel::ComputeLocal(_uint AnimIndex, _uint MeshIndex) pDesc->PrevTime = m_Animations[m_iPreAnimIndex]->Get_CurrentTrackPosition(); pDesc->BlendRatio = m_fRatio; pDesc->RootBoneIndex = m_iRootBoneIndex; + pDesc->HeadBoneIndex = m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HEAD)]; + pDesc->HeadAimWeight = 1.f; + pDesc->paddding1 = 0.f; + if (m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HEAD)] != -1) + { + _vector dirWS = XMVector3Normalize(m_vTargetPos - m_pTransform->Get_State(STATE::POSITION)); + + _matrix worldInv = m_pTransform->Get_WorldMatrixInv(); + + _vector dirLocal =XMVector3Normalize(XMVector3TransformNormal(dirWS, worldInv)); + + XMStoreFloat3(&pDesc->TargetDir_Local, dirLocal); + } + else { + pDesc->TargetDir_Local = _float3(0.f, 0.f, 0.f); + } + pDesc->padding = 0.f; pDesc->PreTransformMatrix = m_PreTransformMatrix; pDesc->RootInitRot = m_vInitialRootRot; m_pContext->Unmap(m_pConstantBuffer, 0); diff --git a/Jusin154_Team3D/Engine/Public/Engine_Enum.h b/Jusin154_Team3D/Engine/Public/Engine_Enum.h index 422570c33..26262d4fb 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Enum.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Enum.h @@ -8,7 +8,7 @@ enum class COLLIDER { AABB, OBB, SPHERE, END }; enum class RENDER {PRIORITY, SHADOW_NEAR, NONBLEND, DECAL, BLUR, NONLIGHT, EFFECT ,BLEND, BLOOM, DISTORTION, BULR_MESH ,UI, OCCLUSION, SHADOW_MIDDLE, PRESHADOW, UI_OVERLAY ,END }; enum class RAY { LOCAL, WORLD, END }; enum class ACTOR { BOX, CAPSULE, SPHERE, PLANE, TRIANGLEMESH, HEIGHTFIELD, END }; -enum class BLEND_BONE{SPINE,SHOULDER_L,SHOULDER_R,NECK,SHOULDER_NECK_L, SHOULDER_NECK_R,END}; +enum class BLEND_BONE{SPINE,SHOULDER_L,SHOULDER_R,NECK,SHOULDER_NECK_L, SHOULDER_NECK_R,HEAD,END}; enum class STAT { NAME, CURRENTHP, MAXHP, TARGETHP, MELEE, MAGIC, DEFENSE, SPEED, AGILITY, LEVEL, EXPERIENCE, MAX_EXPERIENCE, GOLD, END }; //enum class CONDITION { POISON, HPREGENERATION, PANIC, GRAP, END }; enum class SHADOW : _ubyte { diff --git a/Jusin154_Team3D/Engine/Public/Model.h b/Jusin154_Team3D/Engine/Public/Model.h index f35f45a51..4aeb61011 100644 --- a/Jusin154_Team3D/Engine/Public/Model.h +++ b/Jusin154_Team3D/Engine/Public/Model.h @@ -20,7 +20,12 @@ class ENGINE_DLL CModel final : public CComponent _float BlendRatio; _int RootBoneIndex; - _float3 padding; + _int HeadBoneIndex; + _float HeadAimWeight; + _float paddding1; + + _float3 TargetDir_Local; + _float padding; _float4x4 PreTransformMatrix; _float4 RootInitRot; @@ -43,6 +48,8 @@ class ENGINE_DLL CModel final : public CComponent virtual HRESULT Render_Indexed(_uint iMeshIndex, _uint IndexCount, _uint StartIndexLocation, _uint BaseVertexLocation); MODEL Get_Type() { return m_eType; } void Set_Temp(_bool Temp) { m_bTemp = Temp; } + void Set_TargetPos(_vector vTargetPos) { m_vTargetPos = vTargetPos; } + void Set_HeadPos(_vector vHeadPos) { m_vHeadPos = vHeadPos; } #pragma endregion #pragma region Animation _bool Play_Animation(_float fTimeDelta, class CTransform* pTransform = nullptr); // 애니메이션에 델타타임을 넣어줌 @@ -164,7 +171,7 @@ class ENGINE_DLL CModel final : public CComponent _float m_fRatio = {}; _int m_iCurrSecondAnimIndex = { -1 }; - _int m_iBoneIndex[ENUM_CLASS(BLEND_BONE::END)] = { -1,-1,-1,-1,-1,-1 }; + _int m_iBoneIndex[ENUM_CLASS(BLEND_BONE::END)] = { -1,-1,-1,-1,-1,-1,-1 }; vector> m_BoneMask; vector<_bool> m_CPUBoneMask; @@ -195,6 +202,8 @@ class ENGINE_DLL CModel final : public CComponent _bool m_bRootBone = {}; _float4x4 m_RootMatrix = {}; _bool m_bTemp = {false}; + _vector m_vTargetPos = XMVectorZero(); + _vector m_vHeadPos = XMVectorZero(); private: