From 62df366b9415fe919f49b4704679af81241dfbb7 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Fri, 9 Jan 2026 21:35:53 +0900 Subject: [PATCH 1/2] [add] Base cinemachine --- .../Client/Private/Camera_Cinematic.cpp | 105 +++++------ .../Client/Private/Level_Field.cpp | 16 +- Jusin154_Team3D/Client/Private/Loader.cpp | 3 + Jusin154_Team3D/Client/Private/Ranrok.cpp | 13 +- .../Client/Public/Camera_Cinematic.h | 9 +- Jusin154_Team3D/Client/Public/Ranrok.h | 2 + .../Data/CutScene/RanrokCutScene.xml | 172 +++++++++++------- Jusin154_Team3D/Editor/Private/Loader.cpp | 3 + Jusin154_Team3D/Engine/Public/TimeSocket.h | 4 + 9 files changed, 200 insertions(+), 127 deletions(-) diff --git a/Jusin154_Team3D/Client/Private/Camera_Cinematic.cpp b/Jusin154_Team3D/Client/Private/Camera_Cinematic.cpp index c4575561f..3171d4595 100644 --- a/Jusin154_Team3D/Client/Private/Camera_Cinematic.cpp +++ b/Jusin154_Team3D/Client/Private/Camera_Cinematic.cpp @@ -23,27 +23,16 @@ void CCamera_Cinematic::Priority_Update(_float fTimeDelta) return; } if (false == m_bIsCurrentTransition) { - if (m_bEnable_FollowLerp) { - _float fTimeDenom = max(m_vFollowLerpTime.y, FLT_EPSILON); - _vector vNewPos = XMVectorSetW(XMVectorLerp(XMLoadFloat3(&m_vFollowPos_Src), XMLoadFloat3(&m_vFollowPos_Dest), CMyTools::Saturate(m_vFollowLerpTime.x / fTimeDenom)), 1.f); - m_pTransformCom->Set_State(STATE::POSITION, vNewPos); - } - else { - m_pTransformCom->Set_State(STATE::POSITION, m_pFollowTarget->Get_Component()->Get_State(STATE::POSITION)); - } - if (m_bEnable_LookLerp) { - _float fTimeDenom = max(m_vLookLerpTime.y, FLT_EPSILON); - _vector vNewLook = XMVectorSetW(XMVectorLerp(XMLoadFloat3(&m_vLookPos_Src), XMLoadFloat3(&m_vLookPos_Dest), CMyTools::Saturate(m_vLookLerpTime.x / fTimeDenom)), 1.f); - m_pTransformCom->LookAt(vNewLook); - } - else { - m_pTransformCom->LookAt(m_pLookTarget->Get_Component()->Get_State(STATE::POSITION)); - } + m_pLookTargetPart->Priority_Update(fTimeDelta); + m_pFollowTargetPart->Priority_Update(fTimeDelta); + m_pTransformCom->Set_State(STATE::POSITION, m_pFollowTargetPart->Get_WorldPostion()); + m_pTransformCom->LookAt(m_pLookTargetPart->Get_WorldPostion()); } else { - + Transition(fTimeDelta); } m_bActive = true; + Update_LerpTimer(fTimeDelta); __super::Bind_Matrices(); } @@ -55,8 +44,6 @@ void CCamera_Cinematic::Update(_float fTimeDelta) if (false == m_bActive) { return; } - Transition(fTimeDelta); - Update_LerpTimer(fTimeDelta); } void CCamera_Cinematic::Late_Update(_float fTimeDelta) { @@ -86,24 +73,8 @@ void CCamera_Cinematic::Update_LerpTimer(_float fTimeDelta) return; } Lerp_Translation(fTimeDelta); + Lerp_Rotation(fTimeDelta); Lerp_FovY(fTimeDelta); - if (true == m_bEnable_LookLerp) { - m_vLookLerpTime.x += fTimeDelta; - if (m_vLookLerpTime.y <= m_vLookLerpTime.x) { - m_vLookLerpTime.x = 0.f; - XMStoreFloat3(&m_vLookPos_Src, XMLoadFloat3(&m_vLookPos_Dest)); - XMStoreFloat3(&m_vLookPos_Dest, m_pLookTarget->Get_WorldPostion()); - } - } - - if (true == m_bEnable_FollowLerp) { - m_vFollowLerpTime.x += fTimeDelta; - if (m_vFollowLerpTime.y <= m_vFollowLerpTime.x) { - m_vFollowLerpTime.x = 0.f; - XMStoreFloat3(&m_vFollowPos_Src, m_pTransformCom->Get_State(STATE::POSITION)); - XMStoreFloat3(&m_vFollowPos_Dest, m_pFollowTarget->Get_WorldPostion()); - } - } } void CCamera_Cinematic::Set_Priority(_uint iPriority) @@ -131,12 +102,7 @@ void CCamera_Cinematic::Trigger(CTimeSocket& Socket) break; case TIMESOCKET_FUNC::TRANSLATION: { - m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3((_float3*)&pContents->pxTransform.p), 1.f)); - m_pTransformCom->RotationQ(pContents->pxTransform.q); - - _vector vNewPos = m_pTransformCom->Get_State(STATE::POSITION); - m_pFollowTargetPart->Set_WorldPostion(vNewPos); - m_pLookTargetPart->Set_WorldPostion(vNewPos + m_pTransformCom->Get_State(STATE::LOOK) * 10.f); + m_pFollowTargetPart->Set_WorldPostion(XMVectorSetW(XMLoadFloat3((_float3*)&pContents->pxTransform.p), 1.f)); Clear_Lerp_Translation(); } break; case TIMESOCKET_FUNC::TRANSLATION_LERP: @@ -144,6 +110,16 @@ void CCamera_Cinematic::Trigger(CTimeSocket& Socket) Clear_Lerp_Translation(); Start_Lerp_Translation(pContents->vParam_11.x, pContents->pxTransform); } break; + case TIMESOCKET_FUNC::ROTATION: { + m_pTransformCom->RotationQ(pContents->pxTransform.q); + m_pLookTargetPart->Set_WorldPostion(m_pTransformCom->Get_State(STATE::POSITION) + m_pTransformCom->Get_State(STATE::LOOK) * 10.f); + Clear_Lerp_Rotation(); + } break; + case TIMESOCKET_FUNC::ROTATION_LERP: + { + Clear_Lerp_Rotation(); + Start_Lerp_Rotation(pContents->vParam_11.x, pContents->pxTransform); + } break; case TIMESOCKET_FUNC::LOOK_AT: { Set_LookTarget(pContents->pOtherTarget); @@ -232,25 +208,22 @@ void CCamera_Cinematic::Lerp_Translation(_float fTimeDelta) m_vLerpTranslationTimer.x = m_vLerpTranslationTimer.y; m_bLerpTranslation = false; } - _float4x4 ResultMatrix = {}; - CMyTools::MatrixLerp(&m_vLerpTranslationStart, &m_vLerpTranslationEnd, &m_vLerpRotQStart, &m_vLerpRotQEnd, - ResultMatrix, m_vLerpTranslationTimer.x / m_vLerpTranslationTimer.y); - m_pTransformCom->Set_WorldMatrix(ResultMatrix); + + _vector vPos = XMVectorSetW(XMVectorLerp(XMLoadFloat3(&m_vLerpTranslationStart), XMLoadFloat3(&m_vLerpTranslationEnd), m_vLerpTranslationTimer.x / m_vLerpTranslationTimer.y), 1.f); + m_pFollowTargetPart->Set_WorldPostion(vPos); } } void CCamera_Cinematic::Start_Lerp_Translation(_float fTimeMaximum, PSX::PxTransform pxTransform) { _float3 vTrans = { pxTransform.p.x , pxTransform.p.y, pxTransform.p.z }; - _float4 vRotQ = { pxTransform.q.x, pxTransform.q.y, pxTransform.q.z, pxTransform.q.w }; - Start_Lerp_Translation(fTimeMaximum, vTrans, vRotQ); + Start_Lerp_Translation(fTimeMaximum, vTrans); } -void CCamera_Cinematic::Start_Lerp_Translation(_float fTimeMaximum, _float3& vTrans, _float4& vRotQ) +void CCamera_Cinematic::Start_Lerp_Translation(_float fTimeMaximum, _float3& vTrans) { m_bLerpTranslation = { fTimeMaximum != 0 }; m_vLerpTranslationTimer = { 0.f, fTimeMaximum }; - m_pTransformCom->Compress_WorldMatrix(m_vLerpTranslationStart, m_vLerpRotQStart); + XMStoreFloat3(&m_vLerpTranslationStart, m_pTransformCom->Get_State(STATE::POSITION)); m_vLerpTranslationEnd = vTrans; - m_vLerpRotQEnd = vRotQ; } void CCamera_Cinematic::Clear_Lerp_Translation() { @@ -258,6 +231,36 @@ void CCamera_Cinematic::Clear_Lerp_Translation() m_vLerpTranslationTimer = {}; m_vLerpTranslationStart = {}; m_vLerpTranslationEnd = {}; +} +void CCamera_Cinematic::Lerp_Rotation(_float fTimeDelta) +{ + if (true == m_bLerpRotiation) { + m_vLerpRotiationTimer.x += fTimeDelta; + if (m_vLerpRotiationTimer.y < m_vLerpRotiationTimer.x) { + m_vLerpRotiationTimer.x = m_vLerpRotiationTimer.y; + m_bLerpRotiation = false; + } + _vector vRotQ = XMQuaternionSlerp(XMLoadFloat4(&m_vLerpRotQStart), XMLoadFloat4(&m_vLerpRotQEnd), m_vLerpRotiationTimer.x / m_vLerpRotiationTimer.y); + _vector vPos = m_pTransformCom->Get_State(STATE::POSITION); + m_pLookTargetPart->Get_Component()->RotationQ(vRotQ); + } +} +void CCamera_Cinematic::Start_Lerp_Rotation(_float fTimeMaximum, PSX::PxTransform pxTransform) +{ + _float4 vRotQ = { pxTransform.q.x, pxTransform.q.y, pxTransform.q.z, pxTransform.q.w }; + Start_Lerp_Rotation(fTimeMaximum, vRotQ); +} +void CCamera_Cinematic::Start_Lerp_Rotation(_float fTimeMaximum, _float4& vRotQ) +{ + m_bLerpRotiation = { fTimeMaximum != 0 }; + m_vLerpRotiationTimer = { 0.f, fTimeMaximum }; + XMStoreFloat4(&m_vLerpRotQStart, m_pTransformCom->Get_QuarternionVector()); + m_vLerpRotQEnd = vRotQ; +} +void CCamera_Cinematic::Clear_Lerp_Rotation() +{ + m_bLerpRotiation = { false }; + m_vLerpRotiationTimer = {}; m_vLerpRotQStart = {}; m_vLerpRotQEnd = {}; } diff --git a/Jusin154_Team3D/Client/Private/Level_Field.cpp b/Jusin154_Team3D/Client/Private/Level_Field.cpp index 3c61e99f5..fb2a5d965 100644 --- a/Jusin154_Team3D/Client/Private/Level_Field.cpp +++ b/Jusin154_Team3D/Client/Private/Level_Field.cpp @@ -531,21 +531,23 @@ void CLevel_Field::Load_CutSceneXML(const string& path, CCamera* pCamera, CMonst SocketContents.strEventName = pEventNameText ? pEventNameText : ""; SocketContents.eTypeParam = TIMESOCKET_PARAM::END; - if (const _char* pTypeText = pInfoNode->Attribute("eTypeParam")) + const _char* pTypeText = pInfoNode->Attribute("eTypeParam"); + if (nullptr != pTypeText) { CTimeSocket::TryParse_TimeSocketParam(string_view(pTypeText), SocketContents.eTypeParam); } SocketContents.eTypeFunc = TIMESOCKET_FUNC::END; - if (const _char* pFuncText = pInfoNode->Attribute("eTypeFunc")) + const _char* pFuncText = pInfoNode->Attribute("eTypeFunc"); + if (nullptr != pFuncText) { CTimeSocket::TryParse_TimeSocketFunc(string_view(pFuncText), SocketContents.eTypeFunc); } SocketContents.pEventTarget = nullptr; SocketContents.funcEvent = nullptr; - - if (const _char* pTargetText = pInfoNode->Attribute("pTarget")) + const _char* pTargetText = pInfoNode->Attribute("pTarget"); + if (nullptr != pTargetText) { if (strcmp(pTargetText, "CAMERA_CINEMATIC") == 0) { @@ -565,6 +567,12 @@ void CLevel_Field::Load_CutSceneXML(const string& path, CCamera* pCamera, CMonst SocketContents.pEventTarget = pEventTarget; SocketContents.funcEvent = [pEventTarget](CTimeSocket& Socket) { pEventTarget->Trigger(Socket); }; } + else if (strcmp(pTargetText, "ACTOR_RANROK") == 0) + { + CMonster* pEventTarget = pMonster; + SocketContents.pEventTarget = pEventTarget; + SocketContents.funcEvent = [pEventTarget](CTimeSocket& Socket) { pEventTarget->Trigger(Socket); }; + } } } diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 023159524..8658c0311 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -1108,6 +1108,9 @@ HRESULT CLoader::Loading_For_GamePlay() jobMapShaders.emplace_back(Deferred_ShaderLoad(m_pDevice, m_pContext, FX_MESH, TEXT("../Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl"), VTXMESH::Elements, VTXMESH::iNumElements)); + jobMapShaders.emplace_back(Deferred_ShaderLoad(m_pDevice, m_pContext, + FX_VTXPOS, + TEXT("../Bin/Resources/ShaderFiles/Shader_VtxPos.hlsl"), VTXPOS::Elements, VTXPOS::iNumElements)); } #pragma endregion diff --git a/Jusin154_Team3D/Client/Private/Ranrok.cpp b/Jusin154_Team3D/Client/Private/Ranrok.cpp index 5fa7c9031..a4bb192ba 100644 --- a/Jusin154_Team3D/Client/Private/Ranrok.cpp +++ b/Jusin154_Team3D/Client/Private/Ranrok.cpp @@ -80,6 +80,7 @@ HRESULT CRanrok::Initialize(void* pArg) m_pModelCom->Set_DisableRootMotionScale(true); + m_pTransformCom->Compress_WorldMatrix(m_vInitialTrans, m_vInitialRotQ); return S_OK; } @@ -336,7 +337,9 @@ void CRanrok::Trigger(CTimeSocket& Socket) }break; case TIMESOCKET_FUNC::SET_FSMSTATE: { - m_pFSM->Change_State(FSMSTATE::TUCKED); + if (Socket.m_Contents.vFlags.b[0]) { + m_pFSM->Change_State(FSMSTATE::TUCKED); + } }break; default: break; @@ -990,7 +993,13 @@ void CRanrok::Describe_Entity() GUI::Begin("UNIT", 0, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("Ranrak")) { __super::Describe_Entity(); - + if (GUI::SmallButton("ResetPos")) { + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vInitialTrans), 1.f)); + m_pCharacter_Controller->Set_Position(m_pTransformCom->Get_State(STATE::POSITION)); + m_pTransformCom->RotationQ(XMLoadFloat4(&m_vInitialRotQ)); + m_iCurrentFlow = 0; + m_iCurrentPoint = 0; + } string AnimList = m_pModelCom->Get_AnimList(m_pModelCom->Get_AnimIndex()); GUI::Text(AnimList.c_str()); diff --git a/Jusin154_Team3D/Client/Public/Camera_Cinematic.h b/Jusin154_Team3D/Client/Public/Camera_Cinematic.h index 9cda58935..d6ae9441a 100644 --- a/Jusin154_Team3D/Client/Public/Camera_Cinematic.h +++ b/Jusin154_Team3D/Client/Public/Camera_Cinematic.h @@ -41,8 +41,12 @@ class CCamera_Cinematic final : public CCamera void Lerp_Translation(_float fTimeDelta); void Start_Lerp_Translation(_float fTimeMaximum, PSX::PxTransform pxTransform); - void Start_Lerp_Translation(_float fTimeMaximum, _float3& vTrans, _float4& vRotQ); + void Start_Lerp_Translation(_float fTimeMaximum, _float3& vTrans); void Clear_Lerp_Translation(); + void Lerp_Rotation(_float fTimeDelta); + void Start_Lerp_Rotation(_float fTimeMaximum, PSX::PxTransform pxTransform); + void Start_Lerp_Rotation(_float fTimeMaximum, _float4& vRotQ); + void Clear_Lerp_Rotation(); void Lerp_FovY(_float fTimeDelta); @@ -57,6 +61,9 @@ class CCamera_Cinematic final : public CCamera _bool m_bLerpTranslation = { false }; _float2 m_vLerpTranslationTimer = {}; + _bool m_bLerpRotiation = { false }; + _float2 m_vLerpRotiationTimer = {}; + _float3 m_vLerpTranslationStart = {}; _float3 m_vLerpTranslationEnd = {}; _float4 m_vLerpRotQStart = {}; diff --git a/Jusin154_Team3D/Client/Public/Ranrok.h b/Jusin154_Team3D/Client/Public/Ranrok.h index 691515ae9..c384a6502 100644 --- a/Jusin154_Team3D/Client/Public/Ranrok.h +++ b/Jusin154_Team3D/Client/Public/Ranrok.h @@ -93,6 +93,8 @@ class CRanrok final : public CMonster #ifdef _DEBUG virtual void Describe_Entity() override; + _float4 m_vInitialRotQ = {}; + _float3 m_vInitialTrans = {}; #endif // _DEBUG private: diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/CutScene/RanrokCutScene.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/CutScene/RanrokCutScene.xml index f8e2e8a02..4fb2b8e57 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/CutScene/RanrokCutScene.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/CutScene/RanrokCutScene.xml @@ -67,6 +67,40 @@ + + + + + + + + + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + + + + @@ -101,40 +135,6 @@ - - - - - - - - - - - true - false - false - false - false - false - false - false - false - false - false - false - false - false - false - false - - - - - - - - @@ -169,40 +169,6 @@ - - - - - - - - - - - false - false - false - false - false - false - false - false - false - false - false - false - false - false - false - false - - - - - - - - @@ -237,6 +203,74 @@ + + + + + + + + + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + + + + + + + + + + + + + + + true + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + + + + @@ -302,7 +336,7 @@ - + diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index d2a5d8677..a7191b260 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -377,6 +377,9 @@ HRESULT CLoader::Loading_For_Logo() jobMapShaders.emplace_back(Deferred_ShaderLoad(m_pDevice, m_pContext, FX_MESH, TEXT("../Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl"), VTXMESH::Elements, VTXMESH::iNumElements)); + jobMapShaders.emplace_back(Deferred_ShaderLoad(m_pDevice, m_pContext, + FX_VTXPOS, + TEXT("../Bin/Resources/ShaderFiles/Shader_VtxPos.hlsl"), VTXPOS::Elements, VTXPOS::iNumElements)); } m_strMessage = TEXT("Texture Loading.."); diff --git a/Jusin154_Team3D/Engine/Public/TimeSocket.h b/Jusin154_Team3D/Engine/Public/TimeSocket.h index bf66c54ee..ed1c29947 100644 --- a/Jusin154_Team3D/Engine/Public/TimeSocket.h +++ b/Jusin154_Team3D/Engine/Public/TimeSocket.h @@ -24,6 +24,8 @@ typedef enum class typeTimeSocket_Func { // COMMON TRANSLATION, TRANSLATION_LERP, + ROTATION, + ROTATION_LERP, TOGGLE_FLAGS, // CAMERA @@ -57,6 +59,8 @@ static constexpr pair g_SocketFuncTypeTable[ENUM_C { {"TRANSLATION", TIMESOCKET_FUNC::TRANSLATION}, {"TRANSLATION_LERP", TIMESOCKET_FUNC::TRANSLATION_LERP}, + {"ROTATION", TIMESOCKET_FUNC::ROTATION}, + {"ROTATION_LERP", TIMESOCKET_FUNC::ROTATION_LERP}, {"TOGGLE_FLAGS", TIMESOCKET_FUNC::TOGGLE_FLAGS}, {"BIND_CAMERA", TIMESOCKET_FUNC::BIND_CAMERA}, From 581ecc6aa3186d770ead1c6aa448c1ef758db991 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Fri, 9 Jan 2026 21:41:30 +0900 Subject: [PATCH 2/2] [fix] PackingDebug --- Jusin154_Team3D/Client/Private/Ranrok.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jusin154_Team3D/Client/Private/Ranrok.cpp b/Jusin154_Team3D/Client/Private/Ranrok.cpp index a4bb192ba..4387b797f 100644 --- a/Jusin154_Team3D/Client/Private/Ranrok.cpp +++ b/Jusin154_Team3D/Client/Private/Ranrok.cpp @@ -79,8 +79,10 @@ HRESULT CRanrok::Initialize(void* pArg) m_pModelCom->Set_DisableRootMotionScale(true); - +#ifdef _DEBUG m_pTransformCom->Compress_WorldMatrix(m_vInitialTrans, m_vInitialRotQ); +#endif // _DEBUG + return S_OK; }