diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj b/Jusin154_Team3D/Client/Default/Client.vcxproj index 87cdc4be1..a1c8e8ee3 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj @@ -166,6 +166,7 @@ call Update_Resources.bat + @@ -411,6 +412,7 @@ call Update_Resources.bat + diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters index b4299d692..751ebd328 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters @@ -742,10 +742,10 @@ 02.GameObjects\Effect\MonsterEffect\Ranrok\Ranrok_Breath - + - 02.GameObjects\Cameras\CameraPosition\AI - + 02.GameObjects\Cameras\CameraPosition\AI + 04.Mechanic\Dialogue\Dialogue_Data @@ -755,6 +755,9 @@ 02.GameObjects\Player\Robe + + 02.GameObjects\Cameras\Camera_Model + @@ -1556,16 +1559,19 @@ {a3b5e707-dbb3-47da-a77b-b0ca62b89e99} - + {a24f4687-f540-44e5-ae47-fe176c4c9042} - + {b03591a7-a14e-425a-8a3f-2a6a054c884a} {f3c7cf8d-2b83-49d3-85da-fe135e376a11} + + {f8d55057-c0f8-4cac-8a6c-6f11345a83bb} + @@ -2255,15 +2261,15 @@ 02.GameObjects\Effect\MonsterEffect\Ranrok\Ranrok_Breath - + 02.GameObjects\Cameras\CameraPosition\AI - + 04.Mechanic\Dialogue\Dialogue_Data - - 02.GameObjects\Player\Robe + + 02.GameObjects\Cameras\Camera_Model diff --git a/Jusin154_Team3D/Client/Private/Camera_Model.cpp b/Jusin154_Team3D/Client/Private/Camera_Model.cpp new file mode 100644 index 000000000..2038d0675 --- /dev/null +++ b/Jusin154_Team3D/Client/Private/Camera_Model.cpp @@ -0,0 +1,246 @@ +#include "pch.h" +#include "Camera_Model.h" +#include "Shader.h" +#include "Layer.h" +#include "Player.h" + + +CCamera_Model::CCamera_Model(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CCamera(pDevice, pContext) +{ +} + +CCamera_Model::CCamera_Model(const CCamera_Model& rhs) + : CCamera(rhs) +{ +} + +void CCamera_Model::Priority_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + m_pGameInstance->Bind_Camera(NEXT_LEVEL, CAMERA_MODEL, false); +#endif // _DEBUG + + if (FAILED(m_pGameInstance->IsBinded_Camera(CAMERA_MODEL))) { + return; + } + //Transition(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; + } + if (m_pGameInstance->Mouse_Down(DIM_MBUTTON)) { + m_pGameInstance->Toggle_MouseCenter(); + } + + __super::Bind_Matrices(); +} + +void CCamera_Model::Update(_float fTimeDelta) +{ + m_pModelCom->Play_Animation(fTimeDelta, m_pTransformCom); + + +#ifdef _DEBUG + Describe_Entity(); +#endif // _DEBUG +} + +void CCamera_Model::Late_Update(_float fTimeDelta) +{ + /*if (FAILED(m_pGameInstance->IsBinded_Camera(CAMERA_MODEL))) { + return; + }*/ + + auto M = m_pModelCom->Get_BoneMatrix("lookat_target"); + GUI::Text("Bone T: %.3f %.3f %.3f", M.r[3].m128_f32[0], M.r[3].m128_f32[1], M.r[3].m128_f32[2]); + + + _vector vTargetPos = m_pModelCom->Get_BoneMatrix("lookat_target").r[3]; + + m_pTransformCom->LookAt( + XMVectorSetW(vTargetPos, 1.f) + ); + +// m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); +} + +HRESULT CCamera_Model::Render() +{ + if (FAILED(Bind_ShaderResources())) { + return E_FAIL; + } + + _uint iNumMeshes = m_pModelCom->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + + if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_Matrices( + "g_OffsetMatrix", + m_pModelCom->Get_OffsetMatrix(i).data(), + (_int)m_pModelCom->Get_OffsetMatrix(i).size() + ))) + { + return E_FAIL; + } + + + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::DEFAULT)))) { + return E_FAIL; + } + + m_pModelCom->Bind_OutPut_SRV_VS(31, 0); + m_pModelCom->Bind_OutPut_SRV_VS_Prev(32, 0); + + + if (FAILED(m_pModelCom->Render(i))) { + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT CCamera_Model::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CCamera_Model::Initialize(void* pArg) +{ + CAMERA_MODEL_DESC* pDesc = static_cast(pArg); + + if (FAILED(__super::Initialize(pArg))) { + return E_FAIL; + } + + if (FAILED(Ready_Components(pArg))) { + return E_FAIL; + } + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pDesc->vEye), 1.f)); + m_pTransformCom->LookAt(XMVectorSetW(XMLoadFloat3(&pDesc->vAt), 1.f)); + m_matInitial = *m_pTransformCom->Get_WorldMatrixPtr(); + m_bActive = true; + + + m_pModelCom->Set_Temp(true); + return S_OK; +} + +HRESULT CCamera_Model::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_CCL_CameraRig.001_Model"), + reinterpret_cast(&m_pModelCom)))) { + return E_FAIL; + } + + + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_ANIMMESH, + reinterpret_cast(&m_pShaderCom)))) { + return E_FAIL; + } + + + return S_OK; +} + +HRESULT CCamera_Model::Bind_ShaderResources() +{ + if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) { + return E_FAIL; + } +#ifdef 기무리 + if (FAILED(m_pShaderCom->Bind_Matrix("g_PrevWorldMatrix", m_pTransformCom->Get_PrevWorldMatrixPtr()))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Bind_PrevMatrix(m_pShaderCom, "g_PrevViewMatrix", D3DTS::VIEW))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Bind_PrevMatrix(m_pShaderCom, "g_PrevProjMatrix", D3DTS::PROJ))) { + return E_FAIL; + } +#endif // 기무리 + + if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { + return E_FAIL; + } + return S_OK; +} + +void CCamera_Model::Set_InitialPos() +{ + m_pTransformCom->Set_WorldMatrix(m_matInitial); +} + +CCamera_Model* CCamera_Model::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CCamera_Model* pInstance = new CCamera_Model(pDevice, pContext); + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CCamera_Model"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CCamera_Model::Clone(void* pArg, CGameObject* pOwner) +{ + CCamera_Model* pInstance = new CCamera_Model(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CCamera_Model"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CCamera_Model::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pModelCom); + SAFE_RELEASE(m_pShaderCom); +} +#ifdef _DEBUG + +void CCamera_Model::Describe_Entity() +{ + _float3 vPosition = {}; + GUI::Begin("CameraAnim List"); + for (_int i = 0; i < m_pModelCom->Get_AnimSize(); i++) + { + if (GUI::Button(m_pModelCom->Get_AnimList(i))) + { + m_pModelCom->Set_AnimationIndex(i); + } + } + + + GUI::End(); +} + +#endif // _DEBUG diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index 4e42cbdf8..bab50cfd9 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -4,6 +4,7 @@ #include "Level_Loading.h" #include "Light_Main.h" #include "Camera_Debug.h" +#include "Camera_Model.h" #include "InfoInstance.h" #include "UI_Manager.h" #include "Layer.h" diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 2afc59636..17c1dda96 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -14,6 +14,7 @@ #include "CamPosition_Socket.h" #include "CamPosition_Target.h" #include "CamPosition_AI.h" +#include "Camera_Model.h" #include "SkyBox.h" #include "Troll_Weapon.h" #include "Troll_Rock.h" @@ -1751,7 +1752,7 @@ HRESULT CLoader::Loading_For_GamePlay() Desc1.ePxMaterialTypes = { PXMATERIAL::DEFAULT }; Desc1.vMatInfo = { 0.5f, 0.5f, 0.6f }; Desc1.fContactOffset = { 0.05f }; - Desc1.vhalfGeometryInfo = { 1.f, 1.f, 1.f }; + Desc.vhalfGeometryInfo = { 0.5f, 0.5f, 0.5f }; Desc1.fDensity = 1.f; Desc1.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY()); Desc1.eLockFlag = {}; @@ -1911,6 +1912,9 @@ HRESULT CLoader::Loading_For_GamePlay() return E_FAIL; } + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_CCL_CameraRig.001_Model"), + CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Object/Camera/CCL_CameraRig.001.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) + return E_FAIL; /* For.Prototype_Component_SkyboxModel */ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_SkyboxModel"), @@ -2835,6 +2839,10 @@ HRESULT CLoader::Loading_For_GamePlay() if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamPosition_Arm::Create(m_pDevice, m_pContext)))) return E_FAIL; + /* For.Prototype_GameObject_Camera_Model */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamera_Model::Create(m_pDevice, m_pContext)))) + return E_FAIL; + /* For.Prototype_GameObject_Wand */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CWand::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 d293cc6fb..a1df16d7a 100644 --- a/Jusin154_Team3D/Client/Private/Player.cpp +++ b/Jusin154_Team3D/Client/Private/Player.cpp @@ -247,7 +247,7 @@ void CPlayer::Late_Update(_float fTimeDelta) if (m_bLookAt && m_LockOnInfo.pUnit) { - m_pTransformCom->LookAt_Horizontal_Lerp(m_LockOnInfo.pUnit->Get_WorldPostion(), fTimeDelta, 10.f); + m_pTransformCom->LookAt_Horizontal_Lerp(m_LockOnInfo.pUnit->Get_WorldPostion(), fTimeDelta, 5.f); } //////////////////////////////////////////////////////////////////////////// _vector look = XMVector3Normalize(m_pTransformCom->Get_State(STATE::LOOK)); @@ -374,7 +374,7 @@ void CPlayer::OnCollision(CGameObject* pOther, void* pDesc) { m_bShield = true; } - if (m_pFSM->IsEnable(FSMSTATE::DODGE | FSMSTATE::BLINK) && m_bShield) + if (m_pFSM->IsEnable(FSMSTATE::DODGE | FSMSTATE::BLINK) || m_bShield) return; #ifdef _DEBUG @@ -392,7 +392,8 @@ void CPlayer::OnCollision(CGameObject* pOther, void* pDesc) m_fHitDegree = -1.f; } - m_pFSM->Change_State(FSMSTATE::HIT); + if(m_eHitType !=ENUM_CLASS(HIT_TYPE::HIT_NONE)) + m_pFSM->Change_State(FSMSTATE::HIT); } void CPlayer::OnHit(CGameObject* pOther, CGameObject* pCaller) { diff --git a/Jusin154_Team3D/Client/Private/Player_States.cpp b/Jusin154_Team3D/Client/Private/Player_States.cpp index e2bc1b266..9a82f4762 100644 --- a/Jusin154_Team3D/Client/Private/Player_States.cpp +++ b/Jusin154_Team3D/Client/Private/Player_States.cpp @@ -1707,7 +1707,7 @@ HRESULT CPlayer::Behavior_ShieldExitCheck() if (Degree <= 60.f) { pairAnimInfo = m_Animation[STATEANIM::PARRY4]; - m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true, 1.f, false); Add_Event(pairAnimInfo.first, [this]() {m_bLookAt = true; }, @@ -1718,16 +1718,16 @@ HRESULT CPlayer::Behavior_ShieldExitCheck() if (Cross < 0.f) { pairAnimInfo = m_Animation[STATEANIM::PARRY2]; - m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second,1.f,true,1.f,false); } else { pairAnimInfo = m_Animation[STATEANIM::PARRY3]; - m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true, 1.f, false); } Add_Event(pairAnimInfo.first, [this]() {m_bLookAt = true; }, - 0.8f); + 0.11f); } else { pairAnimInfo = m_Animation[STATEANIM::PARRY_180]; diff --git a/Jusin154_Team3D/Client/Private/Protego.cpp b/Jusin154_Team3D/Client/Private/Protego.cpp index f71361785..a0d1db045 100644 --- a/Jusin154_Team3D/Client/Private/Protego.cpp +++ b/Jusin154_Team3D/Client/Private/Protego.cpp @@ -97,7 +97,6 @@ void CProtego::Late_Update(_float fTimeDelta) m_pTransformCom->Set_State(STATE::POSITION, m_pOwner->Get_Component()->Get_Position()); __super::Late_Update(fTimeDelta); - } HRESULT CProtego::Pre_Setting(CGameObject* pObject, void* pArg) @@ -135,7 +134,7 @@ HRESULT CProtego::Ready_Components(void* pArg) // if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_SHIELD"), (CComponent**)&m_pRigidBody, &Desc))) { // return E_FAIL; // } - // m_pGameInstance->Attach_Actor(*m_pRigidBody->Get_Actor()); + // m_pGameInstance->Attach_Actor(*m_pRigidBody->Get_Actor(),m_pGameInstance->Get_NextLevelID()); //} return S_OK; diff --git a/Jusin154_Team3D/Client/Private/Ranrok.cpp b/Jusin154_Team3D/Client/Private/Ranrok.cpp index 09a6abacc..86068d69f 100644 --- a/Jusin154_Team3D/Client/Private/Ranrok.cpp +++ b/Jusin154_Team3D/Client/Private/Ranrok.cpp @@ -160,10 +160,10 @@ void CRanrok::Late_Update(_float fTimeDelta) if (!m_pFSM->IsEnable(FSMSTATE::TUCKED)) { - /* if (true == m_bLookAt) { + if (true == m_bLookAt) { m_pTransformCom->LookAt_Horizontal_Lerp(XMLoadFloat4(&m_vTargetPos), fTimeDelta, 3.f); - }*/ + } m_pModelCom->Set_TargetPos((XMLoadFloat4(&m_vTargetPos))); } diff --git a/Jusin154_Team3D/Client/Private/Ranrok_FireBall.cpp b/Jusin154_Team3D/Client/Private/Ranrok_FireBall.cpp index 00cf5893a..f9a7976fb 100644 --- a/Jusin154_Team3D/Client/Private/Ranrok_FireBall.cpp +++ b/Jusin154_Team3D/Client/Private/Ranrok_FireBall.cpp @@ -85,7 +85,6 @@ void CRanrok_FireBall::Update(_float fTimeDelta) _vector vStartPos = XMLoadFloat4(&m_vStartPos); _vector vEndPos = m_pFireBall->Get_WorldPostion(); ON_COLLISION_INFO CollisionInfo = MonsterSweepTarget(vStartPos, vEndPos, 0.2f, true); - OnCollision(this, &CollisionInfo); } diff --git a/Jusin154_Team3D/Client/Private/Ranrok_States.cpp b/Jusin154_Team3D/Client/Private/Ranrok_States.cpp index 36eb4c179..dfede4778 100644 --- a/Jusin154_Team3D/Client/Private/Ranrok_States.cpp +++ b/Jusin154_Team3D/Client/Private/Ranrok_States.cpp @@ -283,6 +283,7 @@ void CRanrok::Behavior_FlyExit() void CRanrok::Behavior_FireBreathEnter() { pair<_uint, _bool> pairAnimInfo = {}; + m_bLookAt = true; m_pFSM->Enable_State(FSMSTATE::FIREBREATH); if (m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_AIR)) { @@ -292,13 +293,15 @@ void CRanrok::Behavior_FireBreathEnter() [&]() { pairAnimInfo = m_Animation[STATEANIM::FIREBREATH_A]; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBREATH)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBREATH)]; - m_pModelCom->Play_HeadBone(true); }, + m_pModelCom->Play_HeadBone(true); + m_bLookAt = false; }, 0.95f); Add_Event(m_Animation[STATEANIM::FIREBREATH_A].first, [&]() { pairAnimInfo = m_Animation[STATEANIM::FIREBREATH_COOLDOWN_A]; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); }, 0.95f); + Add_Event(m_Animation[STATEANIM::FIREBREATH_A].first, [this]() { m_pEffectPool->Use_Skill(SKILL_TYPE::RANROK_BREATH, this); @@ -358,6 +361,7 @@ void CRanrok::Behavior_FireBreathExit() void CRanrok::Behavior_FireSweepEnter() { pair<_uint, _bool> pairAnimInfo = {}; + m_bLookAt = true; m_pFSM->Enable_State(FSMSTATE::FIRESWEEP); if (m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_AIR)) { @@ -367,15 +371,15 @@ void CRanrok::Behavior_FireSweepEnter() [&]() { pairAnimInfo = m_Animation[STATEANIM::FIRESWEEP_A]; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIRESWEEP)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIRESWEEP)]; - m_pModelCom->Play_HeadBone(true); }, + m_pModelCom->Play_HeadBone(true); + m_bLookAt = false; }, 0.95f); Add_Event(m_Animation[STATEANIM::FIRESWEEP_A].first, [&]() { pairAnimInfo = m_Animation[STATEANIM::FIRESWEEP_COOLDOWN_A]; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); - m_bLookAt = true; }, - 0.94f); + 0.95f); Add_Event(m_Animation[STATEANIM::FIRESWEEP_A].first, @@ -650,9 +654,9 @@ void CRanrok::Behavior_PulseEnter() m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::PULSE)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::PULSE)]; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); - /*Add_Event(pairAnimInfo.first, + Add_Event(pairAnimInfo.first, [this]() { CameraShake(10.f, 2.f, 5.f, 1.2f); }, - 0.39f);*/ + 0.39f); } HRESULT CRanrok::Behavior_PulseExitCheck(_float fTimeDelta) diff --git a/Jusin154_Team3D/Client/Public/Camera_Model.h b/Jusin154_Team3D/Client/Public/Camera_Model.h new file mode 100644 index 000000000..eee7bdcfc --- /dev/null +++ b/Jusin154_Team3D/Client/Public/Camera_Model.h @@ -0,0 +1,50 @@ +#pragma once + +#include "Client_Define.h" +#include "Camera.h" + +NS_BEGIN(Client) + +class CCamera_Model final : public CCamera +{ +public: + typedef struct tagCamera_Model : public CCamera::CAMERA_DESC + { + _float3 vEye{}, vAt{}; + _float fMouseSensor{}; + }CAMERA_MODEL_DESC; +private: + CCamera_Model(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CCamera_Model(const CCamera_Model& rhs); + virtual ~CCamera_Model() = 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; + +private: + class CModel* m_pModelCom = { nullptr }; + class CShader* m_pShaderCom = { nullptr }; + _bool m_bMovable = true; + _float4x4 m_matInitial = {}; + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + HRESULT Bind_ShaderResources() override; + void Set_InitialPos(); + +public: + static CCamera_Model* 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/Client_Macro.h b/Jusin154_Team3D/Client/Public/Client_Macro.h index a1a9fddb0..9e18c3844 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_DEBUG TEXT("CAMERA_DEBUG") #define CAMERA_SHOULDER TEXT("CAMERA_SHOULDER") #define CAMERA_AI TEXT("CAMERA_AI") +#define CAMERA_MODEL TEXT("CAMERA_MODEL") #pragma endregion #pragma region COMPONENT diff --git a/Jusin154_Team3D/Client/Public/Ranrok.h b/Jusin154_Team3D/Client/Public/Ranrok.h index 1ce067a01..b36cf14d6 100644 --- a/Jusin154_Team3D/Client/Public/Ranrok.h +++ b/Jusin154_Team3D/Client/Public/Ranrok.h @@ -93,7 +93,7 @@ class CRanrok final : public CMonster _int m_ePhase = ENUM_CLASS(RANROK_PHASE::PHASE_AIR); _float m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::END)] = {}; - _float m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::END)] = { 40.f,40.f ,15.f,40.f,40.f,40.f}; + _float m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::END)] = { 40.f,40.f ,10.f,40.f,40.f,40.f}; _float m_fTuckedTime = {}; _bool m_bFireBurst = { false }; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Camera/CCL_CameraRig.001.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Camera/CCL_CameraRig.001.bin new file mode 100644 index 000000000..380521f4d --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Camera/CCL_CameraRig.001.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68c43f1841c58a234fbd5176f722501c140b04a21ee2bdaad46fc3f838b96f21 +size 150944 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Camera/CCL_CameraRig.001.fbx b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Camera/CCL_CameraRig.001.fbx new file mode 100644 index 000000000..274080f38 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Camera/CCL_CameraRig.001.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2796feec259cd37ae881572dc61f33b67e07fc233666fb7037789c2699c81b9f +size 818412 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Camera/T_Seasons_Fall_Grass_Top_D.png b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Camera/T_Seasons_Fall_Grass_Top_D.png new file mode 100644 index 000000000..53319dfb7 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Camera/T_Seasons_Fall_Grass_Top_D.png differ diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index 6ef6ee465..cd9b21a6a 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -2384,12 +2384,6 @@ HRESULT CLoader::Loading_For_ObjectViewer() } vector*>> futures = {}; - - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_SK_ConjuredDragon_Model"), - CModel::Create(m_pDevice, m_pContext, MODEL::ANIM_LOCAL, "C:/MeshTable\\Game\\Environment\\BroomFlight\\Meshes\\SM_BRR_RaceRing_01.fbx", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixIdentity())))) { - return E_FAIL; - } - #pragma region MONSTER futures.emplace_back(Deferred_ModelLoad( @@ -2498,10 +2492,13 @@ HRESULT CLoader::Loading_For_ObjectViewer() TEXT("Prototype_Component_Playable_Model") )); - /*futures.emplace_back(Deferred_ModelLoad( - MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Cmbt.fbx", XMMatrixIdentity(), - TEXT("Prototype_Component_Student_Cmbt_Model") - )); + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_CCL_CameraRig.001_Model"), + CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Object/Camera/CCL_CameraRig.001.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) + return E_FAIL; + //futures.emplace_back(Deferred_ModelLoad( + // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Rct.fbx", XMMatrixIdentity(), + // TEXT("Prototype_Component_Student_Cmbt_Model") + //)); futures.emplace_back(Deferred_ModelLoad( MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Rct.fbx", XMMatrixIdentity(), diff --git a/Jusin154_Team3D/Engine/Private/Channel.cpp b/Jusin154_Team3D/Engine/Private/Channel.cpp index fc4e1f6f6..ef532b799 100644 --- a/Jusin154_Team3D/Engine/Private/Channel.cpp +++ b/Jusin154_Team3D/Engine/Private/Channel.cpp @@ -164,11 +164,7 @@ void CChannel::Update_TransformationMatirx( vTranslation = XMVectorSetW(XMVectorLerp(XMLoadFloat3(&vSourTranslation), XMLoadFloat3(&vDestTranslation), fRatio), 1.f); } - /*if (!bIsSpine) - { - m_IsUpper = BoneMask[m_iBoneIndex]; - m_ilayerIndex = m_IsUpper ? 1 : 0; - }*/ + if (m_iBoneIndex == RootBoneIndex) { if (vector) @@ -185,23 +181,6 @@ void CChannel::Update_TransformationMatirx( XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation); Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix); - //if (bIsSpine) - //{ - // m_BoneTransformationMatrix = - // XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation); - - // Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix); - //} - //else - //{ - // if (m_ilayerIndex == 1) - // { - // m_BoneTransformationMatrix = - // XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation); - - // Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix); - // } - //} } } diff --git a/Jusin154_Team3D/Engine/Private/Model.cpp b/Jusin154_Team3D/Engine/Private/Model.cpp index 8669113bf..fff729c86 100644 --- a/Jusin154_Team3D/Engine/Private/Model.cpp +++ b/Jusin154_Team3D/Engine/Private/Model.cpp @@ -177,6 +177,8 @@ _bool CModel::Play_Anim(_float fTimeDelta, CTransform* pTransform) ComputeAnimation(m_iCurrentAnimIndex, m_iIndexAnimPlayableMesh); + Apply_CPU_HeadAim(); + if (m_bIsFinishedAnim) { if (m_bIsLoop) @@ -517,6 +519,47 @@ vector<_float4x4> CModel::Get_OffsetMatrix(_int iIndex) return m_Meshes[iIndex]->Get_OffsetMatrix(); } +void CModel::Apply_CPU_HeadAim() +{ + _int headIdx = m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HEAD)]; + if (headIdx < 0) + return; + + _float4x4 localF = m_Bones[headIdx]->Get_TransformationMatrix(); + _matrix local = XMLoadFloat4x4(&localF); + + _vector headFwd = XMVector3Normalize(local.r[2]); + + _vector dirWS = XMVector3Normalize(m_vTargetPos - m_pTransform->Get_State(STATE::POSITION)); + + _matrix worldInv = m_pTransform->Get_WorldMatrixInv(); + + _vector dirLocal = XMVector3Normalize(XMVector3TransformNormal(dirWS, worldInv)); + + _float dot = XMVectorGetX(XMVector3Dot(headFwd, dirLocal)); + dot = clamp(dot, -1.f, 1.f); + + _float angle = acosf(dot) * m_fHeadAimWeight; + + _vector axis = XMVector3Cross(headFwd, dirLocal); + if (XMVector3LengthSq(axis).m128_f32[0] < 1e-6f) + return; + + axis = XMVector3Normalize(axis); + + _vector qAim = XMQuaternionRotationAxis(axis, angle); + + _matrix aimRot = XMMatrixRotationQuaternion(qAim); + _matrix newLocal = aimRot * local; + + m_Bones[headIdx]->Set_TransformationMatrix(newLocal); + + Mark_CPUChain(headIdx); + Apply_CPUMask_ToBones(); +} + + + void CModel::Apply_CPUMask_ToBones() { for (size_t i = 0; i < m_Bones.size(); ++i) @@ -551,19 +594,18 @@ const _float4x4* CModel::Get_BoneMatrixPtr(const _char* pBoneName) return m_Bones[boneIdx]->Get_CombinedTransformationMatrixPtr(); } -const _float4x4* CModel::Get_BoneLocalMatrixPtr(const _char* pBoneName) +_matrix CModel::Get_BoneMatrix(const _char* pBoneName) { _int boneIdx = Get_BoneIndex(pBoneName); - if (boneIdx < 0) { - return nullptr; - } + if (boneIdx < 0) + return XMMatrixIdentity(); Mark_CPUChain(boneIdx); Apply_CPUMask_ToBones(); - return m_Bones[boneIdx]->Get_TransformationMatrixPtr(); + return m_Bones[boneIdx]->Get_CombinedTransformationMatrix(); } _matrix CModel::Get_BoneMatrix(const _char* pBoneName) const @@ -579,6 +621,20 @@ _matrix CModel::Get_BoneMatrix(const _char* pBoneName) const return (*iter)->Get_CombinedTransformationMatrix(); } +const _float4x4* CModel::Get_BoneLocalMatrixPtr(const _char* pBoneName) +{ + _int boneIdx = Get_BoneIndex(pBoneName); + + if (boneIdx < 0) + return nullptr; + + Mark_CPUChain(boneIdx); + + Apply_CPUMask_ToBones(); + + return m_Bones[boneIdx]->Get_TransformationMatrixPtr(); +} + _matrix CModel::Get_BoneLocalMatrix(const _char* pBoneName) const { vector::const_iterator iter = find_if(m_Bones.begin(), m_Bones.end(), [&](CBone* pBone)->_bool @@ -2367,10 +2423,10 @@ HRESULT CModel::Initialize(void* pArg) break; } } - if (-1 == m_iIndexAnimPlayableMesh) { + /* if (-1 == m_iIndexAnimPlayableMesh) { assert(false); - } + }*/ } diff --git a/Jusin154_Team3D/Engine/Public/Engine_Enum.h b/Jusin154_Team3D/Engine/Public/Engine_Enum.h index ffdb88d77..3afae67dc 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Enum.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Enum.h @@ -233,7 +233,7 @@ enum class PXOBJECT : _uint { enum class HIT_TYPE : _ubyte { - HIT_NONE = 0, + HIT_NONE = 0, // 히트모션 없음 HIT_PROJECTILE = 1 << 0, // 발사체 HIT_MEDIUM = 1 << 1, // 적당한 공격 HIT_HEAVY = 1 << 2, // 강공격 diff --git a/Jusin154_Team3D/Engine/Public/Model.h b/Jusin154_Team3D/Engine/Public/Model.h index 29b5c508f..c8f253b41 100644 --- a/Jusin154_Team3D/Engine/Public/Model.h +++ b/Jusin154_Team3D/Engine/Public/Model.h @@ -93,14 +93,16 @@ class ENGINE_DLL CModel final : public CComponent void Update_RootBone(_float Amount = 1.f); void Initialize_RootBone(); vector<_float4x4> Get_OffsetMatrix(_int iIndex); + void Apply_CPU_HeadAim(); void Apply_CPUMask_ToBones(); void Mark_CPUChain(_int boneIdx); #pragma endregion #pragma region Bone HRESULT Bind_BoneMatrices(_uint iMeshIndex, class CShader* pShader, const _char* pConstantName); const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName); - const _float4x4* Get_BoneLocalMatrixPtr(const _char* pBoneName); + _matrix Get_BoneMatrix(const _char* pBoneName); _matrix Get_BoneMatrix(const _char* pBoneName) const; + const _float4x4* Get_BoneLocalMatrixPtr(const _char* pBoneName); _matrix Get_BoneLocalMatrix(const _char* pBoneName) const; static _int Get_BoneIndex(const _char* pBoneName, vector Bones); // 본의 벡터와 이름을 넘겨주면 인덱스를 넘겨줌 ( n 순회 ) _int Get_BoneIndex(const _char* pBoneName) const;