From d1b471c0674256b7ca357440f316f4738e588f0e Mon Sep 17 00:00:00 2001 From: kimnuri Date: Fri, 9 Jan 2026 13:35:56 +0900 Subject: [PATCH] [add] Basic Cinemachine --- Jusin154_Team3D/Client/Default/Client.vcxproj | 2 + .../Client/Default/Client.vcxproj.filters | 9 + .../Client/Private/CamPosition_Shoulder.cpp | 18 +- .../Client/Private/Camera_Cinematic.cpp | 301 +++++++++++++++ .../Client/Private/Camera_Debug.cpp | 9 +- .../Client/Private/Camera_Gaze.cpp | 45 +++ .../Client/Private/CutSceneInfo.cpp | 48 ++- .../Client/Private/InfoInstance.cpp | 4 +- .../Client/Private/Level_Field.cpp | 326 ++++++++++++++++- .../Client/Private/Level_GamePlay.cpp | 22 +- Jusin154_Team3D/Client/Private/Loader.cpp | 9 +- Jusin154_Team3D/Client/Private/Player.cpp | 28 ++ Jusin154_Team3D/Client/Private/Ranrok.cpp | 28 ++ Jusin154_Team3D/Client/Private/Ride_Panel.cpp | 2 +- .../Private/SpellLearn_ChaserPointer.cpp | 2 +- .../Client/Private/SpellLearn_Overlay.cpp | 2 +- .../Client/Private/SpellLearn_Slot.cpp | 2 +- .../Client/Public/Camera_Cinematic.h | 76 ++++ Jusin154_Team3D/Client/Public/Camera_Gaze.h | 12 +- Jusin154_Team3D/Client/Public/Client_Macro.h | 1 + Jusin154_Team3D/Client/Public/CutSceneInfo.h | 13 +- Jusin154_Team3D/Client/Public/InfoInstance.h | 2 +- Jusin154_Team3D/Client/Public/Level_Field.h | 11 + Jusin154_Team3D/Client/Public/Player.h | 1 + Jusin154_Team3D/Client/Public/Ranrok.h | 1 + .../Data/CutScene/RanrokCutScene.xml | 342 ++++++++++++++++++ .../Editor/Private/CamPosition_Shoulder.cpp | 16 +- .../Editor/Private/LoadingWidget.cpp | 2 +- .../Editor/Private/Mission_Icon.cpp | 2 +- Jusin154_Team3D/Editor/Private/Ride_Panel.cpp | 2 +- .../Private/SpellLearn_ChaserPointer.cpp | 2 +- .../Editor/Private/SpellLearn_Overlay.cpp | 2 +- .../Editor/Private/SpellLearn_Slot.cpp | 2 +- .../Editor/Public/CamPosition_Shoulder.h | 4 +- Jusin154_Team3D/Engine/Private/Camera.cpp | 14 +- .../Engine/Private/Camera_Manager.cpp | 6 + .../Engine/Private/ElementObject.cpp | 2 +- .../Engine/Private/GameInstance.cpp | 4 + Jusin154_Team3D/Engine/Private/Model.cpp | 30 +- Jusin154_Team3D/Engine/Private/NPCStat.cpp | 2 +- .../Engine/Private/PanelObject.cpp | 2 +- Jusin154_Team3D/Engine/Private/TimeSocket.cpp | 88 +++-- Jusin154_Team3D/Engine/Private/Transform.cpp | 74 ++++ Jusin154_Team3D/Engine/Private/UIObject.cpp | 2 +- Jusin154_Team3D/Engine/Private/tinyxml2.cpp | 2 +- Jusin154_Team3D/Engine/Public/Camera.h | 8 +- .../Engine/Public/Camera_Manager.h | 1 + Jusin154_Team3D/Engine/Public/ElementObject.h | 2 +- Jusin154_Team3D/Engine/Public/Engine_Struct.h | 4 + Jusin154_Team3D/Engine/Public/GameInstance.h | 1 + Jusin154_Team3D/Engine/Public/Model.h | 2 +- Jusin154_Team3D/Engine/Public/MyTools.h | 49 +++ Jusin154_Team3D/Engine/Public/PanelObject.h | 2 +- .../PxVehiclePhysXConstraintStates.h | 4 +- Jusin154_Team3D/Engine/Public/TimeSocket.h | 127 +++++-- Jusin154_Team3D/Engine/Public/Transform.h | 3 + Jusin154_Team3D/Engine/Public/UIObject.h | 2 +- Jusin154_Team3D/Engine/Public/Unit.h | 1 + 58 files changed, 1620 insertions(+), 160 deletions(-) create mode 100644 Jusin154_Team3D/Client/Private/Camera_Cinematic.cpp create mode 100644 Jusin154_Team3D/Client/Public/Camera_Cinematic.h create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Data/CutScene/RanrokCutScene.xml diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj b/Jusin154_Team3D/Client/Default/Client.vcxproj index 300e277cd..d9a9337f9 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj @@ -175,6 +175,7 @@ call Update_Resources.bat + @@ -463,6 +464,7 @@ call Update_Resources.bat + diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters index 265498909..bb29d792a 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters @@ -884,6 +884,9 @@ 03.InfoInstance\04.CutSceneInfo + + 02.GameObjects\Cameras\Camera_Cinematic + @@ -1833,6 +1836,9 @@ {d07bd195-0cdf-4a47-8c50-e3a88361352f} + + {581e7b08-09ae-4e52-8e84-d6ac8cc94dc9} + @@ -2670,6 +2676,9 @@ 03.InfoInstance\04.CutSceneInfo + + 02.GameObjects\Cameras\Camera_Cinematic + diff --git a/Jusin154_Team3D/Client/Private/CamPosition_Shoulder.cpp b/Jusin154_Team3D/Client/Private/CamPosition_Shoulder.cpp index bd50d7874..b1da4dd04 100644 --- a/Jusin154_Team3D/Client/Private/CamPosition_Shoulder.cpp +++ b/Jusin154_Team3D/Client/Private/CamPosition_Shoulder.cpp @@ -165,7 +165,7 @@ void CCamPosition_Shoulder::Update(_float fTimeDelta) } else if(m_bZoomIn) { - m_pBinded_Camera->Set_Fov(XMConvertToRadians(60.f),fTimeDelta, m_bZoomIn); + m_pBinded_Camera->Set_FovSlope(XMConvertToRadians(60.f),fTimeDelta, m_bZoomIn); } } @@ -292,8 +292,20 @@ _vector CCamPosition_Shoulder::Calc_BestPosition(_fvector vCastingPosition, _gve CMyTools::SortHitsByDistance(sweepHits); // 벽면에서 팔로우 타겟을 살짝 띄우는 오프셋 - _float fCameraSurfaceOffset = 0.05f; - _float fCameraMinDistance = 0.20f; + + static _float fCameraSurfaceOffset = 0.20f; // 높이면 카메라가 벽으로부터 좀 더 안정적으로 띄워지지만 벽에 바짝 붙은 플레이어를 감당불가 + static _float fCameraMinDistance = 0.71f; // 높이면 + +#ifdef _DEBUG + GUI::Begin("CAMERA"); + if (GUI::TreeNode("MinSurfaceOffset")) { + GUI::DragFloat("fCameraMinDistance", &fCameraMinDistance, 0.01f, 0.01f, 1.f); + GUI::DragFloat("fCameraSurfaceOffset", &fCameraSurfaceOffset, 0.01f, 0.01f, 1.f); + GUI::TreePop(); + } + GUI::End(); +#endif // _DEBUG + _float fDistance = { }; _float fFinalTargetDistance = fZeroSafeDistance; for (auto& hit : sweepHits) diff --git a/Jusin154_Team3D/Client/Private/Camera_Cinematic.cpp b/Jusin154_Team3D/Client/Private/Camera_Cinematic.cpp new file mode 100644 index 000000000..987f202b0 --- /dev/null +++ b/Jusin154_Team3D/Client/Private/Camera_Cinematic.cpp @@ -0,0 +1,301 @@ +#include "pch.h" +#include "Camera_Cinematic.h" +#include "InfoInstance.h" +#include "TimeSocket.h" +#include "Layer.h" + + +CCamera_Cinematic::CCamera_Cinematic(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CCamera(pDevice, pContext) +{ +} + +CCamera_Cinematic::CCamera_Cinematic(const CCamera_Cinematic& rhs) + : CCamera(rhs), + m_pInfoInstance(CInfoInstance::GetInstance()) +{ +} + +void CCamera_Cinematic::Priority_Update(_float fTimeDelta) +{ + if (false == m_bActive) { + return; + } + m_bActive = true; + __super::Bind_Matrices(); +} + +void CCamera_Cinematic::Update(_float fTimeDelta) +{ +#ifdef _DEBUG + Describe_Entity(); +#endif // _DEBUG + if (false == m_bActive) { + return; + } + Transition(fTimeDelta); + Update_LerpTimer(fTimeDelta); + +} +void CCamera_Cinematic::Late_Update(_float fTimeDelta) +{ + if (false == m_bActive) { + return; + } +} +HRESULT CCamera_Cinematic::Render() +{ + return S_OK; +} + +void CCamera_Cinematic::Update_LerpTimer(_float fTimeDelta) +{ + if (false == m_bActive) { + return; + } + Lerp_Translation(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) +{ + m_iPriority = iPriority; +} + +void CCamera_Cinematic::Set_LookTarget(CGameObject* pTarget) +{ + SAFE_RELEASE(m_pLookTarget); + m_pLookTarget = pTarget; + SAFE_ADDREF(m_pLookTarget); +} + +void CCamera_Cinematic::Set_FollowTarget(CGameObject* pTarget) +{ + SAFE_RELEASE(m_pFollowTarget); + m_pFollowTarget = pTarget; + SAFE_ADDREF(m_pFollowTarget); +} + +void CCamera_Cinematic::Trigger(CTimeSocket& Socket) +{ + SOCKETCONTENTS* pContents = &Socket.m_Contents; + switch (pContents->eTypeFunc) + { + case TIMESOCKET_FUNC::BIND_CAMERA: + m_pGameInstance->Bind_Camera(NEXT_LEVEL, pContents->wstrKeyName, true); + 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); + Clear_Lerp_Translation(); + break; + case TIMESOCKET_FUNC::TRANSLATION_LERP: + { + Clear_Lerp_Translation(); + Start_Lerp_Translation(pContents->vParam_11.x, pContents->pxTransform); + } break; + case TIMESOCKET_FUNC::LOOK_AT: + { + Set_LookTarget(pContents->pOtherTarget); + }break; + case TIMESOCKET_FUNC::DONT_LOOK_AT: + { + Set_LookTarget(pContents->pOtherTarget); + }break; + case TIMESOCKET_FUNC::ZOOM_IN: + { + Set_Fov(XMConvertToRadians(pContents->vParam_11.x)); + }break; + case TIMESOCKET_FUNC::ZOOM_OUT: + { + Set_Fov(XMConvertToRadians(pContents->vParam_11.x)); + }break; + case TIMESOCKET_FUNC::ZOOM_LERP: + { + Start_Lerp_FovY(pContents->vParam_11.z, { pContents->vParam_11.x, pContents->vParam_11.y }); + Set_Fov(XMConvertToRadians(pContents->vParam_11.x)); + }break; + case TIMESOCKET_FUNC::END_CINEMATIC: + { + m_pGameInstance->Bind_Camera(CURRENT_LEVEL, Socket.m_Contents.wstrKeyName, true); + }break; + default: + break; + } +} + +HRESULT CCamera_Cinematic::Initialize_Prototype() +{ + return S_OK; +} +HRESULT CCamera_Cinematic::Initialize(void* pArg) +{ + + if (FAILED(__super::Initialize(pArg))) { + return E_FAIL; + } + + if (FAILED(Ready_Components(pArg))) { + return E_FAIL; + } + + return S_OK; +} +HRESULT CCamera_Cinematic::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + return S_OK; +} +HRESULT CCamera_Cinematic::Bind_ShaderResources() +{ + return S_OK; +} +void CCamera_Cinematic::Lerp_Translation(_float fTimeDelta) +{ + if (true == m_bLerpTranslation) { + m_vLerpTranslationTimer.x += fTimeDelta; + if (m_vLerpTranslationTimer.y < m_vLerpTranslationTimer.x) { + 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); + } +} +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); +} +void CCamera_Cinematic::Start_Lerp_Translation(_float fTimeMaximum, _float3& vTrans, _float4& vRotQ) +{ + m_bLerpTranslation = { fTimeMaximum != 0 }; + m_vLerpTranslationTimer = { 0.f, fTimeMaximum }; + m_pTransformCom->Compress_WorldMatrix(m_vLerpTranslationStart, m_vLerpRotQStart); + m_vLerpTranslationEnd = vTrans; + m_vLerpRotQEnd = vRotQ; +} +void CCamera_Cinematic::Clear_Lerp_Translation() +{ + m_bLerpTranslation = { false }; + m_vLerpTranslationTimer = {}; + m_vLerpTranslationStart = {}; + m_vLerpTranslationEnd = {}; + m_vLerpRotQStart = {}; + m_vLerpRotQEnd = {}; +} +void CCamera_Cinematic::Lerp_FovY(_float fTimeDelta) +{ + if (true == m_bLerpFovY) { + m_vLerpFovYTimer.x += fTimeDelta; + if (m_vLerpFovYTimer.y < m_vLerpFovYTimer.x) { + m_vLerpFovYTimer.x = m_vLerpFovYTimer.y; + m_bLerpFovY = false; + } + Set_Fov(XMConvertToRadians(CMyTools::Lerp_f1D(m_vFovYLerp.x, m_vFovYLerp.y, m_vLerpFovYTimer.x / m_vLerpFovYTimer.y))); + } +} +void CCamera_Cinematic::Start_Lerp_FovY(_float fTimeMaximum, _float2 vRange) +{ + m_bLerpFovY = true; + m_vFovYLerp = { vRange.x, vRange.y }; + m_vLerpFovYTimer = { 0.f, fTimeMaximum }; +} +void CCamera_Cinematic::Clear_Lerp_FovY() +{ + m_bLerpFovY = false; + m_vFovYLerp = { 60.f, 60.f }; + m_vLerpFovYTimer = { 0.f, 0.f }; +} +CCamera_Cinematic* CCamera_Cinematic::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CCamera_Cinematic* pInstance = new CCamera_Cinematic(pDevice, pContext); + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CCamera_Cinematic"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} +CGameObject* CCamera_Cinematic::Clone(void* pArg, CGameObject* pOwner) +{ + CCamera_Cinematic* pInstance = new CCamera_Cinematic(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CCamera_Cinematic"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} +void CCamera_Cinematic::Free() +{ + __super::Free(); +} + +#ifdef _DEBUG + +void CCamera_Cinematic::Describe_Entity() +{ + GUI::Begin("CAMERA", 0, IMGUI_GLOBAL_BEGIN_FLAG); + if (GUI::CollapsingHeader("Camera_Cinematic_Describe")) { + if (GUI::SmallButton("Trigger_RanrokIntro")) { + _string strCutSceneName = "RanrokIntro"; + m_pInfoInstance->Active_Event(strCutSceneName); + } + m_pTransformCom->Describe_Entity(); + GUI::Text("LOOK_SRC %.2f, %.2f, %.2f", m_vLookPos_Src.x, m_vLookPos_Src.y, m_vLookPos_Src.z); + GUI::Text("LOOK_DST %.2f, %.2f, %.2f", m_vLookPos_Dest.x, m_vLookPos_Dest.y, m_vLookPos_Dest.z); + GUI::Text("FOLLOW_SRC %.2f, %.2f, %.2f", m_vFollowPos_Src.x, m_vFollowPos_Src.y, m_vFollowPos_Src.z); + GUI::Text("FOLLOW_DST %.2f, %.2f, %.2f", m_vFollowPos_Dest.x, m_vFollowPos_Dest.y, m_vFollowPos_Dest.z); + + GUI::DragFloat2("VerticalAngle", (_float*)&m_vAccRotDegree_VerticalLocks, 1.f, 0.f, 89.f); + GUI::Checkbox("TransitionLerp", &m_bEnable_TransitionLerp); + if (true == m_bEnable_TransitionLerp) { + GUI::SameLine(); GUI::Text("Translation : %.1f %.1f", m_vTransitionTime.x, m_vTransitionTime.y); + GUI::SliderFloat("TranslationTime", &m_vTransitionTime.y, 0.1f, 3.f, "%.1f"); + } + + GUI::Checkbox("LookLerp", &m_bEnable_LookLerp); + if (true == m_bEnable_LookLerp) { + GUI::SameLine(); GUI::Text("Translation : %.1f %.1f", m_vLookLerpTime.x, m_vLookLerpTime.y); + GUI::SliderFloat("LookTime", &m_vLookLerpTime.y, 0.1f, 3.f, "%.1f"); + } + + GUI::Checkbox("FollowLerp", &m_bEnable_FollowLerp); + if (true == m_bEnable_FollowLerp) { + GUI::SameLine(); GUI::Text("Translation : %.1f %.1f", m_vFollowLerpTime.x, m_vFollowLerpTime.y); + GUI::SliderFloat("FollowTime", &m_vFollowLerpTime.y, 0.1f, 3.f, "%.1f"); + } + + } + GUI::End(); +} + +#endif // _DEBUG diff --git a/Jusin154_Team3D/Client/Private/Camera_Debug.cpp b/Jusin154_Team3D/Client/Private/Camera_Debug.cpp index 2a7cfea87..78e8930ea 100644 --- a/Jusin154_Team3D/Client/Private/Camera_Debug.cpp +++ b/Jusin154_Team3D/Client/Private/Camera_Debug.cpp @@ -28,9 +28,6 @@ void CCamera_Debug::Priority_Update(_float fTimeDelta) _float3 vCamPos = {}; _float3 vSetPos = {}; XMStoreFloat3(&vCamPos, m_pTransformCom->Get_State(STATE::POSITION)); -#ifdef _DEBUG - GUI::Text("Cam Coord %.2f, %.2f, %.2f", vCamPos.x, vCamPos.y, vCamPos.z); -#endif // _DEBUG if (m_pGameInstance->Key_Up(DIK_GRAVE)) { m_bMovable = !m_bMovable; @@ -198,7 +195,11 @@ void CCamera_Debug::Describe_Entity() GUI::InputFloat3("Pos", (float*)&vPosition); } } - + GUI::End(); + GUI::Begin("CAMERA"); + if (GUI::CollapsingHeader("DebugCamera")){ + m_pTransformCom->Describe_Entity(); + } GUI::End(); } diff --git a/Jusin154_Team3D/Client/Private/Camera_Gaze.cpp b/Jusin154_Team3D/Client/Private/Camera_Gaze.cpp index 5b6d26d31..4dd9f2729 100644 --- a/Jusin154_Team3D/Client/Private/Camera_Gaze.cpp +++ b/Jusin154_Team3D/Client/Private/Camera_Gaze.cpp @@ -128,12 +128,57 @@ void CCamera_Gaze::Toggle_AIPriority() } } +void CCamera_Gaze::Set_LookTarget(CGameObject* pTarget) +{ + SAFE_RELEASE(m_pLookTarget); + m_pLookTarget = pTarget; + SAFE_ADDREF(m_pLookTarget); +} + +void CCamera_Gaze::Set_FollowTarget(CGameObject* pTarget) +{ + SAFE_RELEASE(m_pFollowTarget); + m_pFollowTarget = pTarget; + SAFE_ADDREF(m_pFollowTarget); +} void CCamera_Gaze::Late_Update(_float fTimeDelta) { if (false == m_bActive) { return; } } +void CCamera_Gaze::Trigger(CTimeSocket& Socket) +{ + SOCKETCONTENTS* pContents = &Socket.m_Contents; + switch (pContents->eTypeFunc) + { + case TIMESOCKET_FUNC::TRANSLATION: + + break; + case TIMESOCKET_FUNC::TRANSLATION_LERP: + { + + } break; + case TIMESOCKET_FUNC::SET_PITCHLIMIT: + { + Set_RotDegreeVerticalLock({ pContents->vParam_11.x , pContents->vParam_11.y }); + }break; + case TIMESOCKET_FUNC::ZOOM_IN: + { + Set_Fov(pContents->vParam_11.x); + }break; + case TIMESOCKET_FUNC::ZOOM_OUT: + { + Set_Fov(pContents->vParam_11.x); + }break; + case TIMESOCKET_FUNC::END_CINEMATIC: + { + m_pGameInstance->Bind_Camera(CURRENT_LEVEL, Socket.m_Contents.wstrKeyName, true); + }break; + default: + break; + } +} HRESULT CCamera_Gaze::Render() { return S_OK; diff --git a/Jusin154_Team3D/Client/Private/CutSceneInfo.cpp b/Jusin154_Team3D/Client/Private/CutSceneInfo.cpp index 6e616f1e1..07fc375cc 100644 --- a/Jusin154_Team3D/Client/Private/CutSceneInfo.cpp +++ b/Jusin154_Team3D/Client/Private/CutSceneInfo.cpp @@ -13,21 +13,29 @@ CCutSceneInfo::CCutSceneInfo() void CCutSceneInfo::Update(_float fTimeDelta) { _float fRatio = 0.f; - for (map<_string, TimeLine>::iterator iter = m_funcActiveEvents.begin(); iter != m_funcActiveEvents.end();) { - list* pSockets = &iter->second.m_Sockets; - iter->second.m_vTimer.x += fTimeDelta; - fRatio = CMyTools::Saturate(iter->second.m_vTimer.x / iter->second.m_vTimer.y); - - for (list::iterator socketIter = pSockets->begin(); socketIter == pSockets->end();) { - if (false == (*socketIter)->Trigger(fRatio)) { - socketIter++; - break; + for (map<_string, TimeLine*>::iterator iter = m_funcActiveEvents.begin(); iter != m_funcActiveEvents.end();) { + list* pSockets = &iter->second->m_Sockets; + iter->second->m_vTimer.x += fTimeDelta; + fRatio = CMyTools::Saturate(iter->second->m_vTimer.x / iter->second->m_vTimer.y); + for (list::iterator socketIter = pSockets->begin(); socketIter != pSockets->end();) { + GUI::Begin("CutScene"); + if (GUI::TreeNode((*socketIter)->m_Contents.strEventName.c_str())) { + GUI::Text("fRatio : %.2f", fRatio); + GUI::TreePop(); } - else { + GUI::End(); + if ((*socketIter)->Trigger(fRatio)) + { + SAFE_RELEASE((*socketIter)); socketIter = pSockets->erase(socketIter); } + else + { + break; + } } if (pSockets->empty()) { + Safe_Delete((*iter).second); iter = m_funcActiveEvents.erase(iter); } else { @@ -45,7 +53,7 @@ void CCutSceneInfo::Change_Level() void CCutSceneInfo::Active_Event(_string& strKey) { - map<_string, TimeLine>::iterator iter = m_funcWaitEvents.find(strKey); + map<_string, TimeLine*>::iterator iter = m_funcWaitEvents.find(strKey); if (iter != m_funcWaitEvents.end()) { m_funcActiveEvents.emplace(iter->first, iter->second); m_funcWaitEvents.erase(iter); @@ -54,19 +62,20 @@ void CCutSceneInfo::Active_Event(_string& strKey) HRESULT CCutSceneInfo::DeActive_ActiveEvent(_string& strKey) { - map<_string, TimeLine>::iterator iter = m_funcActiveEvents.find(strKey); + map<_string, TimeLine*>::iterator iter = m_funcActiveEvents.find(strKey); if (iter != m_funcActiveEvents.end()) { - for (list::iterator socketIter = (*iter).second.m_Sockets.begin(); - socketIter == (*iter).second.m_Sockets.end(); ++iter) { + for (list::iterator socketIter = (*iter).second->m_Sockets.begin(); + socketIter != (*iter).second->m_Sockets.end(); ++socketIter) { SAFE_RELEASE((*socketIter)); } + Safe_Delete((*iter).second); m_funcActiveEvents.erase(iter); } return S_OK; } -void CCutSceneInfo::Load_Events(pair<_string, TimeLine>& pairTimeLine) +void CCutSceneInfo::Load_Events(pair<_string, TimeLine*>& pairTimeLine) { m_funcWaitEvents.emplace(pairTimeLine); } @@ -89,15 +98,16 @@ HRESULT CCutSceneInfo::Clear_ActiveEvents() { return Clear_Events(m_funcActiveEvents); } -HRESULT CCutSceneInfo::Clear_Events(map<_string, TimeLine>& Events) +HRESULT CCutSceneInfo::Clear_Events(map<_string, TimeLine*>& Events) { - map<_string, TimeLine>::iterator iter = Events.begin(); + map<_string, TimeLine*>::iterator iter = Events.begin(); for (; iter != Events.end();) { - for (list::iterator socketIter = (*iter).second.m_Sockets.begin(); - socketIter == (*iter).second.m_Sockets.end(); ++iter) { + for (list::iterator socketIter = (*iter).second->m_Sockets.begin(); + socketIter != (*iter).second->m_Sockets.end(); ++socketIter) { SAFE_RELEASE((*socketIter)); } + Safe_Delete((*iter).second); iter = Events.erase(iter); } return S_OK; diff --git a/Jusin154_Team3D/Client/Private/InfoInstance.cpp b/Jusin154_Team3D/Client/Private/InfoInstance.cpp index 4b412c385..1e0c41981 100644 --- a/Jusin154_Team3D/Client/Private/InfoInstance.cpp +++ b/Jusin154_Team3D/Client/Private/InfoInstance.cpp @@ -28,6 +28,7 @@ void CInfoInstance::Update(_float fTimeDelta) m_pMapInfo->Update(fTimeDelta); m_pSkillInfo->Update(fTimeDelta); m_pInteractiveInfo->Update(fTimeDelta); + m_pCutSceneInfo->Update(fTimeDelta); } void CInfoInstance::Change_Level() @@ -38,6 +39,7 @@ void CInfoInstance::Change_Level() m_pSkillInfo->Change_Level(); m_pInteractiveInfo->Change_Level(); UI_Event.clear(); + m_pCutSceneInfo->Change_Level(); } CStat* CInfoInstance::Get_PlayerStatPtr() @@ -405,7 +407,7 @@ HRESULT CInfoInstance::DeActive_ActiveEvent(_string& strKey) return m_pCutSceneInfo->DeActive_ActiveEvent(strKey); } -void CInfoInstance::Load_Events(pair<_string, TimeLine>& pairTimeLine) +void CInfoInstance::Load_Events(pair<_string, TimeLine*>& pairTimeLine) { m_pCutSceneInfo->Load_Events(pairTimeLine); } diff --git a/Jusin154_Team3D/Client/Private/Level_Field.cpp b/Jusin154_Team3D/Client/Private/Level_Field.cpp index 4820a3961..2316271b0 100644 --- a/Jusin154_Team3D/Client/Private/Level_Field.cpp +++ b/Jusin154_Team3D/Client/Private/Level_Field.cpp @@ -7,6 +7,8 @@ #include "EffectPool.h" #include "Light_Main.h" #include "Layer.h" +#include "Camera_Cinematic.h" +#include "TimeSocket.h" #include "Camera_Debug.h" #include "Terrain.h" #include "SkyBox.h" @@ -60,6 +62,9 @@ HRESULT CLevel_Field::Initialize(void* pArg) if (FAILED(Ready_Layer_Monster())) { return E_FAIL; } + if (FAILED(Ready_Layer_CutScene())) { + return E_FAIL; + } return S_OK; } @@ -72,6 +77,11 @@ HRESULT CLevel_Field::Initialize() void CLevel_Field::Update(_float fTimeDelta) { +#ifdef _DEBUG + Describe_Entity(); +#endif // _DEBUG + + if (m_pGameInstance->Key_Up(DIK_F1)) { //m_pGameInstance->Set_LevelToChange(); @@ -206,11 +216,34 @@ HRESULT CLevel_Field::Ready_Camera() m_pGameInstance->Add_Camera(NEXT_LEVEL, pCamera, CAMERA_DEBUG); -#endif // _DEBUG - if (FAILED(m_pGameInstance->Bind_Camera(NEXT_LEVEL, CAMERA_DEBUG, true))) { return E_FAIL; } +#endif // _DEBUG + + { + CCamera_Cinematic::Camera_Cinematic_DESC Camera_Desc{}; + Camera_Desc.fSpeedPerSec = 5.f; + Camera_Desc.fRotationPerSec = XMConvertToRadians(90.0f); + Camera_Desc.fFovy = XMConvertToRadians(60.0f); + Camera_Desc.fNear = 0.1f; + Camera_Desc.fFar = 500.f; + Camera_Desc.pCameraKey = CAMERA_CINEMATIC; + Camera_Desc.iPriority = 65; + Camera_Desc.bEnableTransitionLerp = true; + Camera_Desc.bEnableLookLerp = true; + Camera_Desc.bEnableFollowLerp = true; + Camera_Desc.vTransitionTime.y = 1.f; + Camera_Desc.pFollowTarget = { nullptr }; + Camera_Desc.pLookTarget = { nullptr }; + + CCamera_Cinematic* pCamera = { nullptr }; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CAMERA, &Camera_Desc, nullptr, &pCamera))) { + return E_FAIL; + } + m_pGameInstance->Add_Camera(NEXT_LEVEL, pCamera, CAMERA_CINEMATIC); + } + return S_OK; } @@ -291,6 +324,27 @@ HRESULT CLevel_Field::Reday_Layer_EffectPool() return S_OK; } +HRESULT CLevel_Field::Ready_Layer_CutScene() +{ + CMonster* pMonster = { nullptr }; + CCamera* pCamera = { nullptr }; + { + CLayer* pLayer = m_pGameInstance->Get_Layer(NEXT_LEVEL, LAYER_MONSTER); + if (nullptr != pLayer) { + pMonster = pLayer->Get_Object(); + } + } + { + pCamera = m_pGameInstance->Get_Camera(NEXT_LEVEL, CAMERA_CINEMATIC); + } + + if (nullptr == pMonster || nullptr == pCamera) { + return E_FAIL; + } + Load_CutSceneXML("../Bin/Resources/Data/CutScene/RanrokCutScene.xml", pCamera, pMonster); + return S_OK; +} + pair> CLevel_Field::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID, void* pArg) { CLevel_Field* pInstance = new CLevel_Field(pDevice, pContext, eLevelID); @@ -310,3 +364,271 @@ void CLevel_Field::Free() SAFE_RELEASE(m_pInfoInstance); } + +static _bool IsTrueText(const char* text) +{ + if (!text){ return false; } + return (strcmp(text, "true") == 0) || (strcmp(text, "1") == 0); +} + +static _bool TryReadFloatAttr(tinyxml2::XMLElement* element, const _char* attrName, _float& outValue) +{ + if (!element || !attrName) { + return false; + } + + const _char* text = element->Attribute(attrName); + if (!text || text[0] == '\0'){ + return false; + } + + return (element->QueryFloatAttribute(attrName, &outValue) == tinyxml2::XML_SUCCESS); +} + +static _bool TryReadUIntAttr(tinyxml2::XMLElement* element, const _char* attrName, _uint& outValue) +{ + if (!element || !attrName) return false; + + const _char* text = element->Attribute(attrName); + if (!text || text[0] == '\0') { + return false; + } + + return (element->QueryUnsignedAttribute(attrName, &outValue) == tinyxml2::XML_SUCCESS); +} + +static void ReadPxTransform(tinyxml2::XMLElement* transformNode, PSX::PxTransform& outTransform) +{ + outTransform.p = PSX::PxVec3(0.f, 0.f, 0.f); + outTransform.q = PSX::PxQuat(0.f, 0.f, 0.f, 1.f); + + if (!transformNode) { return; } + + tinyxml2::XMLElement* rotQNode = transformNode->FirstChildElement("RotQ"); + tinyxml2::XMLElement* transNode = transformNode->FirstChildElement("Trans"); + if (!rotQNode || !transNode) { + return; + } + + TryReadFloatAttr(rotQNode, "X", outTransform.q.x); + TryReadFloatAttr(rotQNode, "Y", outTransform.q.y); + TryReadFloatAttr(rotQNode, "Z", outTransform.q.z); + TryReadFloatAttr(rotQNode, "W", outTransform.q.w); + + TryReadFloatAttr(transNode, "X", outTransform.p.x); + TryReadFloatAttr(transNode, "Y", outTransform.p.y); + TryReadFloatAttr(transNode, "Z", outTransform.p.z); +} + +static void ReadFlags16(tinyxml2::XMLElement* flagsNode, _boolean& outFlags) +{ + memset(&outFlags, 0, sizeof(_boolean)); + + if (!flagsNode) { + return; + } + + for (tinyxml2::XMLElement* flagNode = flagsNode->FirstChildElement("Flag"); + flagNode; + flagNode = flagNode->NextSiblingElement("Flag")) + { + int flagId = -1; + if (flagNode->QueryIntAttribute("id", &flagId) != tinyxml2::XML_SUCCESS) { + continue; + } + + if (flagId < 0 || flagId >= 16) { + continue; + } + + outFlags.b[flagId] = IsTrueText(flagNode->GetText()); + } +} + +static void ReadUInt4(tinyxml2::XMLElement* param10Node, _uint4& outValue) +{ + outValue = {}; + + if (!param10Node) { + return; + } + tinyxml2::XMLElement* uintNode = param10Node->FirstChildElement("uint"); + if (!uintNode) return; + + _uint temp = 0; + if (TryReadUIntAttr(uintNode, "X", temp)) outValue.x = temp; + if (TryReadUIntAttr(uintNode, "Y", temp)) outValue.y = temp; + if (TryReadUIntAttr(uintNode, "Z", temp)) outValue.z = temp; + if (TryReadUIntAttr(uintNode, "W", temp)) outValue.w = temp; +} + +static void ReadFloat4(tinyxml2::XMLElement* param11Node, _float4& outValue) +{ + outValue = {}; + + if (!param11Node) { + return; + } + tinyxml2::XMLElement* floatNode = param11Node->FirstChildElement("float"); + if (!floatNode) { + return; + } + + TryReadFloatAttr(floatNode, "X", outValue.x); + TryReadFloatAttr(floatNode, "Y", outValue.y); + TryReadFloatAttr(floatNode, "Z", outValue.z); + TryReadFloatAttr(floatNode, "W", outValue.w); +} + +void CLevel_Field::Load_CutSceneXML(const string& path, CCamera* pCamera, CMonster* pMonster) +{ + tinyxml2::XMLDocument doc; + if (doc.LoadFile(path.c_str()) != tinyxml2::XML_SUCCESS){ + return; + } + + TimeLine* pTimeLine = new TimeLine(); + tinyxml2::XMLElement* pContentsNode = doc.FirstChildElement("RanrokIntro"); + if (!pContentsNode){ + return; + } + + pTimeLine->m_vTimer.y = 0.f; + pContentsNode->QueryFloatAttribute("fDuration", &pTimeLine->m_vTimer.y); + + pTimeLine->m_Sockets.clear(); + + for (tinyxml2::XMLElement* pSocketNode = pContentsNode->FirstChildElement("Socket"); + pSocketNode; pSocketNode = pSocketNode->NextSiblingElement("Socket")) + { + SOCKETCONTENTS SocketContents = {}; + + SocketContents .fRatio = 0.f; + _int fStartPosition = 0; + pSocketNode->QueryIntAttribute("fStartPosition", &fStartPosition); + SocketContents.fRatio = CMyTools::Saturate(fStartPosition / pTimeLine->m_vTimer.y); + // Info + tinyxml2::XMLElement* pInfoNode = pSocketNode->FirstChildElement("Info"); + if (pInfoNode != nullptr) + { + const _char* pEventNameText = pInfoNode->Attribute("strEventName"); + SocketContents.strEventName = pEventNameText ? pEventNameText : ""; + + SocketContents.eTypeParam = TIMESOCKET_PARAM::END; + if (const _char* pTypeText = pInfoNode->Attribute("eTypeParam")) + { + CTimeSocket::TryParse_TimeSocketParam(string_view(pTypeText), SocketContents.eTypeParam); + } + + SocketContents.eTypeFunc = TIMESOCKET_FUNC::END; + if (const _char* pFuncText = pInfoNode->Attribute("eTypeFunc")) + { + CTimeSocket::TryParse_TimeSocketFunc(string_view(pFuncText), SocketContents.eTypeFunc); + } + + SocketContents.pEventTarget = nullptr; + SocketContents.funcEvent = nullptr; + + if (const _char* pTargetText = pInfoNode->Attribute("pTarget")) + { + if (strcmp(pTargetText, "CAMERA_CINEMATIC") == 0) + { + CCamera* pEventTarget = pCamera; + SocketContents.pEventTarget = pEventTarget; + SocketContents.funcEvent = [pEventTarget](CTimeSocket& Socket) { pEventTarget->Trigger(Socket); }; + } + else if (strcmp(pTargetText, "CAMERA_SHOULDER") == 0) + { + CCamera* pEventTarget = m_pGameInstance->Get_Camera(NEXT_LEVEL, CAMERA_SHOULDER); + SocketContents.pEventTarget = pEventTarget; + SocketContents.funcEvent = [pEventTarget](CTimeSocket& Socket) { pEventTarget->Trigger(Socket); }; + } + else if (strcmp(pTargetText, "ACTOR_PLAYER") == 0) + { + CPlayer* pEventTarget = m_pGameInstance->Get_Layer(NEXT_LEVEL, LAYER_PLAYER)->Get_Object(); + SocketContents.pEventTarget = pEventTarget; + SocketContents.funcEvent = [pEventTarget](CTimeSocket& Socket) { pEventTarget->Trigger(Socket); }; + } + } + } + + // -------- Param_0 ---------- + tinyxml2::XMLElement* pParam0Node = pSocketNode->FirstChildElement("Param_0"); + if (nullptr != pParam0Node) + { + switch (SocketContents.eTypeParam) + { + case TIMESOCKET_PARAM::TARGET: + { + tinyxml2::XMLElement* pOtherTargetNode = pParam0Node->FirstChildElement("OtherTarget"); + if (!pOtherTargetNode) break; + + const _char* pLayerNameText = pOtherTargetNode->Attribute("Layer"); + const _char* pTypeIdText = pOtherTargetNode->Attribute("TypeID"); + + if (!pLayerNameText || !pTypeIdText) break; + if (pLayerNameText[0] == '\0' || pTypeIdText[0] == '\0') break; + + SocketContents.wstrLayerName = CMyTools::ToWstring(pLayerNameText); + SocketContents.wstrKeyName = CMyTools::ToWstring(pTypeIdText); + + if (string_view(pTypeIdText) == "Ranrok") + { + SocketContents.pOtherTarget = + m_pGameInstance->Get_Layer(NEXT_LEVEL, SocketContents.wstrLayerName)->Get_Object(); + } + else if (string_view(pTypeIdText) == "CAMERA_CINEMATIC") + { + SocketContents.pOtherTarget = pCamera; + } + else if (string_view(pTypeIdText) == "CAMERA_SHOULDER") + { + SocketContents.pOtherTarget = m_pGameInstance->Get_Camera(NEXT_LEVEL, CAMERA_SHOULDER); + } + + break; + } + + case TIMESOCKET_PARAM::TRANSFORM: + { + tinyxml2::XMLElement* pTransformNode = pParam0Node->FirstChildElement("Transform"); + ReadPxTransform(pTransformNode, SocketContents.pxTransform); + break; + } + case TIMESOCKET_PARAM::END: + default: + break; + } + } + + // -------- vFlags / Param_10 / Param_11 ---------- + ReadFlags16(pSocketNode->FirstChildElement("vFlags"), SocketContents.vFlags); + ReadUInt4(pSocketNode->FirstChildElement("Param_10"), SocketContents.vParam_10); + ReadFloat4(pSocketNode->FirstChildElement("Param_11"), SocketContents.vParam_11); + CTimeSocket* pSocket = CTimeSocket::Create(&SocketContents); + if (!pSocket) { + continue; + } + pTimeLine->m_Sockets.push_back(pSocket); + } + pTimeLine->m_Sockets.sort([](CTimeSocket* a, CTimeSocket* b) { + return a->m_Contents.fRatio < b->m_Contents.fRatio; + }); + pair<_string, TimeLine*> pairResult = { _string(pContentsNode->Name()), pTimeLine }; + m_pInfoInstance->Load_Events(pairResult); +} + +#ifdef _DEBUG +void CLevel_Field::Describe_Entity() +{ + GUI::Begin("CutScene"); + if (GUI::Button("ReadyCutScene")) { + Ready_Layer_CutScene(); + } + if (GUI::Button("DeActiveCutScene")) { + _string strDeActiveEvent = "RanrokIntro"; + m_pInfoInstance->DeActive_ActiveEvent(strDeActiveEvent); + } + GUI::End(); +} +#endif // _DEBUG diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index 49cd0d828..cc15acd36 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -302,8 +302,8 @@ HRESULT CLevel_GamePlay::Ready_Background() isReady_Hogwart = false; #endif // #ifdef 기무리 - isReady_Background = true; - isReady_Hogsmeade = true; + isReady_Background = false; + isReady_Hogsmeade = false; isReady_Hogwart = false; #endif // #ifdef 나 @@ -811,8 +811,8 @@ HRESULT CLevel_GamePlay::Ready_Layer_Player(const _wstring& strLayerTag) isLoad_NPC = false; #endif // #ifdef 기무리 - isLoad_NPC = true; - isLoad_RandomNPC = true; + isLoad_NPC = false; + isLoad_RandomNPC = false; #endif // #ifdef 나 isLoad_RandomNPC = true; @@ -859,12 +859,12 @@ HRESULT CLevel_GamePlay::Ready_Layer_Player(const _wstring& strLayerTag) } } } - } - CHuman_Duelist::DUELISTDESC DuelistDesc = {}; - DuelistDesc.vPos = _float4(-21.f, 0.f, -16.f, 1.f); - DuelistDesc.vRotQ = _float4(0.f, 0.f, 0.f, 1.f); - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &DuelistDesc))) { - return E_FAIL; + CHuman_Duelist::DUELISTDESC DuelistDesc = {}; + DuelistDesc.vPos = _float4(-21.f, 0.f, -16.f, 1.f); + DuelistDesc.vRotQ = _float4(0.f, 0.f, 0.f, 1.f); + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &DuelistDesc))) { + return E_FAIL; + } } @@ -911,7 +911,7 @@ HRESULT CLevel_GamePlay::Ready_Layer_Monster() isLoad_Monster = false; #endif // #ifdef 기무리 - isLoad_Monster = true; + isLoad_Monster = false; #endif // #ifdef 나 diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 52f42fee5..5d50436f8 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -10,6 +10,7 @@ #include "Broom.h" #include "Camera_Gaze.h" +#include "Camera_Cinematic.h" #include "CamPosition_Arm.h" #include "CamPosition_Shoulder.h" #include "CamPosition_Socket.h" @@ -417,10 +418,10 @@ HRESULT CLoader::Loading_For_GamePlay() isLoad_UI_SEQUANTIAL = false; #endif // #ifdef 기무리 - isLoad_Background = true; + isLoad_Background = false; isLoad_Hogwart = false; isLoad_UI_SEQUANTIAL = false; - isLoad_NPC = true; + isLoad_NPC = false; isLoad_Monster = true; #endif // #ifdef 나 @@ -3589,6 +3590,10 @@ HRESULT CLoader::Loading_For_GamePlay() if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamera_Gaze::Create(m_pDevice, m_pContext)))) return E_FAIL; + /* For.Prototype_GameObject_Camera_Cinematic */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamera_Cinematic::Create(m_pDevice, m_pContext)))) + return E_FAIL; + /* For.Prototype_GameObject_CamPosition_Player */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamPosition_Socket::Create(m_pDevice, m_pContext)))) return E_FAIL; diff --git a/Jusin154_Team3D/Client/Private/Player.cpp b/Jusin154_Team3D/Client/Private/Player.cpp index 251b0fff1..c9debecd9 100644 --- a/Jusin154_Team3D/Client/Private/Player.cpp +++ b/Jusin154_Team3D/Client/Private/Player.cpp @@ -14,6 +14,7 @@ #include "Layer.h" #include "MapElement_Interactable.h" #include "Monster.h" +#include "TimeSocket.h" #include "PlayerRobe.h" #include "RaceRing.h" #include "Wand.h" @@ -475,6 +476,33 @@ void CPlayer::OnHit(CGameObject* pOther, CGameObject* pCaller) { } +void CPlayer::Trigger(CTimeSocket& Socket) +{ + SOCKETCONTENTS* pContents = &Socket.m_Contents; + switch (pContents->eTypeFunc) + { + case TIMESOCKET_FUNC::TRANSLATION: + { + _vector vNewPos = XMVectorSetW(XMLoadFloat3((_float3*)&pContents->pxTransform.p), 1.f); + m_pTransformCom->Set_State(STATE::POSITION, vNewPos); + m_pCharacter_Controller->Set_Position(vNewPos); + m_pTransformCom->RotationQ(pContents->pxTransform.q); + m_pTransformCom->RewindMomentum(); + } + break; + case TIMESOCKET_FUNC::TRANSLATION_LERP: + { + + } break; + case TIMESOCKET_FUNC::SET_ANIMSTATE: + { + + } break; + default: + break; + } +} + void CPlayer::Start_CameraShake(_float fTime, _float fIntense) { m_vCameraShakeTimer.x = 0.f; diff --git a/Jusin154_Team3D/Client/Private/Ranrok.cpp b/Jusin154_Team3D/Client/Private/Ranrok.cpp index 610a11ed5..4c6de3160 100644 --- a/Jusin154_Team3D/Client/Private/Ranrok.cpp +++ b/Jusin154_Team3D/Client/Private/Ranrok.cpp @@ -10,6 +10,8 @@ #include "Layer.h" #include "TrailObject.h" #include "MapElement_Interactable.h" +#include "TimeSocket.h" +#include "Layer.h" #pragma region STATE @@ -275,6 +277,32 @@ HRESULT CRanrok::Render_Shadow(SHADOW eType) return S_OK; } +void CRanrok::Trigger(CTimeSocket& Socket) +{ + SOCKETCONTENTS* pContents = &Socket.m_Contents; + switch (pContents->eTypeFunc) + { + case TIMESOCKET_FUNC::TRANSLATION: + { + + }break; + case TIMESOCKET_FUNC::TRANSLATION_LERP: + { + + }break; + case TIMESOCKET_FUNC::SET_ANIMSTATE: + { + //m_pFSM->Set_State(FSMSTATE::CUTSCENE); + }break; + case TIMESOCKET_FUNC::SET_FSMSTATE: + { + //m_pModelCom->Set_AnimationIndex(); + }break; + default: + break; + } +} + HRESULT CRanrok::Render_MotionTrail(ID3D11ShaderResourceView* pSRV) { for (_uint i = ENUM_CLASS(RANROK_MESH_ORDER::WINGS); i < ENUM_CLASS(RANROK_MESH_ORDER::END); ++i) diff --git a/Jusin154_Team3D/Client/Private/Ride_Panel.cpp b/Jusin154_Team3D/Client/Private/Ride_Panel.cpp index 9c7a6276c..1840a9252 100644 --- a/Jusin154_Team3D/Client/Private/Ride_Panel.cpp +++ b/Jusin154_Team3D/Client/Private/Ride_Panel.cpp @@ -126,7 +126,7 @@ void CRide_Panel::Update(_float fTimeDelta) if (m_bHover == true) { - Start_Lerp(fTimeDelta); + Start_Lerp_Translation(fTimeDelta); } else { diff --git a/Jusin154_Team3D/Client/Private/SpellLearn_ChaserPointer.cpp b/Jusin154_Team3D/Client/Private/SpellLearn_ChaserPointer.cpp index 05a2bcc0a..d8cc07aa5 100644 --- a/Jusin154_Team3D/Client/Private/SpellLearn_ChaserPointer.cpp +++ b/Jusin154_Team3D/Client/Private/SpellLearn_ChaserPointer.cpp @@ -167,7 +167,7 @@ void CSpellLearn_ChaserPointer::Line(_float fTime) { m_vLerp_Position = m_MoveLine[m_iCurrentLine]; - if (Start_Lerp(fTime) == true) + if (Start_Lerp_Translation(fTime) == true) { if (m_iCurrentLine < m_iLineIndex - 1) { diff --git a/Jusin154_Team3D/Client/Private/SpellLearn_Overlay.cpp b/Jusin154_Team3D/Client/Private/SpellLearn_Overlay.cpp index bff6981fc..02cb8fc25 100644 --- a/Jusin154_Team3D/Client/Private/SpellLearn_Overlay.cpp +++ b/Jusin154_Team3D/Client/Private/SpellLearn_Overlay.cpp @@ -127,7 +127,7 @@ void CSpellLearn_Overlay::Update(_float fTimeDelta) if (m_fSizeUp == true) { - if (Start_Lerp(fTimeDelta * m_fTimeMult * m_fMoveSpeed) == true) + if (Start_Lerp_Translation(fTimeDelta * m_fTimeMult * m_fMoveSpeed) == true) { m_fSizeUp = false; } diff --git a/Jusin154_Team3D/Client/Private/SpellLearn_Slot.cpp b/Jusin154_Team3D/Client/Private/SpellLearn_Slot.cpp index 5fcebb92a..db036793d 100644 --- a/Jusin154_Team3D/Client/Private/SpellLearn_Slot.cpp +++ b/Jusin154_Team3D/Client/Private/SpellLearn_Slot.cpp @@ -97,7 +97,7 @@ void CSpellLearn_Slot::Update(_float fTimeDelta) if (m_fSizeUp == true) { - if (Start_Lerp(fTimeDelta * m_fTimeMult * m_fMoveSpeed) == true) + if (Start_Lerp_Translation(fTimeDelta * m_fTimeMult * m_fMoveSpeed) == true) { m_fSizeUp = false; } diff --git a/Jusin154_Team3D/Client/Public/Camera_Cinematic.h b/Jusin154_Team3D/Client/Public/Camera_Cinematic.h new file mode 100644 index 000000000..15d4153ca --- /dev/null +++ b/Jusin154_Team3D/Client/Public/Camera_Cinematic.h @@ -0,0 +1,76 @@ +#pragma once + +#include "Client_Define.h" +#include "Camera.h" + +NS_BEGIN(Client) + +class CCamera_Cinematic final : public CCamera +{ +public: + typedef struct tagCamera_Cinematic : public CCamera::CAMERA_DESC + { + }Camera_Cinematic_DESC; +private: + CCamera_Cinematic(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CCamera_Cinematic(const CCamera_Cinematic& rhs); + virtual ~CCamera_Cinematic() = 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; + virtual void Trigger(CTimeSocket& Socket)override; + +public: + void Update_LerpTimer(_float fTimeDelta); + void Set_Priority(_uint iPriority); + void Set_LookTarget(CGameObject* pTarget); + void Set_FollowTarget(CGameObject* pTarget); + + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + HRESULT Bind_ShaderResources() override; + + 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 Clear_Lerp_Translation(); + + + void Lerp_FovY(_float fTimeDelta); + void Start_Lerp_FovY(_float fTimeMaximum, _float2 vRange); + void Clear_Lerp_FovY(); + +private: + CInfoInstance* m_pInfoInstance = { nullptr }; + + _bool m_bLerpTranslation = { false }; + _float2 m_vLerpTranslationTimer = {}; + + _float3 m_vLerpTranslationStart = {}; + _float3 m_vLerpTranslationEnd = {}; + _float4 m_vLerpRotQStart = {}; + _float4 m_vLerpRotQEnd = {}; + + _bool m_bLerpFovY = { false }; + _float2 m_vFovYLerp = { 60.f, 60.f }; + _float2 m_vLerpFovYTimer = { }; + +public: + static CCamera_Cinematic* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, CGameObject* pOwner) override; + virtual void Free() override; + + +#ifdef _DEBUG + void Describe_Entity() override; + +#endif // _DEBUG +}; + +NS_END diff --git a/Jusin154_Team3D/Client/Public/Camera_Gaze.h b/Jusin154_Team3D/Client/Public/Camera_Gaze.h index e1f890778..3c0ea2ae3 100644 --- a/Jusin154_Team3D/Client/Public/Camera_Gaze.h +++ b/Jusin154_Team3D/Client/Public/Camera_Gaze.h @@ -2,6 +2,7 @@ #include "Client_Define.h" #include "Camera.h" +#include "TimeSocket.h" NS_BEGIN(Client) @@ -19,14 +20,17 @@ class CCamera_Gaze final : public CCamera public: virtual void Priority_Update(_float fTimeDelta) override; virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + virtual void Trigger(class CTimeSocket& Socket)override; + virtual HRESULT Render() override; void Update_LerpTimer(_float fTimeDelta); void Enable_FollowLerp(); void Enable_LookLerp(); - void Sync_Follow(_bool bSink); + void Sync_Follow(_bool bSync); void Toggle_Priority(); void Toggle_AIPriority(); - virtual void Late_Update(_float fTimeDelta) override; - virtual HRESULT Render() override; + void Set_LookTarget(CGameObject* pTarget); + void Set_FollowTarget(CGameObject* pTarget); private: virtual HRESULT Initialize_Prototype() override; @@ -36,7 +40,7 @@ class CCamera_Gaze final : public CCamera _bool m_bSyncFollow = { false }; private: CInfoInstance* m_pInfoInstance = { nullptr }; - + public: static CCamera_Gaze* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); diff --git a/Jusin154_Team3D/Client/Public/Client_Macro.h b/Jusin154_Team3D/Client/Public/Client_Macro.h index eff67e7d3..d3fde4fa2 100644 --- a/Jusin154_Team3D/Client/Public/Client_Macro.h +++ b/Jusin154_Team3D/Client/Public/Client_Macro.h @@ -34,6 +34,7 @@ namespace Client { #define CAMERA_SHOULDER TEXT("CAMERA_SHOULDER") #define CAMERA_AI TEXT("CAMERA_AI") #define CAMERA_MODEL TEXT("CAMERA_MODEL") +#define CAMERA_CINEMATIC TEXT("CAMERA_CINEMATIC") #pragma endregion #pragma region COMPONENT diff --git a/Jusin154_Team3D/Client/Public/CutSceneInfo.h b/Jusin154_Team3D/Client/Public/CutSceneInfo.h index 4f7dceb3e..2e56d96ac 100644 --- a/Jusin154_Team3D/Client/Public/CutSceneInfo.h +++ b/Jusin154_Team3D/Client/Public/CutSceneInfo.h @@ -23,7 +23,7 @@ class CCutSceneInfo final : public CBase public: void Active_Event(_string& strKey); HRESULT DeActive_ActiveEvent(_string& strKey); - void Load_Events(pair<_string, TimeLine>& pairTimeLine); + void Load_Events(pair<_string, TimeLine*>& pairTimeLine); private: CGameInstance* m_pGameInstance = { nullptr }; @@ -31,13 +31,16 @@ class CCutSceneInfo final : public CBase ID3D11Device* m_pDevice = { nullptr }; ID3D11DeviceContext* m_pContext = { nullptr }; - map<_string, TimeLine> m_funcActiveEvents = {}; - map<_string, TimeLine> m_funcWaitEvents = {}; + map<_string, TimeLine*> m_funcActiveEvents = {}; + map<_string, TimeLine*> m_funcWaitEvents = {}; private: HRESULT Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContex); - HRESULT Clear_ActiveEvents(); - HRESULT Clear_Events(map<_string, TimeLine>&Events); +#ifdef _DEBUG +public: +#endif // _DEBUG + HRESULT Clear_ActiveEvents(); + HRESULT Clear_Events(map<_string, TimeLine*>&Events); HRESULT Clear_AllEvents(); diff --git a/Jusin154_Team3D/Client/Public/InfoInstance.h b/Jusin154_Team3D/Client/Public/InfoInstance.h index 57ffc4fbb..a6b385d62 100644 --- a/Jusin154_Team3D/Client/Public/InfoInstance.h +++ b/Jusin154_Team3D/Client/Public/InfoInstance.h @@ -105,7 +105,7 @@ DECLARE_SINGLETON(CInfoInstance) #pragma region CutScene void Active_Event(_string& strKey); HRESULT DeActive_ActiveEvent(_string& strKey); - void Load_Events(pair< _string, struct TimeLine>& pairTimeLine); + void Load_Events(pair< _string, struct TimeLine*>& pairTimeLine); #pragma endregion private: CGameInstance* m_pGameInstance = { nullptr }; diff --git a/Jusin154_Team3D/Client/Public/Level_Field.h b/Jusin154_Team3D/Client/Public/Level_Field.h index 978ec5d8b..26dc28a85 100644 --- a/Jusin154_Team3D/Client/Public/Level_Field.h +++ b/Jusin154_Team3D/Client/Public/Level_Field.h @@ -3,6 +3,10 @@ #include "Client_Define.h" #include "Level.h" +NS_BEGIN(Engine) +class CCamera; +NS_END + NS_BEGIN(Client) class CLevel_Field final : public CLevel @@ -35,10 +39,17 @@ class CLevel_Field final : public CLevel HRESULT Ready_Layer_Effect(const _wstring& strLayerTag); HRESULT Ready_Layer_Monster(); HRESULT Reday_Layer_EffectPool(); + HRESULT Ready_Layer_CutScene(); public: static pair> Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID, void* pArg); virtual void Free() override; + + void Load_CutSceneXML(const string& path, CCamera* pCamera, class CMonster* pMonster); + +#ifdef _DEBUG + virtual void Describe_Entity(); +#endif // _DEBUG }; NS_END diff --git a/Jusin154_Team3D/Client/Public/Player.h b/Jusin154_Team3D/Client/Public/Player.h index f93dfd709..1f89d59ac 100644 --- a/Jusin154_Team3D/Client/Public/Player.h +++ b/Jusin154_Team3D/Client/Public/Player.h @@ -27,6 +27,7 @@ class CPlayer final : public CUnit virtual HRESULT Render_Shadow(SHADOW eType) override; virtual void OnCollision(CGameObject* pOther = nullptr, void* pDesc = nullptr)override; virtual void OnHit(CGameObject* pOther, CGameObject* pCaller = nullptr)override; + virtual void Trigger(class CTimeSocket& Socket)override; _bool Get_Aim() { return m_bAim; } void Set_SpellHit(_bool bHit) { m_bSpellHit = bHit; } void Set_Shield(_bool bShield) { m_bShield = bShield; } diff --git a/Jusin154_Team3D/Client/Public/Ranrok.h b/Jusin154_Team3D/Client/Public/Ranrok.h index 7a4dbe679..b4efcdc18 100644 --- a/Jusin154_Team3D/Client/Public/Ranrok.h +++ b/Jusin154_Team3D/Client/Public/Ranrok.h @@ -50,6 +50,7 @@ class CRanrok final : public CMonster virtual HRESULT Render() override; virtual HRESULT Render_OutLine() override; virtual HRESULT Render_Shadow(SHADOW eType) override; + virtual void Trigger(CTimeSocket& Socket)override; HRESULT Render_MotionTrail(ID3D11ShaderResourceView* pSRV); virtual _vector Get_LockOnPos() override; virtual void OnCollision(CGameObject* pOther = nullptr, void* pDesc = nullptr)override; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/CutScene/RanrokCutScene.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/CutScene/RanrokCutScene.xml new file mode 100644 index 000000000..15253a742 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/CutScene/RanrokCutScene.xml @@ -0,0 +1,342 @@ + + + + + + + + + + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + + + + + + + + + + + + + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + + + + + + + + + + + + + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + + + + + + + + + + + + + + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + + + + + + + + + + + + + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + + + + + + + + + + + + + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + + + + + + + + + + + + + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + + + + + + + + + + + + + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + + + + + + + + + + + + + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + + + + + diff --git a/Jusin154_Team3D/Editor/Private/CamPosition_Shoulder.cpp b/Jusin154_Team3D/Editor/Private/CamPosition_Shoulder.cpp index 9eea44ab3..aacbd8c8d 100644 --- a/Jusin154_Team3D/Editor/Private/CamPosition_Shoulder.cpp +++ b/Jusin154_Team3D/Editor/Private/CamPosition_Shoulder.cpp @@ -111,8 +111,8 @@ void CCamPosition_Shoulder::Update(_float fTimeDelta) if (m_pGameInstance->Key_Up(DIK_P)) { m_vShoulderOtherRatio = m_vShoulderPosRatio = m_vShoulderStartRatio; m_vShoulderStartRatio.x *= -1.f; - m_bLerp = true; - m_vLerpTimer.x = 0.f; + m_bLerpTranslation = true; + m_vLerpTranslationTimer.x = 0.f; } } @@ -121,12 +121,12 @@ void CCamPosition_Shoulder::Late_Update(_float fTimeDelta) if (FAILED(m_pGameInstance->IsBinded_Camera(CAMERA_SHOULDER))) { return; } - if (true == m_bLerp) { - m_vLerpTimer.x += fTimeDelta; - XMStoreFloat3(&m_vShoulderPosRatio, XMVectorLerp(XMLoadFloat3(&m_vShoulderStartRatio), XMLoadFloat3(&m_vShoulderOtherRatio), m_vLerpTimer.x / m_vLerpTimer.y)); - if (m_vLerpTimer.x > m_vLerpTimer.y) { - m_bLerp = false; - m_vLerpTimer.x = 0.f; + if (true == m_bLerpTranslation) { + m_vLerpTranslationTimer.x += fTimeDelta; + XMStoreFloat3(&m_vShoulderPosRatio, XMVectorLerp(XMLoadFloat3(&m_vShoulderStartRatio), XMLoadFloat3(&m_vShoulderOtherRatio), m_vLerpTranslationTimer.x / m_vLerpTranslationTimer.y)); + if (m_vLerpTranslationTimer.x > m_vLerpTranslationTimer.y) { + m_bLerpTranslation = false; + m_vLerpTranslationTimer.x = 0.f; m_vShoulderPosRatio = m_vShoulderOtherRatio; } diff --git a/Jusin154_Team3D/Editor/Private/LoadingWidget.cpp b/Jusin154_Team3D/Editor/Private/LoadingWidget.cpp index 9adb078a0..e203437b0 100644 --- a/Jusin154_Team3D/Editor/Private/LoadingWidget.cpp +++ b/Jusin154_Team3D/Editor/Private/LoadingWidget.cpp @@ -90,7 +90,7 @@ void CLoadingWidget::Update(_float fTimeDelta) } if (m_bLerpOn == true) { - Start_Lerp(m_fMoveSpeed); + Start_Lerp_Translation(m_fMoveSpeed); } if (m_bLerpOff == true) diff --git a/Jusin154_Team3D/Editor/Private/Mission_Icon.cpp b/Jusin154_Team3D/Editor/Private/Mission_Icon.cpp index 4c8f7af6e..baf3037f8 100644 --- a/Jusin154_Team3D/Editor/Private/Mission_Icon.cpp +++ b/Jusin154_Team3D/Editor/Private/Mission_Icon.cpp @@ -101,7 +101,7 @@ void CMission_Icon::Update(_float fTimeDelta) } if (m_bLerpOn == true) { - Start_Lerp(m_fMoveSpeed); + Start_Lerp_Translation(m_fMoveSpeed); } if (m_bLerpOff == true) diff --git a/Jusin154_Team3D/Editor/Private/Ride_Panel.cpp b/Jusin154_Team3D/Editor/Private/Ride_Panel.cpp index 0e4a565ad..193ac237e 100644 --- a/Jusin154_Team3D/Editor/Private/Ride_Panel.cpp +++ b/Jusin154_Team3D/Editor/Private/Ride_Panel.cpp @@ -111,7 +111,7 @@ void CRide_Panel::Update(_float fTimeDelta) if (m_bHover == true) { - Start_Lerp(fTimeDelta); + Start_Lerp_Translation(fTimeDelta); } else { diff --git a/Jusin154_Team3D/Editor/Private/SpellLearn_ChaserPointer.cpp b/Jusin154_Team3D/Editor/Private/SpellLearn_ChaserPointer.cpp index 5c760c82f..157ede96e 100644 --- a/Jusin154_Team3D/Editor/Private/SpellLearn_ChaserPointer.cpp +++ b/Jusin154_Team3D/Editor/Private/SpellLearn_ChaserPointer.cpp @@ -165,7 +165,7 @@ void CSpellLearn_ChaserPointer::Line(_float fTime) { m_vLerp_Position = m_MoveLine[m_iCurrentLine]; - if (Start_Lerp(fTime) == true) + if (Start_Lerp_Translation(fTime) == true) { if (m_iCurrentLine < m_iLineIndex - 1) { diff --git a/Jusin154_Team3D/Editor/Private/SpellLearn_Overlay.cpp b/Jusin154_Team3D/Editor/Private/SpellLearn_Overlay.cpp index 7c04ff286..591a9e3c1 100644 --- a/Jusin154_Team3D/Editor/Private/SpellLearn_Overlay.cpp +++ b/Jusin154_Team3D/Editor/Private/SpellLearn_Overlay.cpp @@ -125,7 +125,7 @@ void CSpellLearn_Overlay::Update(_float fTimeDelta) if (m_fSizeUp == true) { - if (Start_Lerp(fTimeDelta * m_fTimeMult * m_fMoveSpeed) == true) + if (Start_Lerp_Translation(fTimeDelta * m_fTimeMult * m_fMoveSpeed) == true) { m_fSizeUp = false; } diff --git a/Jusin154_Team3D/Editor/Private/SpellLearn_Slot.cpp b/Jusin154_Team3D/Editor/Private/SpellLearn_Slot.cpp index f7d879eaf..5c30daa21 100644 --- a/Jusin154_Team3D/Editor/Private/SpellLearn_Slot.cpp +++ b/Jusin154_Team3D/Editor/Private/SpellLearn_Slot.cpp @@ -95,7 +95,7 @@ void CSpellLearn_Slot::Update(_float fTimeDelta) if (m_fSizeUp == true) { - if (Start_Lerp(fTimeDelta * m_fTimeMult * m_fMoveSpeed) == true) + if (Start_Lerp_Translation(fTimeDelta * m_fTimeMult * m_fMoveSpeed) == true) { m_fSizeUp = false; } diff --git a/Jusin154_Team3D/Editor/Public/CamPosition_Shoulder.h b/Jusin154_Team3D/Editor/Public/CamPosition_Shoulder.h index a5b431472..14cbd0a93 100644 --- a/Jusin154_Team3D/Editor/Public/CamPosition_Shoulder.h +++ b/Jusin154_Team3D/Editor/Public/CamPosition_Shoulder.h @@ -46,8 +46,8 @@ class CCamPosition_Shoulder final : public CCamPosition _float3 m_vShoulderStartRatio = { 1.f, 2.f, -1.f }; _float3 m_vShoulderOtherRatio = { 1.f, 2.f, -1.f }; - _bool m_bLerp = { false }; - _float2 m_vLerpTimer = { 0.f, 1.f }; + _bool m_bLerpTranslation = { false }; + _float2 m_vLerpTranslationTimer = { 0.f, 1.f }; _float2 m_vAccRotDegrees = { 0.f, 0.f }; _float2 m_vAccRealDegrees = { 0.f, 0.f }; diff --git a/Jusin154_Team3D/Engine/Private/Camera.cpp b/Jusin154_Team3D/Engine/Private/Camera.cpp index 96886d17a..664d55f04 100644 --- a/Jusin154_Team3D/Engine/Private/Camera.cpp +++ b/Jusin154_Team3D/Engine/Private/Camera.cpp @@ -139,6 +139,13 @@ void CCamera::EnableTransition(_float fTransitionTime) m_vTransitionTime.y = fTransitionTime; } +void CCamera::DisableTransition() +{ + m_bIsCurrentTransition = false; + m_vTransitionTime.x = 0.f; + m_vTransitionTime.y = 1.f; +} + void CCamera::Set_RotDegreeVerticalLock(_float2 vVerticalLock) { m_vAccRotDegree_VerticalLocks = vVerticalLock; @@ -168,7 +175,7 @@ void CCamera::ZoomIn(_float fTimeDelta) } -void CCamera::Set_Fov(_float fFovy, _float fTimeDelta,_bool& bZoomIn) +void CCamera::Set_FovSlope(_float fFovy, _float fTimeDelta,_bool& bZoomIn) { if (fFovy > m_fFovy) { @@ -192,6 +199,11 @@ void CCamera::Set_Fov(_float fFovy, _float fTimeDelta,_bool& bZoomIn) } } +void CCamera::Set_Fov(_float fFovy) +{ + m_fFovy = fFovy; +} + _float CCamera::Get_Fov() { return m_fFovy; diff --git a/Jusin154_Team3D/Engine/Private/Camera_Manager.cpp b/Jusin154_Team3D/Engine/Private/Camera_Manager.cpp index 77fd7a9e3..fca41334d 100644 --- a/Jusin154_Team3D/Engine/Private/Camera_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/Camera_Manager.cpp @@ -58,6 +58,12 @@ HRESULT CCamera_Manager::Bind_Camera(_uint iLevel, const _wstring& wstrCameraKey return S_OK; } +CCamera* CCamera_Manager::Get_Camera(_uint iLevel, const _wstring& strCameraKey) +{ + CCamera* pOut = Find_Camera(iLevel, strCameraKey); + return pOut; +} + HRESULT CCamera_Manager::IsBinded_Camera(const _wstring& wstrCameraKey) { if (m_wstrCurrentCameraKey == wstrCameraKey) { diff --git a/Jusin154_Team3D/Engine/Private/ElementObject.cpp b/Jusin154_Team3D/Engine/Private/ElementObject.cpp index f06ff23ee..4dfbfdeb8 100644 --- a/Jusin154_Team3D/Engine/Private/ElementObject.cpp +++ b/Jusin154_Team3D/Engine/Private/ElementObject.cpp @@ -137,7 +137,7 @@ _float CElementObject::Get_Nine_Slice_Bottom() return m_vNine_Slice.w; } -_bool CElementObject::Start_Lerp(_float fTimeDelta) +_bool CElementObject::Start_Lerp_Translation(_float fTimeDelta) { _vector Pos = XMLoadFloat4(&m_fCurrent_Position); diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp index 8950b472d..eb3b004cb 100644 --- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp +++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp @@ -984,6 +984,10 @@ HRESULT CGameInstance::Add_Camera(_uint iLevel, CCamera* pCamera, const _wstring { return m_pCamera_Manager->Add_Camera(iLevel, pCamera, strCameraKey); } +CCamera* CGameInstance::Get_Camera(_uint iLevel, const _wstring& strCameraKey) +{ + return m_pCamera_Manager->Get_Camera(iLevel, strCameraKey); +} HRESULT CGameInstance::Bind_Camera(_uint iLevel, const _wstring& strCameraKey, _bool bIgnorePriority) { return m_pCamera_Manager->Bind_Camera(iLevel, strCameraKey, bIgnorePriority); diff --git a/Jusin154_Team3D/Engine/Private/Model.cpp b/Jusin154_Team3D/Engine/Private/Model.cpp index 3294aeaf5..62844e783 100644 --- a/Jusin154_Team3D/Engine/Private/Model.cpp +++ b/Jusin154_Team3D/Engine/Private/Model.cpp @@ -219,9 +219,9 @@ _bool CModel::Play_Anim(_float fTimeDelta, CTransform* pTransform) if (m_iPreAnimIndex >= 0 && m_iPreAnimIndex != m_iCurrentAnimIndex) { m_fBlendTime += fTimeDelta; - m_fRatio = (m_fBlendTime / m_fBlendDuration); - if (m_fRatio > 1.f) { - m_fRatio = 1.f; + fRatio = (m_fBlendTime / m_fBlendDuration); + if (fRatio > 1.f) { + fRatio = 1.f; } CAnimation* pCurAnim = m_Animations[m_iCurrentAnimIndex]; @@ -229,9 +229,9 @@ _bool CModel::Play_Anim(_float fTimeDelta, CTransform* pTransform) m_bIsFinishedAnim = pCurAnim->Update_TransformationMatrices(m_Bones, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_OutScale,m_OutRotation, m_OutTranslation,m_iRootBoneIndex); - pCurAnim->InterpAnim(pPreAnim, m_Bones, m_fRatio); + pCurAnim->InterpAnim(pPreAnim, m_Bones, fRatio); - if (m_fRatio >= 1.f) + if (fRatio >= 1.f) { m_iPreAnimIndex = m_iCurrentAnimIndex; m_fBlendTime = 0.f; @@ -263,7 +263,7 @@ _bool CModel::Play_Anim(_float fTimeDelta, CTransform* pTransform) if (m_bRatio) { - Update_RootBone(m_fAmount * m_fRatio); + Update_RootBone(m_fAmount * fRatio); } else { @@ -290,9 +290,9 @@ _bool CModel::Play_Anim(_float fTimeDelta, CTransform* pTransform) if (m_bQueuedAnim) { - if (m_fRatio >= 1.f) + if (fRatio >= 1.f) { - m_fRatio = 1.f; + fRatio = 1.f; m_iPreAnimIndex = m_iCurrentAnimIndex; m_fBlendTime = 0.f; @@ -315,8 +315,8 @@ _bool CModel::Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform) if (m_iPreAnimIndex >= 0 && m_iPreAnimIndex != m_iCurrentAnimIndex) { m_fBlendTime += fTimeDelta; - m_fRatio = (m_fBlendTime / m_fBlendDuration); - if (m_fRatio > 1.f) m_fRatio = 1.f; + fRatio = (m_fBlendTime / m_fBlendDuration); + if (fRatio > 1.f) fRatio = 1.f; m_fSecondBlendTime += fTimeDelta; m_fSecondRatio = (m_fSecondBlendTime / m_fSecondBlendDuration); @@ -333,7 +333,7 @@ _bool CModel::Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform) m_Animations[m_iCurrSecondAnimIndex]->InterpSecondAnim(m_Animations[m_iCurrentAnimIndex], m_iBoneMask, m_Bones, m_fSecondRatio* 5.f); - if (m_fRatio >= 1.f) + if (fRatio >= 1.f) { m_iPreAnimIndex = m_iCurrentAnimIndex; m_fBlendTime = 0.f; @@ -387,7 +387,7 @@ _bool CModel::Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform) } if (m_bRatio) { - Update_RootBone(m_fAmount * m_fRatio); + Update_RootBone(m_fAmount * fRatio); } else { @@ -441,7 +441,7 @@ _bool CModel::Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform) _bool CModel::IsBlending() const { return m_iPreAnimIndex != m_iCurrentAnimIndex && - m_fRatio < 1.f; + fRatio < 1.f; } @@ -476,7 +476,7 @@ void CModel::Set_AnimationIndex(_uint iIndex, _bool isLoop, _float fAmount, _boo } m_fBlendTime = 0.f; - m_fRatio = 0.f; + fRatio = 0.f; m_bRootBone = bRootBone; m_iCurrentAnimIndex = iIndex; m_bIsLoop = isLoop; @@ -2083,7 +2083,7 @@ void CModel::ComputeLocal(_uint AnimIndex, _uint MeshIndex) pDesc->CurrentAnimIndex = m_iCurrentAnimIndex; pDesc->PrevAnimIndex = m_iPreAnimIndex; pDesc->PrevTime = m_Animations[m_iPreAnimIndex]->Get_CurrentTrackPosition(); - pDesc->BlendRatio = m_fRatio; + pDesc->BlendRatio = fRatio; pDesc->RootBoneIndex = m_iRootBoneIndex; pDesc->PlayHeadBone = m_bHeadBone; diff --git a/Jusin154_Team3D/Engine/Private/NPCStat.cpp b/Jusin154_Team3D/Engine/Private/NPCStat.cpp index 8eb63279b..38fb97ad4 100644 --- a/Jusin154_Team3D/Engine/Private/NPCStat.cpp +++ b/Jusin154_Team3D/Engine/Private/NPCStat.cpp @@ -19,7 +19,7 @@ HRESULT CNPCStat::Initialize_Prototype(tinyxml2::XMLNode* pChild) pElement->QueryIntAttribute("ID", &m_NpcInfo.iID); m_NpcInfo.pNpc_Name = CMyTools::ToWstring(pElement->Attribute("Name")); m_NpcInfo.pName = CMyTools::ToWstring(pElement->Attribute("NpcName")); - pElement->QueryIntAttribute("TAG", &m_NpcInfo.iNpcType); + pElement->QueryIntAttribute("ZOOM_IN", &m_NpcInfo.iNpcType); pElement->QueryFloatAttribute("SizeX", &m_NpcInfo.fFontPos); return S_OK; } diff --git a/Jusin154_Team3D/Engine/Private/PanelObject.cpp b/Jusin154_Team3D/Engine/Private/PanelObject.cpp index 258e22c95..1cf136457 100644 --- a/Jusin154_Team3D/Engine/Private/PanelObject.cpp +++ b/Jusin154_Team3D/Engine/Private/PanelObject.cpp @@ -162,7 +162,7 @@ void CPanelObject::Function_Callback(wstring Name, void* pArg) } } -_bool CPanelObject::Start_Lerp(_float fTimeDelta) +_bool CPanelObject::Start_Lerp_Translation(_float fTimeDelta) { _vector Pos = XMLoadFloat4(&m_fCurrent_Position); diff --git a/Jusin154_Team3D/Engine/Private/TimeSocket.cpp b/Jusin154_Team3D/Engine/Private/TimeSocket.cpp index adf5699fd..cfd501a0e 100644 --- a/Jusin154_Team3D/Engine/Private/TimeSocket.cpp +++ b/Jusin154_Team3D/Engine/Private/TimeSocket.cpp @@ -9,65 +9,77 @@ CTimeSocket::CTimeSocket() _bool CTimeSocket::Trigger(_float fRatio) { _bool bResult = false; - if (m_fRatio <= fRatio) { + if (m_Contents.fRatio <= fRatio) { bResult = true; - m_funcEvent(*this); - - Finalize(); + m_Contents.funcEvent(*this); } return bResult; } - -HRESULT CTimeSocket::Initialize(CGameObject* pTarget, _string& strTag) +HRESULT CTimeSocket::Initialize(void* pArg) { - m_pEventTarget = pTarget; - SAFE_ADDREF(m_pEventTarget); - m_strEventName = strTag; - m_eTypeParam = TIMESOCKET_PARAM::END; - return S_OK; -} + SOCKETCONTENTS* pDesc = static_cast(pArg); -HRESULT CTimeSocket::Initialize(CGameObject* pTarget, _string& strTag, PSX::PxTransform& pxTransform) -{ - m_pEventTarget = pTarget; - SAFE_ADDREF(m_pEventTarget); - m_strEventName = strTag; - m_pxTransform = pxTransform; - m_eTypeParam = TIMESOCKET_PARAM::TRANSFORM; - return S_OK; -} + m_Contents.fRatio = pDesc->fRatio; + m_Contents.bTriggerred = pDesc->bTriggerred; + m_Contents.pEventTarget = pDesc->pEventTarget; + m_Contents.strEventName = pDesc->strEventName; + m_Contents.wstrLayerName = pDesc->wstrLayerName; + m_Contents.wstrKeyName = pDesc->wstrKeyName; + m_Contents.eTypeParam = pDesc->eTypeParam; + m_Contents.eTypeFunc = pDesc->eTypeFunc; + m_Contents.vFlags = pDesc->vFlags; + m_Contents.vParam_10 = pDesc->vParam_10; + m_Contents.vParam_11 = pDesc->vParam_11; + m_Contents.funcEvent = pDesc->funcEvent; -HRESULT CTimeSocket::Initialize(CGameObject* pTarget, _string& strTag, CGameObject* pOther) -{ - m_pEventTarget = pTarget; - SAFE_ADDREF(m_pEventTarget); - m_strEventName = strTag; - m_pOtherTarget = pOther; - SAFE_ADDREF(m_pOtherTarget); - m_eTypeParam = TIMESOCKET_PARAM::TARGET; - return S_OK; + switch (m_Contents.eTypeParam) + { + case TIMESOCKET_PARAM::TARGET: + m_Contents.pOtherTarget = pDesc->pOtherTarget; + break; + case TIMESOCKET_PARAM::TRANSFORM: + m_Contents.pxTransform = pDesc->pxTransform; + break; + case TIMESOCKET_PARAM::NOT_USE: + m_Contents.pOtherTarget = nullptr; + break; + default: + m_Contents.pOtherTarget = nullptr; + break; + } + + SAFE_ADDREF(m_Contents.pEventTarget); + if (m_Contents.eTypeParam == TIMESOCKET_PARAM::TARGET){ + SAFE_ADDREF(m_Contents.pOtherTarget); + } + + return S_OK; } void CTimeSocket::Finalize() { - switch (m_eTypeParam) + switch (m_Contents.eTypeParam) { case TIMESOCKET_PARAM::TARGET: - SAFE_RELEASE(m_pOtherTarget); - break; - case TIMESOCKET_PARAM::TRANSFORM: - m_pxTransform = {}; + SAFE_RELEASE(m_Contents.pOtherTarget); break; default: break; } - SAFE_RELEASE(m_pEventTarget); + SAFE_RELEASE(m_Contents.pEventTarget); } -CTimeSocket* CTimeSocket::Create() +CTimeSocket* CTimeSocket::Create(void* pArg) { - return new CTimeSocket(); + CTimeSocket* pInstance = new CTimeSocket(); + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Created : CTimeSocket"); + SAFE_RELEASE(pInstance); + } + + return pInstance; } void CTimeSocket::Free() diff --git a/Jusin154_Team3D/Engine/Private/Transform.cpp b/Jusin154_Team3D/Engine/Private/Transform.cpp index 4c1f10a3a..d95985a45 100644 --- a/Jusin154_Team3D/Engine/Private/Transform.cpp +++ b/Jusin154_Team3D/Engine/Private/Transform.cpp @@ -94,6 +94,15 @@ void CTransform::Set_WorldMatrix(PSX::PxTransform dstMatrix) XMMatrixAffineTransformation(XMLoadFloat3(&vScale), XMVectorZero(), XMLoadFloat4((_float4*)&dstMatrix.q), XMLoadFloat3((_float3*)&dstMatrix.p))); } +void CTransform::Compress_WorldMatrix(_float3& vTrans, _float4& vRotQ) +{ + vTrans.x = m_WorldMatrix.m[3][0]; + vTrans.y = m_WorldMatrix.m[3][1]; + vTrans.z = m_WorldMatrix.m[3][2]; + + XMStoreFloat4(&vRotQ, Get_QuarternionVector()); +} + HRESULT CTransform::Initialize_Prototype() { XMStoreFloat4x4(&m_WorldMatrix, XMMatrixIdentity()); @@ -418,6 +427,42 @@ void CTransform::Rotation(_fvector vRPY) Set_State(STATE::LOOK, vLook); } +void CTransform::RotationQ(_fvector vRotQ) +{ + _float3 vScale = Get_Scale(); + _vector vRight = XMVectorSet(1.f, 0.f, 0.f, 0.f) * vScale.x; + _vector vUp = XMVectorSet(0.f, 1.f, 0.f, 0.f) * vScale.y; + _vector vLook = XMVectorSet(0.f, 0.f, 1.f, 0.f) * vScale.z; + + _matrix RotationMatrix = XMMatrixRotationQuaternion(vRotQ); + + vRight = XMVector3TransformNormal(vRight, RotationMatrix); + vUp = XMVector3TransformNormal(vUp, RotationMatrix); + vLook = XMVector3TransformNormal(vLook, RotationMatrix); + + Set_State(STATE::RIGHT, vRight); + Set_State(STATE::UP, vUp); + Set_State(STATE::LOOK, vLook); +} + +void CTransform::RotationQ(PSX::PxQuat vRotQ) +{ + _float3 vScale = Get_Scale(); + _vector vRight = XMVectorSet(1.f, 0.f, 0.f, 0.f) * vScale.x; + _vector vUp = XMVectorSet(0.f, 1.f, 0.f, 0.f) * vScale.y; + _vector vLook = XMVectorSet(0.f, 0.f, 1.f, 0.f) * vScale.z; + + _matrix RotationMatrix = XMMatrixRotationQuaternion(XMVectorSet(vRotQ.x, vRotQ.y, vRotQ.z, vRotQ.w)); + + vRight = XMVector3TransformNormal(vRight, RotationMatrix); + vUp = XMVector3TransformNormal(vUp, RotationMatrix); + vLook = XMVector3TransformNormal(vLook, RotationMatrix); + + Set_State(STATE::RIGHT, vRight); + Set_State(STATE::UP, vUp); + Set_State(STATE::LOOK, vLook); +} + void CTransform::LookAt(_fvector vAt) { _float3 vScale = Get_Scale(); @@ -555,6 +600,35 @@ void CTransform::Free() void CTransform::Describe_Entity() { +#ifdef 기무리 + if (GUI::TreeNode("NuriDebug")) { + { + _vector vScale, vRotQ, vTrans; + XMMatrixDecompose(&vScale, &vRotQ, &vTrans, XMLoadFloat4x4(&m_WorldMatrix)); + _float4 scale, rotQ, trans; + XMStoreFloat4(&scale, vScale); + XMStoreFloat4(&rotQ, vRotQ); + XMStoreFloat4(&trans, vTrans); + if (GUI::SmallButton("Copy")) { + _char buf[512] = {}; + sprintf_s( + buf, sizeof(buf), + "\n" + "\t\n" + "\t\n" + "", + rotQ.x, rotQ.y, rotQ.z, rotQ.w, + trans.x, trans.y, trans.z + ); + GUI::SetClipboardText(buf); + } + GUI::Text("vScale : %.1f\t%.1f\t%.1f", scale.x, scale.y, scale.z); + GUI::Text("vRotQ : %.2f\t%.2f\t%.2f\t%.2f", rotQ.x, rotQ.y, rotQ.z, rotQ.w); + GUI::Text("vTrans : %.1f\t%.1f\t%.1f", trans.x, trans.y, trans.z); + } + GUI::TreePop(); + } +#endif // 기무리 if (GUI::TreeNode("Transform")) { GUI::Text("----- Gizmo ----"); _float3 vMove = {}; diff --git a/Jusin154_Team3D/Engine/Private/UIObject.cpp b/Jusin154_Team3D/Engine/Private/UIObject.cpp index ebb28b9da..a57ffec1f 100644 --- a/Jusin154_Team3D/Engine/Private/UIObject.cpp +++ b/Jusin154_Team3D/Engine/Private/UIObject.cpp @@ -370,7 +370,7 @@ void CUIObject::Lerp_PosY(_float PosY) m_fLerpY = PosY; } -_bool CUIObject::Start_Lerp(_float fTimeDelta) +_bool CUIObject::Start_Lerp_Translation(_float fTimeDelta) { return false; } diff --git a/Jusin154_Team3D/Engine/Private/tinyxml2.cpp b/Jusin154_Team3D/Engine/Private/tinyxml2.cpp index c237340e2..d05ae3efb 100644 --- a/Jusin154_Team3D/Engine/Private/tinyxml2.cpp +++ b/Jusin154_Team3D/Engine/Private/tinyxml2.cpp @@ -1,4 +1,4 @@ -/* +/* Original code by Lee Thomason (www.grinninglizard.com) This software is provided 'as-is', without any express or implied diff --git a/Jusin154_Team3D/Engine/Public/Camera.h b/Jusin154_Team3D/Engine/Public/Camera.h index c22ee96cf..a6acf7155 100644 --- a/Jusin154_Team3D/Engine/Public/Camera.h +++ b/Jusin154_Team3D/Engine/Public/Camera.h @@ -40,7 +40,10 @@ class ENGINE_DLL CCamera abstract : public CGameObject virtual void Late_Update(_float fTimeDelta) override; virtual HRESULT Render() override; virtual HRESULT Ready_Components(void* pArg)override; + virtual void Trigger(class CTimeSocket& Socket) {}; virtual void EnableTransition(_float fTransitionTime); + virtual void DisableTransition(); + void Set_RotDegreeVerticalLock(_float2 vVerticalLock); _float2 Get_RotDegreeVerticalLock(); @@ -49,9 +52,12 @@ class ENGINE_DLL CCamera abstract : public CGameObject _bool IsImportantThan(CCamera* pOther) const; const _float* Get_CurrentFar(); void ZoomIn(_float fTimeDelta); - void Set_Fov(_float fFovy,_float fTimeDelta, _bool& bZoomIn); + void Set_FovSlope(_float fFovy,_float fTimeDelta, _bool& bZoomIn); + + void Set_Fov(_float fFovy); _float Get_Fov(); + protected: _float m_fFovy = {}; _float m_fAspect = {}; diff --git a/Jusin154_Team3D/Engine/Public/Camera_Manager.h b/Jusin154_Team3D/Engine/Public/Camera_Manager.h index e599912ee..3d2ab50a7 100644 --- a/Jusin154_Team3D/Engine/Public/Camera_Manager.h +++ b/Jusin154_Team3D/Engine/Public/Camera_Manager.h @@ -15,6 +15,7 @@ class CCamera_Manager final : public CBase HRESULT Release_Camera(_uint iLevel, const _wstring& wstrCameraKey); HRESULT Add_Camera(_uint iLevel, CCamera* pCamera, const _wstring& wstrCameraKey); HRESULT Bind_Camera(_uint iLevel, const _wstring& wstrCameraKey, _bool bIgnorePriority); + class CCamera* Get_Camera(_uint iLevel, const _wstring& strCameraKey); HRESULT IsBinded_Camera(const _wstring& wstrCameraKey); _vector Get_CameraLook(); _float Get_CameraFov(); diff --git a/Jusin154_Team3D/Engine/Public/ElementObject.h b/Jusin154_Team3D/Engine/Public/ElementObject.h index 3e4d70450..c88564c54 100644 --- a/Jusin154_Team3D/Engine/Public/ElementObject.h +++ b/Jusin154_Team3D/Engine/Public/ElementObject.h @@ -30,7 +30,7 @@ class ENGINE_DLL CElementObject abstract : public CUIObject virtual _float Get_Nine_Slice_Top() override; virtual _float Get_Nine_Slice_Bottom() override; - virtual _bool Start_Lerp(_float fTimeDelta) override; + virtual _bool Start_Lerp_Translation(_float fTimeDelta) override; virtual _bool Start_Lerp_Speed(_float fTimeDelta, _float2 MousePoint) override; virtual _bool Set_Trgger(); virtual void Reset_Pos(_float fTimeDelta)override; diff --git a/Jusin154_Team3D/Engine/Public/Engine_Struct.h b/Jusin154_Team3D/Engine/Public/Engine_Struct.h index a4c17238a..7933e1aa1 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Struct.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Struct.h @@ -619,4 +619,8 @@ typedef struct tagPrevVPMatrices { _float4x4 PrevProjMatrix; }PREVVPMATRICES; +typedef struct tagBoolean { + _bool b[16] = {}; +}_boolean; + NS_END diff --git a/Jusin154_Team3D/Engine/Public/GameInstance.h b/Jusin154_Team3D/Engine/Public/GameInstance.h index 09abcda1b..21b7bebd4 100644 --- a/Jusin154_Team3D/Engine/Public/GameInstance.h +++ b/Jusin154_Team3D/Engine/Public/GameInstance.h @@ -199,6 +199,7 @@ class ENGINE_DLL CGameInstance final : public CBase HRESULT Release_Camera(_uint iLevel, const _wstring& wstrCameraKey); HRESULT Add_Camera(_uint iLevel, class CCamera* pCamera, const _wstring& strCameraKey); HRESULT Bind_Camera(_uint iLevel, const _wstring& strCameraKey, _bool bIgnorePriority); + class CCamera* Get_Camera(_uint iLevel, const _wstring& strCameraKey); HRESULT IsBinded_Camera(const _wstring& strCameraKey); _vector Get_CameraLook(); _float Get_CameraFov(); diff --git a/Jusin154_Team3D/Engine/Public/Model.h b/Jusin154_Team3D/Engine/Public/Model.h index a26897e21..f2217cb3a 100644 --- a/Jusin154_Team3D/Engine/Public/Model.h +++ b/Jusin154_Team3D/Engine/Public/Model.h @@ -214,7 +214,7 @@ class ENGINE_DLL CModel final : public CComponent _matrix m_DeltaAnimationMatrix = {}; // 루트본의 델타애니메이션 class CTransform* m_pTransform = { nullptr }; // 모델 대상의 트랜스폼 - _float m_fRatio = {}; + _float fRatio = {}; _int m_iCurrSecondAnimIndex = { -1 }; _int m_iBoneIndex[ENUM_CLASS(BLEND_BONE::END)] = { -1,-1,-1,-1,-1,-1,-1,-1 }; vector> m_BoneMask; diff --git a/Jusin154_Team3D/Engine/Public/MyTools.h b/Jusin154_Team3D/Engine/Public/MyTools.h index 89bf81ac7..18173e55c 100644 --- a/Jusin154_Team3D/Engine/Public/MyTools.h +++ b/Jusin154_Team3D/Engine/Public/MyTools.h @@ -155,6 +155,30 @@ class CMyTools { XMStoreFloat4x4(&matOut, (XMMatrixAffineTransformation(vTargetScale, XMVectorZero(), vTargetRotq, vTargetTrans))); } + + inline static void MatrixLerp( + _In_ _float3* pTransOrigin, // Origin -> 0 + _In_ _float3* pTransDest, + _In_ _float4* pRotQOrigin, + _In_ _float4* pRotQDest, + _Out_ _float4x4& matOut, _float fRatio) { + fRatio = Saturate(fRatio); + + _vector vOriginRotQ = XMVectorSet(pRotQOrigin->x, pRotQOrigin->y, pRotQOrigin->z, pRotQOrigin->w); + _vector vOriginTrans = XMVectorSet(pTransOrigin->x, pTransOrigin->y, pTransOrigin->z, 0.f); + + _vector vDestRotQ = XMVectorSet(pRotQDest->x, pRotQDest->y, pRotQDest->z, pRotQDest->w); + _vector vDestTrans = XMVectorSet(pTransDest->x, pTransDest->y, pTransDest->z, 0.f); + + if (XMVectorGetX(XMVector4Dot(vOriginRotQ, vDestRotQ)) < 0.f){ + vDestRotQ = XMVectorNegate(vDestRotQ); + } + + _vector vLerpRotQ = XMQuaternionSlerp(vOriginRotQ, vDestRotQ, fRatio); + _vector vLerpTrans = XMVectorLerp(vOriginTrans, vDestTrans, fRatio); + + XMStoreFloat4x4(&matOut, XMMatrixAffineTransformation(XMVectorSet(1.f, 1.f, 1.f, 0.f), XMVectorZero(), vLerpRotQ, vLerpTrans)); + } // 비슷하면 1 직교하면 0 완전 반대방향일수록 -1 inline static _float DirectionCompare(_vector a, _vector b) @@ -337,6 +361,31 @@ class CMyTools { return (Alphabet - 'A'); } + + template + inline static _bool TryParseEnum( string_view text, const pair(&table)[N], ENUM& outValue) + { + for (size_t i = 0; i < N; ++i) + { + if (table[i].first == text) + { + outValue = table[i].second; + return true; + } + } + return false; + } + + template + inline static string_view EnumToString( ENUM value, const pair(&table)[N], string_view fallback = "UNKNOWN") + { + for (size_t i = 0; i < N; ++i) + { + if (table[i].second == value) + return table[i].first; + } + return fallback; + } #ifdef _DEBUG inline static _bool DescribePxTransform(PSX::PxTransform& pxTransform, size_t iID) diff --git a/Jusin154_Team3D/Engine/Public/PanelObject.h b/Jusin154_Team3D/Engine/Public/PanelObject.h index d1b1aefc1..d49e14c04 100644 --- a/Jusin154_Team3D/Engine/Public/PanelObject.h +++ b/Jusin154_Team3D/Engine/Public/PanelObject.h @@ -34,7 +34,7 @@ class ENGINE_DLL CPanelObject abstract : public CUIObject virtual void Add_Function(wstring Name, function Evnet) override; virtual void Function_Callback(wstring Name, void* pArg = nullptr) override; - virtual _bool Start_Lerp(_float fTimeDelta) override; + virtual _bool Start_Lerp_Translation(_float fTimeDelta) override; virtual void Reset_Pos(_float fTimeDelta)override; protected: diff --git a/Jusin154_Team3D/Engine/Public/PhysX/vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h b/Jusin154_Team3D/Engine/Public/PhysX/vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h index 3b825b5df..84a5d06d6 100644 --- a/Jusin154_Team3D/Engine/Public/PhysX/vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h +++ b/Jusin154_Team3D/Engine/Public/PhysX/vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h @@ -1,4 +1,4 @@ -// Redistribution and use in source and binary forms, with or without +// Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // * Redistributions of source code must retain the above copyright @@ -127,7 +127,7 @@ struct PxVehiclePhysXConstraintState } }; -//TAG:solverprepshader +//ZOOM_IN:solverprepshader PX_FORCE_INLINE PxU32 vehicleConstraintSolverPrep (Px1DConstraint* constraints, PxVec3p& body0WorldOffset, diff --git a/Jusin154_Team3D/Engine/Public/TimeSocket.h b/Jusin154_Team3D/Engine/Public/TimeSocket.h index c2b320d26..bf66c54ee 100644 --- a/Jusin154_Team3D/Engine/Public/TimeSocket.h +++ b/Jusin154_Team3D/Engine/Public/TimeSocket.h @@ -3,51 +3,134 @@ NS_BEGIN(Engine) class CGameObject; +class CTimeSocket; typedef enum class typeTimeSocket_Param { + NOT_USE, TARGET, TRANSFORM, END }TIMESOCKET_PARAM; +static constexpr pair g_SocketParamTypeTable[ENUM_CLASS(TIMESOCKET_PARAM::END) + 1] = +{ + {"NOT_USE", TIMESOCKET_PARAM::NOT_USE}, + {"TARGET", TIMESOCKET_PARAM::TARGET}, + {"TRANSFORM", TIMESOCKET_PARAM::TRANSFORM}, + {"END", TIMESOCKET_PARAM::END}, +}; + typedef enum class typeTimeSocket_Func { - TRIGGER, - POSITION, - TAG, - TARGETTING, + // COMMON + TRANSLATION, + TRANSLATION_LERP, + TOGGLE_FLAGS, + + // CAMERA + BIND_CAMERA, + ZOOM_IN, + ZOOM_OUT, + ZOOM_LERP, + FADE_IN, + FADE_OUT, + END_CINEMATIC, + SET_PITCHLIMIT, + LOOK_AT, + DONT_LOOK_AT, + FOLLOW, + DONT_FOLLOW, + SHAKE, + + // CHARACTER + SET_ANIMSTATE, + SET_FSMSTATE, + + // EFFECT + + // SOUND + + // TRIGGER END }TIMESOCKET_FUNC; +static constexpr pair g_SocketFuncTypeTable[ENUM_CLASS(TIMESOCKET_FUNC::END) + 1] = +{ + {"TRANSLATION", TIMESOCKET_FUNC::TRANSLATION}, + {"TRANSLATION_LERP", TIMESOCKET_FUNC::TRANSLATION_LERP}, + {"TOGGLE_FLAGS", TIMESOCKET_FUNC::TOGGLE_FLAGS}, + + {"BIND_CAMERA", TIMESOCKET_FUNC::BIND_CAMERA}, + {"ZOOM_IN", TIMESOCKET_FUNC::ZOOM_IN}, + {"ZOOM_OUT", TIMESOCKET_FUNC::ZOOM_OUT}, + {"ZOOM_LERP", TIMESOCKET_FUNC::ZOOM_LERP}, + {"FADE_IN", TIMESOCKET_FUNC::FADE_IN}, + {"FADE_OUT", TIMESOCKET_FUNC::FADE_OUT}, + {"END_CINEMATIC", TIMESOCKET_FUNC::END_CINEMATIC}, + {"SET_PITCHLIMIT", TIMESOCKET_FUNC::SET_PITCHLIMIT}, + {"LOOK_AT", TIMESOCKET_FUNC::LOOK_AT}, + {"DONT_LOOK_AT", TIMESOCKET_FUNC::DONT_LOOK_AT}, + {"FOLLOW", TIMESOCKET_FUNC::FOLLOW}, + {"DONT_FOLLOW", TIMESOCKET_FUNC::DONT_FOLLOW}, + + {"SET_ANIMSTATE", TIMESOCKET_FUNC::SET_ANIMSTATE}, + {"SET_FSMSTATE", TIMESOCKET_FUNC::SET_FSMSTATE}, + + {"END", TIMESOCKET_FUNC::END}, +}; + +typedef struct tagSocketContents { + _float fRatio = { 0.f }; + _bool bTriggerred = { false }; + CGameObject* pEventTarget = { nullptr }; + _string strEventName = {}; + _wstring wstrLayerName = {}; + _wstring wstrKeyName = {}; + TIMESOCKET_PARAM eTypeParam = {}; + TIMESOCKET_FUNC eTypeFunc = {}; + union { + CGameObject* pOtherTarget = { nullptr }; + PSX::PxTransform pxTransform; + }; + _boolean vFlags = {}; + _uint4 vParam_10 = {}; + _float4 vParam_11 = {}; + function funcEvent = { nullptr }; +}SOCKETCONTENTS; + class ENGINE_DLL CTimeSocket final : public CBase { private: CTimeSocket(); virtual ~CTimeSocket() = default; public: - _float m_fRatio = { 0.f }; - _bool m_bTriggerred = { false }; - CGameObject* m_pEventTarget = { nullptr }; - _string m_strEventName = {}; - TIMESOCKET_PARAM m_eTypeParam = {}; - union { - CGameObject* m_pOtherTarget = { nullptr }; - PSX::PxTransform m_pxTransform; - }; - + SOCKETCONTENTS m_Contents = {}; virtual _bool Trigger(_float fRatio); -public: - HRESULT Initialize(CGameObject* pTarget, _string& strTag); - HRESULT Initialize(CGameObject* pTarget, _string& strTag, PSX::PxTransform& pxTransform); - HRESULT Initialize(CGameObject* pTarget, _string& strTag, CGameObject* pOther); + inline static _bool TryParse_TimeSocketParam(string_view text, TIMESOCKET_PARAM& outValue) + { + return CMyTools::TryParseEnum(text, g_SocketParamTypeTable, outValue); + } + + inline static string_view ToString_TimeSocketParam(TIMESOCKET_PARAM value) + { + return CMyTools::EnumToString(value, g_SocketParamTypeTable, "UNKNOWN_PARAM"); + } + + inline static _bool TryParse_TimeSocketFunc(string_view text, TIMESOCKET_FUNC& outValue) + { + return CMyTools::TryParseEnum(text, g_SocketFuncTypeTable, outValue); + } + + inline static string_view ToString_TimeSocketFunc(TIMESOCKET_FUNC value) + { + return CMyTools::EnumToString(value, g_SocketFuncTypeTable, "UNKNOWN_FUNC"); + } public: - static CTimeSocket* Create(); + static CTimeSocket* Create(void* pArg); virtual void Free() override; - -private: - function m_funcEvent = { nullptr }; private: + HRESULT Initialize(void* pArg); void Finalize(); }; diff --git a/Jusin154_Team3D/Engine/Public/Transform.h b/Jusin154_Team3D/Engine/Public/Transform.h index 91cd1f269..bcb69fea0 100644 --- a/Jusin154_Team3D/Engine/Public/Transform.h +++ b/Jusin154_Team3D/Engine/Public/Transform.h @@ -28,6 +28,7 @@ class ENGINE_DLL CTransform final : void Set_WorldMatrix(_float4x4& dstMatrix) { memcpy_s(&m_WorldMatrix, sizeof(_float4x4), &dstMatrix, sizeof(_float4x4)); } void Set_WorldMatrix(_fmatrix& dstMatrix) { XMStoreFloat4x4(&m_WorldMatrix, dstMatrix); } void Set_WorldMatrix(PSX::PxTransform dstMatrix); + void Compress_WorldMatrix(_float3& vTrans, _float4& vRotQ); _float Get_Speed() const { return m_fSpeedPerSec; } _float Get_RotationSpeed() const { return m_fRotationPerSec; } _float Get_Radius() const { return m_fRadius; } @@ -77,6 +78,8 @@ class ENGINE_DLL CTransform final : void Rotation(_float fRadianX, _float fRadianY, _float fRadianZ); void Rotation(_float3& vRadian); void Rotation(_fvector vRPY); + void RotationQ(_fvector vRotQ); + void RotationQ(PSX::PxQuat vRotQ); // Up, Down 벡터를 바라보게 하면 터짐, w에 1 있어야함 void LookAt(_fvector vAt); diff --git a/Jusin154_Team3D/Engine/Public/UIObject.h b/Jusin154_Team3D/Engine/Public/UIObject.h index 56a728363..ab627ee6b 100644 --- a/Jusin154_Team3D/Engine/Public/UIObject.h +++ b/Jusin154_Team3D/Engine/Public/UIObject.h @@ -156,7 +156,7 @@ typedef struct tagSpellLearnInfo virtual void Lerp_PosX(_float PosX); virtual void Lerp_PosY(_float PosY); - virtual _bool Start_Lerp(_float fTimeDelta); + virtual _bool Start_Lerp_Translation(_float fTimeDelta); virtual _bool Start_Lerp_Speed(_float fTimeDelta, _float2 Mouse_Point); virtual void Reset_Pos(_float fTimeDelta); virtual void Start_Size_Lerp(_float fTimeDelta); diff --git a/Jusin154_Team3D/Engine/Public/Unit.h b/Jusin154_Team3D/Engine/Public/Unit.h index cc11e348c..203419e88 100644 --- a/Jusin154_Team3D/Engine/Public/Unit.h +++ b/Jusin154_Team3D/Engine/Public/Unit.h @@ -32,6 +32,7 @@ class ENGINE_DLL CUnit abstract : public CContainerObject virtual void Priority_Update(_float fTimeDelta) override; virtual void Update(_float fTimeDelta) override; virtual void Late_Update(_float fTimeDelta) override; + virtual void Trigger(class CTimeSocket& Socket) {}; _wstring& Get_PrototypeTag() { return m_strModelPrototypeTag; } _bool IsAI() { return m_bAI; }