diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj b/Jusin154_Team3D/Client/Default/Client.vcxproj index 84e2df0f2..4c8d2f9a4 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj @@ -113,7 +113,7 @@ $(USERNAME);_DEBUG;_WINDOWS;%(PreprocessorDefinitions);%(PreprocessorDefinitions) true stdcpp17 - ../Public/;../../EngineSDK/Inc/;../../EngineSDK/Inc/DirectXTK/;../../EngineSDK/Inc/fMod/;../../EngineSDK/Inc/IMGUI/;../../EngineSDK/Inc/FX11/;%(AdditionalIncludeDirectories) + ../Public/;../../EngineSDK/Inc/;../../EngineSDK/Inc/DirectXTK/;../../EngineSDK/Inc/fMod/;../../EngineSDK/Inc/IMGUI/;../../EngineSDK/Inc/FX11/;../../EngineSDK/Inc/PhysX/;%(AdditionalIncludeDirectories) true true Use @@ -123,7 +123,7 @@ Windows true ../../EngineSDK/Lib/$(ConfigurationName);%(AdditionalLibraryDirectories) - Engine.lib;fmod_vc.lib;DirectXTKd.lib;%(AdditionalDependencies) + Engine.lib;fmod_vc.lib;PhysX_64.lib;PhysXCommon_64.lib;PhysXCooking_64.lib;PhysXExtensions_static_64.lib;PhysXFoundation_64.lib;DirectXTKd.lib;%(AdditionalDependencies);%(AdditionalDependencies) cd /d "$(SolutionDir)" @@ -140,7 +140,7 @@ call Update_Resources.bat $(USERNAME);NDEBUG;_WINDOWS;%(PreprocessorDefinitions);%(PreprocessorDefinitions) true stdcpp17 - ../Public/;../../EngineSDK/Inc/;../../EngineSDK/Inc/DirectXTK/;../../EngineSDK/Inc/fMod/;../../EngineSDK/Inc/IMGUI/;../../EngineSDK/Inc/FX11/;%(AdditionalIncludeDirectories) + ../Public/;../../EngineSDK/Inc/;../../EngineSDK/Inc/DirectXTK/;../../EngineSDK/Inc/fMod/;../../EngineSDK/Inc/IMGUI/;../../EngineSDK/Inc/FX11/;../../EngineSDK/Inc/PhysX/;%(AdditionalIncludeDirectories) true true Use @@ -150,7 +150,7 @@ call Update_Resources.bat Windows true ../../EngineSDK/Lib/$(ConfigurationName);%(AdditionalLibraryDirectories) - Engine.lib;fmod_vc.lib;%(AdditionalDependencies) + Engine.lib;fmod_vc.lib;PhysX_64.lib;PhysXCommon_64.lib;PhysXCooking_64.lib;PhysXExtensions_static_64.lib;PhysXFoundation_64.lib;%(AdditionalDependencies);%(AdditionalDependencies) cd /d "$(SolutionDir)" @@ -166,6 +166,9 @@ call Update_Resources.bat + + + @@ -174,8 +177,12 @@ call Update_Resources.bat + + + + @@ -409,6 +416,10 @@ call Update_Resources.bat + + + + @@ -417,7 +428,10 @@ call Update_Resources.bat + + + diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters index 42bd5e443..8d7919437 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters @@ -338,7 +338,7 @@ 04.Mechanic\State\State_Combat\State_Swing - 04.Mechanic\State\State_Combat\State_Blink + 04.Mechanic\State\Movement\State_Blink 02.GameObjects\Item\Goblin_Dagger @@ -742,13 +742,34 @@ 02.GameObjects\Effect\MonsterEffect\Ranrok\Ranrok_Breath - + - 02.GameObjects\Cameras\CameraPosition\AI - + 02.GameObjects\Cameras\CameraPosition\AI + 04.Mechanic\Dialogue\Dialogue_Data + + 02.GameObjects\Player + + + 02.GameObjects\Player\Robe + + + 02.GameObjects\Cameras\Camera_Model + + + 02.GameObjects\NPC\Hostile\Monster\Goblin\Goblin_Assassin + + + 02.GameObjects\Item\Goblin_Sword + + + 04.Mechanic\State\State_Combat\State_Slash + + + 04.Mechanic\State\Movement\Dash + @@ -1137,9 +1158,6 @@ {f109c973-c532-4549-9680-d0d6495b0fa8} - - {27251db2-19f2-4492-a3a4-32c11526f413} - {b8c7e12b-da04-4d49-bc61-104649975d0b} @@ -1550,13 +1568,34 @@ {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} + + + {af9f5cf6-151a-49bc-9af4-28ba0bde1d37} + + + {db12252c-8c0d-40bc-9466-e76ec60e2509} + + + {0736f27e-2722-483b-88b6-30471ad70835} + + + {27251db2-19f2-4492-a3a4-32c11526f413} + + + {6d1f0862-40a4-4c0b-9921-87fe6af2008b} + @@ -1878,7 +1917,7 @@ 04.Mechanic\State\State_Combat\State_Swing - 04.Mechanic\State\State_Combat\State_Blink + 04.Mechanic\State\Movement\State_Blink 02.GameObjects\Item\Goblin_Dagger @@ -2246,13 +2285,32 @@ 02.GameObjects\Effect\MonsterEffect\Ranrok\Ranrok_Breath - + 02.GameObjects\Cameras\CameraPosition\AI - + 04.Mechanic\Dialogue\Dialogue_Data + + 02.GameObjects\Cameras\Camera_Model + + + + 02.GameObjects\NPC\Hostile\Monster\Goblin\Goblin_Assassin + + + 02.GameObjects\NPC\Hostile\Monster\Goblin\Goblin_Assassin + + + 02.GameObjects\Item\Goblin_Sword + + + 04.Mechanic\State\State_Combat\State_Slash + + + 04.Mechanic\State\Movement\Dash + diff --git a/Jusin154_Team3D/Client/Private/Avadakedavra.cpp b/Jusin154_Team3D/Client/Private/Avadakedavra.cpp index 959c7d120..6296b3046 100644 --- a/Jusin154_Team3D/Client/Private/Avadakedavra.cpp +++ b/Jusin154_Team3D/Client/Private/Avadakedavra.cpp @@ -76,7 +76,9 @@ void CAvadakedavra::Late_Update(_float fTimeDelta) __super::Late_Update(fTimeDelta); - //XMStoreFloat4(&m_vEndPos, m_pStupefy_PJ_PT->Get_WorldPostion()); + if (m_Info.pUnit) { + XMStoreFloat4(&m_vEndPos, m_Info.pUnit->Get_LockOnPos()); + } _vector vDir = XMLoadFloat4(&m_vEndPos) - XMLoadFloat4(&m_vStartPos); @@ -84,7 +86,7 @@ void CAvadakedavra::Late_Update(_float fTimeDelta) if (false == m_bHit) { _vector vStartPos = XMLoadFloat4(&m_vStartPos); _vector vEndPos = XMLoadFloat4(&m_vEndPos); - ON_COLLISION_INFO CollisionInfo = SweepTarget(vStartPos, vEndPos, 0.002f); + ON_COLLISION_INFO CollisionInfo = SweepTarget(vStartPos, vEndPos, 0.2f); OnCollision(this, &CollisionInfo); } diff --git a/Jusin154_Team3D/Client/Private/BroomRaceManager.cpp b/Jusin154_Team3D/Client/Private/BroomRaceManager.cpp index 08a5d9a48..258b6a796 100644 --- a/Jusin154_Team3D/Client/Private/BroomRaceManager.cpp +++ b/Jusin154_Team3D/Client/Private/BroomRaceManager.cpp @@ -251,38 +251,33 @@ void CBroomRaceManager::Check_RingPassed() _vector prevPos = racer.prevPos; - _float d0 = XMVectorGetX( - XMVector3Dot(prevPos - ringPos, ringFwd)); - _float d1 = XMVectorGetX( - XMVector3Dot(currPos - ringPos, ringFwd)); + _float Prev = XMVectorGetX(XMVector3Dot(prevPos - ringPos, ringFwd)); + _float Curr = XMVectorGetX(XMVector3Dot(currPos - ringPos, ringFwd)); #ifdef _DEBUG GUI::Text("%s", racer.pAI ? "AI" : "Player"); GUI::SameLine(); GUI::Text("CurRing %d", racer.curRing); - GUI::Text("PrevSide %.2f", d0); - GUI::Text("CurrSide %.2f", d1); + GUI::Text("PrevSide %.2f", Prev); + GUI::Text("CurrSide %.2f", Curr); #endif // _DEBUG - if (d0 * d1 <= 0.f && fabs(d0 - d1) > 1e-4f) + if (Prev * Curr <= 0.f && fabs(Prev - Curr) > 1e-4f) { - _float t = d0 / (d0 - d1); - t = std::clamp(t, 0.f, 1.f); + _float t = Prev / (Prev - Curr); + t = clamp(t, 0.f, 1.f); - _vector hitPos = - prevPos + (currPos - prevPos) * t; + _vector hitPos = prevPos + (currPos - prevPos) * t; _vector v = hitPos - ringPos; _float side = XMVectorGetX(XMVector3Dot(v, ringFwd)); _vector proj = hitPos - ringFwd * side; - _float dist = - XMVectorGetX(XMVector3Length(proj - ringPos)); + _float dist = XMVectorGetX(XMVector3Length(proj - ringPos)); if (dist <= PASS_RADIUS) { if(racer.pRacer){ pRing->Set_Target(false); } - racer.curRing = (racer.curRing + 1) % m_pRaceRings.size(); diff --git a/Jusin154_Team3D/Client/Private/CallBack_EffectHitBox_Behavior.cpp b/Jusin154_Team3D/Client/Private/CallBack_EffectHitBox_Behavior.cpp index 2e11f5720..d71b90b93 100644 --- a/Jusin154_Team3D/Client/Private/CallBack_EffectHitBox_Behavior.cpp +++ b/Jusin154_Team3D/Client/Private/CallBack_EffectHitBox_Behavior.cpp @@ -17,7 +17,7 @@ PSX::PxControllerBehaviorFlags CCallBack_EffectHitBox_Behavior::getBehaviorFlags return PSX::PxControllerBehaviorFlags(0); } PSX::PxControllerBehaviorFlags eResults = PSX::PxControllerBehaviorFlags(0); - PhsXUserData* pActorData = static_cast(actor.userData); + PHYSX_USERDATA* pActorData = static_cast(actor.userData); switch (pActorData->eKind) { case PHYSX_KIND::BODY_STATIC: diff --git a/Jusin154_Team3D/Client/Private/CallBack_EffectHitBox_HitReport.cpp b/Jusin154_Team3D/Client/Private/CallBack_EffectHitBox_HitReport.cpp index 7c3a1370d..e7058f463 100644 --- a/Jusin154_Team3D/Client/Private/CallBack_EffectHitBox_HitReport.cpp +++ b/Jusin154_Team3D/Client/Private/CallBack_EffectHitBox_HitReport.cpp @@ -34,8 +34,8 @@ void CCallBack_EffectHitBox_HitReport::onShapeHit(const PSX::PxControllerShapeHi ON_COLLISION_INFO CollisionDesc = {}; if (nullptr != pController && nullptr != pActor) { - PhsXUserData* pTargetActorData = static_cast(pActor->userData); - PhsXUserData* pOwnerActorData = static_cast(pController->getActor()->userData); + PHYSX_USERDATA* pTargetActorData = static_cast(pActor->userData); + PHYSX_USERDATA* pOwnerActorData = static_cast(pController->getActor()->userData); if (nullptr == pTargetActorData) { // missing user data return; } @@ -119,8 +119,8 @@ void CCallBack_EffectHitBox_HitReport::onControllerHit(const PSX::PxControllersH ON_COLLISION_INFO CollisionDesc = {}; if (nullptr != pController && nullptr != pOtherController) { - PhsXUserData* pTargetActorData = static_cast(pActor->userData); - PhsXUserData* pOwnerActorData = static_cast(pController->getActor()->userData); + PHYSX_USERDATA* pTargetActorData = static_cast(pActor->userData); + PHYSX_USERDATA* pOwnerActorData = static_cast(pController->getActor()->userData); assert(nullptr != pTargetActorData); // missing user data switch (pTargetActorData->eKind) diff --git a/Jusin154_Team3D/Client/Private/CallBack_Monster_Behavior.cpp b/Jusin154_Team3D/Client/Private/CallBack_Monster_Behavior.cpp index e4b961ca8..f27cdeb1b 100644 --- a/Jusin154_Team3D/Client/Private/CallBack_Monster_Behavior.cpp +++ b/Jusin154_Team3D/Client/Private/CallBack_Monster_Behavior.cpp @@ -17,7 +17,7 @@ PSX::PxControllerBehaviorFlags CCallBack_Monster_Behavior::getBehaviorFlags(cons return PSX::PxControllerBehaviorFlags(0); } PSX::PxControllerBehaviorFlags eResults = PSX::PxControllerBehaviorFlags(0); - PhsXUserData* pActorData = static_cast(actor.userData); + PHYSX_USERDATA* pActorData = static_cast(actor.userData); switch (pActorData->eKind) { case PHYSX_KIND::BODY_STATIC: diff --git a/Jusin154_Team3D/Client/Private/CallBack_Monster_HitReport.cpp b/Jusin154_Team3D/Client/Private/CallBack_Monster_HitReport.cpp index f01606d87..728bcf8e4 100644 --- a/Jusin154_Team3D/Client/Private/CallBack_Monster_HitReport.cpp +++ b/Jusin154_Team3D/Client/Private/CallBack_Monster_HitReport.cpp @@ -33,8 +33,8 @@ void CCallBack_Monster_HitReport::onShapeHit(const PSX::PxControllerShapeHit& hi PSX::PxRigidActor* pActor = hit.actor; if (nullptr != pController && nullptr != pActor) { - PhsXUserData* pTargetActorData = static_cast(pActor->userData); - PhsXUserData* pOwnerActorData = static_cast(pController->getActor()->userData); + PHYSX_USERDATA* pTargetActorData = static_cast(pActor->userData); + PHYSX_USERDATA* pOwnerActorData = static_cast(pController->getActor()->userData); if (nullptr == pTargetActorData) { // missing user data return; } @@ -105,8 +105,8 @@ void CCallBack_Monster_HitReport::onControllerHit(const PSX::PxControllersHit& h ON_COLLISION_INFO CollisionDesc = {}; if (nullptr != pController && nullptr != pOtherController) { - PhsXUserData* pTargetActorData = static_cast(pActor->userData); - PhsXUserData* pOwnerActorData = static_cast(pController->getActor()->userData); + PHYSX_USERDATA* pTargetActorData = static_cast(pActor->userData); + PHYSX_USERDATA* pOwnerActorData = static_cast(pController->getActor()->userData); assert(nullptr != pTargetActorData); // missing user data switch (pTargetActorData->eKind) diff --git a/Jusin154_Team3D/Client/Private/CallBack_NonPlayable_Behavior.cpp b/Jusin154_Team3D/Client/Private/CallBack_NonPlayable_Behavior.cpp index 90dce5274..ba7105ea8 100644 --- a/Jusin154_Team3D/Client/Private/CallBack_NonPlayable_Behavior.cpp +++ b/Jusin154_Team3D/Client/Private/CallBack_NonPlayable_Behavior.cpp @@ -17,7 +17,7 @@ PSX::PxControllerBehaviorFlags CCallBack_NonPlayable_Behavior::getBehaviorFlags( return PSX::PxControllerBehaviorFlags(0); } PSX::PxControllerBehaviorFlags eResults = PSX::PxControllerBehaviorFlags(0); - PhsXUserData* pActorData = static_cast(actor.userData); + PHYSX_USERDATA* pActorData = static_cast(actor.userData); switch (pActorData->eKind) { case PHYSX_KIND::BODY_STATIC: diff --git a/Jusin154_Team3D/Client/Private/CallBack_NonPlayable_HitReport.cpp b/Jusin154_Team3D/Client/Private/CallBack_NonPlayable_HitReport.cpp index fe36e9a90..1da0df324 100644 --- a/Jusin154_Team3D/Client/Private/CallBack_NonPlayable_HitReport.cpp +++ b/Jusin154_Team3D/Client/Private/CallBack_NonPlayable_HitReport.cpp @@ -31,8 +31,8 @@ void CCallBack_NonPlayable_HitReport::onShapeHit(const PSX::PxControllerShapeHit PSX::PxRigidActor* pActor = hit.actor; if (nullptr != pController && nullptr != pActor) { - PhsXUserData* pTargetActorData = static_cast(pActor->userData); - PhsXUserData* pOwnerActorData = static_cast(pController->getActor()->userData); + PHYSX_USERDATA* pTargetActorData = static_cast(pActor->userData); + PHYSX_USERDATA* pOwnerActorData = static_cast(pController->getActor()->userData); if (nullptr == pTargetActorData) { // missing user data return; } @@ -110,7 +110,7 @@ void CCallBack_NonPlayable_HitReport::onControllerHit(const PSX::PxControllersHi PSX::PxController* pOtherController = hit.other; // 다른 컨트롤러 if (nullptr != pController && nullptr != pOtherController) { - PhsXUserData* pActorData = static_cast(pOtherController->getActor()->userData); + PHYSX_USERDATA* pActorData = static_cast(pOtherController->getActor()->userData); assert(nullptr != pActorData); // missing user data switch (pActorData->eKind) diff --git a/Jusin154_Team3D/Client/Private/CallBack_Playable_Behavior.cpp b/Jusin154_Team3D/Client/Private/CallBack_Playable_Behavior.cpp index 28678a758..7b55633ab 100644 --- a/Jusin154_Team3D/Client/Private/CallBack_Playable_Behavior.cpp +++ b/Jusin154_Team3D/Client/Private/CallBack_Playable_Behavior.cpp @@ -17,7 +17,7 @@ PSX::PxControllerBehaviorFlags CCallBack_Playable_Behavior::getBehaviorFlags(con return PSX::PxControllerBehaviorFlags(0); } PSX::PxControllerBehaviorFlags eResults = PSX::PxControllerBehaviorFlags(0); - PhsXUserData* pActorData = static_cast(actor.userData); + PHYSX_USERDATA* pActorData = static_cast(actor.userData); switch (pActorData->eKind) { case PHYSX_KIND::BODY_STATIC: diff --git a/Jusin154_Team3D/Client/Private/CallBack_Playable_HitReport.cpp b/Jusin154_Team3D/Client/Private/CallBack_Playable_HitReport.cpp index 25d73a42d..a65b21501 100644 --- a/Jusin154_Team3D/Client/Private/CallBack_Playable_HitReport.cpp +++ b/Jusin154_Team3D/Client/Private/CallBack_Playable_HitReport.cpp @@ -31,8 +31,8 @@ void CCallBack_Playable_HitReport::onShapeHit(const PSX::PxControllerShapeHit& h PSX::PxRigidActor* pActor = hit.actor; if (nullptr != pController && nullptr != pActor) { - PhsXUserData* pTargetActorData = static_cast(pActor->userData); - PhsXUserData* pOwnerActorData = static_cast(pController->getActor()->userData); + PHYSX_USERDATA* pTargetActorData = static_cast(pActor->userData); + PHYSX_USERDATA* pOwnerActorData = static_cast(pController->getActor()->userData); if (nullptr == pTargetActorData) { // missing user data return; } @@ -110,7 +110,7 @@ void CCallBack_Playable_HitReport::onControllerHit(const PSX::PxControllersHit& PSX::PxController* pOtherController = hit.other; // 다른 컨트롤러 if (nullptr != pController && nullptr != pOtherController) { - PhsXUserData* pActorData = static_cast(pOtherController->getActor()->userData); + PHYSX_USERDATA* pActorData = static_cast(pOtherController->getActor()->userData); assert(nullptr != pActorData); // missing user data switch (pActorData->eKind) diff --git a/Jusin154_Team3D/Client/Private/CallBack_Ranrok_HitReport.cpp b/Jusin154_Team3D/Client/Private/CallBack_Ranrok_HitReport.cpp index 1d2fa2d99..d89f0b92a 100644 --- a/Jusin154_Team3D/Client/Private/CallBack_Ranrok_HitReport.cpp +++ b/Jusin154_Team3D/Client/Private/CallBack_Ranrok_HitReport.cpp @@ -34,8 +34,8 @@ void CCallBack_Ranrok_HitReport::onShapeHit(const PSX::PxControllerShapeHit& hit PSX::PxRigidActor* pActor = hit.actor; if (nullptr != pController && nullptr != pActor) { - PhsXUserData* pTargetActorData = static_cast(pActor->userData); - PhsXUserData* pOwnerActorData = static_cast(pController->getActor()->userData); + PHYSX_USERDATA* pTargetActorData = static_cast(pActor->userData); + PHYSX_USERDATA* pOwnerActorData = static_cast(pController->getActor()->userData); if (nullptr == pTargetActorData) { // missing user data return; } @@ -106,8 +106,8 @@ void CCallBack_Ranrok_HitReport::onControllerHit(const PSX::PxControllersHit& hi ON_COLLISION_INFO CollisionDesc = {}; if (nullptr != pController && nullptr != pOtherController) { - PhsXUserData* pTargetActorData = static_cast(pActor->userData); - PhsXUserData* pOwnerActorData = static_cast(pController->getActor()->userData); + PHYSX_USERDATA* pTargetActorData = static_cast(pActor->userData); + PHYSX_USERDATA* pOwnerActorData = static_cast(pController->getActor()->userData); assert(nullptr != pTargetActorData); // missing user data switch (pTargetActorData->eKind) diff --git a/Jusin154_Team3D/Client/Private/CallBack_Troll_HitReport.cpp b/Jusin154_Team3D/Client/Private/CallBack_Troll_HitReport.cpp index b7d81f51a..b973b2653 100644 --- a/Jusin154_Team3D/Client/Private/CallBack_Troll_HitReport.cpp +++ b/Jusin154_Team3D/Client/Private/CallBack_Troll_HitReport.cpp @@ -34,8 +34,8 @@ void CCallBack_Troll_HitReport::onShapeHit(const PSX::PxControllerShapeHit& hit) PSX::PxRigidActor* pActor = hit.actor; if (nullptr != pController && nullptr != pActor) { - PhsXUserData* pTargetActorData = static_cast(pActor->userData); - PhsXUserData* pOwnerActorData = static_cast(pController->getActor()->userData); + PHYSX_USERDATA* pTargetActorData = static_cast(pActor->userData); + PHYSX_USERDATA* pOwnerActorData = static_cast(pController->getActor()->userData); if (nullptr == pTargetActorData) { // missing user data return; } @@ -117,8 +117,8 @@ void CCallBack_Troll_HitReport::onControllerHit(const PSX::PxControllersHit& hit PSX::PxActor* pActor = pOtherController->getActor(); if (nullptr != pController && nullptr != pOtherController) { - PhsXUserData* pTargetActorData = static_cast(pActor->userData); - PhsXUserData* pOwnerActorData = static_cast(pController->getActor()->userData); + PHYSX_USERDATA* pTargetActorData = static_cast(pActor->userData); + PHYSX_USERDATA* pOwnerActorData = static_cast(pController->getActor()->userData); assert(nullptr != pTargetActorData); // missing user data diff --git a/Jusin154_Team3D/Client/Private/CamPosition_Socket.cpp b/Jusin154_Team3D/Client/Private/CamPosition_Socket.cpp index 14f9d07b9..afd31ccf9 100644 --- a/Jusin154_Team3D/Client/Private/CamPosition_Socket.cpp +++ b/Jusin154_Team3D/Client/Private/CamPosition_Socket.cpp @@ -16,7 +16,7 @@ void CCamPosition_Socket::Priority_Update(_float fTimeDelta) { /*_matrix socketMatrix = {}; - socketMatrix = XMLoadFloat4x4(m_pSocketMatrices); + socketMatrix = XMLoadFloat4x4(m_pSocketMatrix); for (int i = 0; i < 3; ++i) { socketMatrix.r[i] = XMVector3Normalize(socketMatrix.r[i]); @@ -40,7 +40,7 @@ HRESULT CCamPosition_Socket::Initialize_Prototype() HRESULT CCamPosition_Socket::Initialize(void* pArg) { CAMERAPOSITION_PLAYER_DESC* pDesc = static_cast (pArg); - //m_pSocketMatrices = pDesc->pSocketMatrices; + //m_pSocketMatrix = pDesc->pSocketMatrix; if (FAILED(__super::Initialize(pArg))) { return E_FAIL; 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/Effect_Container.cpp b/Jusin154_Team3D/Client/Private/Effect_Container.cpp index adf490335..b15a3fc87 100644 --- a/Jusin154_Team3D/Client/Private/Effect_Container.cpp +++ b/Jusin154_Team3D/Client/Private/Effect_Container.cpp @@ -634,7 +634,7 @@ _int CEffect_Container::CollisionCheck() if (nullptr != pActor && nullptr != pActor->userData) { - PhsXUserData* pUserData = static_cast(pActor->userData); + PHYSX_USERDATA* pUserData = static_cast(pActor->userData); if (pUserData->iSubKind >= UINT_MAX - 1) { continue; @@ -648,6 +648,7 @@ _int CEffect_Container::CollisionCheck() case PXOBJECT::GOBLIN_WARRIOR: case PXOBJECT::GOBLIN_MAGICIAN: case PXOBJECT::TROLL: + case PXOBJECT::RANROK: case PXOBJECT::WALL: { return i; @@ -707,11 +708,22 @@ ON_COLLISION_INFO CEffect_Container::SweepTarget(_vector StartPos, _vector EndPo if (nullptr != pActor && nullptr != pActor->userData) { - PhsXUserData* pUserData = static_cast(pActor->userData); + PHYSX_USERDATA* pUserData = static_cast(pActor->userData); tagCollInfo.pObject = pUserData->pOwner; switch (pUserData->eKind) { + case PHYSX_KIND::BODY_DYNAMIC: + switch (PXOBJECT(pUserData->iSubKind)) + { + case PXOBJECT::GOBLIN_PROTEGO: + { + pUserData->pOwner->OnCollision(this, &tagCollInfo); + m_bHit = true; + } + break; + } + break; case PHYSX_KIND::CCTActor: { switch (PXOBJECT(pUserData->iSubKind)) @@ -774,7 +786,7 @@ ON_COLLISION_INFO CEffect_Container::SweepTarget(_vector StartPos, _vector EndPo if (nullptr != pActor && nullptr != pActor->userData) { - PhsXUserData* pUserData = static_cast(pActor->userData); + PHYSX_USERDATA* pUserData = static_cast(pActor->userData); tagCollInfo.pObject = pUserData->pOwner; switch (PXOBJECT(pUserData->iSubKind)) @@ -826,11 +838,22 @@ ON_COLLISION_INFO CEffect_Container::MonsterSweepTarget(_vector StartPos, _vecto if (nullptr != pActor && nullptr != pActor->userData) { - PhsXUserData* pUserData = static_cast(pActor->userData); + PHYSX_USERDATA* pUserData = static_cast(pActor->userData); tagCollInfo.pObject = pUserData->pOwner; switch (pUserData->eKind) { + case PHYSX_KIND::BODY_DYNAMIC: + switch (PXOBJECT(pUserData->iSubKind)) + { + case PXOBJECT::SKILL_PROTEGO: + { + pUserData->pOwner->OnCollision(this, &tagCollInfo); + m_bHit = true; + } + break; + } + break; case PHYSX_KIND::CCTActor: { switch (PXOBJECT(pUserData->iSubKind)) @@ -842,11 +865,7 @@ ON_COLLISION_INFO CEffect_Container::MonsterSweepTarget(_vector StartPos, _vecto m_bHit = true; } break; - case PXOBJECT::SKILL_PROTEGO: - { - pUserData->pOwner->OnCollision(this, &tagCollInfo); - m_bHit = true; - } + } } } @@ -880,7 +899,7 @@ ON_COLLISION_INFO CEffect_Container::MonsterSweepTarget(_vector StartPos, _vecto if (nullptr != pActor && nullptr != pActor->userData) { - PhsXUserData* pUserData = static_cast(pActor->userData); + PHYSX_USERDATA* pUserData = static_cast(pActor->userData); tagCollInfo.pObject = pUserData->pOwner; switch (PXOBJECT(pUserData->iSubKind)) @@ -934,7 +953,7 @@ ON_COLLISION_INFO CEffect_Container::MonsterRayCast(_vector StartPos, _vector _v if (nullptr != pActor && nullptr != pActor->userData) { - PhsXUserData* pUserData = static_cast(pActor->userData); + PHYSX_USERDATA* pUserData = static_cast(pActor->userData); tagCollInfo.pObject = pUserData->pOwner; switch (pUserData->eKind) diff --git a/Jusin154_Team3D/Client/Private/Goblin.cpp b/Jusin154_Team3D/Client/Private/Goblin.cpp index 77e3a906f..bf67a4832 100644 --- a/Jusin154_Team3D/Client/Private/Goblin.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin.cpp @@ -340,6 +340,12 @@ void CGoblin::OnCollision(CGameObject* pOther, void* pDesc) case ENUM_CLASS(SKILL_TYPE::STUPEFY): m_eHitSpell = ENUM_CLASS(SKILL_TYPE::STUPEFY); break; + case ENUM_CLASS(SKILL_TYPE::AVADAKEDAVRA): + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::AVADAKEDAVRA); + break; + case ENUM_CLASS(SKILL_TYPE::ANCIENT_MAGIC): + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::ANCIENT_MAGIC); + break; } } else diff --git a/Jusin154_Team3D/Client/Private/Goblin_Assassin.cpp b/Jusin154_Team3D/Client/Private/Goblin_Assassin.cpp new file mode 100644 index 000000000..9f2534bdf --- /dev/null +++ b/Jusin154_Team3D/Client/Private/Goblin_Assassin.cpp @@ -0,0 +1,675 @@ +#include "pch.h" +#include "Goblin_Assassin.h" + +#include "GameInstance.h" +#include "InfoInstance.h" +#include "Layer.h" +#include "Player.h" +#include "Goblin_Sword.h" +#include "Goblin_Spector.h" +#include "Effect_Container.h" +#include "EffectPool.h" +#include "MapElement_Interactable.h" + +#include "EffectParts.h" + + +CGoblin_Assassin::CGoblin_Assassin(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CMonster(pDevice, pContext) +{ +} + +CGoblin_Assassin::CGoblin_Assassin(const CGoblin_Assassin& Prototype) + : CMonster(Prototype) +{ +} + +HRESULT CGoblin_Assassin::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CGoblin_Assassin::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components())) + return E_FAIL; + + if (FAILED(Ready_Parts())) + return E_FAIL; + + Add_FSM(); + + Set_Anim(); + + { + CFSM::FSM_DESC FSMDesc{}; + FSMDesc.pStates = &m_States; + FSMDesc.pStateMask = &m_iStateMask; + + m_pFSM->Bind_States(FSMDesc); + m_pFSM->Change_State(FSMSTATE::IDLE); + } + + m_pCallBack_Behavior->Initialize(m_pCharacter_Controller, m_pRigidBody); + m_pCallBack_HitReport->Initialize(m_pCharacter_Controller, m_pRigidBody); + + + m_pCharacter_Controller->Set_Position(XMVectorSet(-52.f, 0.f, -14.f, 1.f)); + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(-52.f, 0.f, -14.f, 1.f)); + + + m_pEffectPool = m_pGameInstance->Get_Layer(NEXT_LEVEL, TEXT("Layer_EffectPool"))->Get_Object(); + SAFE_ADDREF(m_pEffectPool); + + m_pModelCom->Set_Temp(true); + + return S_OK; +} + +void CGoblin_Assassin::Priority_Update(_float fTimeDelta) +{ + __super::Priority_Update(fTimeDelta); +} + +void CGoblin_Assassin::Update(_float fTimeDelta) +{ + if (m_bVisible == false) + return; + + m_pFSM->Update_State(fTimeDelta); + + m_pModelCom->Play_Animation(fTimeDelta * m_fEasing, m_pTransformCom); + + __super::Update(fTimeDelta); + + Play_Event(); + + if (true == m_pCharacter_Controller->IsActive()) { + { // 세트 + m_pCallBack_HitReport->BeginFrame(); + m_pCharacter_Controller->Move(fTimeDelta); + m_pCallBack_HitReport->Set_CurrentSlop(); + } + m_vStunTimer.x = 0.f; + } + else if (true == m_pRigidBody->IsActive()) { + if (0.f == m_vStunTimer.x) { + PSX::PxExtendedVec3 pxControlllerPos = m_pCharacter_Controller->Get_Controller()->getPosition(); + PSX::PxTransform pxTransform((_float)pxControlllerPos.x, (_float)pxControlllerPos.y + 100.f, (_float)pxControlllerPos.z); + m_pCharacter_Controller->Set_Position(XMLoadFloat3((_float3*)&pxTransform.p)); + //m_pCharacter_Controller->Move(fTimeDelta); + } + m_vStunTimer.x += fTimeDelta; + m_pTransformCom->Set_WorldMatrix(m_pRigidBody->Get_Actor()->getGlobalPose()); + if (m_vStunTimer.y < m_vStunTimer.x) { + m_pRigidBody->ConvertToCCT(*m_pCharacter_Controller); + } + } +#ifdef _DEBUG + Describe_Entity(); +#endif // _DEBUG + + for (_uint i = 0; i < ENUM_CLASS(GOBLIN_ASSASSIN_SKILL::END); i++) + m_fSkillCoolTime[i] = max(0.f, m_fSkillCoolTime[i] - fTimeDelta); + + + //m_pDetection->Set_Active(m_bDetection); + + + if (m_bDisolve) { + m_fDisolveTime += fTimeDelta*0.8f; + if (m_fDisolveTime >= 1.f) + { + m_fDisolveTime = 0.f; + m_bDisolve = false; + } + } +} + +void CGoblin_Assassin::Late_Update(_float fTimeDelta) +{ + if (m_bVisible == false) + return; + + __super::Late_Update(fTimeDelta); + if (true == m_pCharacter_Controller->IsActive()) { + m_pTransformCom->Set_State(STATE::POSITION, m_pCharacter_Controller->Get_FootPosition()); + } + else if (true == m_pRigidBody->IsActive()) { + m_pTransformCom->Set_WorldMatrix(m_pRigidBody->Get_FootPositionPxTransform()); + } + if (true == m_bLookAt) { + m_pTransformCom->LookAt_Horizontal_Lerp(XMLoadFloat4(&m_vTargetPos), fTimeDelta, 3.f); + } + + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); + + Set_Shadow(m_pGameInstance->IsIn_ShadowViewFrustum(m_pTransformCom->Get_State(STATE::POSITION), m_pTransformCom->Get_Radius())); +} + +HRESULT CGoblin_Assassin::Render() +{ + if (FAILED(Bind_ShaderResources())) { + return E_FAIL; + } + + if (FAILED(Render_DeadDisolve())) { + return E_FAIL; + } + _uint iNumMeshes = m_pModelCom->Get_NumMeshes(); + for (_uint i = 0; i < iNumMeshes; i++) + { + 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_pModelCom->Bind_Material(i, m_pShaderCom))) { + return E_FAIL; + } + + if (FAILED(m_pModelCom->Begin(i, m_pShaderCom, m_bDrawOutLine))) { + return E_FAIL; + } + + m_pModelCom->Bind_OutPut_SRV_VS(26, 0); + m_pModelCom->Bind_OutPut_SRV_VS_Prev(27, 0); + + if (FAILED(m_pModelCom->Render(i))) { + return E_FAIL; + } + } + + if (true == m_bDrawOutLine) { + Render_OutLine(); + } + +#ifdef _DEBUG + //if (true == m_pCharacter_Controller->IsActive()) { + // if (FAILED(m_pCharacter_Controller->Render())) { + // return E_FAIL; + // } + //} + //else { + // if (FAILED(m_pRigidBody->Render())) { + // return E_FAIL; + // } + //} +#endif + + if (0.f < m_fDeadRatio) { + _bool bDisolve = false; + if (FAILED(m_pShaderCom->Bind_RawValue("g_bDisolve", &bDisolve, sizeof(_bool)))) { + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT CGoblin_Assassin::Render_OutLine() +{ + m_bDrawOutLine = false; + if (FAILED(Bind_ShaderResources())) { + return E_FAIL; + } + + Compute_Depth(); + _float fRatio = (m_fCamDepth / *m_pGameInstance->Get_CurrentCameraFar()); + m_fOutLineThickness = CMyTools::Lerp_f1D(0.01f, 0.1f, fRatio); + if (m_fOutLineThickness > 0.1f) { + m_fOutLineThickness = 0.1f; + } + else if (m_fOutLineThickness < 0.01f) { + m_fOutLineThickness = 0.01f; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_vOutLineColor", &m_vOutLineColor, sizeof(_float3)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fOutLineThickness", &m_fOutLineThickness, sizeof(_float)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fOutLineScale", &m_fOutLineScale, sizeof(_float)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fOutLinePower", &m_fOutLinePower, sizeof(_float)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_vCamPosition", m_pGameInstance->Get_CamPosition(), sizeof(_float4)))) { + return E_FAIL; + } + _uint iNumMeshes = m_pModelCom->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + 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_pModelCom->Bind_Material(i, m_pShaderCom))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_NPC_PBR_ANIM::OUTLINE_READ)))) { + return E_FAIL; + } + + m_pModelCom->Bind_OutPut_SRV_VS(26, 0); + m_pModelCom->Bind_OutPut_SRV_VS_Prev(27, 0); + + if (FAILED(m_pModelCom->Render(i))) { + return E_FAIL; + } + } + return S_OK; +} + +HRESULT CGoblin_Assassin::Render_Shadow(SHADOW eType) +{ + if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShaderCom, "g_ViewMatrix", D3DTS::VIEW, eType))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShaderCom, "g_ProjMatrix", D3DTS::PROJ, eType))) { + return E_FAIL; + } + _uint iNumMeshes = m_pModelCom->Get_NumMeshes(); + for (_uint i = 0; i < iNumMeshes; i++) + { + 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_pModelCom->Begin(i, m_pShaderCom))) { + return E_FAIL; + } + + m_pModelCom->Bind_OutPut_SRV_VS(26, 0); + + if (FAILED(m_pModelCom->Render(i))) { + return E_FAIL; + } + } + + return S_OK; +} + +_vector CGoblin_Assassin::Get_LockOnPos() +{ + if (nullptr != m_pCharacter_Controller && true == m_pCharacter_Controller->IsActive()) { + return m_pCharacter_Controller->Get_Position(); + } + else if (nullptr != m_pRigidBody) { + return m_pRigidBody->Get_Position(); + } + return Get_WorldPostion(); +} + +void CGoblin_Assassin::OnCollision(CGameObject* pOther, void* pDesc) +{ + if (true == m_bDead) { + return; + } + if (m_pFSM->IsEnable(FSMSTATE::BLINK)) { + return; + } + m_DamageInfo.vTarget_Pos = m_pCharacter_Controller->Get_HeadPosition(); + +// m_pGoblinSpector->Set_Visible(false); + ON_COLLISION_INFO* CollisionDesc = static_cast(pDesc); + + Check_HitAngle(XMLoadFloat4(&CollisionDesc->vHitDir)); + + m_fHitRadius = CMyTools::Get_Direction2D(m_pTransformCom->Get_State(STATE::LOOK), XMLoadFloat4(&CollisionDesc->vHitDir)); + + CEffect_Container* pEffect_Container = dynamic_cast(pOther); + + pair<_float, _float> damagePair = {}; + + if (pEffect_Container != nullptr) + { + _uint iSkillType = pEffect_Container->Get_SkillType(); + //damagePair = Get_Damage(m_pInfoInstance->Get_Spell_Damage(iSkillType)); + + switch (iSkillType) + { + case ENUM_CLASS(SKILL_TYPE::DESCENDO): + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::DESCENDO); + break; + case ENUM_CLASS(SKILL_TYPE::BOMBARDA): + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::BOMBARDA); + break; + case ENUM_CLASS(SKILL_TYPE::JAP): + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::JAP); + m_fTumbleTimer = 0.f; + break; + case ENUM_CLASS(SKILL_TYPE::LEVIOSO): + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::LEVIOSO); + m_eHitState = ENUM_CLASS(HIT_STATE::AIR_LEVIOSO); + break; + case ENUM_CLASS(SKILL_TYPE::ACCIO): + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::ACCIO); + m_eHitState = ENUM_CLASS(HIT_STATE::AIR_LEVIOSO); + break; + case ENUM_CLASS(SKILL_TYPE::STUPEFY): + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::STUPEFY); + break; + case ENUM_CLASS(SKILL_TYPE::AVADAKEDAVRA): + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::AVADAKEDAVRA); + break; + case ENUM_CLASS(SKILL_TYPE::ANCIENT_MAGIC): + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::ANCIENT_MAGIC); + break; + } + } + else + { + damagePair = Get_Damage(m_pInfoInstance->Get_Spell_Damage(ENUM_CLASS(SKILL_TYPE::ANCIENT_MAGIC_THROW))); + CMapElement_Interactable* pProps = dynamic_cast(pOther); + if (pProps != nullptr) + { + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::ANCIENT_MAGIC_THROW); + } + } + + + //m_DamageInfo.fDamage = damagePair.first; + //m_pInfoInstance->Event_CallBack(TEXT("Monster_Hit"), &m_DamageInfo); + //if (0 == damagePair.second) { + // m_pFSM->Change_State(FSMSTATE::DEAD); + // _int ID = m_pStat->Get_Stat().iObjectID; + // m_pInfoInstance->Event_CallBack(TEXT("MonsterDead"), &ID); + // return; + //} + + + m_pFSM->Change_State(FSMSTATE::HIT); + + +} + +void CGoblin_Assassin::OnHit(CGameObject* pOther, CGameObject* pCaller) +{ +} + +void CGoblin_Assassin::Set_Detection(_bool bDetection) +{ + m_bDetection = bDetection; +} + +HRESULT CGoblin_Assassin::Ready_Components() +{ + CTransform::TRANSFORM_DESC Desc = {}; + + Desc.fSpeedPerSec = 10.f; + Desc.fRotationPerSec = XMConvertToRadians(180.0f); + Desc.fRadius = 10.f; + + if (FAILED(Add_Component(g_iStaticLevel, &m_pTransformCom, &Desc))) { + return E_FAIL; + } + if (FAILED(Add_Component(g_iStaticLevel, &m_pFSM))) { + return E_FAIL; + } + /* Com_Shader */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_NPC_PBR_ANIM, + reinterpret_cast(&m_pShaderCom)))) { + return E_FAIL; + } + + m_strModelPrototypeTag = TEXT("Prototype_Component_Goblin_Assassin_Model"); + + /* Com_Model */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_strModelPrototypeTag, + reinterpret_cast(&m_pModelCom)))) { + return E_FAIL; + } + + { // CCT + CCharacter_Controller::Character_Controller_DESC Desc{}; + + Desc.iSubKind = ENUM_CLASS(PXOBJECT::GOBLIN_WARRIOR); + Desc.pTransform = m_pTransformCom; + Desc.eBodyType = ACTOR::CAPSULE; + Desc.fContactOffset = 0.001f; + Desc.fMaterial = { 1.2f, 1.0f, 0.0f }; + Desc.bAutoStepping = { false }; + Desc.fStepOffset = { 0.02f }; + Desc.fRadius = 0.6f; + Desc.fHeight = 0.7f; + Desc.pCallback_HitReport = m_pCallBack_HitReport = CCallBack_Monster_HitReport::Create(); + Desc.pCallback_Behavior = m_pCallBack_Behavior = CCallBack_Monster_Behavior::Create(); + Desc.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY; + Desc.fWalkableSlope = 45.f; + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), (CComponent**)&m_pCharacter_Controller, &Desc))) { + return E_FAIL; + } + } + m_pCharacter_Controller->Set_Position(m_pTransformCom->Get_State(STATE::POSITION)); + { // DO + CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; + Desc.iSubKind = ENUM_CLASS(PXOBJECT::GOBLIN_WARRIOR); + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), (CComponent**)&m_pRigidBody, &Desc))) { + return E_FAIL; + } + m_pGameInstance->Detach_Actor(*m_pRigidBody->Get_Actor(), NEXT_LEVEL); + } + + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("STAT_GOBLIN"), (CComponent**)&m_pStat))) { + return E_FAIL; + } + return S_OK; +} + +HRESULT CGoblin_Assassin::Ready_Parts() +{ + { + CGoblin_Sword::GOBLIN_SWORD_DESC Goblin_SwordDesc{}; + + Goblin_SwordDesc.pParentTransform = m_pTransformCom; + Goblin_SwordDesc.pSocketMatrices = m_pModelCom->Get_BoneMatrixPtr("SKT_LeftHand"); + + if (FAILED(Add_PartObject("Goblin_Sword_L", g_iStaticLevel, nullptr, &Goblin_SwordDesc))) + { + return E_FAIL; + } + } + + { + CGoblin_Sword::GOBLIN_SWORD_DESC Goblin_SwordDesc{}; + + Goblin_SwordDesc.pParentTransform = m_pTransformCom; + Goblin_SwordDesc.pSocketMatrices = m_pModelCom->Get_BoneMatrixPtr("SKT_RightHand"); + + if (FAILED(Add_PartObject("Goblin_Sword_R", g_iStaticLevel, nullptr, &Goblin_SwordDesc))) + { + return E_FAIL; + } + } + + + //CGoblin_Spector::GOBLIN_SPECTOR_DESC Goblin_SpectorDesc{}; + + //Goblin_SpectorDesc.pParentTransform = m_pTransformCom; + + //if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_MONSTER, &Goblin_SpectorDesc, this, &m_pGoblinSpector))) { + // return E_FAIL; + //} + +#pragma region EFFECT + /* EFFECT */ + + CPartObject::PARTOBJECT_DESC PartsDesc{}; + + PartsDesc.pParentTransform = m_pTransformCom; + + if (FAILED(Add_PartObject("Goblin_Particle", g_iStaticLevel, &m_pGoblin_Particle, &PartsDesc))) + { + return E_FAIL; + } + + m_pGoblin_Particle->Load("../Bin/Resources/Data/Effect/Goblin/GoblinSide/Goblin_Particle", static_cast(g_iStaticLevel)); + m_pGoblin_Particle->FollowParents(m_pModelCom->Get_BoneMatrixPtr("RightShoulder")); + + + + if (FAILED(Add_PartObject("Goblin_Particle2", g_iStaticLevel, &m_pGoblin_Particle2, &PartsDesc))) + { + return E_FAIL; + } + + m_pGoblin_Particle2->Load("../Bin/Resources/Data/Effect/Goblin/GoblinSide/Goblin_Particle2", static_cast(g_iStaticLevel)); + m_pGoblin_Particle2->FollowParents(m_pModelCom->Get_BoneMatrixPtr("RightShoulder")); + + + if (FAILED(Add_PartObject("Goblin_Smoke", g_iStaticLevel, &m_pSmoke, &PartsDesc))) + { + return E_FAIL; + } + + m_pSmoke->Load("../Bin/Resources/Data/Effect/Goblin/GoblinSide/Goblin_Smoke", static_cast(g_iStaticLevel)); + m_pSmoke->FollowParents(m_pModelCom->Get_BoneMatrixPtr("Spine2")); + + +#pragma endregion + + + //if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_MONSTER, &PartsDesc, this, &m_pDetection))) { + // return E_FAIL; + //} + + return S_OK; +} + +HRESULT CGoblin_Assassin::Bind_ShaderResources() +{ + if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { + return E_FAIL; + } + 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; + } + 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; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { + return E_FAIL; + } + return S_OK; +} + +CGoblin_Assassin* CGoblin_Assassin::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CGoblin_Assassin* pInstance = new CGoblin_Assassin(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CGoblin_Assassin"); + SAFE_RELEASE(pInstance); + } + return pInstance; +} + +CGameObject* CGoblin_Assassin::Clone(void* pArg, CGameObject* pOwner) +{ + CGoblin_Assassin* pInstance = new CGoblin_Assassin(*this); + + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CGoblin_Assassin"); + SAFE_RELEASE(pInstance); + } + return pInstance; +} + +void CGoblin_Assassin::Free() +{ + __super::Free(); + + if (nullptr != m_pCallBack_Behavior) { + m_pCallBack_Behavior->Finalize(); + } + if (nullptr != m_pCallBack_HitReport) { + m_pCallBack_HitReport->Finalize(); + } + + SAFE_RELEASE(m_pCharacter_Controller); + SAFE_RELEASE(m_pRigidBody); + SAFE_RELEASE(m_pSmoke); + SAFE_RELEASE(m_pGoblin_Particle); + SAFE_RELEASE(m_pGoblin_Particle2); + SAFE_RELEASE(m_pEffectPool); + Safe_Delete(m_pCallBack_Behavior); + Safe_Delete(m_pCallBack_HitReport); +} +#ifdef _DEBUG + +void CGoblin_Assassin::Describe_Entity() +{ + GUI::Begin("UNIT", 0, IMGUI_GLOBAL_BEGIN_FLAG); + GUI::PushItemWidth(80); + if (GUI::CollapsingHeader("Goblin")) { + GUI::Checkbox("LookAt", &m_bLookAt); + + string AnimList = m_pModelCom->Get_AnimList(m_pModelCom->Get_AnimIndex()); + GUI::Text(AnimList.c_str()); + + GUI::Text("AnimTrack %.2f", m_pModelCom->Get_CurrentTrackPosition()); + GUI::Text("AnimRatio %.2f", m_pModelCom->Get_CurrentTrackProgressRatio()); + + _float4 vMomentum = {}; + XMStoreFloat4(&vMomentum, m_pTransformCom->Get_CurrentMomentum()); + GUI::Text("%.2f %.2f %.2f %.2f ", vMomentum.x, vMomentum.y, vMomentum.z, vMomentum.w); + + _float3 Pos; + XMStoreFloat3(&Pos, Get_WorldPostion()); + + if (GUI::DragFloat3("Pos", (_float*)&Pos)) + { + m_pCharacter_Controller->Set_Position(XMLoadFloat3(&Pos)); + } + + XMFLOAT3 f3; + XMStoreFloat3(&f3, m_vOriginPos); + + GUI::Text("Origin: %.2f, %.2f, %.2f", f3.x, f3.y, f3.z); + + m_fLength = XMVectorGetX(XMVector2Length(m_pTransformCom->Get_State(STATE::POSITION) - m_vOriginPos)); + + GUI::Text("Length %.2f", m_fLength); + + GUI::TextColored(ImVec4(1.f, 0.f, 0.f, 1.f), "Distance %.2f", m_fTargetDistance); + } + GUI::End(); +} + +#endif // _DEBUG diff --git a/Jusin154_Team3D/Client/Private/Goblin_Assassin_States.cpp b/Jusin154_Team3D/Client/Private/Goblin_Assassin_States.cpp new file mode 100644 index 000000000..89460f865 --- /dev/null +++ b/Jusin154_Team3D/Client/Private/Goblin_Assassin_States.cpp @@ -0,0 +1,1056 @@ +#include "pch.h" +#include "Goblin_Assassin.h" +#include "InfoInstance.h" +#include "GameInstance.h" +#include "Player.h" +#include "Goblin_Dagger.h" +#include "Goblin_Spector.h" +#include "EffectParts.h" + +#include "EffectPool.h" +#include "Goblin_BattleAxe.h" + +#pragma region STATE +#include "State_Idle.h" +#include "State_IdleBreak.h" +#include "State_Dodge.h" +#include "State_Jump.h" +#include "State_Land.h" +#include "State_Move.h" +#include "State_Combat.h" +#include "State_Slash.h" +#include "State_Dash.h" +#include "State_Blink.h" +#include "State_Hit.h" +#include "State_Dead.h" +#include "State_Shuffle.h" +#pragma endregion + + +void CGoblin_Assassin::Behavior_IdleEnter() +{ + m_pFSM->Enable_State(FSMSTATE::IDLE); + +} + +HRESULT CGoblin_Assassin::Behavior_IdleExitCheck() +{ + if (m_fTargetDistance <= 20.f && m_fTargetDistance > 10.f) + { + m_bLookAt = false; + m_bDetection = true; + + pair<_uint, _bool> pairAnimInfo = m_Animation[STATEANIM::IDLE]; + + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + } + if ((m_fTargetDistance <= 10.f && m_fTargetDistance != 0.f) /*|| m_pDetection->Get_Step() == true*/) + { + m_vOriginPos = m_pTransformCom->Get_State(STATE::POSITION); + m_bLookAt = true; + m_pFSM->Change_State(FSMSTATE::MOVE); + return E_FAIL; + } + else if (m_fTargetDistance >= 25.f) + { + m_bDetection = false; + + m_pFSM->Change_State(FSMSTATE::IDLEBREAK); + return E_FAIL; + } + + return S_OK; +} + +void CGoblin_Assassin::Behavior_IdleExit() +{ + m_pFSM->Disable_State(FSMSTATE::IDLE); +} + +void CGoblin_Assassin::Behavior_IdleBreakEnter() +{ + m_pFSM->Enable_State(FSMSTATE::IDLEBREAK); + pair<_uint, _bool> pairAnimInfo; + m_bLookAt = false; + _int RandIndex = m_pGameInstance->Real_Random_Int(0, 6); + switch (RandIndex) + { + case 0: + pairAnimInfo = m_Animation[STATEANIM::IDLE_BREAK1]; + break; + case 1: + pairAnimInfo = m_Animation[STATEANIM::IDLE_BREAK2]; + break; + case 2: + pairAnimInfo = m_Animation[STATEANIM::IDLE_BREAK3]; + break; + case 3: + pairAnimInfo = m_Animation[STATEANIM::IDLE_BREAK4]; + break; + case 4: + pairAnimInfo = m_Animation[STATEANIM::IDLE_BREAK5]; + break; + case 5: + pairAnimInfo = m_Animation[STATEANIM::IDLE_BREAK6]; + break; + case 6: + pairAnimInfo = m_Animation[STATEANIM::IDLE_BREAK7]; + break; + } + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); +} + +HRESULT CGoblin_Assassin::Behavior_IdleBreakExitCheck() +{ + if (m_pModelCom->IsFinishedAnim()) { + m_pFSM->Change_State(FSMSTATE::IDLE); + return E_FAIL; + } + + return S_OK; +} + +void CGoblin_Assassin::Behavior_IdleBreakExit() +{ + m_pFSM->Disable_State(FSMSTATE::IDLEBREAK); +} + +void CGoblin_Assassin::Behavior_MoveEnter() +{ + pair<_uint, _bool> pairAnimInfo = {}; + m_pFSM->Enable_State(FSMSTATE::MOVE); + m_bLookAt = true; + m_pFSM->Enable_State(FSMSTATE::JOG); + + if (!m_pFSM->IsEnable_Previous(FSMSTATE::COMBAT)) + { + m_bFirstMove = false; + } +} + +HRESULT CGoblin_Assassin::Behavior_MoveExitCheck(_float fTimeDelta) +{ + pair<_uint, _bool> pairAnimInfo = {}; + _uint iCurrAnimIndex = m_pModelCom->Get_AnimIndex(); + + if (m_fTargetDistance >= 6.f) + { + pairAnimInfo = m_Animation[STATEANIM::JOG_FWD]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + } + else { + if (!m_bFirstMove) + { + _uint Rand = m_pGameInstance->Real_Random_Int(0, 3); + + switch (Rand) + { + case 0: + pairAnimInfo = m_Animation[STATEANIM::JOG_112_L]; + break; + case 1: + pairAnimInfo = m_Animation[STATEANIM::JOG_112_R]; + break; + case 2: + if (iCurrAnimIndex == m_Animation[STATEANIM::JOG_90_R].first) { + pairAnimInfo = m_Animation[STATEANIM::JOG_112_R]; + } + else { + pairAnimInfo = m_Animation[STATEANIM::JOG_90_L]; + } + break; + case 3: + if (iCurrAnimIndex == m_Animation[STATEANIM::JOG_90_L].first) { + pairAnimInfo = m_Animation[STATEANIM::JOG_112_L]; + } + else { + pairAnimInfo = m_Animation[STATEANIM::JOG_90_R]; + } + break; + } + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 0.5f, true); + + m_bFirstMove = true; + m_fMoveTime = 0.f; + return S_OK; + } + m_fMoveTime += fTimeDelta; + + if (m_fMoveTime >= 2.f) + { + m_bFirstMove = false; + m_fMoveTime = 0.f; + } + } + + + if (m_fTargetDistance <= 15.f && m_fTargetDistance >= 4.f && m_fTargetDistance != 0.f) + { + m_pFSM->Change_State(FSMSTATE::COMBAT); + return E_FAIL; + } + + return S_OK; +} + +void CGoblin_Assassin::Behavior_MoveExit() +{ + m_pFSM->Disable_State(FSMSTATE::MOVE | FSMSTATE::SPRINT | FSMSTATE::JOG | FSMSTATE::WALK); +} + +void CGoblin_Assassin::Behavior_CombatEnter() +{ + pair<_uint, _bool> pairAnimInfo = {}; + m_pFSM->Enable_State(FSMSTATE::COMBAT); + m_bLookAt = true; +} + +HRESULT CGoblin_Assassin::Behavior_CombatExitCheck(_float fTimeDelta) +{ + if (m_fTargetDistance > 25.f && m_fTargetDistance != 0.f) + { + m_pFSM->Change_State(FSMSTATE::IDLE); + return E_FAIL; + } + else if (m_fTargetDistance > 20.f && m_fTargetDistance != 0.f) + { + m_pFSM->Change_State(FSMSTATE::MOVE); + return E_FAIL; + } + + if (m_fTargetDistance <= 6.f && m_fSkillCoolTime[ENUM_CLASS(GOBLIN_ASSASSIN_SKILL::SLASH)] <= 0.f) + { + m_pFSM->Change_State(FSMSTATE::SLASH); + return E_FAIL; + } + else if (m_fTargetDistance <= 10.f && m_fSkillCoolTime[ENUM_CLASS(GOBLIN_ASSASSIN_SKILL::DASH)] <= 0.f) + { + m_pFSM->Change_State(FSMSTATE::DASH); + return E_FAIL; + } + else if (m_fTargetDistance <= 15.f && m_fSkillCoolTime[ENUM_CLASS(GOBLIN_ASSASSIN_SKILL::TP)] <= 0.f) + { + m_pFSM->Change_State(FSMSTATE::BLINK); + return E_FAIL; + } + else { + m_pFSM->Change_State(FSMSTATE::MOVE); + return E_FAIL; + } + + return S_OK; +} + +void CGoblin_Assassin::Behavior_CombatExit() +{ + m_pFSM->Disable_State(FSMSTATE::COMBAT); +} + +void CGoblin_Assassin::Behavior_SlashEnter() +{ + pair<_uint, _bool> pairAnimInfo = {}; + m_pFSM->Enable_State(FSMSTATE::SLASH); + + pairAnimInfo = m_Animation[STATEANIM::SLASH]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + m_fSkillCoolTime[ENUM_CLASS(GOBLIN_ASSASSIN_SKILL::SLASH)] = m_fMaxSkillCoolTime[ENUM_CLASS(GOBLIN_ASSASSIN_SKILL::SLASH)]; +} + +HRESULT CGoblin_Assassin::Behavior_SlashExitCheck(_float fTimeDelta) +{ + if (m_pModelCom->IsFinishedAnim()) + { + m_pFSM->Change_State(FSMSTATE::COMBAT); + return E_FAIL; + } + + return S_OK; +} + +void CGoblin_Assassin::Behavior_SlashExit() +{ + m_pFSM->Disable_State(FSMSTATE::SLASH); +} + +void CGoblin_Assassin::Behavior_DashEnter() +{ + pair<_uint, _bool> pairAnimInfo = {}; + m_pFSM->Enable_State(FSMSTATE::DASH); + + pairAnimInfo = m_Animation[STATEANIM::DASH]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + m_fSkillCoolTime[ENUM_CLASS(GOBLIN_ASSASSIN_SKILL::DASH)] = m_fMaxSkillCoolTime[ENUM_CLASS(GOBLIN_ASSASSIN_SKILL::DASH)]; +} + +HRESULT CGoblin_Assassin::Behavior_DashExitCheck(_float fTimeDelta) +{ + if (m_pModelCom->IsFinishedAnim()) + { + m_pFSM->Change_State(FSMSTATE::SLASH); + return E_FAIL; + } + + return S_OK; +} + +void CGoblin_Assassin::Behavior_DashExit() +{ + m_pFSM->Disable_State(FSMSTATE::DASH); +} + +void CGoblin_Assassin::Behavior_BlinkEnter() +{ + pair<_uint, _bool> pairAnimInfo = {}; + m_pFSM->Enable_State(FSMSTATE::BLINK); + + pairAnimInfo = m_Animation[STATEANIM::BLINK_START]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true); + m_bDisolve = true; + + Add_Event(pairAnimInfo.first, + [this]() { + m_pEffectPool->Use_Skill(SKILL_TYPE::GOBILN_TELEPORT, this); + }, 0.1f); +} + +HRESULT CGoblin_Assassin::Behavior_BlinkExitCheck(_float fTimeDelta) +{ + pair<_uint, _bool> pairAnimInfo = {}; + _uint iCurrAnimIndex = m_pModelCom->Get_AnimIndex(); + if (!m_bDisolve && iCurrAnimIndex != m_Animation[STATEANIM::BLINK].first) + { + m_fSkillCoolTime[ENUM_CLASS(GOBLIN_ASSASSIN_SKILL::TP)] = m_fMaxSkillCoolTime[ENUM_CLASS(GOBLIN_ASSASSIN_SKILL::TP)]; + _vector vPlayerPos = XMLoadFloat4(&m_vTargetPos); + _vector vPlayerLook = m_pTarget->Get_Component()->Get_State(STATE::LOOK); + vPlayerLook = XMVectorSetY(vPlayerLook, 0.f); + vPlayerLook = XMVector3Normalize(vPlayerLook); + + _float randAngleDeg = m_pGameInstance->Real_Random_Float(-60.f, 60.f); + _float randAngleRad = XMConvertToRadians(randAngleDeg); + + _matrix rot = XMMatrixRotationY(randAngleRad); + _vector offsetDir = XMVector3TransformNormal(vPlayerLook, rot); + + _float randDist = m_pGameInstance->Real_Random_Float(3.f, 3.5f); + + _vector vFinalPos = vPlayerPos + offsetDir * randDist; + vFinalPos = XMVectorSetY(vFinalPos, XMVectorGetY(vPlayerPos) + 1.5f); + + m_pCharacter_Controller->Set_Position(vFinalPos); + + pairAnimInfo = m_Animation[STATEANIM::BLINK]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true); + } + + if (m_pModelCom->IsFinishedAnim() && iCurrAnimIndex == m_Animation[STATEANIM::BLINK].first) + { + m_bLookAt = true; + m_fTpTime = 0.f; + m_pFSM->Change_State(FSMSTATE::COMBAT); + return E_FAIL; + } + + return S_OK; +} + +void CGoblin_Assassin::Behavior_BlinkExit() +{ + m_pFSM->Disable_State(FSMSTATE::BLINK); +} + +void CGoblin_Assassin::Behavior_ShuffleEnter() +{ + pair<_uint, _bool> pairAnimInfo = {}; + m_pFSM->Enable_State(FSMSTATE::SHUFFLE); + _uint iRand = m_pGameInstance->Real_Random_Int(0, 3); + switch (iRand) + { + case 0: + pairAnimInfo = m_Animation[STATEANIM::SHUFFLE1]; + break; + case 1: + pairAnimInfo = m_Animation[STATEANIM::SHUFFLE2]; + break; + case 2: + pairAnimInfo = m_Animation[STATEANIM::SHUFFLE3]; + break; + case 3: + pairAnimInfo = m_Animation[STATEANIM::SHUFFLE4]; + break; + } + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true); +} + +HRESULT CGoblin_Assassin::Behavior_ShuffleExitCheck(_float fTimeDelta) +{ + _float fRatio = m_pModelCom->Get_CurrentTrackProgressRatio(); + + if (fRatio >= 0.3f) + { + m_pFSM->Change_State(FSMSTATE::COMBAT); + return E_FAIL; + } + + return S_OK; +} + +void CGoblin_Assassin::Behavior_ShuffleExit() +{ + m_pFSM->Disable_State(FSMSTATE::SHUFFLE); +} + +void CGoblin_Assassin::Behavior_HitEnter() +{ + pair<_uint, _bool> pairAnimInfo = {}; + _int iCurrAnimIndex = m_pModelCom->Get_AnimIndex(); + m_pFSM->Enable_State(FSMSTATE::HIT); + + m_bLookAt = false; + + _float fAnimSpeed = 1.f; + switch (m_eHitSpell) + { + case ENUM_CLASS(SKILL_TYPE::DESCENDO): + pairAnimInfo = m_Animation[STATEANIM::KNOCKDOWN_BWD]; + fAnimSpeed = 2.f; + Add_Event(m_Animation[STATEANIM::KNOCKDOWN_BWD_SPLT].first, + [&]() { pairAnimInfo = m_Animation[STATEANIM::TUMBLE_FWD]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, false, 0.5f); + m_pCharacter_Controller->SetGravity(false); + m_bAir = true; + }, + 0.3f); + + Add_Event(m_Animation[STATEANIM::KNOCKDOWN_BWD_SPLT].first, + [this]() { + CameraShake(10.f, 1.f, 2.f, 0.3f); + }, + 0.27f); + + Add_Event(m_Animation[STATEANIM::TUMBLE_FWD].first, + [this]() {m_pModelCom->Set_AnimSpeed(1.5f); }, + 0.75f); + + Add_Event(m_Animation[STATEANIM::TUMBLE_FWD].first, + [&]() { pairAnimInfo = m_Animation[STATEANIM::KNOCKDOWN_BWD_SPLT]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + m_bAir = false; + m_pCharacter_Controller->SetGravity(true); + }, + 0.96f); + + Add_Event(m_Animation[STATEANIM::KNOCKDOWN_BWD_SPLT].first, + [&]() { pairAnimInfo = m_Animation[STATEANIM::GETUP_BWD]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f); }, + 0.95f); + + Add_Event(m_Animation[STATEANIM::GETUP_BWD].first, + [this]() {m_bLookAt = true; }, + 0.7f); + break; + case ENUM_CLASS(SKILL_TYPE::BOMBARDA): + pairAnimInfo = m_Animation[STATEANIM::STUMBLE_BWD_L]; + break; + case ENUM_CLASS(SKILL_TYPE::JAP): + { + if (m_fHitDegree >= 90.f) + { + _int iRandIndex = m_pGameInstance->Real_Random_Int(0, 3); + switch (iRandIndex) + { + case 0: + pairAnimInfo = m_Animation[STATEANIM::HIT_BWD]; + break; + case 1: + pairAnimInfo = m_Animation[STATEANIM::HIT_BWD2]; + break; + case 2: + pairAnimInfo = m_Animation[STATEANIM::HIT_BWD3]; + break; + case 3: + pairAnimInfo = m_Animation[STATEANIM::HIT_BWD4]; + break; + default: + break; + } + } + else if (m_fHitDegree >= 45.f) { + + if (m_fHitCross > 0.f) { + pairAnimInfo = m_Animation[STATEANIM::HIT_L]; + } + else { + pairAnimInfo = m_Animation[STATEANIM::HIT_R]; + } + } + else { + pairAnimInfo = m_Animation[STATEANIM::HIT_FWD]; + } + } + break; + case ENUM_CLASS(SKILL_TYPE::LEVIOSO): + pairAnimInfo = m_Animation[STATEANIM::HIT_LEVIOSO]; + break; + case ENUM_CLASS(SKILL_TYPE::ACCIO): + pairAnimInfo = m_Animation[STATEANIM::INCARCEROUS]; + break; + default: + _int iRand = m_pGameInstance->Real_Random_Int(0, 1); + if (iRand == 0) + pairAnimInfo = m_Animation[STATEANIM::STUMBLE_BWD_L]; + else + pairAnimInfo = m_Animation[STATEANIM::STUMBLE_BWD_R]; + break; + } + + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, false, fAnimSpeed); + +} + +HRESULT CGoblin_Assassin::Behavior_HitExitCheck(_float fTimeDelta) +{ + pair<_uint, _bool> pairAnimInfo = {}; + _uint iCurrAnimIndex = m_pModelCom->Get_AnimIndex(); + _float fRatio = m_pModelCom->Get_CurrentTrackProgressRatio(); + CTransform* pTransform = m_pTarget->Get_Component(); + + if (iCurrAnimIndex == m_Animation[STATEANIM::KNOCKDOWN_BWD].first) + { + if (fRatio >= 0.15f) + { + pairAnimInfo = m_Animation[STATEANIM::KNOCKDOWN_BWD_SPLT]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f,false,2.f); + } + } + if (m_bAir) + { + _vector vDir = m_pTransformCom->Get_State(STATE::UP); + vDir = XMVector4Normalize(vDir); + _vector vPos = m_pCharacter_Controller->Get_Position(); + _vector Force = vDir * fTimeDelta*0.6f; + m_pCharacter_Controller->Set_Position(vPos + Force); + } + + if (!m_bAir && iCurrAnimIndex == m_Animation[STATEANIM::KNOCKDOWN_BWD_SPLT].first) + { + m_fGravityAmount += fTimeDelta * fRatio* 20.f; + m_pCharacter_Controller->Set_GravityAmount(m_fGravityAmount); + } + + if (iCurrAnimIndex == m_Animation[STATEANIM::TUMBLE_FWD].first) + { + Add_Event(m_Animation[STATEANIM::KNOCKDOWN_BWD_SPLT].first, + [&]() {CameraShake(3.f, 0.8f, 1.f, 0.2f); }, + 0.17f); + } + + if (m_eHitSpell == ENUM_CLASS(SKILL_TYPE::ACCIO)) + { + if (!m_bPos) + { + m_pCharacter_Controller->SetGravity(false); + _vector vPlayerPos = pTransform->Get_State(STATE::POSITION); + vPlayerPos = XMVectorSetY(vPlayerPos, XMVectorGetY(vPlayerPos) + 2.5f); + _vector vMonsterPos = m_pCharacter_Controller->Get_Position(); + + _vector vDir = XMVector3Normalize(vPlayerPos - vMonsterPos); + _float fLength = XMVectorGetX(XMVector3Length(vPlayerPos - vMonsterPos)); + + m_fSpeed += (m_fTargetSpeed - m_fSpeed) * fTimeDelta * m_fAccel; + + if (fLength >= 4.f) + { + m_pCharacter_Controller->Set_Position( + vMonsterPos + vDir * m_fSpeed * fTimeDelta + ); + } + else { + m_bPos = true; + pairAnimInfo = m_Animation[STATEANIM::HIT_LEVIOSO]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f); + } + } + } + + if (m_eHitSpell == ENUM_CLASS(SKILL_TYPE::LEVIOSO)) + { + if (iCurrAnimIndex == m_Animation[STATEANIM::HIT_LEVIOSO].first) + { + _vector vDir = m_pTransformCom->Get_State(STATE::UP); + vDir = XMVector4Normalize(vDir); + _vector vPos = m_pCharacter_Controller->Get_Position(); + m_fAirTime += fTimeDelta; + _vector Force = vDir * fTimeDelta; + if (m_fAirTime < 1.3f) { + m_pCharacter_Controller->Set_Position(vPos + Force); + } + else { + m_pCharacter_Controller->Set_Position(vPos); + } + m_pCharacter_Controller->SetGravity(false); + } + } + + HitState_Behavior(fTimeDelta); + + + if (iCurrAnimIndex == m_Animation[STATEANIM::TUMBLE].first) + { + m_fTumbleTimer += fTimeDelta; + + if (m_fTumbleTimer >= 1.5f) + { + m_fTumbleTimer = 0.f; + pairAnimInfo = m_Animation[STATEANIM::KNOCKDOWN_BWD_SPLT]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + m_pCharacter_Controller->SetGravity(true); + + + Add_Event(m_Animation[STATEANIM::KNOCKDOWN_BWD_SPLT].first, + [&]() {CameraShake(3.f, 0.8f, 1.f, 0.2f); }, + 0.21f); + + Add_Event(m_Animation[STATEANIM::KNOCKDOWN_BWD_SPLT].first, + [&]() { pairAnimInfo = m_Animation[STATEANIM::GETUP_BWD]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f); + m_fAirTime = 0.f; }, + 0.95f); + } + return S_OK; + } + if (m_vStunTimer.y < m_vStunTimer.x) { + pairAnimInfo = m_Animation[STATEANIM::GETUP_FWD]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f); + } + + if (m_pModelCom->IsFinishedAnim()) + { + m_pFSM->Change_State(FSMSTATE::COMBAT); + return E_FAIL; + } + return S_OK; +} + +void CGoblin_Assassin::Behavior_HitExit() +{ + m_pFSM->Disable_State(FSMSTATE::HIT); + m_bPos = false; + m_bLookAt = true; + m_eHitState = ENUM_CLASS(HIT_STATE::END); + m_pCharacter_Controller->Reset_GravityAmount(); + m_fGravityAmount = 0.f; +} + +void CGoblin_Assassin::Behavior_DeadEnter() +{ + m_bLookAt = false; + pair<_uint, _bool> pairAnimInfo = {}; + m_pFSM->Enable_State(FSMSTATE::DEAD); + m_pCharacter_Controller->SetGravity(true); + + _bool bStrongerKnockDown = { false }; + + _float fabsRadius = fabsf(m_fHitRadius); + _uint iState = { UINT_MAX }; + + if (fabsRadius > 135.f) { + iState = STATEANIM::DEAD_FWD; + } + else if (fabsRadius < 45.f) { + iState = STATEANIM::DEAD_BWD; + } + else { + if (m_fHitRadius < 0.f) { + iState = STATEANIM::DEAD_L; + } + else { + iState = STATEANIM::DEAD_R; + } + } + pairAnimInfo = m_Animation[iState + bStrongerKnockDown]; + + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); +} + +HRESULT CGoblin_Assassin::Behavior_DeadExitCheck(_float fTimeDelta) +{ + if (FLT_EPSILON > m_pModelCom->Get_CurrentTrackProgressRatio()) { + + return E_PENDING; + } + return S_OK; +} + +void CGoblin_Assassin::Behavior_DeadExit() +{ + m_bDead = true; +} + +void CGoblin_Assassin::HitState_Behavior(_float fTimeDelta) +{ + pair<_uint, _bool> pairAnimInfo = {}; + CTransform* pTransform = m_pTarget->Get_Component(); + _uint iCurrAnimIndex = m_pModelCom->Get_AnimIndex(); + _float fRatio = m_pModelCom->Get_CurrentTrackProgressRatio(); + + if (m_eHitState == ENUM_CLASS(HIT_STATE::AIR_LEVIOSO)) + { + switch (m_eHitSpell) + { + case ENUM_CLASS(SKILL_TYPE::DESCENDO): + { + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::END); + m_pCharacter_Controller->SetGravity(true); + m_pCharacter_Controller->Set_GravityAmount(1.5f); + m_fAirTime = 0.f; + pairAnimInfo = m_Animation[STATEANIM::KNOCKDOWN_BWD]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, false, 2.f); + + Add_Event(m_Animation[STATEANIM::KNOCKDOWN_BWD_SPLT].first, + [&]() { pairAnimInfo = m_Animation[STATEANIM::TUMBLE_FWD]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, false, 0.5f); + m_pCharacter_Controller->SetGravity(false); + m_bAir = true; + }, + 0.3f); + + Add_Event(m_Animation[STATEANIM::KNOCKDOWN_BWD_SPLT].first, + [this]() { + CameraShake(10.f, 1.f, 2.f, 0.3f); + }, + 0.27f); + + Add_Event(m_Animation[STATEANIM::TUMBLE_FWD].first, + [this]() {m_pModelCom->Set_AnimSpeed(1.5f); }, + 0.75f); + + Add_Event(m_Animation[STATEANIM::TUMBLE_FWD].first, + [&]() { pairAnimInfo = m_Animation[STATEANIM::KNOCKDOWN_BWD_SPLT]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + m_bAir = false; + m_pCharacter_Controller->SetGravity(true); + }, + 0.96f); + + Add_Event(m_Animation[STATEANIM::KNOCKDOWN_BWD_SPLT].first, + [&]() { pairAnimInfo = m_Animation[STATEANIM::GETUP_BWD]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f); }, + 0.95f); + + Add_Event(m_Animation[STATEANIM::GETUP_BWD].first, + [this]() {m_bLookAt = true; }, + 0.7f); + } + break; + case ENUM_CLASS(SKILL_TYPE::BOMBARDA): + { + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::END); + m_pCharacter_Controller->ConvertToDO(*m_pRigidBody); + _vector vCameraLook = m_pGameInstance->Get_CameraLook(); + vCameraLook = XMVector3Normalize(vCameraLook); + m_pRigidBody->Add_Force(vCameraLook * 60.f, PSX::PxForceMode::eIMPULSE); + m_fAirTime = 0.f; + } + break; + case ENUM_CLASS(SKILL_TYPE::JAP): + { + m_fHitTimer += fTimeDelta; + if (m_fHitTimer <= 0.4f) + { + _vector vPlayerLook = pTransform->Get_State(STATE::LOOK); + vPlayerLook = XMVector4Normalize(vPlayerLook); + _vector vPos = m_pCharacter_Controller->Get_Position(); + + _float t = clamp(m_fHitTimer, 0.f, 1.f); + _float ease = 1.f - (t * t); + _vector Force = vPlayerLook * fTimeDelta * 6.f * ease; + + m_pCharacter_Controller->Set_Position(vPos + Force); + pairAnimInfo = m_Animation[STATEANIM::TUMBLE]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, false, 0.8f); + } + else { + m_fHitTimer = 0.f; + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::END); + } + } + break; + } + if (fRatio >= 0.31f && iCurrAnimIndex == m_Animation[STATEANIM::HIT_LEVIOSO].first) + { + m_fAirTime = 0.f; + m_pCharacter_Controller->SetGravity(true); + pairAnimInfo = m_Animation[STATEANIM::LAND]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f); + } + } + +} + + +void CGoblin_Assassin::Add_FSM() +{ +#pragma region Behavior_Movement_NotFocus + { + CState_Idle::STATE_IDLE_DESC Desc{}; + Desc.pOwner = this; + Desc.funcEnterEvent = [this]() { Behavior_IdleEnter(); }; + Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_IdleExitCheck(); }; + Desc.funcExitEvent = [this]() { Behavior_IdleExit(); }; + Desc.funcPriorityUpdate = nullptr; + Desc.funcLateUpdate = nullptr; + m_States.emplace(FSMSTATE::IDLE, CState_Idle::Create(&Desc)); + } + + { + CState_IdleBreak::STATE_IDLEBREAK_DESC Desc{}; + Desc.pOwner = this; + Desc.funcEnterEvent = [this]() { Behavior_IdleBreakEnter(); }; + Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_IdleBreakExitCheck(); }; + Desc.funcExitEvent = [this]() { Behavior_IdleBreakExit(); }; + Desc.funcPriorityUpdate = nullptr; + Desc.funcLateUpdate = nullptr; + m_States.emplace(FSMSTATE::IDLEBREAK, CState_IdleBreak::Create(&Desc)); + } + + { + CState_Move::STATE_MOVE_DESC Desc{}; + Desc.pOwner = this; + Desc.funcEnterEvent = [this]() { Behavior_MoveEnter(); }; + Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_MoveExitCheck(fTimedelta); }; + Desc.funcExitEvent = [this]() { Behavior_MoveExit(); }; + Desc.funcPriorityUpdate = nullptr; + Desc.funcLateUpdate = nullptr; + m_States.emplace(FSMSTATE::MOVE, CState_Move::Create(&Desc)); + } +#pragma endregion +#pragma region Behavior_Combat_NotFocus + { + CState_Combat::STATE_COMBAT_DESC Desc{}; + Desc.pOwner = this; + Desc.funcEnterEvent = [this]() { Behavior_CombatEnter(); }; + Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_CombatExitCheck(fTimedelta); }; + Desc.funcExitEvent = [this]() { Behavior_CombatExit(); }; + Desc.funcPriorityUpdate = nullptr; + Desc.funcLateUpdate = nullptr; + m_States.emplace(FSMSTATE::COMBAT, CState_Combat::Create(&Desc)); + } + { + CState_Slash::STATE_SLASH_DESC Desc{}; + Desc.pOwner = this; + Desc.funcEnterEvent = [this]() { Behavior_SlashEnter(); }; + Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_SlashExitCheck(fTimedelta); }; + Desc.funcExitEvent = [this]() { Behavior_SlashExit(); }; + Desc.funcPriorityUpdate = nullptr; + Desc.funcLateUpdate = nullptr; + m_States.emplace(FSMSTATE::SLASH, CState_Slash::Create(&Desc)); + } + { + CState_Dash::STATE_DASH_DESC Desc{}; + Desc.pOwner = this; + Desc.funcEnterEvent = [this]() { Behavior_DashEnter(); }; + Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_DashExitCheck(fTimedelta); }; + Desc.funcExitEvent = [this]() { Behavior_DashExit(); }; + Desc.funcPriorityUpdate = nullptr; + Desc.funcLateUpdate = nullptr; + m_States.emplace(FSMSTATE::DASH, CState_Dash::Create(&Desc)); + } + { + CState_Blink::STATE_BLINK_DESC Desc{}; + Desc.pOwner = this; + Desc.funcEnterEvent = [this]() { Behavior_BlinkEnter(); }; + Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_BlinkExitCheck(fTimedelta); }; + Desc.funcExitEvent = [this]() { Behavior_BlinkExit(); }; + Desc.funcPriorityUpdate = nullptr; + Desc.funcLateUpdate = nullptr; + m_States.emplace(FSMSTATE::BLINK, CState_Blink::Create(&Desc)); + } + + { + CState_Shuffle::STATE_SHUFFLE_DESC Desc{}; + Desc.pOwner = this; + Desc.funcEnterEvent = [this]() { Behavior_ShuffleEnter(); }; + Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_ShuffleExitCheck(fTimedelta); }; + Desc.funcExitEvent = [this]() { Behavior_ShuffleExit(); }; + Desc.funcPriorityUpdate = nullptr; + Desc.funcLateUpdate = nullptr; + m_States.emplace(FSMSTATE::SHUFFLE, CState_Shuffle::Create(&Desc)); + } +#pragma endregion +#pragma region Behavior_Combat_Focus + { + CState_Dead::STATE_DEAD_DESC Desc{}; + Desc.pOwner = this; + Desc.funcEnterEvent = [this]() { Behavior_DeadEnter(); }; + Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_DeadExitCheck(fTimedelta); }; + Desc.funcExitEvent = [this]() { Behavior_DeadExit(); }; + Desc.funcLateUpdate = [this](_float fDeadRatio) { + m_fDeadRatio = fDeadRatio; + if (m_fDeadRatio > 1.f) { + PSX::PxExtendedVec3 pxControlllerPos = m_pCharacter_Controller->Get_Controller()->getPosition(); + PSX::PxTransform pxTransform((_float)pxControlllerPos.x, (_float)pxControlllerPos.y + 100.f, (_float)pxControlllerPos.z); + m_pCharacter_Controller->Set_Position(XMLoadFloat3((_float3*)&pxTransform.p)); + m_pRigidBody->SetActive(false); + m_pCharacter_Controller->SetActive(false); + m_bDead = true; + } + }; + Desc.vDeadTimer.x = FLT_EPSILON5; + Desc.vDeadTimer.y = 2.f; + m_States.emplace(FSMSTATE::DEAD, CState_Dead::Create(&Desc)); + } +#pragma endregion + +#pragma region Hit + { + CState_Hit::STATE_HIT_DESC Desc{}; + Desc.pOwner = this; + Desc.funcEnterEvent = [this]() { Behavior_HitEnter(); }; + Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_HitExitCheck(fTimedelta); }; + Desc.funcExitEvent = [this]() { Behavior_HitExit(); }; + Desc.funcPriorityUpdate = nullptr; + Desc.funcLateUpdate = nullptr; + m_States.emplace(FSMSTATE::HIT, CState_Hit::Create(&Desc)); + } + +#pragma endregion + + +} + +void CGoblin_Assassin::Set_Anim() +{ + m_Animation[STATEANIM::IDLE] = { 22,true }; + m_Animation[STATEANIM::IDLE_TURN_BWD] = { 24, false }; + m_Animation[STATEANIM::IDLE_TURN_L] = { 26, false }; + m_Animation[STATEANIM::IDLE_TURN_R] = { 30, false }; + + m_Animation[STATEANIM::IDLE_BREAK1] = { 137, false }; + m_Animation[STATEANIM::IDLE_BREAK2] = { 138, false }; + m_Animation[STATEANIM::IDLE_BREAK3] = { 139, false }; + m_Animation[STATEANIM::IDLE_BREAK4] = { 37, false }; + m_Animation[STATEANIM::IDLE_BREAK5] = { 38, false }; + m_Animation[STATEANIM::IDLE_BREAK6] = { 39, false }; + m_Animation[STATEANIM::IDLE_BREAK7] = { 41, false }; + + m_Animation[STATEANIM::WALK_FWD] = { 45,true }; + m_Animation[STATEANIM::WALK_START] = { 57,false }; + m_Animation[STATEANIM::WALK_STOP] = { 58,false }; + m_Animation[STATEANIM::WALK_BWD] = { 252, true }; + + m_Animation[STATEANIM::JOG_FWD] = { 147,true }; // 147 + m_Animation[STATEANIM::JOG_START] = { 157,false }; + m_Animation[STATEANIM::JOG_BWD] = { 146,false }; + m_Animation[STATEANIM::JOG_112_L] = { 148,true }; + m_Animation[STATEANIM::JOG_112_R] = { 152,true }; + m_Animation[STATEANIM::JOG_90_L] = { 151,true }; + m_Animation[STATEANIM::JOG_90_R] = { 155,true }; + + m_Animation[STATEANIM::SHUFFLE1] = { 203,false }; + m_Animation[STATEANIM::SHUFFLE2] = { 204,false }; + m_Animation[STATEANIM::SHUFFLE3] = { 205,false }; + m_Animation[STATEANIM::SHUFFLE4] = { 206,false }; + + m_Animation[STATEANIM::DODGE_LEFT] = { 125, false }; + m_Animation[STATEANIM::DODGE_RIGHT] = { 126, false }; + m_Animation[STATEANIM::SPRINT] = { 90, true }; + + m_Animation[STATEANIM::BLINK_START] = { 428,false }; // 텔레포트 + m_Animation[STATEANIM::BLINK] = { 426,false }; // 텔레포트 + m_Animation[STATEANIM::ATTACK_END] = { 76,false }; + m_Animation[STATEANIM::SLASH] = { 72,false }; + m_Animation[STATEANIM::DASH] = { 73,false }; + + m_Animation[STATEANIM::HIT_FWD] = { 353, false }; + m_Animation[STATEANIM::HIT_BWD] = { 352, false }; + m_Animation[STATEANIM::HIT_BWD2] = { 349, false }; + m_Animation[STATEANIM::HIT_BWD3] = { 350, false }; + m_Animation[STATEANIM::HIT_BWD4] = { 351, false }; + m_Animation[STATEANIM::HIT_L] = { 354, false }; + m_Animation[STATEANIM::HIT_R] = { 355, false }; + + m_Animation[STATEANIM::KNOCKDOWN_BWD] = { 374, false }; + m_Animation[STATEANIM::KNOCKDOWN_BWD_SPLT] = { 375, false }; + m_Animation[STATEANIM::KNOCKDOWN_BWD_SPLT_HOLD] = { 370, false }; + m_Animation[STATEANIM::KNOCKDOWN_FWD] = { 371, false }; + m_Animation[STATEANIM::KNOCKDOWN_FWD_SPLT] = { 372, false }; + m_Animation[STATEANIM::KNOCKDOWN_FWD_SPLT_HOLD] = { 373, false }; + + m_Animation[STATEANIM::GETUP_BWD] = { 330, false }; + m_Animation[STATEANIM::GETUP_FWD] = { 332, false }; + m_Animation[STATEANIM::GETUP_L] = { 334, false }; + m_Animation[STATEANIM::GETUP_L_FD] = { 336, false }; + m_Animation[STATEANIM::GETUP_L_FU] = { 338, false }; + m_Animation[STATEANIM::GETUP_R] = { 340, false }; + m_Animation[STATEANIM::GETUP_R_FD] = { 342, false }; + m_Animation[STATEANIM::GETUP_R_FU] = { 344, false }; + m_Animation[STATEANIM::GETUP_SLOUCH] = { 346, false }; + + m_Animation[STATEANIM::KNOCKBACK] = { 377, true }; + m_Animation[STATEANIM::KNOCKBACK2] = { 378, true }; + m_Animation[STATEANIM::TUMBLE] = { 379, true }; + m_Animation[STATEANIM::TUMBLE2] = { 380, true };// 원래 true 였음 + m_Animation[STATEANIM::TUMBLE_FWD] = { 429, true }; + m_Animation[STATEANIM::PETRIFICUSED_START] = { 383, false }; + + m_Animation[STATEANIM::LAND] = { 376, false }; + m_Animation[STATEANIM::HIT_LEVIOSO] = { 381, false }; + m_Animation[STATEANIM::INCARCEROUS] = { 382,false }; + + m_Animation[STATEANIM::STUMBLE_BWD_L] = { 394, false }; + m_Animation[STATEANIM::STUMBLE_BWD_R] = { 395, false }; + m_Animation[STATEANIM::STUMBLE_FWD] = { 396, false }; + + m_Animation[STATEANIM::DEAD_BWD] = { 317, false }; + m_Animation[STATEANIM::DEAD_BWD2] = { 318, false }; + m_Animation[STATEANIM::DEAD_FWD] = { 319, false }; + m_Animation[STATEANIM::DEAD_FWD2] = { 320, false }; + m_Animation[STATEANIM::DEAD_L] = { 321, false }; + m_Animation[STATEANIM::DEAD_L2] = { 322, false }; + m_Animation[STATEANIM::DEAD_R] = { 323, false }; + m_Animation[STATEANIM::DEAD_R2] = { 324, false }; + + //Tp 426 + // Tp Start 428 + // 76 공격끝 + + + + + + + + + // 걷기 시작 57 + // 걷기 루프 50 + // 뛰기 시작 157 + // 뛰기 루프 45 + // 나이프 던지기 85 + // 도끼 공격 444 + // 도끼 공격 후 76 + // 도끼 찍기 439 + // + + // 텀블링 히트 380 + // 디센도 찍기전 띄우기 371 + // 디센도 찍기 372 + + // 레비오소 피격 381 + // 착지 376 + // + + // Shuffle1 211 + // Shuffle2 215 + // Shuffle3 219 + // Shuffle4 223 + + //Jog 112도 L 148 + //Jog 112도 R 152 + // Jog 90 L 151 + // Jog 90 R 155 + + + // L 394 + // R 395 + // fwd 396 +} diff --git a/Jusin154_Team3D/Client/Private/Goblin_BattleAxe.cpp b/Jusin154_Team3D/Client/Private/Goblin_BattleAxe.cpp index f46735c9f..db38f0cc6 100644 --- a/Jusin154_Team3D/Client/Private/Goblin_BattleAxe.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin_BattleAxe.cpp @@ -269,7 +269,7 @@ void CGoblin_BattleAxe::SwingHit(_bool& bPlayerHit) for (_uint i = 0; i < pxHits.size(); ++i) { PSX::PxActor* pxHitActor = pxHits[i].actor; if (nullptr != pxHitActor && nullptr != pxHitActor->userData) { - PhsXUserData* pUserData = (PhsXUserData*)pxHitActor->userData; + PHYSX_USERDATA* pUserData = (PHYSX_USERDATA*)pxHitActor->userData; ON_COLLISION_INFO tagCollInfo = {}; diff --git a/Jusin154_Team3D/Client/Private/Goblin_Dagger.cpp b/Jusin154_Team3D/Client/Private/Goblin_Dagger.cpp index 9873105ac..fa04c9144 100644 --- a/Jusin154_Team3D/Client/Private/Goblin_Dagger.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin_Dagger.cpp @@ -202,7 +202,7 @@ void CGoblin_Dagger::Dagger_Hit() XMStoreFloat4(&tagCollInfo.vHitDir, vDir); tagCollInfo.fLength = fLength; - PhsXUserData* pUserData = static_cast(pActor->userData); + PHYSX_USERDATA* pUserData = static_cast(pActor->userData); tagCollInfo.pObject = pUserData->pOwner; switch (PXOBJECT(pUserData->iSubKind)) { diff --git a/Jusin154_Team3D/Client/Private/Goblin_Mage.cpp b/Jusin154_Team3D/Client/Private/Goblin_Mage.cpp index 7c75e3eb8..91479b8ca 100644 --- a/Jusin154_Team3D/Client/Private/Goblin_Mage.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin_Mage.cpp @@ -82,9 +82,6 @@ void CGoblin_Mage::Priority_Update(_float fTimeDelta) void CGoblin_Mage::Update(_float fTimeDelta) { - if (m_bVisible == false) - return; - m_pFSM->Update_State(fTimeDelta); m_pModelCom->Play_Animation(fTimeDelta, m_pTransformCom); @@ -285,7 +282,6 @@ _vector CGoblin_Mage::Get_LockOnPos() void CGoblin_Mage::OnCollision(CGameObject* pOther, void* pDesc) { - if (true == m_bDead) { return; } @@ -332,6 +328,12 @@ void CGoblin_Mage::OnCollision(CGameObject* pOther, void* pDesc) case ENUM_CLASS(SKILL_TYPE::STUPEFY): m_eHitSpell = ENUM_CLASS(SKILL_TYPE::STUPEFY); break; + case ENUM_CLASS(SKILL_TYPE::AVADAKEDAVRA): + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::AVADAKEDAVRA); + break; + case ENUM_CLASS(SKILL_TYPE::ANCIENT_MAGIC): + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::ANCIENT_MAGIC); + break; } } else diff --git a/Jusin154_Team3D/Client/Private/Goblin_Mage_States.cpp b/Jusin154_Team3D/Client/Private/Goblin_Mage_States.cpp index 4cc70cbc5..98eb7e5ff 100644 --- a/Jusin154_Team3D/Client/Private/Goblin_Mage_States.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin_Mage_States.cpp @@ -466,7 +466,11 @@ void CGoblin_Mage::Behavior_HitEnter() pairAnimInfo = m_Animation[STATEANIM::INCARCEROUS]; break; default: - pairAnimInfo = m_Animation[STATEANIM::STUMBLE_BWD_R]; + _int iRand = m_pGameInstance->Real_Random_Int(0, 1); + if(iRand == 0) + pairAnimInfo = m_Animation[STATEANIM::STUMBLE_BWD_L]; + else + pairAnimInfo = m_Animation[STATEANIM::STUMBLE_BWD_R]; break; } diff --git a/Jusin154_Team3D/Client/Private/Goblin_Protego.cpp b/Jusin154_Team3D/Client/Private/Goblin_Protego.cpp index 95dfce590..c1fab98b3 100644 --- a/Jusin154_Team3D/Client/Private/Goblin_Protego.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin_Protego.cpp @@ -73,6 +73,9 @@ void CGoblin_Protego::Update(_float fTimeDelta) Update_Event(fTimeDelta); + if (m_bVisible == false) { + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(0.f, 0.f, 0.f, 1.f)); + } /* 시작 사이즈 러프 */ @@ -92,10 +95,8 @@ void CGoblin_Protego::Late_Update(_float fTimeDelta) { if (m_bVisible == false) return; - + m_pTransformCom->Set_State(STATE::POSITION, m_pOwner->Get_Component()->Get_Position()); __super::Late_Update(fTimeDelta); - - } HRESULT CGoblin_Protego::Pre_Setting(CGameObject* pObject, void* pArg) @@ -127,6 +128,15 @@ HRESULT CGoblin_Protego::Ready_Components(void* pArg) return E_FAIL; } + { // DO + CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; + Desc.iSubKind = ENUM_CLASS(PXOBJECT::GOBLIN_PROTEGO); + 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(), NEXT_LEVEL); + } + return S_OK; } @@ -164,6 +174,8 @@ CGameObject* CGoblin_Protego::Clone(void* pArg, CGameObject* pOwner) void CGoblin_Protego::OnCollision(CGameObject* pOther, void* pDesc) { + if (!m_bVisible) + return; //CTransform* pOtherTransform = p ON_COLLISION_INFO* CollisionDesc = static_cast(pDesc); @@ -180,6 +192,7 @@ void CGoblin_Protego::Free() SAFE_RELEASE(m_pSphere); SAFE_RELEASE(m_pBottom); SAFE_RELEASE(m_pCircle); + SAFE_RELEASE(m_pRigidBody); } #ifdef _DEBUG diff --git a/Jusin154_Team3D/Client/Private/Goblin_States.cpp b/Jusin154_Team3D/Client/Private/Goblin_States.cpp index 1eac9fdf9..2cd5831f0 100644 --- a/Jusin154_Team3D/Client/Private/Goblin_States.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin_States.cpp @@ -30,9 +30,7 @@ void CGoblin::Behavior_IdleEnter() { m_pFSM->Enable_State(FSMSTATE::IDLE); - pair<_uint, _bool> pairAnimInfo = m_Animation[STATEANIM::IDLE]; - m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); } HRESULT CGoblin::Behavior_IdleExitCheck() @@ -41,6 +39,10 @@ HRESULT CGoblin::Behavior_IdleExitCheck() { m_bLookAt = false; m_bDetection = true; + + pair<_uint, _bool> pairAnimInfo = m_Animation[STATEANIM::IDLE]; + + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); } if ((m_fTargetDistance <= 10.f && m_fTargetDistance != 0.f) /*|| m_pDetection->Get_Step() == true*/) { @@ -131,8 +133,6 @@ HRESULT CGoblin::Behavior_MoveExitCheck(_float fTimeDelta) pair<_uint, _bool> pairAnimInfo = {}; _uint iCurrAnimIndex = m_pModelCom->Get_AnimIndex(); - - if (m_fTargetDistance >= 6.f) { pairAnimInfo = m_Animation[STATEANIM::JOG_FWD]; @@ -207,8 +207,6 @@ void CGoblin::Behavior_CombatEnter() HRESULT CGoblin::Behavior_CombatExitCheck(_float fTimeDelta) { - m_bLookAt = true; - if (m_fTargetDistance > 25.f && m_fTargetDistance != 0.f) { m_pFSM->Change_State(FSMSTATE::IDLE); @@ -286,7 +284,7 @@ void CGoblin::Behavior_SwingEnter() Set_Easing(pairAnimInfo.first, 0.01f, 0.15f, 0.8f); - Set_Easing(pairAnimInfo.first, 0.2f, 0.4f, 1.4f); + Set_Easing(pairAnimInfo.first, 0.15f, 0.4f, 1.4f); } HRESULT CGoblin::Behavior_SwingExitCheck(_float fTimeDelta) @@ -549,7 +547,11 @@ void CGoblin::Behavior_HitEnter() pairAnimInfo = m_Animation[STATEANIM::INCARCEROUS]; break; default: - pairAnimInfo = m_Animation[STATEANIM::STUMBLE_BWD_R]; + _int iRand = m_pGameInstance->Real_Random_Int(0, 1); + if (iRand == 0) + pairAnimInfo = m_Animation[STATEANIM::STUMBLE_BWD_L]; + else + pairAnimInfo = m_Animation[STATEANIM::STUMBLE_BWD_R]; break; } @@ -798,7 +800,7 @@ void CGoblin::HitState_Behavior(_float fTimeDelta) m_pCharacter_Controller->ConvertToDO(*m_pRigidBody); _vector vCameraLook = m_pGameInstance->Get_CameraLook(); vCameraLook = XMVector3Normalize(vCameraLook); - m_pRigidBody->Add_Force(vCameraLook * 30.f, PSX::PxForceMode::eIMPULSE); + m_pRigidBody->Add_Force(vCameraLook * 60.f, PSX::PxForceMode::eIMPULSE); m_fAirTime = 0.f; } break; diff --git a/Jusin154_Team3D/Client/Private/Goblin_Sword.cpp b/Jusin154_Team3D/Client/Private/Goblin_Sword.cpp new file mode 100644 index 000000000..a424e91c9 --- /dev/null +++ b/Jusin154_Team3D/Client/Private/Goblin_Sword.cpp @@ -0,0 +1,261 @@ +#include "pch.h" +#include "Goblin_Sword.h" + +#include "GameInstance.h" +#include "Goblin.h" + +CGoblin_Sword::CGoblin_Sword(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CPartObject(pDevice, pContext) +{ +} + +CGoblin_Sword::CGoblin_Sword(const CGoblin_Sword& Prototype) + : CPartObject(Prototype) +{ +} + +HRESULT CGoblin_Sword::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CGoblin_Sword::Initialize(void* pArg) +{ + GOBLIN_SWORD_DESC* pDesc = static_cast (pArg); + m_pSocketMatrices = pDesc->pSocketMatrices; + + if (FAILED(__super::Initialize(pArg))) { + return E_FAIL; + } + + + if (FAILED(Ready_Components())) { + return E_FAIL; + } + + return S_OK; +} + +void CGoblin_Sword::Priority_Update(_float fTimeDelta) +{ + + + +#ifdef _DEBUG + Describe_Entity(); + +#endif // _DEBUG +} + +void CGoblin_Sword::Update(_float fTimeDelta) +{ +} + +void CGoblin_Sword::Late_Update(_float fTimeDelta) +{ + m_pModelCom->Combined_BoneMatrix(); + XMStoreFloat4(&m_vStartPos, m_pTransformCom->Get_State(STATE::POSITION)); + + _matrix socketMatrix = {}; + + socketMatrix = XMLoadFloat4x4(m_pSocketMatrices); + + for (int i = 0; i < 3; ++i) { + socketMatrix.r[i] = XMVector3Normalize(socketMatrix.r[i]); + } + + m_pTransformCom->Set_WorldMatrix(socketMatrix * XMLoadFloat4x4(m_pParentTransformCom->Get_WorldMatrixPtr())); + Sword_Hit(); + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); +} + +HRESULT CGoblin_Sword::Render() +{ + if (!m_pModelCom) + return S_OK; + + if (!m_bVisible) + return S_OK; + + 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->Begin(ENUM_CLASS(SHADER_PASS_ANIM::DEFAULT)))) { + return E_FAIL; + } + + if (FAILED(m_pModelCom->Render(i))) { + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT CGoblin_Sword::Ready_Components() +{ + + CTransform::TRANSFORM_DESC Desc = {}; + + Desc.fSpeedPerSec = 10.f; + Desc.fRotationPerSec = XMConvertToRadians(180.0f); + Desc.fRadius = 10.f; + + __super::Ready_Components(&Desc); + + + /* Com_Model */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_Goblin_Sword_Model"), + reinterpret_cast(&m_pModelCom)))) + return E_FAIL; + + /* Com_Shader */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH, + reinterpret_cast(&m_pShaderCom)))) + return E_FAIL; + + return S_OK; +} + +HRESULT CGoblin_Sword::Bind_ShaderResources() +{ + if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", m_pTransformCom->Get_WorldMatrixPtr()))) { + return E_FAIL; + } + 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; + } + 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; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { + return E_FAIL; + } + + return S_OK; +} + +void CGoblin_Sword::Sword_Hit() +{ + _vector vStartPos = XMLoadFloat4(&m_vStartPos); + _vector vEndPos = m_pTransformCom->Get_State(STATE::POSITION); + _vector vDir = vEndPos - vStartPos; + _float fLength = XMVectorGetX(XMVector4Length(vDir)); + vDir = XMVector4Normalize(vDir); + m_SweepBuffer = {}; + _bool bHit = m_pGameInstance->SphereCast(0.5f, vStartPos, vDir, fLength, PSX::PxHitFlag::eDEFAULT, PSX::PxQueryFlag::eDYNAMIC, m_SweepBuffer); + if (true == bHit) { + vector Hits; + _uint iHitCount = m_SweepBuffer.nbTouches; + if (true == m_SweepBuffer.hasBlock) { + iHitCount += 1; + Hits.reserve(iHitCount); + Hits.emplace_back(&m_SweepBuffer.block); + } + else { + Hits.reserve(iHitCount); + } + for (_uint i = 0; i < m_SweepBuffer.nbTouches; ++i) { + Hits.emplace_back(&m_SweepBuffer.touches[i]); + } + + for (_uint i = 0; i < Hits.size(); ++i) { + PSX::PxSweepHit* pHit = Hits[i]; + PSX::PxActor* pActor = pHit->actor; + if (nullptr != pActor && nullptr != pActor->userData) { + const PSX::PxSweepHit& hit = m_SweepBuffer.block; + PSX::PxShape* pShape = hit.shape; + ON_COLLISION_INFO tagCollInfo = {}; + + tagCollInfo.vWorldPos.w = 1.f; + + memcpy_s(&tagCollInfo.vWorldPos, sizeof(tagCollInfo.vWorldPos), &hit.position, sizeof(hit.position)); + + memcpy_s(&tagCollInfo.vWorldNomal, sizeof(tagCollInfo.vWorldNomal), &hit.normal, sizeof(hit.normal)); + XMStoreFloat4(&tagCollInfo.vHitDir, vDir); + tagCollInfo.fLength = fLength; + tagCollInfo.fDamage = 10.f; + tagCollInfo.eHitType = ENUM_CLASS(HIT_TYPE::HIT_MEDIUM); + + PHYSX_USERDATA* pUserData = static_cast(pActor->userData); + tagCollInfo.pObject = pUserData->pOwner; + switch (PXOBJECT(pUserData->iSubKind)) + { + case Engine::PXOBJECT::PLAYER: + { + pUserData->pOwner->OnCollision(this, &tagCollInfo); + } + break; + case Engine::PXOBJECT::ALLY_HITBOX: + break; + default: + break; + } + + + } + } + } +} + + +CGoblin_Sword* CGoblin_Sword::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CGoblin_Sword* pInstance = new CGoblin_Sword(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CGoblin_Sword"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CGoblin_Sword::Clone(void* pArg, CGameObject* pOwner) +{ + CGoblin_Sword* pInstance = new CGoblin_Sword(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CGoblin_Sword"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CGoblin_Sword::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pShaderCom); + SAFE_RELEASE(m_pModelCom); + +} +#ifdef _DEBUG + +void CGoblin_Sword::Describe_Entity() +{ +} + +#endif // _DEBUG diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index 262556efd..d99eaa4c4 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" @@ -25,6 +26,7 @@ #include "Troll.h" #include "Goblin.h" #include "Goblin_Mage.h" +#include "Goblin_Assassin.h" #include "Goblin_Spector.h" #include "NPC_Ollivander.h" #include "NPC_EleazarFig.h" @@ -50,13 +52,13 @@ HRESULT CLevel_GamePlay::Initialize(void* pArg) m_isDay = true; #endif // #ifdef 진우 - isDay = true; + m_isDay = true; #endif // #ifdef 기무리 - isDay = true; + m_isDay = true; #endif // #ifdef 인혁 - isDay = true; + m_isDay = true; #endif // if (FAILED(Ready_Lights())) { @@ -660,7 +662,6 @@ HRESULT CLevel_GamePlay::Ready_Layer_Player(const _wstring& strLayerTag) return E_FAIL; } } - return S_OK; } @@ -683,7 +684,7 @@ HRESULT CLevel_GamePlay::Ready_Layer_Item(const _wstring& strLayerTag) HRESULT CLevel_GamePlay::Ready_Layer_RaceRing(const _wstring& strLayerTag) { - for (_uint i = 0; i < 10; ++i) { + for (_uint i = 0; i < 1; ++i) { CRaceRing::RACERING_DESC RaceRingDesc{}; RaceRingDesc.pBroomRaceManager = m_pBroomRaceManager; @@ -716,7 +717,7 @@ HRESULT CLevel_GamePlay::Ready_Layer_SkyBox(const _wstring& strLayerTag) HRESULT CLevel_GamePlay::Ready_Layer_Monster() { - for (_uint i = 0; i <1; ++i) + /*for (_uint i = 0; i <1; ++i) { if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_MONSTER))) { return E_FAIL; @@ -728,23 +729,27 @@ HRESULT CLevel_GamePlay::Ready_Layer_Monster() if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_MONSTER))) { return E_FAIL; } - } + }*/ + for (_uint i = 0; i < 1; ++i) + { + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_MONSTER))) { + return E_FAIL; + } + } if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_MONSTER))) { return E_FAIL; } - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_MONSTER))) { + /*if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_MONSTER))) { return E_FAIL; - } + }*/ #if 진우 #else #endif - - return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/Lightning.cpp b/Jusin154_Team3D/Client/Private/Lightning.cpp index 975c21975..04c8df5ab 100644 --- a/Jusin154_Team3D/Client/Private/Lightning.cpp +++ b/Jusin154_Team3D/Client/Private/Lightning.cpp @@ -39,7 +39,7 @@ HRESULT CLightning::Initialize(void* pArg) if (FAILED(Create_Effect())) return E_FAIL; - m_iSkillType = ENUM_CLASS(SKILL_TYPE::LIGHTNING); + m_iSkillType = ENUM_CLASS(SKILL_TYPE::ANCIENT_MAGIC); m_wstrEffectName = L"Lightning"; @@ -82,14 +82,15 @@ void CLightning::Late_Update(_float fTimeDelta) __super::Late_Update(fTimeDelta); - //if (false == m_bHit) { - // _vector vStartPos = XMLoadFloat4(&m_vStartPos); - // _vector vEndPos = XMLoadFloat4(&m_vEndPos); - // ON_COLLISION_INFO CollisionInfo = SweepTarget(vStartPos, vEndPos, 0.002f , true); + if (false == m_bHit) { + _vector vTop = XMLoadFloat4(&m_vTargetPos) + XMVectorSet(0.f, 5.f, 0.f, 0.f); - // OnCollision(this, &CollisionInfo); - //} + _vector vBottom = XMLoadFloat4(&m_vTargetPos) - XMVectorSet(0.f, 5.f, 0.f, 0.f); + ON_COLLISION_INFO CollisionInfo = SweepTarget(vTop, vBottom, 0.02f, true); + + OnCollision(this, &CollisionInfo); + } } HRESULT CLightning::Pre_Setting(CGameObject* pObject, void* pArg) @@ -215,7 +216,7 @@ void CLightning::OnCollision(CGameObject* pOther, void* pDesc) pPair.second->Get_Component()->Set_State(STATE::POSITION, vPos); } - CWand* pWand = static_cast(m_pOwner)->Get_PartObject(); + CWand* pWand = static_cast(m_pOwner); if (pWand == nullptr) return; diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index f96dae1a0..82c17e9bf 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" @@ -21,14 +22,17 @@ #include "Wand.h" #include "Item_Potion.h" #include "RaceRing.h" +#include "Goblin_Sword.h" #include "Goblin_BattleAxe.h" #include "BroomRaceManager.h" #pragma region ACTOR #include "Player.h" +#include "PlayerRobe.h" #include "Goblin.h" #include "Goblin_Mage.h" +#include "Goblin_Assassin.h" #include "Goblin_Spector.h" #include "Troll.h" #include "NPC_Ollivander.h" @@ -1323,7 +1327,7 @@ HRESULT CLoader::Loading_For_GamePlay() #pragma endregion #endif - +#pragma endregion #pragma region TERRAIN_TEXTURE /* Terrain_Diffuse */ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Terrain_Diffuse"), @@ -1662,7 +1666,68 @@ HRESULT CLoader::Loading_For_GamePlay() CVIBuffer_UI_Instance::Create(m_pDevice, m_pContext, &Quest_Slot_Desc)))) { return E_FAIL; } - + { + CRigidBody_Dynamic::RIGIDBODY_PROTOTYPE_DYNAMIC_DESC Desc{}; + Desc.eType = ACTOR::SPHERE; + Desc.ePxRigidBodyFlags = { /*PSX::PxRigidBodyFlag::eKINEMATIC*/ }; + Desc.ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE }; + Desc.ePxMaterialTypes = { PXMATERIAL::DEFAULT }; + Desc.vMatInfo = { 0.5f, 0.5f, 0.001f }; + Desc.fContactOffset = { 0.005f }; + Desc.vhalfGeometryInfo = { 0.025f, 0.025f, 0.025f }; + Desc.fDensity = 0.01f; + Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY()); + Desc.eLockFlag = {}; + Desc.vAutoDamping = { 12.f, 12.f }; + Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f }; + Desc.vLocalTranslation = { 0.f, 0.f, 0.f }; + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_JOINT_ANCHOR"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { + return E_FAIL; + } + } + { + CRigidBody_Dynamic::RIGIDBODY_PROTOTYPE_DYNAMIC_DESC Desc{}; + Desc.eType = ACTOR::CAPSULE; + Desc.ePxRigidBodyFlags = { /*PSX::PxRigidBodyFlag::eKINEMATIC*/ }; + Desc.ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE }; + Desc.ePxMaterialTypes = { PXMATERIAL::DEFAULT }; + Desc.vMatInfo = { 0.5f, 0.5f, 0.001f }; + Desc.fContactOffset = { 0.005f }; + Desc.vhalfGeometryInfo = { 0.025f, 0.085f, 0.f }; + Desc.fDensity = 0.01f; + Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY()); + Desc.eLockFlag = {}; + Desc.vAutoDamping = { 12.f, 12.f }; + Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f }; + Desc.vLocalTranslation = { 0.f, 0.f, 0.f }; + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_JOINT_ROUTE"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { + return E_FAIL; + } + } + { + CRigidBody_Dynamic::RIGIDBODY_PROTOTYPE_DYNAMIC_DESC Desc{}; + Desc.eType = ACTOR::CAPSULE; + Desc.ePxRigidBodyFlags = { PSX::PxRigidBodyFlag::eKINEMATIC }; + Desc.ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE }; + Desc.ePxMaterialTypes = { PXMATERIAL::DEFAULT }; + Desc.vMatInfo = { 0.5f, 0.5f, 0.01f }; + Desc.fContactOffset = { 0.01f }; + Desc.vhalfGeometryInfo = { 0.12f, 0.25f, 0.f }; + Desc.fDensity = 122.f; + Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY()); + Desc.eLockFlag = {}; + Desc.vAutoDamping = { 1.f, 1.f }; + Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f }; + Desc.vLocalTranslation = { 0.f, 0.f, 0.f }; + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_Player_Leg"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { + return E_FAIL; + } + } + { + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DynamicJoint"), CDynamic_D6Joint::Create(m_pDevice, m_pContext)))) { + return E_FAIL; + } + } { // LIGHT PHYSX DYNAMIC CRigidBody_Dynamic::RIGIDBODY_PROTOTYPE_DYNAMIC_DESC Desc{}; { @@ -1689,7 +1754,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 }; + Desc1.vhalfGeometryInfo = { 2.f, 2.f, 2.f }; Desc1.fDensity = 1.f; Desc1.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY()); Desc1.eLockFlag = {}; @@ -1701,22 +1766,21 @@ HRESULT CLoader::Loading_For_GamePlay() if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_HEAVY_WALL"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { return E_FAIL; } - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_SHIELD"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc1)))) { return E_FAIL; } - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), CCharacter_Controller::Create(m_pDevice, m_pContext)))) { - return E_FAIL; - } Desc.ePxRigidBodyFlags = { PSX::PxRigidBodyFlag::eKINEMATIC }; if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX_KIN"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { return E_FAIL; } - } + } + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), CCharacter_Controller::Create(m_pDevice, m_pContext)))) { + return E_FAIL; + } { // DOOR PHYSX CRigidBody_Dynamic::RIGIDBODY_PROTOTYPE_DYNAMIC_DESC Desc{}; { @@ -1766,7 +1830,7 @@ HRESULT CLoader::Loading_For_GamePlay() } if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Goblin_Model"), - CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin/Goblin.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))){ + CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin/Goblin.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) { return E_FAIL; } @@ -1774,17 +1838,21 @@ HRESULT CLoader::Loading_For_GamePlay() CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin_Mage/GoblinMage.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) return E_FAIL; + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Goblin_Assassin_Model"), + CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Monster/Goblin_Assassin/SK_GOB_M_Assassin_Master.bin", XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) + return E_FAIL; + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Goblin_Spector_Model"), CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Monster/GoblinSpector/GoblinSpector.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) return E_FAIL; if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_GerboldOlivander_Model"), - CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity())))){ + CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Professor_EleazarFig_Model"), - CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/EleazarFig/Professor_EleazarFig.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity())))){ + CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/EleazarFig/Professor_EleazarFig.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) { return E_FAIL; } @@ -1799,7 +1867,7 @@ HRESULT CLoader::Loading_For_GamePlay() } if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Troll_Model"), - CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Monster/SubTroll/troll.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))){ + CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Monster/SubTroll/troll.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) { return E_FAIL; } @@ -1840,13 +1908,23 @@ HRESULT CLoader::Loading_For_GamePlay() CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Object/Goblin_Dagger/SK_WPN_GOB_SmallSword.bin", XMMatrixIdentity())))) return E_FAIL; + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Goblin_Sword_Model"), + CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Object/Goblin_Sword/SK_WPN_GOB_SmallSword.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity())))) + return E_FAIL; + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Goblin_BattleAxe_Model"), - CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Object/Goblin_BattleAxe/SK_WPN_GOB_BattleAxe01.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationX(XMConvertToRadians(-90.f)) * XMMatrixIdentity())))) + CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Object/Goblin_BattleAxe/SK_WPN_GOB_BattleAxe01.bin", XMMatrixRotationX(XMConvertToRadians(-90.f)) * XMMatrixIdentity())))) return E_FAIL; #pragma endregion + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CPlayerRobe::Create(m_pDevice, m_pContext)))) { + 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"), @@ -2717,6 +2795,10 @@ HRESULT CLoader::Loading_For_GamePlay() if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CGoblin_Mage::Create(m_pDevice, m_pContext)))) return E_FAIL; + /* For.Prototype_GameObject_Goblin_Assassin */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CGoblin_Assassin::Create(m_pDevice, m_pContext)))) + return E_FAIL; + /* For.Prototype_GameObject_Goblin_Spector */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CGoblin_Spector::Create(m_pDevice, m_pContext)))) return E_FAIL; @@ -2771,6 +2853,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; @@ -2795,6 +2881,10 @@ HRESULT CLoader::Loading_For_GamePlay() if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CGoblin_Dagger::Create(m_pDevice, m_pContext)))) return E_FAIL; + /* For.Prototype_GameObject_Goblin_Sword */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CGoblin_Sword::Create(m_pDevice, m_pContext)))) + return E_FAIL; + /* For.Prototype_GameObject_Goblin_BattleAxe */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CGoblin_BattleAxe::Create(m_pDevice, m_pContext)))) return E_FAIL; diff --git a/Jusin154_Team3D/Client/Private/MapElement_Chest.cpp b/Jusin154_Team3D/Client/Private/MapElement_Chest.cpp index e88df1c57..c0a2d1748 100644 --- a/Jusin154_Team3D/Client/Private/MapElement_Chest.cpp +++ b/Jusin154_Team3D/Client/Private/MapElement_Chest.cpp @@ -56,7 +56,7 @@ HRESULT CMapElement_Chest::Initialize(void* pArg) m_pActor = static_cast(m_pRigidBody->Get_Actor()); static_cast(m_pRigidBody)->Set_HalfGeometryInfo(pDesc->vBoxSize); - static_cast(m_pRigidBody)->Move_LocalPos(_float4(0.f, 0.f, 0.f, 0.f), pDesc->vBoxLocalPosition); + static_cast(m_pRigidBody)->Move_LocalPos(XMVectorSet(0.f, 0.f, 0.f, 1.f), XMLoadFloat3(&pDesc->vBoxLocalPosition)); return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/MapElement_Door.cpp b/Jusin154_Team3D/Client/Private/MapElement_Door.cpp index 3252956d8..5cfaea21f 100644 --- a/Jusin154_Team3D/Client/Private/MapElement_Door.cpp +++ b/Jusin154_Team3D/Client/Private/MapElement_Door.cpp @@ -117,7 +117,7 @@ void CMapElement_Door::Late_Update(_float fTimeDelta) * (ScaleMatrix * RotationMatrix * TranslationWorld); // 그 후 SRT 적용 m_pTransformCom->Set_WorldMatrix(world); - m_pActor->setGlobalPose(XMWorldToPx_NoScale(world)); + m_pActor->setGlobalPose(XMWorldToPx_NoScaleNoFlip(world)); m_pActor->setAngularVelocity(PSX::PxVec3(0)); m_pActor->setLinearVelocity(PSX::PxVec3(0)); diff --git a/Jusin154_Team3D/Client/Private/MapElement_Interactable.cpp b/Jusin154_Team3D/Client/Private/MapElement_Interactable.cpp index 025f96a04..b81314591 100644 --- a/Jusin154_Team3D/Client/Private/MapElement_Interactable.cpp +++ b/Jusin154_Team3D/Client/Private/MapElement_Interactable.cpp @@ -58,7 +58,7 @@ HRESULT CMapElement_Interactable::Initialize(void* pArg) m_pActor = static_cast(m_pRigidBody->Get_Actor()); static_cast(m_pRigidBody)->Set_HalfGeometryInfo(pDesc->vBoxSize); - static_cast(m_pRigidBody)->Move_LocalPos(_float4(0.f, 0.f, 0.f, 0.f), pDesc->vBoxLocalPosition); + static_cast(m_pRigidBody)->Move_LocalPos(XMVectorSet(0.f, 0.f, 0.f, 1.f), XMLoadFloat3(&pDesc->vBoxLocalPosition)); //static_cast(m_pRigidBody)->Set_Kinematic(false); if (false == m_isPooled) @@ -338,7 +338,7 @@ void CMapElement_Interactable::ActivateAt(_fvector vPos) m_pTransformCom->Set_State(STATE::POSITION, vPos); m_pInfoInstance->Regist_ActiveInteractive(this); m_pRigidBody->Set_Kinematic(false); - m_pRigidBody->Set_Position(vPos); + m_pRigidBody->Set_Position(vPos, true); } ON_COLLISION_INFO CMapElement_Interactable::CollisionCheck(_fvector StartPos, _fvector EndPos, _float fRadius) @@ -372,7 +372,7 @@ ON_COLLISION_INFO CMapElement_Interactable::CollisionCheck(_fvector StartPos, _f if (nullptr != pActor && nullptr != pActor->userData) { - PhsXUserData* pUserData = static_cast(pActor->userData); + PHYSX_USERDATA* pUserData = static_cast(pActor->userData); tagCollInfo.pObject = pUserData->pOwner; switch (pUserData->eKind) @@ -432,7 +432,7 @@ ON_COLLISION_INFO CMapElement_Interactable::CollisionCheck(_fvector StartPos, _f if (nullptr != pActor && nullptr != pActor->userData) { - PhsXUserData* pUserData = static_cast(pActor->userData); + PHYSX_USERDATA* pUserData = static_cast(pActor->userData); tagCollInfo.pObject = pUserData->pOwner; switch (PXOBJECT(pUserData->iSubKind)) diff --git a/Jusin154_Team3D/Client/Private/Monster.cpp b/Jusin154_Team3D/Client/Private/Monster.cpp index c7efd8cb7..965bc70d3 100644 --- a/Jusin154_Team3D/Client/Private/Monster.cpp +++ b/Jusin154_Team3D/Client/Private/Monster.cpp @@ -227,10 +227,10 @@ HRESULT CMonster::Render_Disolve() if (FLT_EPSILON3 * 10 < m_fDisolveTime) { m_bDrawOutLine = false; - _bool bDisolve = true; + _int bDisolve = 1; _float fDisolveAmount = 0.1f; _float fDisolveEdgeWidth = 0.1f; - if (FAILED(m_pShaderCom->Bind_RawValue("g_bDisolve", &bDisolve, sizeof(_bool)))) { + if (FAILED(m_pShaderCom->Bind_RawValue("g_bDisolve", &bDisolve, sizeof(_int)))) { return E_FAIL; } if (FAILED(m_pShaderCom->Bind_RawValue("g_fDisolveRatio", &m_fDisolveTime, sizeof(_float)))) { diff --git a/Jusin154_Team3D/Client/Private/NomalJap.cpp b/Jusin154_Team3D/Client/Private/NomalJap.cpp index 2f62d531b..c4f08c21d 100644 --- a/Jusin154_Team3D/Client/Private/NomalJap.cpp +++ b/Jusin154_Team3D/Client/Private/NomalJap.cpp @@ -6,6 +6,7 @@ #include "GameInstance.h" #include "EffectParts.h" #include "TrailObject.h" +#include "Player.h" CNomalJap::CNomalJap(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) @@ -112,7 +113,7 @@ void CNomalJap::Update(_float fTimeDelta) _vector vDir = XMLoadFloat4(&m_vEndPos) - XMLoadFloat4(&m_vStartPos); - if (true == m_pGameInstance->SphereCast(0.25, XMLoadFloat4(&m_vStartPos), XMVector3Normalize(vDir), XMVectorGetX(XMVector3Length(vDir)) + if (true == m_pGameInstance->SphereCast(0.25f, XMLoadFloat4(&m_vStartPos), XMVector3Normalize(vDir), XMVectorGetX(XMVector3Length(vDir)) , PSX::PxHitFlag::ePOSITION | PSX::PxHitFlag::eNORMAL, PSX::PxQueryFlag::eDYNAMIC | PSX::PxQueryFlag::eSTATIC, m_Hitbuffer)) { OnCollision(this); @@ -302,7 +303,7 @@ void CNomalJap::OnCollision(CGameObject* pOther, void* pDesc) Get_PartObject()->Set_Visible(false); Get_PartObject()->Get_Component()->Set_State(STATE::POSITION, XMVectorSet(0.f, 0.f, 0.f, 1.f)); - + dynamic_cast(m_pOwner->Get_Owner())->Start_CameraShake(0.2f, 1.f); } void CNomalJap::Free() diff --git a/Jusin154_Team3D/Client/Private/Player.cpp b/Jusin154_Team3D/Client/Private/Player.cpp index c0ca9a43f..41a341e39 100644 --- a/Jusin154_Team3D/Client/Private/Player.cpp +++ b/Jusin154_Team3D/Client/Private/Player.cpp @@ -17,6 +17,7 @@ #include "MapElement_Interactable.h" #include "BroomRaceManager.h" #include "RaceRing.h" +#include "PlayerRobe.h" #pragma region STATE #include "State_Idle.h" @@ -177,6 +178,7 @@ __super::Update(fTimeDelta); m_pCharacter_Controller->Move(fTimeDelta); m_pCallBack_HitReport->Set_CurrentSlop(); } + if (m_pGameInstance->Mouse_Down(DIM_RBUTTON)){ m_pInfoInstance->Mouse_Input(ENUM_CLASS(KEYINPUT::DIM_RBUTTON_DOWN)); } @@ -223,6 +225,9 @@ void CPlayer::Late_Update(_float fTimeDelta) m_pTransformCom->Set_State(STATE::POSITION, m_pCharacter_Controller->Get_FootPosition()); m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); +#ifdef _DEBUG + m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this); +#endif // _DEBUG Set_Shadow(m_pGameInstance->IsIn_ShadowViewFrustum(m_pTransformCom->Get_State(STATE::POSITION), m_pTransformCom->Get_Radius())); @@ -242,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)); @@ -257,7 +262,19 @@ void CPlayer::Late_Update(_float fTimeDelta) m_pTransformCom->Set_State(STATE::LOOK, look); //////////////////////////////////////////////////////////////////////////// - +#ifdef 기무리 + if (nullptr == m_pRobePart) { + { + CPlayerRobe::PlayerRobe_DESC Desc{}; + Desc.pModel = m_pModelCom; + Desc.pParentTransform = m_pTransformCom; + Desc.pSocketMatrix = m_pModelCom->Get_BoneMatrixPtr("Hips_Cloth"); + if (FAILED(Add_PartObject("RobePart", g_iStaticLevel, &m_pRobePart, &Desc))) { + assert(false); + } + } + } +#endif // 기무리 } HRESULT CPlayer::Render() @@ -268,43 +285,46 @@ HRESULT CPlayer::Render() if (FAILED(Bind_ShaderResources())) { return E_FAIL; } + RENDER eType = m_pGameInstance->Get_CurrentRenderPass(); + if (RENDER::NONBLEND == eType) { + _uint iNumMeshes = m_pModelCom->Get_NumMeshes(); - _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() - ))) + for (_uint i = 0; i < iNumMeshes; i++) { - return E_FAIL; - } - if (FAILED(m_pModelCom->Begin(i, m_pShaderCom, false))) { - return E_FAIL; - } + 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_pModelCom->Begin(i, m_pShaderCom, false))) { + return E_FAIL; + } - m_pModelCom->Bind_OutPut_SRV_VS(26, 0); - m_pModelCom->Bind_OutPut_SRV_VS_Prev(27, 0); - if (FAILED(Bind_ShaderParameters(i))) { - return E_FAIL; - } + m_pModelCom->Bind_OutPut_SRV_VS(26, 0); + m_pModelCom->Bind_OutPut_SRV_VS_Prev(27, 0); + if (FAILED(Bind_ShaderParameters(i))) { + return E_FAIL; + } - if (FAILED(m_pModelCom->Render(i))) { - return E_FAIL; + if (FAILED(m_pModelCom->Render(i))) { + return E_FAIL; + } } } - #ifdef _DEBUG - m_pCharacter_Controller->Render(); - //m_pRigidBody->Render(); - Render_CameraCoordinateSystem(); + if (RENDER::NONLIGHT == eType) { + //m_pCharacter_Controller->Render(); + //m_pRigidBody->Render(); + Render_CameraCoordinateSystem(); + } #endif return S_OK; @@ -349,12 +369,11 @@ HRESULT CPlayer::Render_Shadow(SHADOW eType) } void CPlayer::OnCollision(CGameObject* pOther, void* pDesc) { - - if (m_pFSM->IsEnable(FSMSTATE::SHIELD)) - { - m_bShield = true; - } - if (m_pFSM->IsEnable(FSMSTATE::DODGE | FSMSTATE::BLINK) && m_bShield) + _int iCurrAnim = m_pModelCom->Get_AnimIndex(); + if (m_pFSM->IsEnable(FSMSTATE::DODGE | FSMSTATE::BLINK) || + m_bShield || + iCurrAnim == m_Animation[STATEANIM::AVADA_KEDAVRA].first|| + iCurrAnim == m_Animation[STATEANIM::ANCIENT_LIGHTNING].first) return; #ifdef _DEBUG @@ -372,7 +391,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) { @@ -385,7 +405,6 @@ void CPlayer::Start_CameraShake(_float fTime, _float fIntense) m_fCameraShakeIntense = fIntense; m_bCameraShake = true; } -#ifdef _DEBUG void CPlayer::Render_CameraCoordinateSystem() { @@ -437,8 +456,6 @@ void CPlayer::Render_CameraCoordinateSystem() ); m_Batch->End(); } -#endif // _DEBUG - HRESULT CPlayer::Ready_Components() { CTransform::TRANSFORM_DESC Desc = {}; @@ -550,8 +567,6 @@ HRESULT CPlayer::Ready_Parts() return E_FAIL; } - - return S_OK; } @@ -719,7 +734,7 @@ void CPlayer::Free() { __super::Free(); - + SAFE_RELEASE(m_pRobePart); SAFE_RELEASE(m_pGrapInteractive); if (nullptr != m_pInfoInstance) { CInfoInstance* pInfo = m_pInfoInstance; diff --git a/Jusin154_Team3D/Client/Private/PlayerRobe.cpp b/Jusin154_Team3D/Client/Private/PlayerRobe.cpp new file mode 100644 index 000000000..c29fa7370 --- /dev/null +++ b/Jusin154_Team3D/Client/Private/PlayerRobe.cpp @@ -0,0 +1,589 @@ +#include "pch.h" +#include "PlayerRobe.h" +#include "GameInstance.h" + +CPlayerRobe::CPlayerRobe(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CPartObject(pDevice, pContext) +{ +} + +CPlayerRobe::CPlayerRobe(const CPlayerRobe& Prototype) + : CPartObject(Prototype) +{ +} +void CPlayerRobe::Priority_Update(_float fTimeDelta) +{ +} + +void CPlayerRobe::Update(_float fTimeDelta) +{ + _matrix SocketMatrixFixed = (XMMatrixRotationZ(XM_PI) * XMLoadFloat4x4(m_pSocketMatrix)) * + XMLoadFloat4x4(m_pParentTransformCom->Get_WorldMatrixPtr()); + m_pRobeMainAnchor->Move_Kinematic(SocketMatrixFixed, false); + m_pRobeMainAnchor->Get_Actor()->wakeUp(); + Update_LegsPosition(); +} + +void CPlayerRobe::Late_Update(_float fTimeDelta) +{ + Update_RobeSocketPosition(); +#ifdef _DEBUG + for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_ORDER::END); ++i) { + PSX::PxConstraintFlags pxConstraintFlags = m_pDynamicJoints[i]->getConstraintFlags(); + const bool bBroken = (pxConstraintFlags.isSet(PSX::PxConstraintFlag::eBROKEN)); + if (true == bBroken) { + assert(false); + } + } + m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this); +#endif // _DEBUG +} + +HRESULT CPlayerRobe::Render() +{ + Render_BonePhysX(); + return S_OK; +} + +HRESULT CPlayerRobe::Update_RobeSocketPosition() +{ + PSX::PxTransform pxTransform = {}; + _matrix WorldMatrix = {}; + for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END); ++i) { + pxTransform = m_pRobeJointAnchor[i]->Get_GlobalPosition(); + WorldMatrix = XMMatrixAffineTransformation(XMVectorSet(1.f, 1.f, 1.f, 0.f), XMVectorZero(), XMLoadFloat4((_float4*)&pxTransform.q), XMVectorSetW(XMLoadFloat3((_float3*)&pxTransform.p), 1.f)); + m_pModelCom->Set_BoneCombinedTransformation(PLAYER_JOINT_BONE_NAMES[i], WorldMatrix); + } + return S_OK; +} + +HRESULT CPlayerRobe::Helper_RouteJointGenerater(CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC& Desc_Body, ROUTE_DESC& Desc_Route, _matrix* xmAnchorMatricesWorld) +{ + + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_JOINT_ROUTE"), (CComponent**)&m_pRobeJointRoute[Desc_Route.iTargetRouteIndex], &Desc_Body))) { + return E_FAIL; + } + m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Set_CenterTransform(xmAnchorMatricesWorld[Desc_Route.iStartBoneIndex].r[3], xmAnchorMatricesWorld[Desc_Route.iEndBoneIndex].r[3], true); + + + PSX::PxRigidDynamic* startAnchorRigidActor = m_pRobeJointAnchor[Desc_Route.iStartBoneIndex]->Get_Actor(); + PSX::PxRigidDynamic* routeRigidActor = m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_Actor(); + PSX::PxRigidDynamic* endAnchorRigidActor = m_pRobeJointAnchor[Desc_Route.iEndBoneIndex]->Get_Actor(); + + PSX::PxTransform startJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), false); // start y-- + PSX::PxTransform endJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), true); // end y++ + + m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_PxD6Joint(startAnchorRigidActor, routeRigidActor, startJointWorldPose); + + m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_PxD6Joint(routeRigidActor, endAnchorRigidActor, endJointWorldPose); + + return S_OK; +} + + +HRESULT CPlayerRobe::Update_LegsPosition() +{ + _matrix WorldMatrix = m_pParentTransformCom->Get_XMWorldMatrix(); + { + + _vector vFootPos = XMVector4Transform(XMLoadFloat4((_float4*)&m_pLeftFootLocalMatrix->m[3][0]), WorldMatrix); + _vector vLegPos = XMVector4Transform(XMLoadFloat4((_float4*)&m_pLeftLegLocalMatrix->m[3][0]), WorldMatrix); + m_pLeftLeg->Set_CenterTransform(vFootPos, vLegPos, false); + +#ifdef _DEBUG + { + _vector vCenterWorldPos = (vFootPos + vLegPos ) * 0.5f; + _vector vRotQ = XMQuaternionIdentity(); + _vector vDir = XMVectorSetW(vLegPos - vFootPos, 0.f); + _float vLength = XMVectorGetX(XMVector3Length(vDir)); + if (vLength > FLT_EPSILON5) { + vDir = XMVector3Normalize(vDir); + vRotQ = CMyTools::MakeQuaternionFromTo(XMVectorSet(0.f, 1.f, 0.f, 0.f), vDir); + } + XMStoreFloat4x4(&m_LeftLegMatrix, XMMatrixRotationQuaternion(vRotQ) * XMMatrixTranslationFromVector(vCenterWorldPos)); + } +#endif // _DEBUG + + vFootPos = XMVector4Transform(XMLoadFloat4((_float4*)&m_pRightFootLocalMatrix->m[3][0]), WorldMatrix); + vLegPos = XMVector4Transform(XMLoadFloat4((_float4*)&m_pRightLegLocalMatrix->m[3][0]), WorldMatrix); + m_pRightLeg->Set_CenterTransform(vFootPos, vLegPos, false); + +#ifdef _DEBUG + { + _vector vCenterWorldPos = (vFootPos + vLegPos) * 0.5f; + _vector vRotQ = XMQuaternionIdentity(); + _vector vDir = XMVectorSetW(vLegPos - vFootPos, 0.f); + _float vLength = XMVectorGetX(XMVector3Length(vDir)); + if (vLength > FLT_EPSILON5) { + vDir = XMVector3Normalize(vDir); + vRotQ = CMyTools::MakeQuaternionFromTo(XMVectorSet(0.f, 1.f, 0.f, 0.f), vDir); + } + XMStoreFloat4x4(&m_RightLegMatrix, XMMatrixRotationQuaternion(vRotQ) * XMMatrixTranslationFromVector(vCenterWorldPos)); + } +#endif // _DEBUG + } + + return S_OK; +} + +#ifdef _DEBUG +HRESULT CPlayerRobe::Render_Legs() +{ + _float fHeight = 0.25f; + + _matrix WorldMatrix = XMLoadFloat4x4(&m_LeftLegMatrix); + _matrix ViewMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW); + _matrix ProjMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ); + _vector vColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0xff0000, 1.f); + + m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, + [this]() { + m_pContext->OMSetDepthStencilState(m_pDepthStencilStateNone, 0); + }); + _matrix WorldUp = XMMatrixTranslationFromVector(WorldMatrix.r[1] * fHeight); + _matrix WorldDown = XMMatrixTranslationFromVector(WorldMatrix.r[1] * -fHeight); + m_pSubShape->Draw(WorldUp * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, + [this]() { + m_pContext->OMSetDepthStencilState(m_pDepthStencilStateNone, 0); + }); + m_pSubShape->Draw(WorldDown * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, + [this]() { + m_pContext->OMSetDepthStencilState(m_pDepthStencilStateNone, 0); + }); + + WorldMatrix = XMLoadFloat4x4(&m_RightLegMatrix); + + m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, + [this]() { + m_pContext->OMSetDepthStencilState(m_pDepthStencilStateNone, 0); + }); + WorldUp = XMMatrixTranslationFromVector(WorldMatrix.r[1] * fHeight); + WorldDown = XMMatrixTranslationFromVector(WorldMatrix.r[1] * -fHeight); + m_pSubShape->Draw(WorldUp * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, + [this]() { + m_pContext->OMSetDepthStencilState(m_pDepthStencilStateNone, 0); + }); + m_pSubShape->Draw(WorldDown * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, + [this]() { + m_pContext->OMSetDepthStencilState(m_pDepthStencilStateNone, 0); + }); + + return S_OK; +} + +HRESULT CPlayerRobe::Render_BonePhysX() +{ + _vector vColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0x00ff00, 1.f); + _fmatrix OwnerMatrix = m_pParentTransformCom->Get_XMWorldMatrix(); + _cmatrix ViewMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW); + _matrix ProjMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ); + ID3D11DepthStencilState* pPrevDSS = nullptr; + UINT iPrevStencilRef = 0; + m_pContext->OMGetDepthStencilState(&pPrevDSS, &iPrevStencilRef); + + for (_uint iBoneIndex = 0; iBoneIndex < ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END); ++iBoneIndex) + { + _matrix WorldMatrix = XMLoadFloat4x4(m_pModelCom->Get_BoneMatrixPtr(PLAYER_JOINT_BONE_NAMES[iBoneIndex])) * OwnerMatrix; + + m_pSubShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, + [this]() { + m_pContext->OMSetDepthStencilState(m_pDepthStencilStateNone, 0); + }); + } + _matrix MainAnchorMatrix = /*XMMatrixRotationZ(XM_PIDIV2) * */XMLoadFloat4x4(m_pSocketMatrix) * OwnerMatrix; + m_pSubShape->Draw(MainAnchorMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, + [this]() { + m_pContext->OMSetDepthStencilState(m_pDepthStencilStateNone, 0); + }); + m_pRobeMainAnchor->Render([this]() { + m_pContext->OMSetDepthStencilState(m_pDepthStencilStateNone, 0); + }); + Render_Legs(); + _vector vRouteColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0x0000ff, 1.f); + for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::END); ++i) { + if (nullptr != m_pRobeJointRoute[i]) { + m_pRobeJointRoute[i]->Render([this]() { + m_pContext->OMSetDepthStencilState(m_pDepthStencilStateNone, 0); + }); + } + } + for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END); ++i) { + m_pRobeJointAnchor[i]->Render([this]() { + m_pContext->OMSetDepthStencilState(m_pDepthStencilStateNone, 0); + }); + } + m_pContext->OMSetDepthStencilState(pPrevDSS, iPrevStencilRef); + if (pPrevDSS != nullptr) { + pPrevDSS->Release(); + } + return S_OK; +} +#endif // _DEBUG + +HRESULT CPlayerRobe::Ready_Components() +{ + __super::Ready_Components(nullptr); + + _matrix socketWorld = /*XMMatrixRotationZ(XM_PIDIV2) * */XMLoadFloat4x4(m_pSocketMatrix) * m_pParentTransformCom->Get_XMWorldMatrix(); + _matrix xmAnchorMatricesWorld[ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END)] = { }; + for (_uint iBoneIndex = 0; iBoneIndex < ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END); ++iBoneIndex) { + xmAnchorMatricesWorld[iBoneIndex] = XMLoadFloat4x4(&m_ReconstructedJointAnchorMatirces[iBoneIndex]) * socketWorld; + } + + { // + CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; + Desc.iSubKind = ENUM_CLASS(PXOBJECT::LEG); + Desc.bAutoOwnerTranslation = false; + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_Player_Leg"), (CComponent**)&m_pLeftLeg, &Desc))) { + return E_FAIL; + } + } + { // + CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; + Desc.iSubKind = ENUM_CLASS(PXOBJECT::LEG); + Desc.bAutoOwnerTranslation = false; + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_Player_Leg"), (CComponent**)&m_pRightLeg, &Desc))) { + return E_FAIL; + } + } + { // RobeSocket + { // Fixed_MainAnchor + CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; + Desc.iSubKind = ENUM_CLASS(PXOBJECT::JOINT_ANCHOR); + Desc.bAutoOwnerTranslation = false; + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_JOINT_ANCHOR"), (CComponent**)&m_pRobeMainAnchor, &Desc))) { + return E_FAIL; + } + m_pRobeMainAnchor->Set_Kinematic(true); + m_pRobeMainAnchor->Set_Transform(socketWorld, true); +#ifdef _DEBUG + m_pRobeMainAnchor->Set_Name("MainAnchor"); +#endif // _DEBUG + } + // SubAnchors + for (_int i = 0; i < ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END); ++i) { + CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; + Desc.iSubKind = ENUM_CLASS(PXOBJECT::JOINT_ANCHOR); + Desc.bAutoOwnerTranslation = false; + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_JOINT_ANCHOR"), (CComponent**)&m_pRobeJointAnchor[i], &Desc))) { + return E_FAIL; + } + + m_pRobeJointAnchor[i]->Set_Transform(xmAnchorMatricesWorld[i], true); +#ifdef _DEBUG + m_pRobeJointAnchor[i]->Set_Name(PLAYER_JOINT_BONE_NAMES[i]); +#endif // _DEBUG + } + } + { // RobeRoute + CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc_Body = {}; + ROUTE_DESC Desc_Route = {}; + Desc_Body.bAutoOwnerTranslation = false; + Desc_Body.iSubKind = ENUM_CLASS(PXOBJECT::JOINT_ROUTE); + /*Origin_Linked_Routes*/ + { + { + Desc_Route.iTargetRouteIndex = ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::ORIGIN_TO_RUP); + Desc_Route.iStartBoneIndex = -1; + Desc_Route.iEndBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::RIGHTUP); + Desc_Route.iStartJointIndex = ENUM_CLASS(PLAYER_JOINT_ORDER::ORIGIN_TO_RUP_START); + Desc_Route.iEndJointIndex = Desc_Route.iStartJointIndex + 1; + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_JOINT_ROUTE"), (CComponent**)&m_pRobeJointRoute[Desc_Route.iTargetRouteIndex], &Desc_Body))) { + return E_FAIL; + } + m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Set_CenterTransform(socketWorld.r[3], xmAnchorMatricesWorld[Desc_Route.iEndBoneIndex].r[3], true); +#ifdef _DEBUG + m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Set_Name("Origin_Linked_Routes"); +#endif // _DEBUG + { // Joint + PSX::PxRigidDynamic* startAnchorRigidActor = m_pRobeMainAnchor->Get_Actor(); + PSX::PxRigidDynamic* routeRigidActor = m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_Actor(); + PSX::PxRigidDynamic* endAnchorRigidActor = m_pRobeJointAnchor[Desc_Route.iEndBoneIndex]->Get_Actor(); + + PSX::PxTransform startJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), false); // start y-- + PSX::PxTransform endJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), true); // end y++ + + m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_PxD6Joint(startAnchorRigidActor, routeRigidActor, startJointWorldPose); + m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_PxD6Joint(routeRigidActor, endAnchorRigidActor, endJointWorldPose); + } + } + { + Desc_Route.iTargetRouteIndex = ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::ORIGIN_TO_TUP); + Desc_Route.iStartBoneIndex = -1; + Desc_Route.iEndBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::TAILUP); + Desc_Route.iStartJointIndex = ENUM_CLASS(PLAYER_JOINT_ORDER::ORIGIN_TO_TUP_START); + Desc_Route.iEndJointIndex = Desc_Route.iStartJointIndex + 1; + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_JOINT_ROUTE"), (CComponent**)&m_pRobeJointRoute[Desc_Route.iTargetRouteIndex], &Desc_Body))) { + return E_FAIL; + } + m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Set_CenterTransform(socketWorld.r[3], xmAnchorMatricesWorld[Desc_Route.iEndBoneIndex].r[3], true); +#ifdef _DEBUG + m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Set_Name("Origin_Linked_Routes"); +#endif // _DEBUG + { // Joint + PSX::PxRigidDynamic* startAnchorRigidActor = m_pRobeMainAnchor->Get_Actor(); + PSX::PxRigidDynamic* routeRigidActor = m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_Actor(); + PSX::PxRigidDynamic* endAnchorRigidActor = m_pRobeJointAnchor[Desc_Route.iEndBoneIndex]->Get_Actor(); + + PSX::PxTransform startJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), false); // start y-- + PSX::PxTransform endJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), true); // end y++ + + m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_PxD6Joint(startAnchorRigidActor, routeRigidActor, startJointWorldPose); + m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_PxD6Joint(routeRigidActor, endAnchorRigidActor, endJointWorldPose); + } + } + { + Desc_Route.iTargetRouteIndex = ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::ORIGIN_TO_LUP); + Desc_Route.iStartBoneIndex = -1; + Desc_Route.iEndBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::LEFTUP); + Desc_Route.iStartJointIndex = ENUM_CLASS(PLAYER_JOINT_ORDER::ORIGIN_TO_LUP_START); + Desc_Route.iEndJointIndex = Desc_Route.iStartJointIndex + 1; + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_JOINT_ROUTE"), (CComponent**)&m_pRobeJointRoute[Desc_Route.iTargetRouteIndex], &Desc_Body))) { + return E_FAIL; + } + m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Set_CenterTransform(socketWorld.r[3], xmAnchorMatricesWorld[Desc_Route.iEndBoneIndex].r[3], true); +#ifdef _DEBUG + m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Set_Name("Origin_Linked_Routes"); +#endif // _DEBUG + { // Joint + PSX::PxRigidDynamic* startAnchorRigidActor = m_pRobeMainAnchor->Get_Actor(); + PSX::PxRigidDynamic* routeRigidActor = m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_Actor(); + PSX::PxRigidDynamic* endAnchorRigidActor = m_pRobeJointAnchor[Desc_Route.iEndBoneIndex]->Get_Actor(); + + PSX::PxTransform startJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), false); // start y-- + PSX::PxTransform endJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), true); // end y++ + + m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_PxD6Joint(startAnchorRigidActor, routeRigidActor, startJointWorldPose); + m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_PxD6Joint(routeRigidActor, endAnchorRigidActor, endJointWorldPose); + } + } + } + /*UP_TO_MIDDLE*/ + { + { + Desc_Route.iTargetRouteIndex = ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::RUP_TO_RMIDDLE); + Desc_Route.iStartBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::RIGHTUP); + Desc_Route.iEndBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::RIGHT); + Desc_Route.iStartJointIndex = ENUM_CLASS(PLAYER_JOINT_ORDER::RUP_TO_RMIDDLE_START); + Desc_Route.iEndJointIndex = Desc_Route.iStartJointIndex + 1; + Helper_RouteJointGenerater(Desc_Body, Desc_Route, xmAnchorMatricesWorld); + } + { + Desc_Route.iTargetRouteIndex = ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::TUP_TO_TMIDDLE); + Desc_Route.iStartBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::TAILUP); + Desc_Route.iEndBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::TAIL); + Desc_Route.iStartJointIndex = ENUM_CLASS(PLAYER_JOINT_ORDER::TUP_TO_TMIDDLE_START); + Desc_Route.iEndJointIndex = Desc_Route.iStartJointIndex + 1; + Helper_RouteJointGenerater(Desc_Body, Desc_Route, xmAnchorMatricesWorld); + } + { + Desc_Route.iTargetRouteIndex = ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::LUP_TO_LMIDDLE); + Desc_Route.iStartBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::LEFTUP); + Desc_Route.iEndBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::LEFT); + Desc_Route.iStartJointIndex = ENUM_CLASS(PLAYER_JOINT_ORDER::LUP_TO_LMIDDLE_START); + Desc_Route.iEndJointIndex = Desc_Route.iStartJointIndex + 1; + Helper_RouteJointGenerater(Desc_Body, Desc_Route, xmAnchorMatricesWorld); + } + } + /*MIDDLE_TO_DOWN*/ + { + { + Desc_Route.iTargetRouteIndex = ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::RMIDDLE_TO_RR); + Desc_Route.iStartBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::RIGHT); + Desc_Route.iEndBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::RIGHTDOWNRIGHT); + Desc_Route.iStartJointIndex = ENUM_CLASS(PLAYER_JOINT_ORDER::RMIDDLE_TO_RR_START); + Desc_Route.iEndJointIndex = Desc_Route.iStartJointIndex + 1; + Helper_RouteJointGenerater(Desc_Body, Desc_Route, xmAnchorMatricesWorld); + } + { + Desc_Route.iTargetRouteIndex = ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::RMIDDLE_TO_R); + Desc_Route.iStartBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::RIGHT); + Desc_Route.iEndBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::RIGHTDOWN); + Desc_Route.iStartJointIndex = ENUM_CLASS(PLAYER_JOINT_ORDER::RMIDDLE_TO_R_START); + Desc_Route.iEndJointIndex = Desc_Route.iStartJointIndex + 1; + Helper_RouteJointGenerater(Desc_Body, Desc_Route, xmAnchorMatricesWorld); + } + { + Desc_Route.iTargetRouteIndex = ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::TMIDDLE_TO_TR); + Desc_Route.iStartBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::TAIL); + Desc_Route.iEndBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::TAILRIGHTDOWN); + Desc_Route.iStartJointIndex = ENUM_CLASS(PLAYER_JOINT_ORDER::TMIDDLE_TO_TR_START); + Desc_Route.iEndJointIndex = Desc_Route.iStartJointIndex + 1; + Helper_RouteJointGenerater(Desc_Body, Desc_Route, xmAnchorMatricesWorld); + } + { + Desc_Route.iTargetRouteIndex = ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::TMIDDLE_TO_TL); + Desc_Route.iStartBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::TAIL); + Desc_Route.iEndBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::TAILLEFTDOWN); + Desc_Route.iStartJointIndex = ENUM_CLASS(PLAYER_JOINT_ORDER::TMIDDLE_TO_TL_START); + Desc_Route.iEndJointIndex = Desc_Route.iStartJointIndex + 1; + Helper_RouteJointGenerater(Desc_Body, Desc_Route, xmAnchorMatricesWorld); + } + { + Desc_Route.iTargetRouteIndex = ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::LMIDDLE_TO_L); + Desc_Route.iStartBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::LEFT); + Desc_Route.iEndBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::LEFTDOWN); + Desc_Route.iStartJointIndex = ENUM_CLASS(PLAYER_JOINT_ORDER::LMIDDLE_TO_L_START); + Desc_Route.iEndJointIndex = Desc_Route.iStartJointIndex + 1; + Helper_RouteJointGenerater(Desc_Body, Desc_Route, xmAnchorMatricesWorld); + } + { + Desc_Route.iTargetRouteIndex = ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::LMIDDLE_TO_LL); + Desc_Route.iStartBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::LEFT); + Desc_Route.iEndBoneIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::LEFTDOWNLEFT); + Desc_Route.iStartJointIndex = ENUM_CLASS(PLAYER_JOINT_ORDER::LMIDDLE_TO_LL_START); + Desc_Route.iEndJointIndex = Desc_Route.iStartJointIndex + 1; + Helper_RouteJointGenerater(Desc_Body, Desc_Route, xmAnchorMatricesWorld); + } + } + } + return S_OK; +} + +HRESULT CPlayerRobe::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CPlayerRobe::Initialize(void* pArg) +{ + PlayerRobe_DESC* pDesc = static_cast (pArg); + m_pSocketMatrix = pDesc->pSocketMatrix; + m_pModelCom = pDesc->pModel; + + m_pLeftFootLocalMatrix = m_pModelCom->Get_BoneMatrixPtr("LeftFoot"); + m_pLeftLegLocalMatrix = m_pModelCom->Get_BoneMatrixPtr("LeftLeg"); + m_pRightFootLocalMatrix = m_pModelCom->Get_BoneMatrixPtr("RightFoot"); + m_pRightLegLocalMatrix = m_pModelCom->Get_BoneMatrixPtr("RightLeg"); + + XMStoreFloat4x4(&m_PreTransformMatrix, XMLoadFloat4x4(m_pModelCom->Get_PreTransformMatrixPtr())); + + for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END); ++i) { + m_RobeJointAnchorMatrices[i] = m_pModelCom->Get_BoneLocalMatrixPtr(PLAYER_JOINT_BONE_NAMES[i]); + } + for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END); ++i) + { + _uint iParentIndex = UINT_MAX; + _bool bCopyPreTransform = false; + + switch ((PLAYER_JOINT_BONE_ORDER)i) + { + case PLAYER_JOINT_BONE_ORDER::RIGHTUP: + case PLAYER_JOINT_BONE_ORDER::TAILUP: + case PLAYER_JOINT_BONE_ORDER::LEFTUP: + bCopyPreTransform = true; + break; + + case PLAYER_JOINT_BONE_ORDER::RIGHT: + iParentIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::RIGHTUP); + break; + case PLAYER_JOINT_BONE_ORDER::TAIL: + iParentIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::TAILUP); + break; + case PLAYER_JOINT_BONE_ORDER::LEFT: + iParentIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::LEFTUP); + break; + case PLAYER_JOINT_BONE_ORDER::RIGHTDOWNRIGHT: + case PLAYER_JOINT_BONE_ORDER::RIGHTDOWN: + iParentIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::RIGHT); + break; + case PLAYER_JOINT_BONE_ORDER::TAILRIGHTDOWN: + case PLAYER_JOINT_BONE_ORDER::TAILLEFTDOWN: + iParentIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::TAIL); + break; + case PLAYER_JOINT_BONE_ORDER::LEFTDOWN: + case PLAYER_JOINT_BONE_ORDER::LEFTDOWNLEFT: + iParentIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::LEFT); + break; + default: + assert(false); + break; + } + + if (true == bCopyPreTransform) + { + _matrix constructedMatrix = XMLoadFloat4x4(m_RobeJointAnchorMatrices[i]) * XMLoadFloat4x4(&m_PreTransformMatrix); + + XMStoreFloat4x4(&m_ReconstructedJointAnchorMatirces[i], constructedMatrix); + continue; + } + + _matrix constructedMatrix = XMLoadFloat4x4(m_RobeJointAnchorMatrices[i]) + * XMLoadFloat4x4(&m_ReconstructedJointAnchorMatirces[iParentIndex]); + + XMStoreFloat4x4(&m_ReconstructedJointAnchorMatirces[i], constructedMatrix); + } + + if (FAILED(__super::Initialize(pArg))) { + return E_FAIL; + } + + if (FAILED(Ready_Components())) { + return E_FAIL; + } +#ifdef _DEBUG + m_pSubShape = (GeometricPrimitive::CreateSphere(m_pContext, 0.05f, 22, false, false)); + m_pMainShape = (GeometricPrimitive::CreateCylinder(m_pContext, 0.3f, 0.075f, 22, false)); + D3D11_DEPTH_STENCIL_DESC depthStencilDesc = {}; + depthStencilDesc.DepthEnable = FALSE; + depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; + depthStencilDesc.DepthFunc = D3D11_COMPARISON_ALWAYS; + depthStencilDesc.StencilEnable = FALSE; + + HRESULT result = m_pDevice->CreateDepthStencilState(&depthStencilDesc, &m_pDepthStencilStateNone); + if (FAILED(result)){ + return E_FAIL; + } +#endif // _DEBUG + return S_OK; +} + +CPlayerRobe* CPlayerRobe::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CPlayerRobe* pInstance = new CPlayerRobe(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CPlayerRobe"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CPlayerRobe::Clone(void* pArg, CGameObject* pOwner) +{ + CPlayerRobe* pInstance = new CPlayerRobe(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CPlayerRobe"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CPlayerRobe::Free() +{ + __super::Free(); +#ifdef _DEBUG + SAFE_RELEASE(m_pDepthStencilStateNone); +#endif // _DEBUG + SAFE_RELEASE(m_pRightLeg); + SAFE_RELEASE(m_pLeftLeg); + SAFE_RELEASE(m_pRobeMainAnchor); + for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::END); ++i) { + SAFE_RELEASE(m_pRobeJointRoute[i]); + } + for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END); ++i) { + SAFE_RELEASE(m_pRobeJointAnchor[i]); + } +} +#ifdef _DEBUG + +void CPlayerRobe::Describe_Entity() +{ +} + +#endif // _DEBUG diff --git a/Jusin154_Team3D/Client/Private/Player_States.cpp b/Jusin154_Team3D/Client/Private/Player_States.cpp index e2bc1b266..85b936d59 100644 --- a/Jusin154_Team3D/Client/Private/Player_States.cpp +++ b/Jusin154_Team3D/Client/Private/Player_States.cpp @@ -186,24 +186,6 @@ HRESULT CPlayer::InputBroom() void CPlayer::Behavior_IdleEnter() { m_pFSM->Enable_State(FSMSTATE::IDLE); - pair<_uint, _bool> pairAnimInfo; - - if (SUCCEEDED(InputAim())) - { - if (m_pGameInstance->Mouse_Pressing(DIM_LBUTTON)) { - pairAnimInfo = m_Animation[STATEANIM::IDLE_AIM]; - m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true); - } - else - pairAnimInfo = m_Animation[STATEANIM::IDLE]; - m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true,1.f,false); - } - else - { - pairAnimInfo = m_Animation[STATEANIM::IDLE]; - m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true, 1.f, false); - } - m_bSprintToggle = false; m_bWalkToggle = false; @@ -258,6 +240,23 @@ HRESULT CPlayer::Behavior_IdleExitCheck(_float fTimeDelta) } return E_FAIL; } + else { + if (SUCCEEDED(InputAim())) + { + if (m_pGameInstance->Mouse_Pressing(DIM_LBUTTON)) { + pairAnimInfo = m_Animation[STATEANIM::IDLE_AIM]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true); + } + else + pairAnimInfo = m_Animation[STATEANIM::IDLE]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true, 1.f, false); + } + else + { + pairAnimInfo = m_Animation[STATEANIM::IDLE]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true, 1.f, false); + } + } if (SUCCEEDED(InputMove())) { @@ -1126,6 +1125,7 @@ void CPlayer::Behavior_CombatEnter() HRESULT CPlayer::Behavior_CombatExitCheck() { pair<_uint, _bool> pairAnimInfo; + _int iCurrAnimIndex = m_pModelCom->Get_AnimIndex(); _float fRatio = m_pModelCom->Get_CurrentTrackProgressRatio(); if (SUCCEEDED(InputAction()) || SUCCEEDED(InputSpell())) { @@ -1183,7 +1183,8 @@ HRESULT CPlayer::Behavior_CombatExitCheck() } else { - if (SUCCEEDED(InputMove()) && fRatio >= 0.3f) { + if (SUCCEEDED(InputMove()) && fRatio >= 0.3f && + iCurrAnimIndex != m_Animation[STATEANIM::ANCIENT_LIGHTNING].first) { m_pFSM->Change_State(FSMSTATE::MOVE); m_bLookAt = false; return E_FAIL; @@ -1426,7 +1427,7 @@ void CPlayer::Behavior_SpellEnter() pairAnimInfo = m_Animation[STATEANIM::SPELL]; fRatio = 0.2f; } - else if (Degree <= 135.f) + else if (Degree <= 85.f) { if (Cross < 0.f) { @@ -1577,7 +1578,8 @@ HRESULT CPlayer::Behavior_SpellExitCheck() Play_SpellHitAnim(); - if (SUCCEEDED(InputMove()) && iIndex != m_Animation[STATEANIM::AVADA_KEDAVRA].first) { + if (SUCCEEDED(InputMove()) && + iIndex != m_Animation[STATEANIM::AVADA_KEDAVRA].first) { if (fRatio >= 0.4f) { m_pFSM->Change_State(FSMSTATE::MOVE); return E_FAIL; @@ -1704,10 +1706,15 @@ HRESULT CPlayer::Behavior_ShieldExitCheck() _vector vCross = XMVector3Cross(vLook, vCameraLook); _float Cross = XMVectorGetY(vCross); - if (Degree <= 60.f) + if (Degree <= 30.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); + } + else if (Degree <= 60.f) + { + pairAnimInfo = m_Animation[STATEANIM::PARRY4]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true, 1.f, false); Add_Event(pairAnimInfo.first, [this]() {m_bLookAt = true; }, @@ -1718,22 +1725,26 @@ 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]; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); } + } + else { + pairAnimInfo = m_Animation[STATEANIM::PARRY4]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true, 1.f, false); } Add_Event(pairAnimInfo.first, diff --git a/Jusin154_Team3D/Client/Private/Protego.cpp b/Jusin154_Team3D/Client/Private/Protego.cpp index f71361785..ab48ec95b 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) @@ -129,14 +128,14 @@ HRESULT CProtego::Ready_Components(void* pArg) } - //{ // DO - // CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; - // Desc.iSubKind = ENUM_CLASS(PXOBJECT::SKILL_PROTEGO); - // 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()); - //} + { // DO + CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; + Desc.iSubKind = ENUM_CLASS(PXOBJECT::SKILL_PROTEGO); + 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(), NEXT_LEVEL); + } return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/Ranrok.cpp b/Jusin154_Team3D/Client/Private/Ranrok.cpp index 09a6abacc..14f0c98b0 100644 --- a/Jusin154_Team3D/Client/Private/Ranrok.cpp +++ b/Jusin154_Team3D/Client/Private/Ranrok.cpp @@ -72,8 +72,8 @@ HRESULT CRanrok::Initialize(void* pArg) } else { - m_pCharacter_Controller->Set_Position(XMVectorSet(-44.704f, -2.860f, 16.071f, 1.f)); - m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(-44.704f, -2.860f, 16.071f, 1.f)); + m_pCharacter_Controller->Set_Position(XMVectorSet(-44.704f, 6.860f, 16.071f, 1.f)); + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(-44.704f, 6.860f, 16.071f, 1.f)); } Load_RanrokPos("../Bin/Resources/Data/RanrokPos/RanrokPos.xml"); @@ -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))); } @@ -281,6 +281,12 @@ void CRanrok::OnCollision(CGameObject* pOther, void* pDesc) case ENUM_CLASS(SKILL_TYPE::STUPEFY): m_eHitSpell = ENUM_CLASS(SKILL_TYPE::STUPEFY); break; + case ENUM_CLASS(SKILL_TYPE::AVADAKEDAVRA): + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::AVADAKEDAVRA); + break; + case ENUM_CLASS(SKILL_TYPE::ANCIENT_MAGIC): + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::ANCIENT_MAGIC); + break; } } else @@ -524,7 +530,7 @@ void CRanrok::MoveTo(_float fTimeDelta) _vector CurPos = m_pCharacter_Controller->Get_Position(); _vector vLook = XMVector3Normalize(m_pTransformCom->Get_State(STATE::LOOK)); - _float Speed = 40.f; + _float Speed = 75.f; _vector toTarget = Target - CurPos; _float fDist = XMVectorGetX(XMVector3Length(toTarget)); 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..f7451e19d 100644 --- a/Jusin154_Team3D/Client/Private/Ranrok_States.cpp +++ b/Jusin154_Team3D/Client/Private/Ranrok_States.cpp @@ -32,7 +32,7 @@ void CRanrok::Behavior_IdleEnter() { m_pFSM->Enable_State(FSMSTATE::IDLE); pair<_uint, _bool> pairAnimInfo = m_Animation[STATEANIM::HOVER_LOOP]; - + m_bLookAt = true; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); } @@ -49,12 +49,14 @@ HRESULT CRanrok::Behavior_IdleExitCheck() void CRanrok::Behavior_IdleExit() { m_pFSM->Disable_State(FSMSTATE::IDLE); + m_bLookAt = false; } void CRanrok::Behavior_IdleBreakEnter() { m_pFSM->Enable_State(FSMSTATE::IDLEBREAK); pair<_uint, _bool> pairAnimInfo; + m_bLookAt = true; pairAnimInfo = m_Animation[STATEANIM::IDLE_BREAK2]; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); } @@ -71,6 +73,7 @@ HRESULT CRanrok::Behavior_IdleBreakExitCheck() void CRanrok::Behavior_IdleBreakExit() { m_pFSM->Disable_State(FSMSTATE::IDLEBREAK); + m_bLookAt = false; } void CRanrok::Behavior_MoveEnter() @@ -283,6 +286,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 +296,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); @@ -328,7 +334,7 @@ HRESULT CRanrok::Behavior_FireBreathExitCheck(_float fTimeDelta) if (iCurrAnimIndex == m_Animation[STATEANIM::FIREBREATH_COOLDOWN_A].first) { - m_fHeadAimWeight -= fTimeDelta*2.f; + m_fHeadAimWeight -= fTimeDelta * 2.f; m_pModelCom->Set_HeadAimWeight(m_fHeadAimWeight); } @@ -358,6 +364,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 +374,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, @@ -495,9 +502,6 @@ void CRanrok::Behavior_FireBallEnter() }, 0.45f); break; } - - - } m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBALL)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBALL)]; @@ -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/Private/Skill_Data.cpp b/Jusin154_Team3D/Client/Private/Skill_Data.cpp index 87a66ea56..d42db2959 100644 --- a/Jusin154_Team3D/Client/Private/Skill_Data.cpp +++ b/Jusin154_Team3D/Client/Private/Skill_Data.cpp @@ -57,7 +57,7 @@ void CSkill_Data::Update_Damage(_float Damage) { for (_int i = 0; i < m_iSpell_Count; ++i) { - m_fSpell_Damage[i] = SpellInfo->fSpell_Damage + Damage; + m_fSpell_Damage[i] = SpellInfo[i].fSpell_Damage + Damage; } } diff --git a/Jusin154_Team3D/Client/Private/State_Dash.cpp b/Jusin154_Team3D/Client/Private/State_Dash.cpp new file mode 100644 index 000000000..4ab7f691e --- /dev/null +++ b/Jusin154_Team3D/Client/Private/State_Dash.cpp @@ -0,0 +1,64 @@ +#include "pch.h" +#include "State_Dash.h" +#include "Unit.h" + + +CState_Dash::CState_Dash() + :CState_Root() +{ +} + +void CState_Dash::Enter() +{ + __super::Enter(); +} + +HRESULT CState_Dash::Update(_float fTimeDelta) +{ + if (nullptr != m_funcPriorityUpdate) { + m_funcPriorityUpdate(fTimeDelta); + } + if (E_FAIL == (__super::Update(fTimeDelta))) { + return E_FAIL; + } + if (nullptr != m_funcLateUpdate) { + m_funcLateUpdate(fTimeDelta); + } + return S_OK; +} + +void CState_Dash::Exit() +{ + __super::Exit(); +} + +HRESULT CState_Dash::Initialize(STATE_DASH_DESC* pDesc) +{ + if (FAILED(__super::Initialize(pDesc))) { + return E_FAIL; + } + m_funcPriorityUpdate = pDesc->funcPriorityUpdate; + m_funcLateUpdate = pDesc->funcLateUpdate; + m_pModel = m_pOwner->Get_Component(); + m_pFSM = m_pOwner->Get_Component(); + + return S_OK; +} + +CState_Dash* CState_Dash::Create(STATE_DASH_DESC* pDesc) +{ + CState_Dash* pInstance = new CState_Dash; + if (FAILED(pInstance->Initialize(pDesc))) { + SAFE_RELEASE(pInstance); + } + return pInstance; +} + +void CState_Dash::Free() +{ + __super::Free(); +} + +void CState_Dash::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Client/Private/State_Slash.cpp b/Jusin154_Team3D/Client/Private/State_Slash.cpp new file mode 100644 index 000000000..d0c51f682 --- /dev/null +++ b/Jusin154_Team3D/Client/Private/State_Slash.cpp @@ -0,0 +1,64 @@ +#include "pch.h" +#include "State_Slash.h" +#include "Unit.h" + + +CState_Slash::CState_Slash() + :CState_Root() +{ +} + +void CState_Slash::Enter() +{ + __super::Enter(); +} + +HRESULT CState_Slash::Update(_float fTimeDelta) +{ + if (nullptr != m_funcPriorityUpdate) { + m_funcPriorityUpdate(fTimeDelta); + } + if (E_FAIL == (__super::Update(fTimeDelta))) { + return E_FAIL; + } + if (nullptr != m_funcLateUpdate) { + m_funcLateUpdate(fTimeDelta); + } + return S_OK; +} + +void CState_Slash::Exit() +{ + __super::Exit(); +} + +HRESULT CState_Slash::Initialize(STATE_SLASH_DESC* pDesc) +{ + if (FAILED(__super::Initialize(pDesc))) { + return E_FAIL; + } + m_funcPriorityUpdate = pDesc->funcPriorityUpdate; + m_funcLateUpdate = pDesc->funcLateUpdate; + m_pModel = m_pOwner->Get_Component(); + m_pFSM = m_pOwner->Get_Component(); + + return S_OK; +} + +CState_Slash* CState_Slash::Create(STATE_SLASH_DESC* pDesc) +{ + CState_Slash* pInstance = new CState_Slash; + if (FAILED(pInstance->Initialize(pDesc))) { + SAFE_RELEASE(pInstance); + } + return pInstance; +} + +void CState_Slash::Free() +{ + __super::Free(); +} + +void CState_Slash::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Client/Private/Transformation.cpp b/Jusin154_Team3D/Client/Private/Transformation.cpp index d2d0fd2c8..e36f77300 100644 --- a/Jusin154_Team3D/Client/Private/Transformation.cpp +++ b/Jusin154_Team3D/Client/Private/Transformation.cpp @@ -216,7 +216,7 @@ void CTransformation::OnCollision(CGameObject* pOther, void* pDesc) //m_pCharacter_Controller->Move(fTimeDelta); - PhsXUserData* pUserData = static_cast(pCCT->Get_Actor()->userData); + PHYSX_USERDATA* pUserData = static_cast(pCCT->Get_Actor()->userData); switch (pUserData->eKind) { case PHYSX_KIND::CCTActor: diff --git a/Jusin154_Team3D/Client/Private/Troll.cpp b/Jusin154_Team3D/Client/Private/Troll.cpp index 3befbaa81..68ba708b4 100644 --- a/Jusin154_Team3D/Client/Private/Troll.cpp +++ b/Jusin154_Team3D/Client/Private/Troll.cpp @@ -388,6 +388,12 @@ void CTroll::OnCollision(CGameObject* pOther, void* pDesc) case ENUM_CLASS(SKILL_TYPE::STUPEFY): m_eHitSpell = ENUM_CLASS(SKILL_TYPE::STUPEFY); break; + case ENUM_CLASS(SKILL_TYPE::AVADAKEDAVRA): + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::AVADAKEDAVRA); + break; + case ENUM_CLASS(SKILL_TYPE::ANCIENT_MAGIC): + m_eHitSpell = ENUM_CLASS(SKILL_TYPE::ANCIENT_MAGIC); + break; } } else diff --git a/Jusin154_Team3D/Client/Private/Troll_Rock.cpp b/Jusin154_Team3D/Client/Private/Troll_Rock.cpp index 982105e77..8d47fc8a6 100644 --- a/Jusin154_Team3D/Client/Private/Troll_Rock.cpp +++ b/Jusin154_Team3D/Client/Private/Troll_Rock.cpp @@ -122,7 +122,7 @@ void CTroll_Rock::RockHit() memcpy_s(&tagCollInfo.vWorldNomal, sizeof(tagCollInfo.vWorldNomal), &hit.normal, sizeof(hit.normal)); XMStoreFloat4(&tagCollInfo.vHitDir, vDir); tagCollInfo.fLength = fLength; - PhsXUserData* pUserData = static_cast(pActor->userData); + PHYSX_USERDATA* pUserData = static_cast(pActor->userData); tagCollInfo.pObject = pUserData->pOwner; tagCollInfo.eHitType = ENUM_CLASS(HIT_TYPE::HIT_HEAVY); tagCollInfo.fDamage = 10.f; diff --git a/Jusin154_Team3D/Client/Private/Troll_States.cpp b/Jusin154_Team3D/Client/Private/Troll_States.cpp index 4a25fa58b..663388a19 100644 --- a/Jusin154_Team3D/Client/Private/Troll_States.cpp +++ b/Jusin154_Team3D/Client/Private/Troll_States.cpp @@ -883,7 +883,7 @@ void CTroll::SwingHit(_bool& bPlayerHit) for (_uint i = 0; i < pxHits.size(); ++i) { PSX::PxActor* pxHitActor = pxHits[i].actor; if (nullptr != pxHitActor && nullptr != pxHitActor->userData) { - PhsXUserData* pUserData = (PhsXUserData*)pxHitActor->userData; + PHYSX_USERDATA* pUserData = (PHYSX_USERDATA*)pxHitActor->userData; ON_COLLISION_INFO tagCollInfo = {}; tagCollInfo.vWorldPos.w = 1.f; @@ -934,7 +934,7 @@ void CTroll::SlamHit(_bool& bPlayerHit) for (_uint i = 0; i < pxHits.size(); ++i) { PSX::PxActor* pxHitActor = pxHits[i].actor; if (nullptr != pxHitActor && nullptr != pxHitActor->userData) { - PhsXUserData* pUserData = (PhsXUserData*)pxHitActor->userData; + PHYSX_USERDATA* pUserData = (PHYSX_USERDATA*)pxHitActor->userData; ON_COLLISION_INFO tagCollInfo = {}; 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/Goblin_Assassin.h b/Jusin154_Team3D/Client/Public/Goblin_Assassin.h new file mode 100644 index 000000000..6f3fb3a22 --- /dev/null +++ b/Jusin154_Team3D/Client/Public/Goblin_Assassin.h @@ -0,0 +1,138 @@ +#pragma once + +#include "Client_Define.h" +#include "Monster.h" +#include "CallBack_Monster_Behavior.h" +#include "CallBack_Monster_HitReport.h" +#include "Enemy_Detection.h" + +NS_BEGIN(Client) + +class CGoblin_Assassin final : public CMonster +{ + enum class GOBLIN_ASSASSIN_SKILL + { + SLASH, + DASH, + TP, + END + }; +private: + CGoblin_Assassin(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CGoblin_Assassin(const CGoblin_Assassin& Prototype); + virtual ~CGoblin_Assassin() = 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 HRESULT Render_OutLine(); + virtual HRESULT Render_Shadow(SHADOW eType) override; + virtual _vector Get_LockOnPos() override; + virtual void OnCollision(CGameObject* pOther = nullptr, void* pDesc = nullptr)override; + virtual void OnHit(CGameObject* pOther, CGameObject* pCaller = nullptr)override; + + void Set_Detection(_bool bDetection); +private: + CCallBack_Monster_Behavior* m_pCallBack_Behavior = { nullptr }; + CCallBack_Monster_HitReport* m_pCallBack_HitReport = { nullptr }; + CEnemy_Detection* m_pDetection = { nullptr }; + + CCharacter_Controller* m_pCharacter_Controller = { nullptr }; + CRigidBody_Dynamic* m_pRigidBody = { nullptr }; + _float2 m_vStunTimer = { 0.f, 4.f }; + _uint iIndex; +private: + class CEffectPool* m_pEffectPool = nullptr; + DAMAGE_INFO m_DamageInfo; + + _bool m_bDetection = { false }; + + + class CEffectParts* m_pSmoke = { nullptr }; + class CEffectParts* m_pGoblin_Particle = { nullptr }; + class CEffectParts* m_pGoblin_Particle2 = { nullptr }; + class CGoblin_Spector* m_pGoblinSpector = { nullptr }; +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + HRESULT Ready_Components(); + HRESULT Ready_Parts(); + HRESULT Bind_ShaderResources(); + void HitState_Behavior(_float fTimeDelta); + +public: + static CGoblin_Assassin* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr) override; + virtual void Free() override; +#ifdef _DEBUG + virtual void Describe_Entity() override; + +#endif // _DEBUG + +private: + virtual void Add_FSM(); + virtual void Set_Anim(); + + _float m_fSkillCoolTime[ENUM_CLASS(GOBLIN_ASSASSIN_SKILL::END)] = {}; + _float m_fMaxSkillCoolTime[ENUM_CLASS(GOBLIN_ASSASSIN_SKILL::END)] = { 5.f,2.f,15.f }; + + _bool m_bStep = { true }; + _float m_fTpTime = {}; + _float m_fAirTime = {}; + _vector m_vOriginPos = {}; + _float m_fLength = {}; + _float m_fMoveTime = {}; + _bool m_bFirstMove = {}; + _bool m_bPos = {}; + _float m_fAccel = { 3.f}; + _float m_fTargetSpeed = {60.f}; + _float m_fSpeed = {}; + _bool m_bAir = {}; + _float m_fGravityAmount = {}; + _float m_fHitTimer = {}; + _float m_fTumbleTimer = {}; + + void Behavior_IdleEnter(); + HRESULT Behavior_IdleExitCheck(); + void Behavior_IdleExit(); + + void Behavior_IdleBreakEnter(); + HRESULT Behavior_IdleBreakExitCheck(); + void Behavior_IdleBreakExit(); + + void Behavior_MoveEnter(); + HRESULT Behavior_MoveExitCheck(_float fTimeDelta); + void Behavior_MoveExit(); + + void Behavior_CombatEnter(); + HRESULT Behavior_CombatExitCheck(_float fTimeDelta); + void Behavior_CombatExit(); + + void Behavior_SlashEnter(); + HRESULT Behavior_SlashExitCheck(_float fTimeDelta); + void Behavior_SlashExit(); + + void Behavior_DashEnter(); + HRESULT Behavior_DashExitCheck(_float fTimeDelta); + void Behavior_DashExit(); + + void Behavior_BlinkEnter(); + HRESULT Behavior_BlinkExitCheck(_float fTimeDelta); + void Behavior_BlinkExit(); + + void Behavior_ShuffleEnter(); + HRESULT Behavior_ShuffleExitCheck(_float fTimeDelta); + void Behavior_ShuffleExit(); + + void Behavior_HitEnter(); + HRESULT Behavior_HitExitCheck(_float fTimeDelta); + void Behavior_HitExit(); + + void Behavior_DeadEnter(); + HRESULT Behavior_DeadExitCheck(_float fTimeDelta); + void Behavior_DeadExit(); +}; + +NS_END diff --git a/Jusin154_Team3D/Client/Public/Goblin_Protego.h b/Jusin154_Team3D/Client/Public/Goblin_Protego.h index 284adbc40..9de274855 100644 --- a/Jusin154_Team3D/Client/Public/Goblin_Protego.h +++ b/Jusin154_Team3D/Client/Public/Goblin_Protego.h @@ -32,7 +32,7 @@ class CGoblin_Protego final : public CEffect_Container virtual void OnCollision(CGameObject* pOther = nullptr, void* pDesc = nullptr) override; private: _wstring m_wstrEffectName = {}; - + CRigidBody_Dynamic* m_pRigidBody = { nullptr }; class CEffectParts* m_pSphere = { nullptr }; class CEffectParts* m_pBottom = { nullptr }; class CEffectParts* m_pCircle = { nullptr }; diff --git a/Jusin154_Team3D/Client/Public/Goblin_Sword.h b/Jusin154_Team3D/Client/Public/Goblin_Sword.h new file mode 100644 index 000000000..241b70699 --- /dev/null +++ b/Jusin154_Team3D/Client/Public/Goblin_Sword.h @@ -0,0 +1,52 @@ +#pragma once + +#include "Client_Define.h" +#include "PartObject.h" + +NS_BEGIN(Client) + +class CGoblin_Sword final : public CPartObject +{ +public: + typedef struct tagSword : public CPartObject::PARTOBJECT_DESC + { + const _float4x4* pSocketMatrices = { }; + }GOBLIN_SWORD_DESC; +private: + CGoblin_Sword(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CGoblin_Sword(const CGoblin_Sword& Prototype); + virtual ~CGoblin_Sword() = default; + +public: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + virtual HRESULT Render() override; +public: + +private: + const _float4x4* m_pSocketMatrices = { }; + CShader* m_pShaderCom = { nullptr }; + CModel* m_pModelCom = { nullptr }; + + _float4 m_vStartPos = {}; + PSX::PxSweepBufferN<12> m_SweepBuffer = {}; + +private: + HRESULT Ready_Components(); + HRESULT Bind_ShaderResources(); + void Sword_Hit(); + +public: + static CGoblin_Sword* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr)override; + virtual void Free() override; + +#ifdef _DEBUG + void Describe_Entity() override; +#endif // _DEBUG +}; + +NS_END diff --git a/Jusin154_Team3D/Client/Public/Player.h b/Jusin154_Team3D/Client/Public/Player.h index 51da992ec..874aaf0aa 100644 --- a/Jusin154_Team3D/Client/Public/Player.h +++ b/Jusin154_Team3D/Client/Public/Player.h @@ -2,30 +2,12 @@ #include "Client_Define.h" #include "Unit.h" +#include "Player_ENUM.h" NS_BEGIN(Client) class CPlayer final : public CUnit { - enum class PLAYER_MESH_ORDER { - HEAD_EYE_OCC, - HEAD_FACE, - HEAD_TEETH, - HEAD_EYELASH, - HEAD_EYES, - BODY_ARMS, - HAIR_MAIN, - HAIR_MAIN_CLOTH, - LOWER, - SHOES, - UPPER, - HAIR_SUB, - HAIR_SUB_CLOTH, - ROBE_SKIRT, - ROBE_FUR, - ROBE_CLOTH, - END - }; public: typedef struct tagPlayerInitDesc { _float4 vPos; @@ -92,6 +74,8 @@ class CPlayer final : public CUnit class CTransform* m_pBroomTransform = { nullptr }; class CBroom* m_pBroom = { nullptr }; CStat* m_pStat = { nullptr }; + class CPlayerRobe* m_pRobePart = { nullptr }; + class CBroomRaceManager* m_pBroomRaceManager = { nullptr }; class CRaceRing* m_pRaceRing = { nullptr }; diff --git a/Jusin154_Team3D/Client/Public/PlayerRobe.h b/Jusin154_Team3D/Client/Public/PlayerRobe.h new file mode 100644 index 000000000..eafc1b58a --- /dev/null +++ b/Jusin154_Team3D/Client/Public/PlayerRobe.h @@ -0,0 +1,82 @@ +#pragma once + +#include "Client_Define.h" +#include "PartObject.h" +#include "Player_ENUM.h" + +NS_BEGIN(Client) + +class CPlayerRobe final : public CPartObject +{ + typedef struct tagRouteCreater { + _uint iTargetRouteIndex = UINT_MAX; // 만들려는 루트 + _uint iStartBoneIndex = UINT_MAX; // 시작 앵커 + _uint iEndBoneIndex = UINT_MAX; // 끝 앵커 + _uint iStartJointIndex = UINT_MAX; // 시작 앵커가 할당받을 인덱스 + _uint iEndJointIndex = UINT_MAX; // 끝 앵커가 할당받을 인덱스 + }ROUTE_DESC; + +public: + typedef struct tagPlayerRobe : public CPartObject::PARTOBJECT_DESC + { + const _float4x4* pSocketMatrix = { }; + CModel* pModel = { nullptr }; + }PlayerRobe_DESC; +private: + CPlayerRobe(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CPlayerRobe(const CPlayerRobe& Prototype); + virtual ~CPlayerRobe() = 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: + _float4x4 m_PreTransformMatrix = { }; + const _float4x4* m_pSocketMatrix = { nullptr }; + const _float4x4* m_pLeftFootLocalMatrix = { nullptr }; + const _float4x4* m_pLeftLegLocalMatrix = { nullptr }; + const _float4x4* m_pRightFootLocalMatrix = { nullptr }; + const _float4x4* m_pRightLegLocalMatrix = { nullptr }; + const _float4x4* m_RobeJointAnchorMatrices[ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END)] = { nullptr }; + _float4x4 m_ReconstructedJointAnchorMatirces[ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END)] = { }; + + CModel* m_pModelCom = { nullptr }; + CRigidBody_Dynamic* m_pRightLeg = { nullptr }; + CRigidBody_Dynamic* m_pLeftLeg = { nullptr }; + CRigidBody_Dynamic* m_pRobeMainAnchor = { nullptr }; + CRigidBody_Dynamic* m_pRobeJointRoute[ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::END)] = { nullptr }; + CRigidBody_Dynamic* m_pRobeJointAnchor[ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END)] = { nullptr }; + PSX::PxD6Joint* m_pDynamicJoints[ENUM_CLASS(PLAYER_JOINT_ORDER::END)] = { nullptr }; +#ifdef _DEBUG + unique_ptr m_pMainShape = { nullptr }; + unique_ptr m_pSubShape = { nullptr }; + ID3D11DepthStencilState* m_pDepthStencilStateNone = { nullptr }; + _float4x4 m_LeftLegMatrix = {}; + _float4x4 m_RightLegMatrix = {}; +#endif // _DEBUG +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + HRESULT Ready_Components(); + HRESULT Bind_ShaderResources() { return S_OK; } + + HRESULT Update_LegsPosition(); + HRESULT Update_RobeSocketPosition(); + HRESULT Helper_RouteJointGenerater(CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC& Desc_Body, ROUTE_DESC& Desc_Route, _matrix* xmAnchorMatricesWorld); +#ifdef _DEBUG + HRESULT Render_BonePhysX(); + HRESULT Render_Legs(); +#endif // _DEBUG +public: + static CPlayerRobe* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr)override; + virtual void Free() override; + +#ifdef _DEBUG + void Describe_Entity() override; +#endif // _DEBUG +}; + +NS_END diff --git a/Jusin154_Team3D/Client/Public/Player_ENUM.h b/Jusin154_Team3D/Client/Public/Player_ENUM.h new file mode 100644 index 000000000..96d76f479 --- /dev/null +++ b/Jusin154_Team3D/Client/Public/Player_ENUM.h @@ -0,0 +1,126 @@ +#pragma once +#include "Client_Define.h" + +NS_BEGIN(Client) + +enum class PLAYER_MESH_ORDER { + HEAD_EYE_OCC, + HEAD_FACE, + HEAD_TEETH, + HEAD_EYELASH, + HEAD_EYES, + BODY_ARMS, + HAIR_MAIN, + HAIR_MAIN_CLOTH, + LOWER, + SHOES, + UPPER, + HAIR_SUB, + HAIR_SUB_CLOTH, + ROBE_SKIRT, + ROBE_FUR, + ROBE_CLOTH, + END +}; + +static const _char* PLAYER_JOINT_BONE_NAMES[12] = { + "RightUpLeg_Cloth" + , "TailUp_Cloth" + , "LeftUpLeg_Cloth" + + , "RightLeg_Cloth" + , "Tail_Cloth" + , "LeftLeg_Cloth" + + , "RightDownLeg_Cloth" + , "RightDownRightLeg_Cloth" + , "TailRightDown_Cloth" + + , "TailLeftDown_Cloth" + , "LeftDownLeftLeg_Cloth" + , "LeftDownLeg_Cloth" +}; + +enum class PLAYER_JOINT_BONE_ORDER { + RIGHTUP + , TAILUP + , LEFTUP + + , RIGHT + , TAIL + , LEFT + + , RIGHTDOWNRIGHT + , RIGHTDOWN + + , TAILRIGHTDOWN + , TAILLEFTDOWN + + , LEFTDOWN + , LEFTDOWNLEFT + , END +}; + +enum class PLAYER_JOINT_ORDER { + ORIGIN_TO_RUP_START + , ORIGIN_TO_RUP_END + + , ORIGIN_TO_TUP_START + , ORIGIN_TO_TUP_END + + , ORIGIN_TO_LUP_START + , ORIGIN_TO_LUP_END + + + , RUP_TO_RMIDDLE_START + , RUP_TO_RMIDDLE_END + + , TUP_TO_TMIDDLE_START + , TUP_TO_TMIDDLE_END + + , LUP_TO_LMIDDLE_START + , LUP_TO_LMIDDLE_END + + + , RMIDDLE_TO_RR_START + , RMIDDLE_TO_RR_END + + , RMIDDLE_TO_R_START + , RMIDDLE_TO_R_END + + , TMIDDLE_TO_TR_START + , TMIDDLE_TO_TR_END + + , TMIDDLE_TO_TL_START + , TMIDDLE_TO_TL_END + + , LMIDDLE_TO_L_START + , LMIDDLE_TO_L_END + + , LMIDDLE_TO_LL_START + , LMIDDLE_TO_LL_END + + + , END +}; + +enum class PLAYER_JOINT_ROUTE_ORDER { + ORIGIN_TO_RUP + , ORIGIN_TO_TUP + , ORIGIN_TO_LUP + + , RUP_TO_RMIDDLE + , TUP_TO_TMIDDLE + , LUP_TO_LMIDDLE + + , RMIDDLE_TO_RR + , RMIDDLE_TO_R + , TMIDDLE_TO_TR + , TMIDDLE_TO_TL + , LMIDDLE_TO_L + , LMIDDLE_TO_LL + , END +}; + + +NS_END diff --git a/Jusin154_Team3D/Client/Public/Ranrok.h b/Jusin154_Team3D/Client/Public/Ranrok.h index 1ce067a01..464ed9958 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 ,8.f,40.f,40.f,40.f}; _float m_fTuckedTime = {}; _bool m_bFireBurst = { false }; diff --git a/Jusin154_Team3D/Client/Public/State_Dash.h b/Jusin154_Team3D/Client/Public/State_Dash.h new file mode 100644 index 000000000..61387d619 --- /dev/null +++ b/Jusin154_Team3D/Client/Public/State_Dash.h @@ -0,0 +1,36 @@ +#pragma once +#include "Client_Define.h" +#include "State_Root.h" + +NS_BEGIN(Client) + +class CState_Dash final : public CState_Root +{ +public: + typedef struct tagDash : public CState_Root::STATE_ROOT_DESC { + function funcPriorityUpdate = { nullptr }; + function funcLateUpdate = { nullptr }; + }STATE_DASH_DESC; +private: + CState_Dash(); + virtual ~CState_Dash() = default; + +public: + virtual void Enter(); + virtual HRESULT Update(_float fTimeDelta); + virtual void Exit(); + +private: + function m_funcPriorityUpdate = { nullptr }; + function m_funcLateUpdate = { nullptr }; + +private: + HRESULT Initialize(STATE_DASH_DESC* pDesc); + +public: + static CState_Dash* Create(STATE_DASH_DESC* pDesc); + virtual void Free() override; + virtual void Describe_Entity(); +}; + +NS_END diff --git a/Jusin154_Team3D/Client/Public/State_Slash.h b/Jusin154_Team3D/Client/Public/State_Slash.h new file mode 100644 index 000000000..cbfc28c0f --- /dev/null +++ b/Jusin154_Team3D/Client/Public/State_Slash.h @@ -0,0 +1,36 @@ +#pragma once +#include "Client_Define.h" +#include "State_Root.h" + +NS_BEGIN(Client) + +class CState_Slash final : public CState_Root +{ +public: + typedef struct tagSlash : public CState_Root::STATE_ROOT_DESC { + function funcPriorityUpdate = { nullptr }; + function funcLateUpdate = { nullptr }; + }STATE_SLASH_DESC; +private: + CState_Slash(); + virtual ~CState_Slash() = default; + +public: + virtual void Enter(); + virtual HRESULT Update(_float fTimeDelta); + virtual void Exit(); + +private: + function m_funcPriorityUpdate = { nullptr }; + function m_funcLateUpdate = { nullptr }; + +private: + HRESULT Initialize(STATE_SLASH_DESC* pDesc); + +public: + static CState_Slash* Create(STATE_SLASH_DESC* pDesc); + virtual void Free() override; + virtual void Describe_Entity(); +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Stat/Stat.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Stat/Stat.xml index a18e49aa2..a9bf5fcb8 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Stat/Stat.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Stat/Stat.xml @@ -1,5 +1,5 @@  - + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/UI/Spell/SpellInfo.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/UI/Spell/SpellInfo.xml index a5487a058..2f4d236b3 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/UI/Spell/SpellInfo.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/UI/Spell/SpellInfo.xml @@ -109,7 +109,7 @@ 반환됩니다." Spell_Lock="0" Equip_Spell="0" Use_Skill="1" Preview="0" Vidio="0" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_DefaultGrey_D.png b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_DefaultGrey_D.png new file mode 100644 index 000000000..b414d5691 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_DefaultGrey_D.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_Eye_Iris_D.png b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_Eye_Iris_D.png new file mode 100644 index 000000000..4bf9d62f9 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_Eye_Iris_D.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_Eye_Sclera_D.png b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_Eye_Sclera_D.png new file mode 100644 index 000000000..6e082532d Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_Eye_Sclera_D.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_Hair_Banker_DAO_MSK.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_Hair_Banker_DAO_MSK.dds new file mode 100644 index 000000000..8642b0c88 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_Hair_Banker_DAO_MSK.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_Hair_Banker_THV_MSK.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_Hair_Banker_THV_MSK.dds new file mode 100644 index 000000000..8acf10a3d Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_Hair_Banker_THV_MSK.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_Head_Banker_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_Head_Banker_N.dds new file mode 100644 index 000000000..76246d5a0 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_Head_Banker_N.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Assassin_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Assassin_D.dds new file mode 100644 index 000000000..d81b678c2 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Assassin_D.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Assassin_MRO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Assassin_MRO.dds new file mode 100644 index 000000000..814317c8f Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Assassin_MRO.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Assassin_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Assassin_N.dds new file mode 100644 index 000000000..2c7789adb Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Assassin_N.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Head_Banker_SRXO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Head_Banker_SRXO.dds new file mode 100644 index 000000000..a37d8d7fc Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Head_Banker_SRXO.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Head_Teeth_D.png b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Head_Teeth_D.png new file mode 100644 index 000000000..eec5a1f7c Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Head_Teeth_D.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Head_Teeth_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Head_Teeth_N.dds new file mode 100644 index 000000000..c3fc70ad7 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Head_Teeth_N.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Head_Teeth_SR.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Head_Teeth_SR.dds new file mode 100644 index 000000000..70bd10254 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Head_Teeth_SR.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Melee_Head_Banker_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Melee_Head_Banker_D.dds new file mode 100644 index 000000000..0f7e04c9c Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_GOB_M_Melee_Head_Banker_D.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_Goblin_Banker_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_Goblin_Banker_D.dds new file mode 100644 index 000000000..085070615 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_Goblin_Banker_D.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_Goblin_Banker_MRO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_Goblin_Banker_MRO.dds new file mode 100644 index 000000000..4be2c4bbe Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_Goblin_Banker_MRO.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_Goblin_Banker_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_Goblin_Banker_N.dds new file mode 100644 index 000000000..7c1a33f12 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/Goblin_Assassin/T_Goblin_Banker_N.dds differ 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/Bin/Resources/Models/Object/Goblin_Sword/SK_WPN_GOB_SmallSword.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Goblin_Sword/SK_WPN_GOB_SmallSword.bin new file mode 100644 index 000000000..73c5adc54 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Goblin_Sword/SK_WPN_GOB_SmallSword.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e61fb4d67eb14f88a623076e96a59d43e19b3fffdf0c44936db7a5a70b511c1b +size 79937 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Goblin_Sword/SK_WPN_GOB_SmallSword.fbx b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Goblin_Sword/SK_WPN_GOB_SmallSword.fbx new file mode 100644 index 000000000..2fea614f3 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Goblin_Sword/SK_WPN_GOB_SmallSword.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47912d072d8c80ecbcfcb6caf1898a8f913e1522516a6ec108fcf4cd120d81c4 +size 48172 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl index d81caa548..3d233fe57 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl @@ -25,6 +25,7 @@ StructuredBuffer g_PrevChannelBuffer : register(t3); StructuredBuffer g_ParentBuffer : register(t4); StructuredBuffer g_BoneLocalBuffer : register(t5); StructuredBuffer g_BoneRemap : register(t6); +StructuredBuffer g_SkipBone : register(t7); RWStructuredBuffer g_LocalMatrixOut : register(u0); @@ -46,8 +47,13 @@ cbuffer AnimCB : register(b0) int HeadBoneIndex; float HeadAimWeight; + int SkipCount; + int _pad0; + int _pad1; + int _pad2; + float3 TargetDir_Local; - float padding; + float padding3; row_major float4x4 PreTransformMatrix; float4 RootInitRot; @@ -356,8 +362,22 @@ row_major float4x4 SampleBlendedLocal(uint bone) void CS_LOCAL(uint3 DTid : SV_DispatchThreadID) { uint bone = DTid.x; + if (bone >= BoneCount) return; + + if (SkipCount != 0) + { + for (int i = 0; i < SkipCount; i++) + { + if (bone == g_SkipBone[i]) + { + g_LocalMatrixOut[bone] = g_BoneLocalBuffer[bone].BoneLocal; + return; + } + } + } + g_LocalMatrixOut[bone] = SampleBlendedLocal(bone); } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl index 6b87a5ef5..6e54e5656 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl @@ -27,10 +27,14 @@ cbuffer AnimCB : register(b0) int PlayHeadBone; int HeadBoneIndex; float HeadAimWeight; - + + int SkipCount; + int _pad0; + int _pad1; + int _pad2; float3 TargetDir_Local; - float padding; + float padding3; row_major float4x4 PreTransformMatrix; float4 RootInitRot; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl index 737b5e082..5ad2199ac 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl @@ -28,6 +28,9 @@ float g_fUsingSurfaceParams; float g_fEtherealRatio; float g_fMixerFactor; float g_fMBIntensity = 1.f; +float g_fDisolveEdgeWidth; +float g_fDisolveAmount; +float g_fDisolveRatio; @@ -65,6 +68,8 @@ StructuredBuffer g_PrevBoneBuffer : register(t27); Texture2D g_SurfaceParamsTexture; +Texture2D g_DeadDisolveTexture; +Texture2D g_DeadDisolveBurnTexture; int g_iBinded_Texture[27]; matrix g_BoneMatrices[512]; @@ -338,7 +343,11 @@ PS_OUT PS_EYELASH_DAOTHV_ToSRO(PS_IN In) PS_OUT Out; float4 vDAO_Mask = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); - + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDAO_Mask = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDAO_Mask, In.vTexcoord); + } float fDiffuseMask = vDAO_Mask.r; float AlphaMask = vDAO_Mask.g; float AoMask_Dao = vDAO_Mask.b; @@ -378,7 +387,11 @@ PS_OUT PS_TEETH_SRXO_ToSRO(PS_IN In) PS_OUT Out; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); - + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); + } if (vDiffuse.a < 0.2f) { discard; } @@ -407,7 +420,11 @@ PS_OUT PS_EYE_DN_SRO(PS_IN In) PS_OUT Out; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); - + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); + } if (vDiffuse.a < 0.2f) { discard; } @@ -442,7 +459,11 @@ PS_OUT PS_FACIAL_HAIR_DAOTHV_ToSRO(PS_IN In) PS_OUT Out; float4 vDAO_Mask = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); - + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDAO_Mask = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDAO_Mask, In.vTexcoord); + } float fDiffuseMask = vDAO_Mask.r; float AlphaMask = vDAO_Mask.g; float AoMask_Dao = vDAO_Mask.b; @@ -484,7 +505,11 @@ PS_OUT PS_HEAD_HAIR_DAOTHV_ToSRO(PS_IN In) PS_OUT Out; float4 vDAO_Mask = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); - + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDAO_Mask = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDAO_Mask, In.vTexcoord); + } float fDiffuseMask = vDAO_Mask.r; float AlphaMask = vDAO_Mask.g; float AoMask_Dao = vDAO_Mask.b; @@ -525,7 +550,11 @@ PS_OUT PS_HEADwtHAND_DSRXON_ToSRO(PS_IN In) PS_OUT Out; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); - + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); + } if (vDiffuse.a < 0.2f) { discard; } @@ -553,7 +582,11 @@ PS_OUT PS_LOWER_DSRON_ToSRO(PS_IN In) PS_OUT Out; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); - + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); + } if (vDiffuse.a < 0.2f) { discard; } @@ -581,7 +614,11 @@ PS_OUT PS_UPPER_DMRON_ToMRO(PS_IN In) PS_OUT Out; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); - + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); + } if (vDiffuse.a < 0.2f) { discard; } @@ -609,7 +646,11 @@ PS_OUT PS_GLASSES_DMRON_ToMRO(PS_IN In) PS_OUT Out; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); - + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); + } if (vDiffuse.a < 0.2f) { discard; } @@ -638,7 +679,12 @@ PS_OUT PS_EmissiveMetalness_DENMRO_ToMRO(PS_IN In) float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); float4 vEmissive = g_EmissiveTexture.Sample(DefaultSampler, In.vTexcoord); - vDiffuse.rgb += vEmissive.rgb; + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); + } + vDiffuse.rgb += vEmissive.rgb * 3.f; if (vDiffuse.a < 0.2f) { discard; } @@ -667,7 +713,12 @@ PS_OUT PS_DNMRO_ToMRO(PS_IN In) float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); float4 vEmissive = g_EmissiveTexture.Sample(DefaultSampler, In.vTexcoord); - vDiffuse.rgb += vEmissive.rgb; + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); + } + vDiffuse.rgb += vEmissive.rgb * 3.f; if (vDiffuse.a < 0.2f) { discard; } @@ -695,6 +746,11 @@ PS_OUT PS_MI_ClothSim_DSEN_ToSRO(PS_IN In) PS_OUT Out; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); + } float4 vEmissive = g_EmissiveTexture.Sample(DefaultSampler, In.vTexcoord); vDiffuse.rgb += vEmissive.rgb; if (vDiffuse.a < 0.2f) { @@ -724,6 +780,11 @@ PS_OUT PS_MI_DANSROMRO_ToSRO(PS_IN In) PS_OUT Out; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); + } float4 vAlpha = g_TransmissionTexture.Sample(DefaultSampler, In.vTexcoord); if (vAlpha.r < 0.2f) { @@ -759,6 +820,11 @@ PS_OUT PS_Troll_Club_DAENMROSRXO_ToMROX(PS_IN In) PS_OUT Out; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); + } float4 vEmissive = g_EmissiveTexture.Sample(DefaultSampler, In.vTexcoord); float4 vAmbient = g_AmbientTexture.Sample(DefaultSampler, In.vTexcoord); vDiffuse.rgb += vEmissive.rgb; @@ -797,6 +863,11 @@ PS_OUT PS_Player_EyeLash_DAOTHV_ToSRO(PS_IN In) float2 p = uv - center; float2 uvRot90 = frac(float2(p.x, p.y) + center); float4 vDAOColor = g_DiffuseTexture.Sample(DefaultSampler, uv); + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDAOColor = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDAOColor, In.vTexcoord); + } float4 vTHVColor = g_DiffuseBlend.Sample(DefaultSampler, uv); float4 vNormalColor = g_NormalTexture.Sample(DefaultSampler, uv); float fAlpha = g_NormalBlendTexture.Sample(DefaultSampler, uvRot90).r; @@ -836,6 +907,11 @@ PS_OUT PS_Player_Eye_ToMRO(PS_IN In) PS_OUT Out; float2 uv = In.vTexcoord; float4 vDiffuseColor = g_DiffuseTexture.Sample(DefaultSampler, uv); + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDiffuseColor = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuseColor, In.vTexcoord); + } float4 vSubSurfaceColor = g_ReflectionTexture.Sample(DefaultSampler, uv); float4 vNormalColor = g_NormalTexture.Sample(DefaultSampler, uv); float4 vMROColor = g_MetalnessTexture.Sample(DefaultSampler, uv); @@ -861,6 +937,11 @@ PS_OUT PS_Player_Robe_ToMRO(PS_IN In) PS_OUT Out; float2 uv = In.vTexcoord; float4 vDiffuseColor = g_DiffuseTexture.Sample(DefaultSampler, uv); + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDiffuseColor = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuseColor, In.vTexcoord); + } float4 vEmissive = g_EmissiveTexture.Sample(DefaultSampler, uv); vDiffuseColor.rgb += vEmissive.r * vEmissive.g; @@ -888,6 +969,11 @@ PS_OUT PS_Player_Suit_DSRON_ToSRO(PS_IN In) PS_OUT Out; float2 uv = In.vTexcoord; float4 vDiffuseColor = g_DiffuseTexture.Sample(DefaultSampler, uv); + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDiffuseColor = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuseColor, In.vTexcoord); + } float4 vSROColor = g_SpecularTexture.Sample(DefaultSampler, uv); float4 vNormalColor = g_NormalTexture.Sample(DefaultSampler, uv); @@ -912,7 +998,12 @@ PS_OUT PS_Player_HairDAOTHV_ToSRO(PS_IN In) { PS_OUT Out; float2 uv = In.vTexcoord; - float4 vDAOColor = g_DiffuseTexture.Sample(DefaultSampler, uv); + float4 vDAOColor = g_DiffuseTexture.Sample(DefaultSampler, uv); + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDAOColor = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDAOColor, In.vTexcoord); + } float3 vHairBaseColor = g_NormalBlendTexture.Sample(DefaultSampler, uv).rrr; float4 vNormalColor = g_NormalTexture.Sample(DefaultSampler, uv); float4 vTHVColor = g_DiffuseBlend.Sample(DefaultSampler, uv); @@ -997,6 +1088,11 @@ PS_OUT PS_Dragon_Body(PS_IN In) PS_OUT Out; float2 uv = In.vTexcoord; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, uv); + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); + } float fOppacity = g_NormalBlendTexture.Sample(DefaultSampler, uv).r; vDiffuse.a = fOppacity; if (vDiffuse.a < 0.2f) @@ -1029,6 +1125,11 @@ PS_OUT PS_Dragon_Wings(PS_IN In) PS_OUT Out; float2 uv = In.vTexcoord; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, uv); + if (true == g_bDisolve) + { + float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); + vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); + } float4 vEmissive = g_EmissiveTexture.Sample(DefaultSampler, uv); vDiffuse += vEmissive; diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index 62df3fcf6..79c54b2b6 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -113,7 +113,7 @@ EDITOR_PROJECT;$(USERNAME);_DEBUG;_WINDOWS;%(PreprocessorDefinitions);%(PreprocessorDefinitions) true stdcpp17 - ../../EngineSDK/Inc/;../Public/;../../EngineSDK/Inc/DirectXTK/;../../EngineSDK/Inc/fMod/;../../EngineSDK/Inc/IMGUI/;../../EngineSDK/Inc/FX11/;%(AdditionalIncludeDirectories) + ../../EngineSDK/Inc/;../../EngineSDK/Inc/PhysX/;../Public/;../../EngineSDK/Inc/DirectXTK/;../../EngineSDK/Inc/fMod/;../../EngineSDK/Inc/IMGUI/;../../EngineSDK/Inc/FX11/;%(AdditionalIncludeDirectories) true true Use @@ -123,7 +123,7 @@ Windows true ../../EngineSDK/Lib/$(ConfigurationName)/;../ThirdPartyLib/ZLib/$(ConfigurationName)/;%(AdditionalLibraryDirectories) - Engine.lib;fmod_vc.lib;Crypt32.lib;assimp-vc145-mtd.lib;DirectXTKd.lib;%(AdditionalDependencies) + Engine.lib;fmod_vc.lib;Crypt32.lib;PhysX_64.lib;PhysXCommon_64.lib;PhysXCooking_64.lib;PhysXExtensions_static_64.lib;PhysXFoundation_64.lib;assimp-vc145-mtd.lib;DirectXTKd.lib;%(AdditionalDependencies);%(AdditionalDependencies) @@ -150,7 +150,7 @@ call Update_Shaders.bat EDITOR_PROJECT;$(USERNAME);NDEBUG;_WINDOWS;%(PreprocessorDefinitions);%(PreprocessorDefinitions) true stdcpp17 - ../../EngineSDK/Inc/;../Public/;../../EngineSDK/Inc/DirectXTK/;../../EngineSDK/Inc/fMod/;../../EngineSDK/Inc/IMGUI/;../../EngineSDK/Inc/FX11/;%(AdditionalIncludeDirectories) + ../../EngineSDK/Inc/;../../EngineSDK/Inc/PhysX/;../Public/;../../EngineSDK/Inc/DirectXTK/;../../EngineSDK/Inc/fMod/;../../EngineSDK/Inc/IMGUI/;../../EngineSDK/Inc/FX11/;%(AdditionalIncludeDirectories) true true Use @@ -160,7 +160,7 @@ call Update_Shaders.bat Windows true ../../EngineSDK/Lib/$(ConfigurationName)/;../ThirdPartyLib/ZLib/$(ConfigurationName)/;%(AdditionalLibraryDirectories) - Engine.lib;fmod_vc.lib;Crypt32.lib;assimp-vc145-mt.lib;%(AdditionalDependencies) + Engine.lib;fmod_vc.lib;Crypt32.lib;PhysX_64.lib;PhysXCommon_64.lib;PhysXCooking_64.lib;PhysXExtensions_static_64.lib;PhysXFoundation_64.lib;assimp-vc145-mt.lib;%(AdditionalDependencies);%(AdditionalDependencies) @@ -268,13 +268,13 @@ call Update_Shaders.bat true - true - true + false + false - true - true + false + false true @@ -518,13 +518,13 @@ call Update_Shaders.bat true - true - true + false + false - true - true + false + false true diff --git a/Jusin154_Team3D/Editor/Private/CallBack_EffectHitBox_Behavior.cpp b/Jusin154_Team3D/Editor/Private/CallBack_EffectHitBox_Behavior.cpp index 140eb3454..8c718c220 100644 --- a/Jusin154_Team3D/Editor/Private/CallBack_EffectHitBox_Behavior.cpp +++ b/Jusin154_Team3D/Editor/Private/CallBack_EffectHitBox_Behavior.cpp @@ -17,7 +17,7 @@ PSX::PxControllerBehaviorFlags CCallBack_EffectHitBox_Behavior::getBehaviorFlags return PSX::PxControllerBehaviorFlags(0); } PSX::PxControllerBehaviorFlags eResults = PSX::PxControllerBehaviorFlags(0); - PhsXUserData* pActorData = static_cast(actor.userData); + PHYSX_USERDATA* pActorData = static_cast(actor.userData); switch (pActorData->eKind) { case PHYSX_KIND::BODY_STATIC: diff --git a/Jusin154_Team3D/Editor/Private/CallBack_EffectHitBox_HitReport.cpp b/Jusin154_Team3D/Editor/Private/CallBack_EffectHitBox_HitReport.cpp index 0a66d2d34..aa5589e64 100644 --- a/Jusin154_Team3D/Editor/Private/CallBack_EffectHitBox_HitReport.cpp +++ b/Jusin154_Team3D/Editor/Private/CallBack_EffectHitBox_HitReport.cpp @@ -26,8 +26,8 @@ void CCallBack_EffectHitBox_HitReport::onShapeHit(const PSX::PxControllerShapeHi ON_COLLISION_INFO CollisionDesc = {}; if (nullptr != pController && nullptr != pActor) { - PhsXUserData* pTargetActorData = static_cast(pActor->userData); - PhsXUserData* pOwnerActorData = static_cast(pController->getActor()->userData); + PHYSX_USERDATA* pTargetActorData = static_cast(pActor->userData); + PHYSX_USERDATA* pOwnerActorData = static_cast(pController->getActor()->userData); if (nullptr == pTargetActorData) { // missing user data return; } @@ -83,7 +83,7 @@ void CCallBack_EffectHitBox_HitReport::onControllerHit(const PSX::PxControllersH PSX::PxController* pOtherController = hit.other; // 다른 컨트롤러 if (nullptr != pController && nullptr != pOtherController) { - PhsXUserData* pActorData = static_cast(pOtherController->getActor()->userData); + PHYSX_USERDATA* pActorData = static_cast(pOtherController->getActor()->userData); assert(nullptr != pActorData); // missing user data switch (pActorData->eKind) diff --git a/Jusin154_Team3D/Editor/Private/CallBack_Monster_Behavior.cpp b/Jusin154_Team3D/Editor/Private/CallBack_Monster_Behavior.cpp index 699647c82..ccfcc848d 100644 --- a/Jusin154_Team3D/Editor/Private/CallBack_Monster_Behavior.cpp +++ b/Jusin154_Team3D/Editor/Private/CallBack_Monster_Behavior.cpp @@ -17,7 +17,7 @@ PSX::PxControllerBehaviorFlags CCallBack_Monster_Behavior::getBehaviorFlags(cons return PSX::PxControllerBehaviorFlags(0); } PSX::PxControllerBehaviorFlags eResults = PSX::PxControllerBehaviorFlags(0); - PhsXUserData* pActorData = static_cast(actor.userData); + PHYSX_USERDATA* pActorData = static_cast(actor.userData); switch (pActorData->eKind) { case PHYSX_KIND::BODY_STATIC: diff --git a/Jusin154_Team3D/Editor/Private/CallBack_Monster_HitReport.cpp b/Jusin154_Team3D/Editor/Private/CallBack_Monster_HitReport.cpp index 348ab72db..bf6f80bfa 100644 --- a/Jusin154_Team3D/Editor/Private/CallBack_Monster_HitReport.cpp +++ b/Jusin154_Team3D/Editor/Private/CallBack_Monster_HitReport.cpp @@ -25,8 +25,8 @@ void CCallBack_Monster_HitReport::onShapeHit(const PSX::PxControllerShapeHit& hi PSX::PxRigidActor* pActor = hit.actor; if (nullptr != pController && nullptr != pActor) { - PhsXUserData* pTargetActorData = static_cast(pActor->userData); - PhsXUserData* pOwnerActorData = static_cast(pController->getActor()->userData); + PHYSX_USERDATA* pTargetActorData = static_cast(pActor->userData); + PHYSX_USERDATA* pOwnerActorData = static_cast(pController->getActor()->userData); if (nullptr == pTargetActorData) { // missing user data return; } @@ -72,7 +72,7 @@ void CCallBack_Monster_HitReport::onControllerHit(const PSX::PxControllersHit& h PSX::PxController* pOtherController = hit.other; // 다른 컨트롤러 if (nullptr != pController && nullptr != pOtherController) { - PhsXUserData* pActorData = static_cast(pOtherController->getActor()->userData); + PHYSX_USERDATA* pActorData = static_cast(pOtherController->getActor()->userData); assert(nullptr != pActorData); // missing user data switch (pActorData->eKind) diff --git a/Jusin154_Team3D/Editor/Private/CallBack_Playable_Behavior.cpp b/Jusin154_Team3D/Editor/Private/CallBack_Playable_Behavior.cpp index b74143b2f..b9749f54c 100644 --- a/Jusin154_Team3D/Editor/Private/CallBack_Playable_Behavior.cpp +++ b/Jusin154_Team3D/Editor/Private/CallBack_Playable_Behavior.cpp @@ -17,7 +17,7 @@ PSX::PxControllerBehaviorFlags CCallBack_Playable_Behavior::getBehaviorFlags(con return PSX::PxControllerBehaviorFlags(0); } PSX::PxControllerBehaviorFlags eResults = PSX::PxControllerBehaviorFlags(0); - PhsXUserData* pActorData = static_cast(actor.userData); + PHYSX_USERDATA* pActorData = static_cast(actor.userData); switch (pActorData->eKind) { case PHYSX_KIND::BODY_STATIC: diff --git a/Jusin154_Team3D/Editor/Private/CallBack_Playable_HitReport.cpp b/Jusin154_Team3D/Editor/Private/CallBack_Playable_HitReport.cpp index 60808b2c7..1c6946b17 100644 --- a/Jusin154_Team3D/Editor/Private/CallBack_Playable_HitReport.cpp +++ b/Jusin154_Team3D/Editor/Private/CallBack_Playable_HitReport.cpp @@ -23,8 +23,8 @@ void CCallBack_Playable_HitReport::onShapeHit(const PSX::PxControllerShapeHit& h PSX::PxRigidActor* pActor = hit.actor; if (nullptr != pController && nullptr != pActor) { - PhsXUserData* pTargetActorData = static_cast(pActor->userData); - PhsXUserData* pOwnerActorData = static_cast(pController->getActor()->userData); + PHYSX_USERDATA* pTargetActorData = static_cast(pActor->userData); + PHYSX_USERDATA* pOwnerActorData = static_cast(pController->getActor()->userData); if (nullptr == pTargetActorData) { // missing user data return; } @@ -99,7 +99,7 @@ void CCallBack_Playable_HitReport::onControllerHit(const PSX::PxControllersHit& PSX::PxController* pOtherController = hit.other; // 다른 컨트롤러 if (nullptr != pController && nullptr != pOtherController) { - PhsXUserData* pActorData = static_cast(pOtherController->getActor()->userData); + PHYSX_USERDATA* pActorData = static_cast(pOtherController->getActor()->userData); assert(nullptr != pActorData); // missing user data switch (pActorData->eKind) diff --git a/Jusin154_Team3D/Editor/Private/CallBack_Ranrok_HitReport.cpp b/Jusin154_Team3D/Editor/Private/CallBack_Ranrok_HitReport.cpp index 1d2fa2d99..d89f0b92a 100644 --- a/Jusin154_Team3D/Editor/Private/CallBack_Ranrok_HitReport.cpp +++ b/Jusin154_Team3D/Editor/Private/CallBack_Ranrok_HitReport.cpp @@ -34,8 +34,8 @@ void CCallBack_Ranrok_HitReport::onShapeHit(const PSX::PxControllerShapeHit& hit PSX::PxRigidActor* pActor = hit.actor; if (nullptr != pController && nullptr != pActor) { - PhsXUserData* pTargetActorData = static_cast(pActor->userData); - PhsXUserData* pOwnerActorData = static_cast(pController->getActor()->userData); + PHYSX_USERDATA* pTargetActorData = static_cast(pActor->userData); + PHYSX_USERDATA* pOwnerActorData = static_cast(pController->getActor()->userData); if (nullptr == pTargetActorData) { // missing user data return; } @@ -106,8 +106,8 @@ void CCallBack_Ranrok_HitReport::onControllerHit(const PSX::PxControllersHit& hi ON_COLLISION_INFO CollisionDesc = {}; if (nullptr != pController && nullptr != pOtherController) { - PhsXUserData* pTargetActorData = static_cast(pActor->userData); - PhsXUserData* pOwnerActorData = static_cast(pController->getActor()->userData); + PHYSX_USERDATA* pTargetActorData = static_cast(pActor->userData); + PHYSX_USERDATA* pOwnerActorData = static_cast(pController->getActor()->userData); assert(nullptr != pTargetActorData); // missing user data switch (pTargetActorData->eKind) diff --git a/Jusin154_Team3D/Editor/Private/CamPosition_Socket.cpp b/Jusin154_Team3D/Editor/Private/CamPosition_Socket.cpp index 7fc1bd947..c0f063ba7 100644 --- a/Jusin154_Team3D/Editor/Private/CamPosition_Socket.cpp +++ b/Jusin154_Team3D/Editor/Private/CamPosition_Socket.cpp @@ -16,7 +16,7 @@ void CCamPosition_Socket::Priority_Update(_float fTimeDelta) { /*_matrix socketMatrix = {}; - socketMatrix = XMLoadFloat4x4(m_pSocketMatrices); + socketMatrix = XMLoadFloat4x4(m_pSocketMatrix); for (int i = 0; i < 3; ++i) { socketMatrix.r[i] = XMVector3Normalize(socketMatrix.r[i]); @@ -40,7 +40,7 @@ HRESULT CCamPosition_Socket::Initialize_Prototype() HRESULT CCamPosition_Socket::Initialize(void* pArg) { CAMERAPOSITION_PLAYER_DESC* pDesc = static_cast (pArg); - //m_pSocketMatrices = pDesc->pSocketMatrices; + //m_pSocketMatrix = pDesc->pSocketMatrix; if (FAILED(__super::Initialize(pArg))) { return E_FAIL; diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXDoorSet.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXDoorSet.cpp index f1c49cb69..4dc34dd71 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXDoorSet.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXDoorSet.cpp @@ -1,7 +1,6 @@ #include "pch.h" #include "Dummy_PhysXDoorSet.h" #include "Dummy_PhysXFixedDoor.h" -#include "Dummy_PhysXDoorFrame.h" #include "GameInstance.h" @@ -32,22 +31,41 @@ HRESULT CDummy_PhysXDoorSet::Initialize(void* pArg) if (FAILED(Ready_PartObject(pArg))) { return E_FAIL; } + PSX::PxRigidDynamic* doorRigidDynamicActor = m_pDoorPart->Get_Actor(); + PSX::PxTransform doorGlobalPose = doorRigidDynamicActor->getGlobalPose(); - PSX::PxTransform pxFrameTransform = {}; - PSX::PxTransform pxDoorTransform = {}; - PSX::PxRigidDynamic* pFrameBody = m_pFramePart->Get_Actor(); - PSX::PxRigidDynamic* pDoorBody = m_pDoorPart->Get_Actor(); + PSX::PxVec3 hingeLocalPositionInDoor = PSX::PxVec3(-1.5f, 0.0f, 0.0f); - _vector vPos = m_pTransformCom->Get_State(STATE::POSITION) + XMVectorSet(0.f, 1.f, 0.f, 0.f); - PSX::PxVec3 vHingeLocalPos = {}; - XMStoreFloat3((_float3*)&vHingeLocalPos, vPos); - pxFrameTransform.p = pFrameBody->getGlobalPose().transformInv(vHingeLocalPos); - pxDoorTransform.p = pDoorBody->getGlobalPose().transformInv(vHingeLocalPos); - - pxDoorTransform.q = pxFrameTransform.q = PSX::PxQuat(XM_PIDIV2, PSX::PxVec3(0.f, 0.f, 1.f)); + // 2) 힌지 월드 위치 = 도어 글로벌 포즈로 로컬 점 변환 + PSX::PxVec3 hingeWorldPosition = doorGlobalPose.transform(hingeLocalPositionInDoor); + + // 3) 힌지 회전축(월드 Y) + PSX::PxVec3 hingeWorldAxis = PSX::PxVec3(0.f, 1.f, 0.f); + + // 4) Revolute는 프레임 X축이 회전축이므로 X->힌지축 회전 + PSX::PxQuat jointWorldOrientation = PSX::PxShortestRotation(PSX::PxVec3(1.f, 0.f, 0.f), hingeWorldAxis); + + // 5) 월드 프레임 구성 + PSX::PxTransform jointWorldFrame = PSX::PxTransform(hingeWorldPosition, jointWorldOrientation); + + // 6) 도어 로컬 프레임(도어 기준) + PSX::PxTransform jointLocalFrameInDoor = doorGlobalPose.transformInv(jointWorldFrame); + + // 7) 조인트 생성 + m_pPSXJoint = (PSX::PxRevoluteJoint*)m_pGameInstance->Create_PxJoint( + PHYSX_JOINT::REVOLUTE, + doorRigidDynamicActor, + jointLocalFrameInDoor, + nullptr, + jointWorldFrame + ); + m_pPSXJoint->setRevoluteJointFlag(PSX::PxRevoluteJointFlag::eDRIVE_ENABLED, true); + m_pPSXJoint->setDriveVelocity(2.f); + m_pPSXJoint->setDriveForceLimit(5000.f); + //m_pPSXJoint->setLimit(PSX::PxJointAngularLimitPair(XMConvertToRadians(-70.f), XMConvertToRadians(70.f))); + //m_pPSXJoint->setRevoluteJointFlag(PSX::PxRevoluteJointFlag::eLIMIT_ENABLED, true); + //m_pPSXJoint->setRevoluteJointFlag(PSX::PxRevoluteJointFlag::eLIMIT_ENABLED, false); - m_pPSXJoint = m_pGameInstance->Create_PxRevoluteJoint(pFrameBody, pxFrameTransform, pDoorBody ,pxDoorTransform); - return S_OK; } @@ -89,15 +107,6 @@ HRESULT CDummy_PhysXDoorSet::Ready_Components(void* pArg) HRESULT CDummy_PhysXDoorSet::Ready_PartObject(void* pArg) { - { - CDummy_PhysXDoorFrame::PHYSXDUMMY_DESC Desc{}; - Desc.pParentTransform = m_pTransformCom; - Desc.vPos = { -10.f, 3.f, -10.f }; - Desc.iSubKind = 23; - if (FAILED(Add_PartObject("DoorFrame", g_iStaticLevel, &m_pFramePart, &Desc))) { - return E_FAIL; - } - } { CDummy_PhysXFixedDoor::PHYSXDUMMY_DESC Desc{}; Desc.pParentTransform = m_pTransformCom; @@ -146,7 +155,6 @@ void CDummy_PhysXDoorSet::Free() __super::Free(); SAFE_RELEASE(m_pDoorPart); - SAFE_RELEASE(m_pFramePart); } void CDummy_PhysXDoorSet::Describe_Entity() diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXFixedDoor.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXFixedDoor.cpp index 1eb6b7e93..d3fe15090 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXFixedDoor.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXFixedDoor.cpp @@ -45,21 +45,12 @@ void CDummy_PhysXFixedDoor::Update(_float fTimeDelta) void CDummy_PhysXFixedDoor::Late_Update(_float fTimeDelta) { - if (m_pGameInstance->IsIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) { - m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this); - } + m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this); } HRESULT CDummy_PhysXFixedDoor::Render() { _vector vRPY = m_pTransformCom->Get_RollPitchYawVector(); - - //GUI::Begin("FixedDoor"); - //m_pTransformCom->Describe_Entity(); - //GUI::Text("Current Roll : %f", XMConvertToDegrees(XMVectorGetX(vRPY))); - //GUI::Text("Current Pitch : %f", XMConvertToDegrees(XMVectorGetY(vRPY))); - //GUI::Text("Current Yaw : %f", XMConvertToDegrees(XMVectorGetZ(vRPY))); - //GUI::End(); #ifdef _DEBUG if (FAILED(m_pRigidBody->Render())) { return E_FAIL; @@ -89,7 +80,7 @@ HRESULT CDummy_PhysXFixedDoor::Ready_Components(void* pArg) { // RIGID_BODY CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; Desc.iSubKind = pPhysXDummyDesc->iSubKind; - if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_DOOR"), (CComponent**)&m_pRigidBody, &Desc))) { + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_FIXED_DOOR"), (CComponent**)&m_pRigidBody, &Desc))) { return E_FAIL; } } diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXFreeDoor.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXFreeDoor.cpp index 7e72f8f41..57c3c8343 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXFreeDoor.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXFreeDoor.cpp @@ -140,7 +140,7 @@ HRESULT CDummy_PhysXFreeDoor::Render() * (ScaleMatrix * RotationMatrix * TranslationWorld); // 그 후 SRT 적용 m_pTransformCom->Set_WorldMatrix(world); - m_pActor->setGlobalPose(XMWorldToPx_NoScale(world)); + m_pActor->setGlobalPose(XMWorldToPx_NoScaleNoFlip(world)); m_pActor->setAngularVelocity(PSX::PxVec3(0)); m_pActor->setLinearVelocity(PSX::PxVec3(0)); diff --git a/Jusin154_Team3D/Editor/Private/Effect_Container.cpp b/Jusin154_Team3D/Editor/Private/Effect_Container.cpp index 4e928fe72..796f6d80d 100644 --- a/Jusin154_Team3D/Editor/Private/Effect_Container.cpp +++ b/Jusin154_Team3D/Editor/Private/Effect_Container.cpp @@ -472,7 +472,7 @@ ON_COLLISION_INFO CEffect_Container::SweepTarget(_vector StartPos, _vector EndPo if (nullptr != pActor && nullptr != pActor->userData) { - PhsXUserData* pUserData = static_cast(pActor->userData); + PHYSX_USERDATA* pUserData = static_cast(pActor->userData); tagCollInfo.pObject = pUserData->pOwner; switch (pUserData->eKind) @@ -516,7 +516,7 @@ ON_COLLISION_INFO CEffect_Container::SweepTarget(_vector StartPos, _vector EndPo bHit = m_pGameInstance->SphereCast(fRadius, vStartPos, vDir, fDistance, PSX::PxHitFlag::ePOSITION | PSX::PxHitFlag::eNORMAL, PSX::PxQueryFlag::eSTATIC, pxBuffer); - PhsXUserData* pUserData = static_cast(pActor->userData); + PHYSX_USERDATA* pUserData = static_cast(pActor->userData); tagCollInfo.pObject = pUserData->pOwner; switch (pUserData->eKind) @@ -570,7 +570,7 @@ ON_COLLISION_INFO CEffect_Container::MonsterSweepTarget(_vector StartPos, _vecto if (nullptr != pActor && nullptr != pActor->userData) { - PhsXUserData* pUserData = static_cast(pActor->userData); + PHYSX_USERDATA* pUserData = static_cast(pActor->userData); tagCollInfo.pObject = pUserData->pOwner; switch (pUserData->eKind) @@ -624,7 +624,7 @@ ON_COLLISION_INFO CEffect_Container::MonsterSweepTarget(_vector StartPos, _vecto if (nullptr != pActor && nullptr != pActor->userData) { - PhsXUserData* pUserData = static_cast(pActor->userData); + PHYSX_USERDATA* pUserData = static_cast(pActor->userData); tagCollInfo.pObject = pUserData->pOwner; switch (PXOBJECT(pUserData->iSubKind)) @@ -678,7 +678,7 @@ ON_COLLISION_INFO CEffect_Container::MonsterRayCast(_vector StartPos, _vector _v if (nullptr != pActor && nullptr != pActor->userData) { - PhsXUserData* pUserData = static_cast(pActor->userData); + PHYSX_USERDATA* pUserData = static_cast(pActor->userData); tagCollInfo.pObject = pUserData->pOwner; switch (pUserData->eKind) @@ -738,7 +738,7 @@ _int CEffect_Container::CollisionCheck() if (nullptr != pActor && nullptr != pActor->userData) { - PhsXUserData* pUserData = static_cast(pActor->userData); + PHYSX_USERDATA* pUserData = static_cast(pActor->userData); if (pUserData->iSubKind >= UINT_MAX - 1) { continue; diff --git a/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp b/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp index aa5db8b3c..6f6680d83 100644 --- a/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp @@ -109,14 +109,14 @@ HRESULT CLevel_PhysXLab::Ready_Layer_PhysXObjects(const _wstring& strLayerTag) return E_FAIL; } } - //{ - // CDummy_PhysXDoorSet::PHYSXDUMMY_DESC Desc{}; - // Desc.vPos = { -15.f, 3.f, -15.f }; - // Desc.vRotRPY = { 0.f, m_pGameInstance->Random_Float(0.f, XM_2PI), 0.f }; - // if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE, &Desc))) { - // return E_FAIL; - // } - //} + { + CDummy_PhysXDoorSet::PHYSXDUMMY_DESC Desc{}; + Desc.vPos = { -15.f, 3.f, -15.f }; + Desc.vRotRPY = { 0.f, m_pGameInstance->Random_Float(0.f, XM_2PI), 0.f }; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE, &Desc))) { + return E_FAIL; + } + } { CDummy_PhysXPlatform::PHYSXDUMMY_DESC Desc{}; Desc.vPos = { -3.f, 2.f, 10.f }; @@ -181,6 +181,7 @@ HRESULT CLevel_PhysXLab::Ready_Layer_PhysXObjects(const _wstring& strLayerTag) // return E_FAIL; // } //} + return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index c5e806319..1279e1145 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -208,8 +208,8 @@ #include "Dummy_PhysXWall.h" #include "Dummy_PhysXEffectHitBox.h" //#include "Dummy_PhysXDoorFrame.h" -//#include "Dummy_PhysXFixedDoor.h" -//#include "Dummy_PhysXDoorSet.h" +#include "Dummy_PhysXFixedDoor.h" +#include "Dummy_PhysXDoorSet.h" #pragma endregion @@ -1956,19 +1956,19 @@ HRESULT CLoader::Loading_For_PhysXLevel() Desc.ePxRigidBodyFlags = { /*PSX::PxRigidBodyFlag::eKINEMATIC*/ }; Desc.ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE }; Desc.ePxMaterialTypes = { PXMATERIAL::DEFAULT }; - Desc.vMatInfo = { 0.5f, 0.5f, 0.6f }; + Desc.vMatInfo = { 0.5f, 0.5f, 0.1f }; Desc.fContactOffset = { 0.05f }; Desc.vhalfGeometryInfo = { 1.5f, 1.5f, 0.25f }; Desc.fDensity = 10.f; - PSX::PxTransform pxPivotTransform = PSX::PxTransform(PSX::PxVec3(1.5f, 1.5f, 0.f)); + PSX::PxTransform pxPivotTransform = PSX::PxTransform(PSX::PxVec3(1.5f, 0.75f, 0.125f)); Desc.pxMassCenter = pxPivotTransform; Desc.eLockFlag = { }; - Desc.vAutoDamping = { 10.f, 10.f }; + Desc.vAutoDamping = { 0.f, 0.2f }; Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f }; Desc.vLocalTranslation = { 0.f, 0.f, 0.f }; } - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_DOOR"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_FIXED_DOOR"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { return E_FAIL; } } @@ -2065,15 +2065,15 @@ HRESULT CLoader::Loading_For_PhysXLevel() if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_PhysXFreeDoor::Create(m_pDevice, m_pContext)))) { return E_FAIL; } - //if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_PhysXDoorSet::Create(m_pDevice, m_pContext)))) { - // return E_FAIL; - //} + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_PhysXDoorSet::Create(m_pDevice, m_pContext)))) { + return E_FAIL; + } //if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_PhysXDoorFrame::Create(m_pDevice, m_pContext)))) { // return E_FAIL; //} - //if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_PhysXFixedDoor::Create(m_pDevice, m_pContext)))) { - // return E_FAIL; - //} + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_PhysXFixedDoor::Create(m_pDevice, m_pContext)))) { + return E_FAIL; + } if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_PhysXPlayable::Create(m_pDevice, m_pContext)))) { return E_FAIL; } @@ -2384,11 +2384,10 @@ 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())))) { + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_GoblinSpector_Anim_Model"), + CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM_LOCAL, "C:/MeshTable\\Game\\RiggedObjects\\Props\\Weapons\\Goblins\\SK_WPN_GOB_SmallSword.fbx", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) return E_FAIL; - } + #pragma region MONSTER @@ -2402,10 +2401,19 @@ HRESULT CLoader::Loading_For_ObjectViewer() TEXT("Prototype_Component_GoblinMage_Model") )); - if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_GoblinSpector_Anim_Model"), - CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Monster/GoblinSpector/GoblinSpector_Anim.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) + futures.emplace_back(Deferred_ModelLoad( + MODEL::PBR_ANIM, "../Bin/Resources/Models/Monster/Goblin_Assassin/SK_GOB_M_Assassin_Master.bin", XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity(), + TEXT("Prototype_Component_SK_GOB_M_Assassin_Master_Model") + )); + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_GoblinSpector_Model"), + CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Monster/GoblinSpector/GoblinSpector.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) return E_FAIL; + //if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Playable_Model"), + // CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable.bin", XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) + // return E_FAIL; + futures.emplace_back(Deferred_ModelLoad( MODEL::ANIM, "../Bin/Resources/Models/Monster/TombProtector/TombProtector.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixIdentity(), TEXT("Prototype_Component_TombProtector_Model") @@ -2494,6 +2502,15 @@ HRESULT CLoader::Loading_For_ObjectViewer() TEXT("Prototype_Component_Playable_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(), // TEXT("Prototype_Component_Student_Cmbt_Model") @@ -2535,7 +2552,7 @@ HRESULT CLoader::Loading_For_ObjectViewer() //)); //futures.emplace_back(Deferred_ModelLoad( - // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_AvadaKedavran.fbx", XMMatrixIdentity(), + // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_AvadaKedavra.fbx", XMMatrixIdentity(), // TEXT("Prototype_Component_Student_Cmbt_Model") //)); diff --git a/Jusin154_Team3D/Editor/Private/MapElement_Chest.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Chest.cpp index f738d0e23..4277a92c1 100644 --- a/Jusin154_Team3D/Editor/Private/MapElement_Chest.cpp +++ b/Jusin154_Team3D/Editor/Private/MapElement_Chest.cpp @@ -60,7 +60,7 @@ HRESULT CMapElement_Chest::Initialize(void* pArg) m_pActor = static_cast(m_pRigidBody->Get_Actor()); static_cast(m_pRigidBody)->Set_HalfGeometryInfo(pDesc->vBoxSize); - static_cast(m_pRigidBody)->Move_LocalPos(_float4(0.f, 0.f, 0.f, 0.f), pDesc->vBoxLocalPosition); + static_cast(m_pRigidBody)->Move_LocalPos(XMVectorSet(0.f, 0.f, 0.f, 1.f), XMLoadFloat3(&pDesc->vBoxLocalPosition)); return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp index 89277aade..5dff6347c 100644 --- a/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp +++ b/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp @@ -54,7 +54,7 @@ HRESULT CMapElement_Interactable::Initialize(void* pArg) m_pActor = static_cast(m_pRigidBody->Get_Actor()); static_cast(m_pRigidBody)->Set_HalfGeometryInfo(pDesc->vBoxSize); - static_cast(m_pRigidBody)->Move_LocalPos(_float4(0.f, 0.f, 0.f, 0.f), pDesc->vBoxLocalPosition); + static_cast(m_pRigidBody)->Move_LocalPos(XMVectorSet(0.f, 0.f, 0.f, 1.f), XMLoadFloat3(&pDesc->vBoxLocalPosition)); return S_OK; } diff --git a/Jusin154_Team3D/Editor/Public/Dummy_PhysXDoorSet.h b/Jusin154_Team3D/Editor/Public/Dummy_PhysXDoorSet.h index a707c20eb..085077006 100644 --- a/Jusin154_Team3D/Editor/Public/Dummy_PhysXDoorSet.h +++ b/Jusin154_Team3D/Editor/Public/Dummy_PhysXDoorSet.h @@ -33,7 +33,6 @@ class CDummy_PhysXDoorSet final : public CContainerObject private: class CDummy_PhysXFixedDoor* m_pDoorPart = { nullptr }; - class CDummy_PhysXDoorFrame* m_pFramePart = { nullptr }; PSX::PxRevoluteJoint* m_pPSXJoint = { nullptr }; _float3 m_vRadianYAngle = {}; diff --git a/Jusin154_Team3D/Editor/Public/Level_EffectViewer.h b/Jusin154_Team3D/Editor/Public/Level_EffectViewer.h index 612bd22ac..7e411a32e 100644 --- a/Jusin154_Team3D/Editor/Public/Level_EffectViewer.h +++ b/Jusin154_Team3D/Editor/Public/Level_EffectViewer.h @@ -25,7 +25,7 @@ class CLevel_EffectViewer final : public CLevel HRESULT Ready_Layer_PhysX(const _wstring& strLayerTag); HRESULT Ready_Layer_BackGround(const _wstring& strLayerTag); - PhsXUserData m_PlaneData = {}; + PHYSX_USERDATA m_PlaneData = {}; class CInfoInstance* m_pInfoInstance = { nullptr }; public: static CLevel_EffectViewer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID); diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl index d81caa548..3d233fe57 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl @@ -25,6 +25,7 @@ StructuredBuffer g_PrevChannelBuffer : register(t3); StructuredBuffer g_ParentBuffer : register(t4); StructuredBuffer g_BoneLocalBuffer : register(t5); StructuredBuffer g_BoneRemap : register(t6); +StructuredBuffer g_SkipBone : register(t7); RWStructuredBuffer g_LocalMatrixOut : register(u0); @@ -46,8 +47,13 @@ cbuffer AnimCB : register(b0) int HeadBoneIndex; float HeadAimWeight; + int SkipCount; + int _pad0; + int _pad1; + int _pad2; + float3 TargetDir_Local; - float padding; + float padding3; row_major float4x4 PreTransformMatrix; float4 RootInitRot; @@ -356,8 +362,22 @@ row_major float4x4 SampleBlendedLocal(uint bone) void CS_LOCAL(uint3 DTid : SV_DispatchThreadID) { uint bone = DTid.x; + if (bone >= BoneCount) return; + + if (SkipCount != 0) + { + for (int i = 0; i < SkipCount; i++) + { + if (bone == g_SkipBone[i]) + { + g_LocalMatrixOut[bone] = g_BoneLocalBuffer[bone].BoneLocal; + return; + } + } + } + g_LocalMatrixOut[bone] = SampleBlendedLocal(bone); } diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl index 6b87a5ef5..6e54e5656 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl @@ -27,10 +27,14 @@ cbuffer AnimCB : register(b0) int PlayHeadBone; int HeadBoneIndex; float HeadAimWeight; - + + int SkipCount; + int _pad0; + int _pad1; + int _pad2; float3 TargetDir_Local; - float padding; + float padding3; row_major float4x4 PreTransformMatrix; float4 RootInitRot; diff --git a/Jusin154_Team3D/Engine/Default/Engine.vcxproj b/Jusin154_Team3D/Engine/Default/Engine.vcxproj index 1d215d3c5..7f862f739 100644 --- a/Jusin154_Team3D/Engine/Default/Engine.vcxproj +++ b/Jusin154_Team3D/Engine/Default/Engine.vcxproj @@ -113,7 +113,7 @@ ENGINE_EXPORTS;IMGUI_EXPORTS;TINYXML2_EXPORT;EDITOR_PROJECT;$(USERNAME);_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) true stdcpp17 - ../Public/;%(AdditionalIncludeDirectories) + ../Public/;../Public/PhysX/;%(AdditionalIncludeDirectories) true true Use @@ -151,7 +151,7 @@ call Update_Lib.bat ENGINE_EXPORTS;IMGUI_EXPORTS;TINYXML2_EXPORT;$(USERNAME);NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) true stdcpp17 - ../Public/;%(AdditionalIncludeDirectories) + ../Public/;../Public/PhysX/;%(AdditionalIncludeDirectories) true true Use @@ -208,6 +208,7 @@ call Update_Lib.bat + @@ -218,10 +219,6 @@ call Update_Lib.bat - - true - true - @@ -426,6 +423,7 @@ call Update_Lib.bat + @@ -436,10 +434,6 @@ call Update_Lib.bat - - true - true - diff --git a/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters b/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters index f09c9f9a1..fd08bd1c2 100644 --- a/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters +++ b/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters @@ -292,9 +292,6 @@ {7c82051e-19af-4284-8156-16f504db30b6} - - {bba1e91b-87a8-4a7b-8e4e-b42d2041d8eb} - {7eab7292-025e-40d7-aa71-73e7a3c71ea7} @@ -316,6 +313,9 @@ {950977f0-f3c9-42f1-83f1-270b4bebf7ef} + + {bba1e91b-87a8-4a7b-8e4e-b42d2041d8eb} + @@ -546,9 +546,6 @@ 02.Element\02.Component\02.VIBuffer\Instance - - 02.Element\02.Component\07.RigidBody\20.Joint - 02.Element\02.Component\02.VIBuffer\Trail @@ -577,7 +574,7 @@ 03.Management\02.Resource_Manager - 03.Management\04. Font_Manager + 03.Management\04.Font_Manager 02.Element\01.GameObject\01. Font @@ -603,6 +600,9 @@ 01.Utility\08.Volumetric + + 02.Element\02.Component\07.RigidBody\20.Joint + @@ -1196,9 +1196,6 @@ 02.Element\02.Component\02.VIBuffer\Instance - - 02.Element\02.Component\07.RigidBody\20.Joint - 02.Element\02.Component\02.VIBuffer\Trail @@ -1230,7 +1227,7 @@ 03.Management\02.Resource_Manager - 03.Management\04. Font_Manager + 03.Management\04.Font_Manager 02.Element\01.GameObject\01. Font @@ -1256,6 +1253,9 @@ 01.Utility\08.Volumetric + + 02.Element\02.Component\07.RigidBody\20.Joint + 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/Character_Controller.cpp b/Jusin154_Team3D/Engine/Private/Character_Controller.cpp index a618ddade..e5d350063 100644 --- a/Jusin154_Team3D/Engine/Private/Character_Controller.cpp +++ b/Jusin154_Team3D/Engine/Private/Character_Controller.cpp @@ -3,7 +3,7 @@ #include "GameInstance.h" #include "GameObject.h" -CPhysX_CctQueryFilterCallback CCharacter_Controller::s_QueryFilterCallback_IGNORE_Shield = {}; +CPhysX_CctQueryFilterCallback CCharacter_Controller::s_QueryFilterCallback_IGNORE_GLOBAL = {}; CCharacter_Controller::CCharacter_Controller(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) : CComponent{ pDevice, pContext } @@ -214,7 +214,7 @@ _bool CCharacter_Controller::UpdateGroundByCast(_float fTimeDelta) PSX::PxRigidActor* hitActor = sweepHit.actor; - PhsXUserData* hitUserData = static_cast(hitActor->userData); + PHYSX_USERDATA* hitUserData = static_cast(hitActor->userData); switch (PXOBJECT(hitUserData->iSubKind)) { @@ -262,7 +262,7 @@ void CCharacter_Controller::Move(_float fTimeDelta) PSX::PxVec3 pxVecMomentum = {}; // 순간 이동량 _float fMinimumDistant = FLT_EPSILON3; // 이동량 오차 허용치, ( 크면 클수록 이동이 더 일찍 끝난다, 순간 이동량보다 같거나 더 크면 안움직일듯? ) PSX::PxControllerFilters pxFilter = {}; // 충돌 대상 필터 - pxFilter.mFilterCallback = &s_QueryFilterCallback_IGNORE_Shield; // 쉴드 무시 + pxFilter.mFilterCallback = &s_QueryFilterCallback_IGNORE_GLOBAL; // 쉴드 무시 const PSX::PxObstacleContext* pPxObstacles = { nullptr }; // 캐릭터가 충돌해야할 추가적인 장애물 객체?, 닿은 장애물은 캐시된다? if (true == m_bGravity) { if (0 >= m_iIsOnGround) { // 공중: 무조건 중력 @@ -323,7 +323,7 @@ HRESULT CCharacter_Controller::Initialize(void* pArg) m_pTransform = pDesc->pTransform; m_fWalkableSlopeDegree = pDesc->fWalkableSlope; } - { // PhsXUserData + { // PHYSX_USERDATA m_tagData.eKind = PHYSX_KIND::CCTActor; m_tagData.pOwner = m_pOwner; XMStoreFloat4x4(&m_tagData.BeforeMatrix, m_pTransform->Get_XMWorldMatrix()); @@ -347,7 +347,6 @@ HRESULT CCharacter_Controller::Initialize(void* pArg) Desc.material = m_pGameInstance->Create_Material(&pDesc->fMaterial); m_pController = m_pGameInstance->Add_BoxController(Desc); m_pController->setUserData(&m_tagData); - m_pController->getActor()->userData = &m_tagData; } break; case ACTOR::CAPSULE: { @@ -363,14 +362,16 @@ HRESULT CCharacter_Controller::Initialize(void* pArg) Desc.material = m_pGameInstance->Create_Material(&pDesc->fMaterial); m_pController = m_pGameInstance->Add_CapsuleController(Desc); m_pController->setUserData(&m_tagData); - m_pController->getActor()->userData = &m_tagData; } break; default: assert(false); // PhysX에서 불가능 return E_FAIL; break; } - + + PSX::PxRigidDynamic* pActor = m_pController->getActor(); + pActor->userData = &m_tagData; + m_pGameInstance->ApplyFilterData(pActor); m_pController->setStepOffset(pDesc->fStepOffset); if (nullptr == m_pController) { diff --git a/Jusin154_Team3D/Engine/Private/Dynamic_D6Joint.cpp b/Jusin154_Team3D/Engine/Private/Dynamic_D6Joint.cpp new file mode 100644 index 000000000..3d27eb965 --- /dev/null +++ b/Jusin154_Team3D/Engine/Private/Dynamic_D6Joint.cpp @@ -0,0 +1,86 @@ +#include "pch.h" +#include "Dynamic_D6Joint.h" +#include "GameInstance.h" + +CDynamic_D6Joint::CDynamic_D6Joint(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CComponent(pDevice, pContext) +{ +} + +CDynamic_D6Joint::CDynamic_D6Joint(const CDynamic_D6Joint& rhs) + : CComponent(rhs) +{ +} + +HRESULT CDynamic_D6Joint::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CDynamic_D6Joint::Initialize(void* pArg) +{ + DYNAMICJOINT_DESC* pDesc = static_cast(pArg); + m_pJoint = m_pGameInstance->Create_PxD6Joint(pDesc->pActor0, pDesc->pActor1, *pDesc->pxJointWorldPos); + return S_OK; +} +#ifdef _DEBUG + +HRESULT CDynamic_D6Joint::Add_DebugShape() +{ + if (nullptr != m_pMainShape){ + m_pMainShape.reset(); + } + m_pMainShape = (GeometricPrimitive::CreateSphere(m_pContext, 0.05f, 10, false, false)); + + return S_OK; +} +HRESULT CDynamic_D6Joint::Render() +{ + //PSX::PxTransform pxTranform = m_pRigidBody->getGlobalPose(); + //_matrix WorldMatrix = XMMatrixTranslation(m_vLocalTranslation.x, m_vLocalTranslation.y, m_vLocalTranslation.z) * XMMatrixAffineTransformation(XMVectorSet(1.f, 1.f, 1.f, 0.f), XMVectorZero(), XMLoadFloat4((_float4*)&pxTranform.q), XMVectorSetW(XMLoadFloat3((_float3*)&pxTranform.p), 1.f)); + //_matrix ViewMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW); + //_matrix ProjMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ); + //_vector vColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0x2fc48000, 1.f); + + //m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true); + return S_OK; +} + +#endif // _DEBUG + + +CDynamic_D6Joint* CDynamic_D6Joint::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CDynamic_D6Joint* pInstance = new CDynamic_D6Joint(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) { + MSG_BOX("CDynamic_D6Joint Prototype Created Failed"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CComponent* CDynamic_D6Joint::Clone(void* pArg, CGameObject* pOwner) +{ + CDynamic_D6Joint* pInstance = new CDynamic_D6Joint(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) { + MSG_BOX("CDynamic_D6Joint Prototype Created Failed"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CDynamic_D6Joint::Free() +{ + __super::Free(); +} +#ifdef _DEBUG + +void CDynamic_D6Joint::Describe_Entity() +{ +} + +#endif // _DEBUG diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp index 3b7e82526..d6d82f0ac 100644 --- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp +++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp @@ -1017,9 +1017,13 @@ PSX::PxRigidStatic* CGameInstance::Add_StaticActor(CRigidBody_Static& RigidBody, { return m_pPhysX_Manager->Add_StaticActor(RigidBody, iLevel); } -PSX::PxRevoluteJoint* CGameInstance::Create_PxRevoluteJoint(PSX::PxRigidActor* pActorFrame, PSX::PxTransform& pxLocalWallFrame, PSX::PxRigidActor* pActorObject, PSX::PxTransform& pxLocalActorFrame, _uint iLevel) +PSX::PxJoint* CGameInstance::Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1) { - return m_pPhysX_Manager->Create_PxRevoluteJoint(pActorFrame, pxLocalWallFrame, pActorObject, pxLocalActorFrame, iLevel); + return m_pPhysX_Manager->Create_PxJoint(eType, pActor0, pxLocalFrame0, pActor1, pxLocalFrame1); +} +PSX::PxD6Joint* CGameInstance::Create_PxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos) +{ + return m_pPhysX_Manager->Create_PxD6Joint(pActor0, pActor1, pxJointWorldPos); } _bool CGameInstance::SphereCast(_float fRadius, _float3 vStartPos, _float3 vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer) { @@ -1065,6 +1069,10 @@ void CGameInstance::Release_Actor(PSX::PxActor& Actor) { m_pPhysX_Manager->Release_Actor(Actor); } +void CGameInstance::ApplyFilterData(PSX::PxRigidActor* pRigidActor) +{ + m_pPhysX_Manager->ApplyFilterData(pRigidActor); +} HRESULT CGameInstance::ConvertToTriMeshes(vector& Meshes, vector& pxTriMeshes, _fmatrix WorldMatrix) { return m_pPhysX_Manager->ConvertToTriMeshes(Meshes, pxTriMeshes, WorldMatrix); @@ -1074,7 +1082,7 @@ HRESULT CGameInstance::SaveTriMeshes(const _char* pPath, vectorSaveTriMeshes(pPath, TriMeshes); } -void CGameInstance::Add_Editor_Plane(PhsXUserData& PlaneData) +void CGameInstance::Add_Editor_Plane(PHYSX_USERDATA& PlaneData) { m_pPhysX_Manager->Add_Editor_Plane(PlaneData); } diff --git a/Jusin154_Team3D/Engine/Private/Material.cpp b/Jusin154_Team3D/Engine/Private/Material.cpp index f02b8bd22..f432e661c 100644 --- a/Jusin154_Team3D/Engine/Private/Material.cpp +++ b/Jusin154_Team3D/Engine/Private/Material.cpp @@ -691,6 +691,8 @@ HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType return S_OK; else if (!strcmp(FileType.c_str(), "Ground MRO/SRO")) return S_OK; + else if (!strcmp(FileType.c_str(), "Corruption Mask")) + return S_OK; else if (!strcmp(FileType.c_str(), "Rock_Texture")) { eTexture = aiTextureType::aiTextureType_DIFFUSE; } diff --git a/Jusin154_Team3D/Engine/Private/Mesh.cpp b/Jusin154_Team3D/Engine/Private/Mesh.cpp index d4db9762a..8b5a1b518 100644 --- a/Jusin154_Team3D/Engine/Private/Mesh.cpp +++ b/Jusin154_Team3D/Engine/Private/Mesh.cpp @@ -422,6 +422,7 @@ HRESULT CMesh::Ready_VertexBuffer_For_Anim(const CModel* pModel, SaveMesh* _Save HRESULT CMesh::Create_BoneRemapBuffer() { + D3D11_BUFFER_DESC desc{}; desc.Usage = D3D11_USAGE_DEFAULT; desc.ByteWidth = sizeof(_uint) * (_uint)m_BoneRemap.size(); diff --git a/Jusin154_Team3D/Engine/Private/Model.cpp b/Jusin154_Team3D/Engine/Private/Model.cpp index 1362df56a..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,6 +594,20 @@ const _float4x4* CModel::Get_BoneMatrixPtr(const _char* pBoneName) return m_Bones[boneIdx]->Get_CombinedTransformationMatrixPtr(); } +_matrix CModel::Get_BoneMatrix(const _char* pBoneName) +{ + _int boneIdx = Get_BoneIndex(pBoneName); + + if (boneIdx < 0) + return XMMatrixIdentity(); + + Mark_CPUChain(boneIdx); + + Apply_CPUMask_ToBones(); + + return m_Bones[boneIdx]->Get_CombinedTransformationMatrix(); +} + _matrix CModel::Get_BoneMatrix(const _char* pBoneName) const { vector::const_iterator iter = find_if(m_Bones.begin(), m_Bones.end(), [&](CBone* pBone)->_bool @@ -564,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 @@ -597,6 +668,18 @@ void CModel::Combined_BoneMatrix() } } +void CModel::Combined_BoneMatrix(_int iStartBoneIndex, _uint iBoneCount) +{ + if (iStartBoneIndex < 0) { + return; + } + _matrix IdenMatrix = XMMatrixIdentity(); + _uint iEndIndex = (_uint)iStartBoneIndex + iBoneCount; + for (_uint i = iStartBoneIndex; i < iEndIndex; ++i) { + m_Bones[i]->Update_CombinedTransformationMatrix(m_Bones, IdenMatrix); + } +} + _int CModel::Find_BoneIndex(const _char* pBoneName) { if (pBoneName == nullptr) @@ -611,6 +694,16 @@ _int CModel::Find_BoneIndex(const _char* pBoneName) return -1; } +HRESULT CModel::Set_BoneCombinedTransformation(const _char* pBoneName, _fmatrix newTransformation) +{ + _int iBoneIndex = Find_BoneIndex(pBoneName); + if (iBoneIndex < 0) { + return E_FAIL; + } + m_Bones[iBoneIndex]->Set_CombinedTransformationMatrix(newTransformation); + return S_OK; +} + void CModel::Set_CurrentTrackPosition(_float TrackPosition) { @@ -1345,6 +1438,10 @@ void CModel::InItialize_BoneIndex() { m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HEAD)] = i; } + if (m_Bones[i]->Compare_Name("Hips_Cloth")) + { + m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)] = i; + } } } @@ -1377,6 +1474,19 @@ void CModel::Initialize_BoneMasks() BuildMask(m_iBoneIndex[ENUM_CLASS(BLEND_BONE::SHOULDER_L)], m_BoneMask[ENUM_CLASS(BLEND_BONE::SHOULDER_L)]); BuildMask(m_iBoneIndex[ENUM_CLASS(BLEND_BONE::SHOULDER_R)], m_BoneMask[ENUM_CLASS(BLEND_BONE::SHOULDER_R)]); BuildMask(m_iBoneIndex[ENUM_CLASS(BLEND_BONE::NECK)], m_BoneMask[ENUM_CLASS(BLEND_BONE::NECK)]); + BuildMask(m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)], m_BoneMask[ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)]); + + if (m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)] != -1) + { + for (_uint i = 0; i < (_uint)m_BoneMask[ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)].size(); i++) + { + if (m_BoneMask[ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)][i] == 1) + { + m_iSkipBoneCount++; + m_SkipBoneindex.push_back(i); + } + } + } for (_uint i = 0; i < m_Bones.size(); i++) { @@ -1425,9 +1535,10 @@ HRESULT CModel::Create_ComputeShaderLocal() sizeof(CHANNEL_DESC), // 채널 sizeof(KEYFRAME_DESC), // 이전애님 키프레임 sizeof(CHANNEL_DESC), // 이전애님 채널 - sizeof(int), // 부모 인덱스 + sizeof(_int), // 부모 인덱스 sizeof(_float4x4), // 로컬좌표 - sizeof(_uint) + sizeof(_uint), + sizeof(_int) //스킵본 인덱스 }; _uint CS_OutputStrides[] = { @@ -1437,7 +1548,7 @@ HRESULT CModel::Create_ComputeShaderLocal() CComputeShader::CS_INFO CS_Desc = {}; CS_Desc.iNumElement = (_uint)m_Bones.size(); - CS_Desc.iNumInputBuffer = 7; + CS_Desc.iNumInputBuffer = 8; CS_Desc.iNumOutputBuffer = 1; CS_Desc.iInputStructStride = CS_InputStrides; @@ -1497,6 +1608,33 @@ HRESULT CModel::Create_BoneLocalVB() return S_OK; } +HRESULT CModel::Create_SkipBoneVB() +{ + D3D11_BUFFER_DESC desc{}; + desc.Usage = D3D11_USAGE_DEFAULT; + desc.ByteWidth = sizeof(_int) * (_uint)m_Bones.size(); + desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; + desc.CPUAccessFlags = 0; + desc.StructureByteStride = sizeof(_int); + desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED; + + D3D11_SUBRESOURCE_DATA init{}; + init.pSysMem = m_SkipBoneindex.data(); + + m_pDevice->CreateBuffer(&desc, &init, &m_pSkipBoneBuffer); + + D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {}; + srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER; + srvDesc.Format = DXGI_FORMAT_UNKNOWN; + srvDesc.Buffer.FirstElement = 0; + srvDesc.Buffer.NumElements = (_uint)m_Bones.size(); + + if (FAILED(m_pDevice->CreateShaderResourceView(m_pSkipBoneBuffer, &srvDesc, &m_pSkipBoneSRV))) + return E_FAIL; + + return S_OK; +} + HRESULT CModel::Create_BoneMatrixVB() { _uint iCount = (_uint)m_Bones.size(); @@ -1703,30 +1841,40 @@ void CModel::ComputeLocal(_uint AnimIndex, _uint MeshIndex) pDesc->Duration = anim->Get_Duration(); pDesc->MeshBoneCount = m_Meshes[MeshIndex]->Get_NumBone(); pDesc->BoneCount = (_uint)m_Bones.size(); + pDesc->CurrentAnimIndex = m_iCurrentAnimIndex; pDesc->PrevAnimIndex = m_iPreAnimIndex; pDesc->PrevTime = m_Animations[m_iPreAnimIndex]->Get_CurrentTrackPosition(); pDesc->BlendRatio = m_fRatio; + pDesc->RootBoneIndex = m_iRootBoneIndex; pDesc->PlayHeadBone = m_bHeadBone; pDesc->HeadBoneIndex = m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HEAD)]; pDesc->HeadAimWeight = m_fHeadAimWeight; + + pDesc->SkipCount = m_iSkipBoneCount; + pDesc->padding0 = 0; + pDesc->padding1 = 0; + pDesc->padding2 = 0; + if (m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HEAD)] != -1) { _vector dirWS = XMVector3Normalize(m_vTargetPos - m_pTransform->Get_State(STATE::POSITION)); _matrix worldInv = m_pTransform->Get_WorldMatrixInv(); - _vector dirLocal =XMVector3Normalize(XMVector3TransformNormal(dirWS, worldInv)); + _vector dirLocal = XMVector3Normalize(XMVector3TransformNormal(dirWS, worldInv)); XMStoreFloat3(&pDesc->TargetDir_Local, dirLocal); } else { pDesc->TargetDir_Local = _float3(0.f, 0.f, 0.f); } - pDesc->padding = 0.f; + pDesc->padding3 = 0.f; + pDesc->PreTransformMatrix = m_PreTransformMatrix; pDesc->RootInitRot = m_vInitialRootRot; + m_pContext->Unmap(m_pConstantBuffer, 0); } @@ -1744,7 +1892,8 @@ void CModel::ComputeLocal(_uint AnimIndex, _uint MeshIndex) m_Animations[m_iPreAnimIndex]->Get_ChannelBuffer(), m_pParentBuffer, m_pBoneLocalBuffer, - m_Meshes[MeshIndex]->Get_BoneRemapBuffer() + m_Meshes[MeshIndex]->Get_BoneRemapBuffer(), + m_pSkipBoneBuffer }; ID3D11ShaderResourceView* srvs[] = @@ -1755,7 +1904,8 @@ void CModel::ComputeLocal(_uint AnimIndex, _uint MeshIndex) m_Animations[m_iPreAnimIndex]->Get_ChannelSrv(), m_pParentSRV, m_pBoneLocalSRV, - m_Meshes[MeshIndex]->Get_BoneRemapSRV() + m_Meshes[MeshIndex]->Get_BoneRemapSRV(), + m_pSkipBoneSRV }; ID3D11UnorderedAccessView* uavs[] = @@ -1768,7 +1918,7 @@ void CModel::ComputeLocal(_uint AnimIndex, _uint MeshIndex) 0, _float3((_float)iGroupCountX, 1.f, 1.f), srvs, - 7, + 8, uavs, 1, m_pConstantBuffer @@ -1778,9 +1928,9 @@ void CModel::ComputeLocal(_uint AnimIndex, _uint MeshIndex) UINT counts[1] = { 0 }; m_pContext->CSSetUnorderedAccessViews(0, 1, nullUAV, counts); - ID3D11ShaderResourceView* nullSRV[7] = { nullptr }; + ID3D11ShaderResourceView* nullSRV[8] = { nullptr }; - m_pContext->CSSetShaderResources(0, 7, nullSRV); + m_pContext->CSSetShaderResources(0, 8, nullSRV); } @@ -2254,6 +2404,7 @@ HRESULT CModel::Initialize(void* pArg) Create_BoneMatrixVB(); Create_ParentVB(); Create_BoneLocalVB(); + Create_SkipBoneVB(); Create_ParentSrv(); Create_BoneLocalSrv(); @@ -2272,10 +2423,10 @@ HRESULT CModel::Initialize(void* pArg) break; } } - if (-1 == m_iIndexAnimPlayableMesh) { + /* if (-1 == m_iIndexAnimPlayableMesh) { assert(false); - } + }*/ } @@ -2390,11 +2541,13 @@ void CModel::Free() SAFE_RELEASE(m_pBoneLocalBuffer); SAFE_RELEASE(m_pBoneMatrixBuffer); SAFE_RELEASE(m_pPrevBoneMatrixBuffer); + SAFE_RELEASE(m_pSkipBoneBuffer); SAFE_RELEASE(m_pLocalMatrixBuffer); SAFE_RELEASE(m_pParentSRV); SAFE_RELEASE(m_pBoneLocalSRV); SAFE_RELEASE(m_pBoneMatrixSRV); SAFE_RELEASE(m_pPrevBoneMatrixSRV); + SAFE_RELEASE(m_pSkipBoneSRV); SAFE_RELEASE(m_pBoneMatrixUAV); SAFE_RELEASE(m_pLocalMatrixSRV); SAFE_RELEASE(m_pLocalMatrixUAV); diff --git a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp index 37cc85f7d..55b6d05d5 100644 --- a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp @@ -19,7 +19,7 @@ CPhysX_Manager::CPhysX_Manager(ID3D11Device* pDevice, ID3D11DeviceContext* pCont PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody_Dynamic& RigidBody, _uint iLevel) { _matrix WorldMatrix = RigidBody.Get_TransformPtr()->Get_XMWorldMatrix(); - PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScale(WorldMatrix); + PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScaleNoFlip(WorldMatrix); // PxRigidDynamic 씬의 동적 바디 인터페이스 PSX::PxRigidDynamic* pActorDynamic = m_pPhysics->createRigidDynamic(pxWorldMatrix); @@ -36,6 +36,7 @@ PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody_Dynamic& RigidB case ACTOR::CAPSULE: geoHolder = PSX::PxCapsuleGeometry(vVolume.x, vVolume.y); pShape = PSX::PxRigidActorExt::createExclusiveShape(*pActorDynamic, geoHolder.capsule(), *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]); + FixCapsuleShapeAxisToY(pShape); break; case ACTOR::SPHERE: geoHolder = PSX::PxSphereGeometry(vVolume.x); @@ -59,6 +60,8 @@ PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody_Dynamic& RigidB PSX::PxRigidBodyExt::updateMassAndInertia(*pActorDynamic, (PSX::PxReal)RigidBody.Get_Density()); m_pRestBodies[iLevel].insert(pActorDynamic); + pActorDynamic->userData = RigidBody.Get_UserDataPtr(); + ApplyFilterData(pActorDynamic); Attach_Actor(*pActorDynamic, iLevel); return pActorDynamic; @@ -67,11 +70,11 @@ PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody_Dynamic& RigidB PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel) { _matrix WorldMatrix = RigidBody.Get_TransformPtr()->Get_XMWorldMatrix(); - PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScale(WorldMatrix); + PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScaleNoFlip(WorldMatrix); // PxRigidStatic 씬의 정적 바디 인터페이스 - PSX::PxRigidStatic* pActor = m_pPhysics->createRigidStatic(pxWorldMatrix); + PSX::PxRigidStatic* pActorStatic = m_pPhysics->createRigidStatic(pxWorldMatrix); PSX::PxShape* pShape = { nullptr }; PSX::PxGeometry* pGeometry = { nullptr }; @@ -130,24 +133,83 @@ PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody break; } - pShape = PSX::PxRigidActorExt::createExclusiveShape(*pActor, *pGeometry, *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]); + pShape = PSX::PxRigidActorExt::createExclusiveShape(*pActorStatic, *pGeometry, *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]); pShape->setFlags(RigidBody.Get_ShapeFlags()); pShape->setContactOffset(RigidBody.Get_ContactOffset()); pShape->setRestOffset(0.f); - m_pRestBodies[iLevel].insert(pActor); - Attach_Actor(*pActor, iLevel); + m_pRestBodies[iLevel].insert(pActorStatic); + ApplyFilterData(pActorStatic); + Attach_Actor(*pActorStatic, iLevel); - return pActor; + return pActorStatic; } -PSX::PxRevoluteJoint* CPhysX_Manager::Create_PxRevoluteJoint(PSX::PxRigidActor* pActorFrame, PSX::PxTransform& pxLocalWallFrame, PSX::PxRigidActor* pActorObject, PSX::PxTransform& pxLocalActorFrame, _uint iLevel) +PSX::PxJoint* CPhysX_Manager::Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1) { - PSX::PxRevoluteJoint* pJoint = PSX::PxRevoluteJointCreate(*m_pPhysics, pActorFrame, pxLocalWallFrame, pActorObject, pxLocalActorFrame); + PSX::PxJoint* pOut = { nullptr }; + switch (eType) + { + case PHYSX_JOINT::D6: + { + PSX::PxD6Joint* pJoint = PSX::PxD6JointCreate(*m_pPhysics, pActor0, pxLocalFrame0, pActor1, pxLocalFrame1); + pOut = pJoint; + } + break; + case PHYSX_JOINT::DISTANCE: + { + PSX::PxDistanceJoint* pJoint = PSX::PxDistanceJointCreate(*m_pPhysics, pActor0, pxLocalFrame0, pActor1, pxLocalFrame1); + pOut = pJoint; + } + break; + case PHYSX_JOINT::REVOLUTE: + { + PSX::PxRevoluteJoint* pJoint = PSX::PxRevoluteJointCreate(*m_pPhysics, pActor0, pxLocalFrame0, pActor1, pxLocalFrame1); + pOut = pJoint; + } + break; + default: + break; + } + assert(nullptr != pOut); - assert(nullptr != pJoint); + return pOut; +} +PSX::PxD6Joint* CPhysX_Manager::Create_PxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos) +{ + const PSX::PxTransform pxWorldParentPos = pActor0->getGlobalPose(); + const PSX::PxTransform pxWorldChildPos = pActor1->getGlobalPose(); + + const PSX::PxTransform pxLocalParentPOs = pxWorldParentPos.transformInv(pxJointWorldPos); + const PSX::PxTransform pxLocalChildPos = pxWorldChildPos.transformInv(pxJointWorldPos); + + PSX::PxD6Joint* pJoint = PSX::PxD6JointCreate(*m_pPhysics, pActor0, pxLocalParentPOs, pActor1, pxLocalChildPos); + + pActor0->setSolverIterationCounts(8, 2); + pActor1->setSolverIterationCounts(8, 2); + + pJoint->setMotion(PSX::PxD6Axis::eX, PSX::PxD6Motion::eLOCKED); + pJoint->setMotion(PSX::PxD6Axis::eY, PSX::PxD6Motion::eLOCKED); + pJoint->setMotion(PSX::PxD6Axis::eZ, PSX::PxD6Motion::eLOCKED); + pJoint->setMotion(PSX::PxD6Axis::eTWIST, PSX::PxD6Motion::eLIMITED); + pJoint->setMotion(PSX::PxD6Axis::eSWING1, PSX::PxD6Motion::eLIMITED); + pJoint->setMotion(PSX::PxD6Axis::eSWING2, PSX::PxD6Motion::eLIMITED); + + + pJoint->setTwistLimit(PSX::PxJointAngularLimitPair(-0.35f, 0.35f)); // 20도 + pJoint->setSwingLimit(PSX::PxJointLimitCone(0.10f, 0.10f)); // 40도 + + pJoint->setDrive(PSX::PxD6Drive::eSLERP, PSX::PxD6JointDrive(50.0f, 10.0f, FLT_MAX, true)); + pJoint->setDrivePosition(PSX::PxTransform(PSX::PxIdentity)); //생성 시 프레임 기준 + //pJoint->setDrive(PSX::PxD6Drive::eSLERP, PSX::PxD6JointDrive(0.0f, 0.0f, 0.0f, false)); + + pJoint->setConstraintFlag(PSX::PxConstraintFlag::eVISUALIZATION, true); + pJoint->setConstraintFlag(PSX::PxConstraintFlag::eIMPROVED_SLERP, true); + pJoint->setConstraintFlag(PSX::PxConstraintFlag::eCOLLISION_ENABLED, false); + + pJoint->setBreakForce(1e30f, 1e30f); return pJoint; } @@ -297,7 +359,7 @@ HRESULT CPhysX_Manager::SaveTriMeshes(const _char* pPath, vectorgetRigidBodyFlags() & PSX::PxRigidBodyFlag::eKINEMATIC) { - const CTransform* pTransform = static_cast(pBody->userData)->pOwner->Get_Component(); + PHYSX_USERDATA* pUserData = (PHYSX_USERDATA*)pBody->userData; + if (false == pUserData->bAutoOwnerTranslation) { + continue; + } + const CTransform* pTransform = pUserData->pOwner->Get_Component(); - pActor->setKinematicTarget(XMWorldToPx_NoScale(pTransform->Get_XMWorldMatrix())); + pActor->setKinematicTarget(XMWorldToPx_NoScaleNoFlip(pTransform->Get_XMWorldMatrix())); } } } @@ -414,12 +480,15 @@ void CPhysX_Manager::Update_Dynamic_ActiveActors() PSX::PxActor** ppActiveActors = m_pScene->getActiveActors(iNumActiveActor); for (PSX::PxU32 i = 0; i < iNumActiveActor; ++i) { - PhsXUserData* pUserData = (PhsXUserData*)ppActiveActors[i]->userData; + PHYSX_USERDATA* pUserData = (PHYSX_USERDATA*)ppActiveActors[i]->userData; PSX::PxRigidDynamic* pActorDynamic = ppActiveActors[i]->is(); if (nullptr != pActorDynamic) { if (nullptr == ppActiveActors[i]->userData) { continue; } + if (false == pUserData->bAutoOwnerTranslation) { + continue; + } CTransform* pTransform = pUserData->pOwner->Get_Component(); PSX::PxTransform pPxTransform = pActorDynamic->getGlobalPose(); @@ -432,6 +501,107 @@ void CPhysX_Manager::Update_Dynamic_ActiveActors() } } +void CPhysX_Manager::FixCapsuleShapeAxisToY(PSX::PxShape* pShape) +{ + PSX::PxTransform shapeLocalPose = pShape->getLocalPose(); + + // X -> Y : Z축 기준 +90도 회전 + shapeLocalPose.q = PSX::PxQuat(PSX::PxHalfPi, PSX::PxVec3(0.f, 0.f, 1.f)) * shapeLocalPose.q; + + pShape->setLocalPose(shapeLocalPose); +} + +uint32_t CPhysX_Manager::ConvertPhysxKindToBit(const PHYSX_USERDATA& physxUserData) +{ + if (physxUserData.eKind == PHYSX_KIND::BODY_STATIC) + return COLLISIONCATERGORY_BIT32::WorldStatic; + + if (physxUserData.eKind == PHYSX_KIND::CCTActor) + return COLLISIONCATERGORY_BIT32::CharacterController; + + if (physxUserData.eKind == PHYSX_KIND::BODY_DYNAMIC) + { + _bool isJointRelatedPart = + physxUserData.iSubKind == ENUM_CLASS(PXOBJECT::JOINT_ANCHOR) || + physxUserData.iSubKind == ENUM_CLASS(PXOBJECT::JOINT_ROUTE); + + if (true == isJointRelatedPart) + return COLLISIONCATERGORY_BIT32::JointedParts; + + return COLLISIONCATERGORY_BIT32::WorldDynamic; + } + + return 0u; +} + +uint32_t CPhysX_Manager::BuildCollisionMaskFromCategoryBit(uint32_t iMyBit) +{ + if (iMyBit == COLLISIONCATERGORY_BIT32::CharacterController) + { + // CCT는 조인트 파츠 충돌x + return COLLISIONCATERGORY_BIT32::WorldStatic | COLLISIONCATERGORY_BIT32::WorldDynamic; + } + + if (iMyBit == COLLISIONCATERGORY_BIT32::JointedParts) + { + // 조인트 파츠도 CCT 충돌x + return COLLISIONCATERGORY_BIT32::WorldStatic | COLLISIONCATERGORY_BIT32::WorldDynamic; + } + + // 기본값 + return COLLISIONCATERGORY_BIT32::WorldStatic | COLLISIONCATERGORY_BIT32::WorldDynamic | COLLISIONCATERGORY_BIT32::CharacterController | COLLISIONCATERGORY_BIT32::JointedParts; +} + +void CPhysX_Manager::ApplyFilterData(PSX::PxRigidActor* pRigidActor) +{ + if (pRigidActor == nullptr){ + return; + } + + PHYSX_USERDATA* physxUserData = reinterpret_cast(pRigidActor->userData); + if (physxUserData == nullptr){ + return; + } + + const uint32_t CategoryBit = ConvertPhysxKindToBit(*physxUserData); // who am i + const uint32_t MaskBits = BuildCollisionMaskFromCategoryBit(CategoryBit); // for what + + PSX::PxFilterData DATAfilter = {}; + DATAfilter.word0 = CategoryBit; // 나는 누구인가 + DATAfilter.word1 = MaskBits; // 누구와 부딪힐 것인가 + + const PSX::PxU32 shapeCount = pRigidActor->getNbShapes(); + vector shapes(shapeCount); + pRigidActor->getShapes(shapes.data(), shapeCount); + + for (PSX::PxShape* shape : shapes) + { + shape->setSimulationFilterData(DATAfilter); + } +} + +PSX::PxFilterFlags CPhysX_Manager::SimulationFilterShader(PSX::PxFilterObjectAttributes pxAttributes0, PSX::PxFilterData pxFilterData0, PSX::PxFilterObjectAttributes pxAttributes1, PSX::PxFilterData pxFilterData1, PSX::PxPairFlags& pxPairFlags, const void* pConstantBlock, PSX::PxU32 iConstantBlockSize) +{ + _bool bFilter0_1 = (pxFilterData0.word0 & pxFilterData1.word1) != 0u; + _bool bFilter1_0 = (pxFilterData1.word0 & pxFilterData0.word1) != 0u; + + if (!bFilter0_1 || !bFilter1_0) + { + // Event. 접촉제거 + return PSX::PxFilterFlag::eSUPPRESS; + } + + if (PSX::PxFilterObjectIsTrigger(pxAttributes0) || PSX::PxFilterObjectIsTrigger(pxAttributes1)) + { + // 트리거 처리 + pxPairFlags = PSX::PxPairFlag::eTRIGGER_DEFAULT; + return PSX::PxFilterFlag::eDEFAULT; + } + + pxPairFlags = PSX::PxPairFlag::eCONTACT_DEFAULT; + return PSX::PxFilterFlag::eDEFAULT; +} + void CPhysX_Manager::ClearScene(_uint iLevel) { for (auto& pBody : m_pActiveBodys[iLevel]) { @@ -585,6 +755,7 @@ HRESULT CPhysX_Manager::Initialize(_uint iLevel) #ifndef _DEBUG m_pPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *m_pFoundation, m_ToleranceScale, true); #endif // _DEBUG + PxInitExtensions(*m_pPhysics, m_pPvd); m_pCookingParam = new PSX::PxCookingParams(m_pPhysics->getTolerancesScale()); m_pCookingParam->meshPreprocessParams |= PSX::PxMeshPreprocessingFlag::eWELD_VERTICES; @@ -597,9 +768,10 @@ HRESULT CPhysX_Manager::Initialize(_uint iLevel) assert(false); return E_FAIL; } + sceneDesc.solverType = PSX::PxSolverType::Enum::eTGS; sceneDesc.cpuDispatcher = m_pDispatcher; //sceneDesc.simulationEventCallback = ; // fetchResults 때 불림. 아래 필터랑, pair랑 같이 짝꿍임. 좀 더 공부해야 쓸 수 있을듯;; - sceneDesc.filterShader = PSX::PxDefaultSimulationFilterShader; // 레이어 충돌, 오브젝트에 속성을 주고 복잡한 필터링 충돌 식 + sceneDesc.filterShader = &SimulationFilterShader;// PSX::PxDefaultSimulationFilterShader; // 레이어 충돌, 오브젝트에 속성을 주고 복잡한 필터링 충돌 식 sceneDesc.flags = PSX::PxSceneFlag::eENABLE_PCM // 기본 true, 현대적인 충돌시스템 적용 | PSX::PxSceneFlag::eENABLE_ACTIVE_ACTORS // 현재 움직임이 있는 액터만 가져옴 @@ -609,7 +781,7 @@ HRESULT CPhysX_Manager::Initialize(_uint iLevel) //| PSX::PxSceneFlag::eDISABLE_CONTACT_REPORT_BUFFER_RESIZE // 접촉 리포트버퍼 리사이즈 금지 -> 보통 끔 //| PSX::PxSceneFlag::eDISABLE_CONTACT_CACHE // 접촉 캐시를 금지 -> 그냥 켜두자, 캐시 있는게 보통 더 낫다 //| PSX::PxSceneFlag::eREQUIRE_RW_LOCK // 멀티스레딩 환경에서 혹시라도 락 걸고 접근하지 않아 발생할 일을 제거, - //| PSX::PxSceneFlag::eENABLE_STABILIZATION // 물체가 얽힌 상황에서 불안정한걸 방지. 추가비용인듯 + | PSX::PxSceneFlag::eENABLE_STABILIZATION // 물체가 얽힌 상황에서 불안정한걸 방지. 추가비용인듯 //| PSX::PxSceneFlag::eENABLE_AVERAGE_POINT // 이해 못하겠음 //| PSX::PxSceneFlag::eEnable_GPU_Dynamics // 피직스 그래픽가속 설정. 여기선 세팅 안돼서 비활성화ㅏ //| PSX::PxSceneFlag::eEnable_Direct_GPU_API // 직접 그래픽버퍼를 다루게끔 설정 @@ -627,7 +799,14 @@ HRESULT CPhysX_Manager::Initialize(_uint iLevel) return E_FAIL; } + // SCENE m_pScene = m_pPhysics->createScene(sceneDesc); +#ifdef _DEBUG + m_pScene->setVisualizationParameter(PSX::PxVisualizationParameter::Enum::eJOINT_LOCAL_FRAMES, 1.f); + m_pScene->setVisualizationParameter(PSX::PxVisualizationParameter::Enum::eJOINT_LIMITS, 1.f); +#endif // _DEBUG + + // CCT m_pCCTManager = PxCreateControllerManager(*m_pScene); @@ -654,7 +833,7 @@ HRESULT CPhysX_Manager::Initialize(_uint iLevel) PlaneData.pOwner = nullptr; PlaneData.pBody = nullptr; - PSX::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 85), *m_pMaterials[ENUM_CLASS(PXMATERIAL::DEFAULT)]); + PSX::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 80), *m_pMaterials[ENUM_CLASS(PXMATERIAL::DEFAULT)]); pGroundPlane->userData = &PlaneData; pGroundPlane->setName("PHYSX_MANAGER_PLANE"); m_pScene->addActor(*pGroundPlane); @@ -740,7 +919,7 @@ void CPhysX_Manager::Free() if (nullptr != m_pDispatcher) { m_pDispatcher->release(); m_pDispatcher = nullptr; } - + PxCloseExtensions(); if (nullptr != m_pPhysics) { m_pPhysics->release(); m_pPhysics = nullptr; } diff --git a/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp b/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp index 933eb0ea2..f76ae0d29 100644 --- a/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp +++ b/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp @@ -21,28 +21,34 @@ CRigidBody_Dynamic::CRigidBody_Dynamic(const CRigidBody_Dynamic& rhs) : #ifdef _DEBUG HRESULT CRigidBody_Dynamic::Render() { - _matrix WorldMatrix = XMMatrixTranslation(m_vLocalTranslation.x, m_vLocalTranslation.y, m_vLocalTranslation.z) * m_pTransform->Get_XMWorldMatrix(); + return Render(nullptr); +} +HRESULT CRigidBody_Dynamic::Render(function custumState) +{ + PSX::PxTransform pxTranform = m_pRigidBody->getGlobalPose(); + _matrix WorldMatrix = XMMatrixTranslation(m_vLocalTranslation.x, m_vLocalTranslation.y, m_vLocalTranslation.z) + * XMMatrixAffineTransformation(XMVectorSet(1.f, 1.f, 1.f, 0.f), XMVectorZero(), XMLoadFloat4((_float4*)&pxTranform.q), XMVectorSetW(XMLoadFloat3((_float3*)&pxTranform.p), 1.f)); _matrix ViewMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW); _matrix ProjMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ); _vector vColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0x2fc48000, 1.f); - switch (m_eActorType) { case ACTOR::BOX: { - m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true); + m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, custumState); } break; case ACTOR::CAPSULE: { - m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true); - _matrix WorldUp = XMMatrixTranslationFromVector(m_pTransform->Get_State(STATE::UP) * m_vhalfGeometryInfo.y); - _matrix WorldDown = XMMatrixTranslationFromVector(m_pTransform->Get_State(STATE::UP) * -m_vhalfGeometryInfo.y); - m_pSubShape->Draw(WorldUp * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true); - m_pSubShape->Draw(WorldDown * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true); + WorldMatrix = XMMatrixAffineTransformation(XMVectorSet(1.f, 1.f, 1.f, 0.f), XMVectorZero(), XMQuaternionMultiply(XMQuaternionRotationAxis(XMVectorSet(0.f, 1.f, 0.f, 0.f), XMConvertToRadians(90.f)), XMLoadFloat4((_float4*)&pxTranform.q)), XMVectorSetW(XMLoadFloat3((_float3*)&pxTranform.p), 1.f)); + m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, custumState); + _matrix WorldUp = XMMatrixTranslationFromVector(WorldMatrix.r[1] * m_vhalfGeometryInfo.y); + _matrix WorldDown = XMMatrixTranslationFromVector(WorldMatrix.r[1] * -m_vhalfGeometryInfo.y); + m_pSubShape->Draw(WorldUp * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, custumState); + m_pSubShape->Draw(WorldDown * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, custumState); } break; case ACTOR::SPHERE: { - m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true); + m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, custumState); } break; default: break; @@ -50,6 +56,10 @@ HRESULT CRigidBody_Dynamic::Render() return S_OK; } #endif +void CRigidBody_Dynamic::Set_Name(const _char* szName) +{ + m_pRigidBody->setName(szName); +} void CRigidBody_Dynamic::Set_HalfGeometryInfo(_float3 vhalfGeometryInfo) { m_vhalfGeometryInfo = vhalfGeometryInfo; @@ -101,17 +111,26 @@ void CRigidBody_Dynamic::Set_HalfGeometryInfo(_float3 vhalfGeometryInfo) Add_DebugShape(); #endif // _DEBUG } -void CRigidBody_Dynamic::Move_LocalPos(_float4 vNewRotQ, _float3 vNewTranslation) +void CRigidBody_Dynamic::Move_LocalPos(_matrix newLocalPos) { - m_vLocalRotQ = vNewRotQ; - m_vLocalTranslation = vNewTranslation; + _vector vScale, vPos, vRotQ; + XMMatrixDecompose(&vScale, &vRotQ, &vPos, newLocalPos); + Move_LocalPos(vPos, vRotQ); +} +void CRigidBody_Dynamic::Move_LocalPos(_float4& vNewRotQ, _float3& vNewTranslation) +{ + Move_LocalPos(XMLoadFloat4(&vNewRotQ), XMLoadFloat3(&vNewTranslation)); +} +void CRigidBody_Dynamic::Move_LocalPos(_fvector vNewRotQ, _gvector vNewTranslation) +{ + XMStoreFloat4(&m_vLocalRotQ, vNewRotQ); + XMStoreFloat3(&m_vLocalTranslation, vNewTranslation); PSX::PxShape* pShape = { nullptr }; m_pRigidBody->getShapes(&pShape, m_pRigidBody->getNbShapes()); - pShape->setLocalPose(PSX::PxTransform(vNewTranslation.x, vNewTranslation.y, vNewTranslation.z, PSX::PxQuat(vNewRotQ.x, vNewRotQ.y, vNewRotQ.z, vNewRotQ.w))); + pShape->setLocalPose(PSX::PxTransform(m_vLocalTranslation.x, m_vLocalTranslation.y, m_vLocalTranslation.z, PSX::PxQuat(m_vLocalRotQ.x, m_vLocalRotQ.y, m_vLocalRotQ.z, m_vLocalRotQ.w))); #ifdef _DEBUG Add_DebugShape(); #endif // _DEBUG - } _float CRigidBody_Dynamic::Get_Mass() { @@ -137,6 +156,31 @@ void CRigidBody_Dynamic::Set_Kinematic(_bool bKinematic) m_pRigidBody->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, bKinematic); } +void CRigidBody_Dynamic::Move_Kinematic(_fmatrix xmTransform, _bool bTeleport) +{ + _vector vScale, vPos, vRotQ; + XMMatrixDecompose(&vScale, &vRotQ, &vPos, xmTransform); + Move_Kinematic(vPos, vRotQ, bTeleport); +} + +void CRigidBody_Dynamic::Move_Kinematic(_fvector vPos, _gvector vRotq, _bool bTeleport) +{ + PSX::PxTransform pxTransform = {}; + XMStoreFloat3((_float3*)&pxTransform.p, vPos); + XMStoreFloat4((_float4*)&pxTransform.q, vRotq); + Move_Kinematic(pxTransform, bTeleport); +} + +void CRigidBody_Dynamic::Move_Kinematic(PSX::PxTransform& pxDestination, _bool bTeleport) +{ + if (true == bTeleport) { + Set_Transform(pxDestination, bTeleport); + } + else { + m_pRigidBody->setKinematicTarget(pxDestination); + } +} + HRESULT CRigidBody_Dynamic::ConvertToCCT(CCharacter_Controller& CCTOriginal) { m_pTransform->Set_WorldMatrix(m_pRigidBody->getGlobalPose()); @@ -164,26 +208,33 @@ _vector CRigidBody_Dynamic::Get_Position() return vPos; } -void CRigidBody_Dynamic::Set_Position(_vector vPos) +void CRigidBody_Dynamic::Set_Position(_vector vPos, _bool bTeleport) { PSX::PxTransform pxTransform = m_pRigidBody->getGlobalPose(); pxTransform.p.x = vPos.m128_f32[0]; pxTransform.p.y = vPos.m128_f32[1]; pxTransform.p.z = vPos.m128_f32[2]; - Set_Transform(pxTransform); + Set_Transform(pxTransform, bTeleport); } -void CRigidBody_Dynamic::Set_Rotation(_vector vRotQ) +void CRigidBody_Dynamic::Set_Rotation(_vector vRotQ, _bool bTeleport) { PSX::PxTransform pxTransform = m_pRigidBody->getGlobalPose(); pxTransform.q.x = vRotQ.m128_f32[0]; pxTransform.q.y = vRotQ.m128_f32[1]; pxTransform.q.z = vRotQ.m128_f32[2]; pxTransform.q.w = vRotQ.m128_f32[3]; - Set_Transform(pxTransform); + Set_Transform(pxTransform, bTeleport); } -void CRigidBody_Dynamic::Set_Transform(_vector vPos, _vector vRotQ) +void CRigidBody_Dynamic::Set_Transform(_matrix WorldMatrix, _bool bTeleport) +{ + _vector vScale, vPos, vRotQ; + XMMatrixDecompose(&vScale, &vRotQ, &vPos, WorldMatrix); + Set_Transform(vPos, vRotQ, bTeleport); +} + +void CRigidBody_Dynamic::Set_Transform(_vector vPos, _vector vRotQ, _bool bTeleport) { PSX::PxTransform pxTransform = m_pRigidBody->getGlobalPose(); pxTransform.p.x = vPos.m128_f32[0]; @@ -194,12 +245,42 @@ void CRigidBody_Dynamic::Set_Transform(_vector vPos, _vector vRotQ) pxTransform.q.y = vRotQ.m128_f32[1]; pxTransform.q.z = vRotQ.m128_f32[2]; pxTransform.q.w = vRotQ.m128_f32[3]; - Set_Transform(pxTransform); + Set_Transform(pxTransform, bTeleport); } -void CRigidBody_Dynamic::Set_Transform(PSX::PxTransform pxTransform) +void CRigidBody_Dynamic::Set_CenterTransform(_vector vStart, _vector vEnd, _bool bTeleport) { - m_pRigidBody->setGlobalPose(pxTransform); + _vector vCenterWorldPos = (vStart + vEnd) * 0.5f; + _vector vRotQ = XMQuaternionIdentity(); + _vector vDir = XMVectorSetW(vEnd - vStart, 0.f); + _float vLength = XMVectorGetX(XMVector3Length(vDir)); + if (vLength > FLT_EPSILON5) { + vDir = XMVector3Normalize(vDir); + vRotQ = CMyTools::MakeQuaternionFromTo(XMVectorSet(0.f, 1.f, 0.f, 0.f), vDir); + } + if (true == bTeleport) { + Set_Transform(vCenterWorldPos, vRotQ, bTeleport); + } + else { + if (m_pRigidBody->getRigidBodyFlags() & PSX::PxRigidBodyFlag::eKINEMATIC) { + Move_Kinematic(vCenterWorldPos, vRotQ); + } + else { + Set_Transform(vCenterWorldPos, vRotQ, bTeleport); + } + } +} + +void CRigidBody_Dynamic::Set_Transform(PSX::PxTransform pxTransform, _bool bTeleport) +{ + m_pRigidBody->setGlobalPose(pxTransform, true); + + if (true == bTeleport) { + m_pRigidBody->setLinearVelocity(PSX::PxVec3(0.f, 0.f, 0.f)); + m_pRigidBody->setAngularVelocity(PSX::PxVec3(0.f, 0.f, 0.f)); + m_pRigidBody->clearForce(); + m_pRigidBody->clearTorque(); + } } _float3 CRigidBody_Dynamic::Get_FootPosition() @@ -244,6 +325,19 @@ _float3 CRigidBody_Dynamic::Get_HeadPosition() return vOut; } +PSX::PxTransform CRigidBody_Dynamic::Get_GlobalPosition() +{ + return m_pRigidBody->getGlobalPose(); +} + +PSX::PxTransform CRigidBody_Dynamic::Get_HeadPositionPxTransform() +{ + PSX::PxTransform pxTransform = m_pRigidBody->getGlobalPose(); + _float3 vFootPos = Get_HeadPosition(); + pxTransform.p = { vFootPos.x, vFootPos.y, vFootPos.z }; + return pxTransform; +} + PSX::PxTransform CRigidBody_Dynamic::Get_FootPositionPxTransform() { PSX::PxTransform pxTransform = m_pRigidBody->getGlobalPose(); @@ -283,22 +377,42 @@ HRESULT CRigidBody_Dynamic::Initialize(void* pArg) return E_FAIL; } #endif // _DEBUG + RIGIDBODY_DYNAMIC_DESC* pDesc = static_cast(pArg); m_tagData.pOwner = m_pOwner; XMStoreFloat4x4(&m_tagData.BeforeMatrix, m_pTransform->Get_XMWorldMatrix()); m_tagData.pBody = this; + m_tagData.bAutoOwnerTranslation = pDesc->bAutoOwnerTranslation; m_pRigidBody = m_pGameInstance->Add_DynamicActor(*this, m_pGameInstance->Get_NextLevelID()); - m_pRigidBody->userData = &m_tagData; m_pRigidBody->setCMassLocalPose(m_PxMassCenter); m_pRigidBody->setRigidDynamicLockFlags(m_eLockFlag); m_pRigidBody->setLinearDamping(m_vDamping.x); m_pRigidBody->setAngularDamping(m_vDamping.y); - Move_LocalPos(m_vLocalRotQ, m_vLocalTranslation); - //m_pRigidBody->joint; - //PSX::PxRevol + if (ACTOR::CAPSULE != m_eActorType) { + Move_LocalPos(m_vLocalRotQ, m_vLocalTranslation); + } + + return S_OK; } +//void CRigidBody_Dynamic::Move(PSX::PxTransform& pxTransform, _bool bTeleport) +//{ +// if (m_pRigidBody->getRigidBodyFlags().isSet(PSX::PxRigidBodyFlag::eKINEMATIC)) { +// m_pRigidBody->setKinematicTarget(pxTransform); +// } +// else { +// m_pRigidBody->setGlobalPose(pxTransform, true); +// +// if (true == bTeleport) { +// m_pRigidBody->setLinearVelocity(PSX::PxVec3(0.f, 0.f, 0.f)); +// m_pRigidBody->setAngularVelocity(PSX::PxVec3(0.f, 0.f, 0.f)); +// m_pRigidBody->clearForce(); +// m_pRigidBody->clearTorque(); +// } +// } +//} + #ifdef _DEBUG HRESULT CRigidBody_Dynamic::Add_DebugShape() { diff --git a/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic_Joint.cpp b/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic_Joint.cpp deleted file mode 100644 index bcb5590be..000000000 --- a/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic_Joint.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "pch.h" diff --git a/Jusin154_Team3D/Engine/Public/Bone.h b/Jusin154_Team3D/Engine/Public/Bone.h index 83c6f4236..4f57e7e3a 100644 --- a/Jusin154_Team3D/Engine/Public/Bone.h +++ b/Jusin154_Team3D/Engine/Public/Bone.h @@ -11,18 +11,12 @@ class ENGINE_DLL CBone final : public CBase CBone(const CBone& other); virtual ~CBone() = default; public: - _matrix Get_CombinedTransformationMatrix() const { - return XMLoadFloat4x4(&m_CombinedTransformationMatrix); - } - _float4x4* Get_CombinedTransformationMatrixPtr() { - return &m_CombinedTransformationMatrix; - } - void Set_CombinedTransformationMatrixPtr(_matrix& newMatrix) { - return XMStoreFloat4x4(&m_CombinedTransformationMatrix, newMatrix); - } - _bool Compare_Name(const _char* pBoneName) const { - return !strcmp(pBoneName, m_strName.c_str()); - } + _matrix Get_CombinedTransformationMatrix() const { return XMLoadFloat4x4(&m_CombinedTransformationMatrix); } + _float4x4* Get_CombinedTransformationMatrixPtr() { return &m_CombinedTransformationMatrix; } + _float4x4* Get_TransformationMatrixPtr() { return &m_TransformationMatrix; }; + + void Set_CombinedTransformationMatrix(_fmatrix newMatrix) { return XMStoreFloat4x4(&m_CombinedTransformationMatrix, newMatrix); } + _bool Compare_Name(const _char* pBoneName) const { return !strcmp(pBoneName, m_strName.c_str()); } void Get_KeyFrame(KEYFRAME& kf, _bool bIsCurrentFrame); // 현재 본의 로컬매트릭스를 캡쳐해서 키프레임으로 성분 분해하여 올려보낸다. const _char* Get_Name() const { return m_strName.c_str(); } _float3 Get_LocalPosition(); diff --git a/Jusin154_Team3D/Engine/Public/CallBack_QueryFilterCallback.h b/Jusin154_Team3D/Engine/Public/CallBack_QueryFilterCallback.h index 4cf8bdf97..520078614 100644 --- a/Jusin154_Team3D/Engine/Public/CallBack_QueryFilterCallback.h +++ b/Jusin154_Team3D/Engine/Public/CallBack_QueryFilterCallback.h @@ -9,12 +9,30 @@ class CPhysX_CctQueryFilterCallback final : public PSX::PxQueryFilterCallback { if (actor != nullptr && actor->userData != nullptr) { - PhsXUserData* physxUserData = (PhsXUserData*)actor->userData; + PHYSX_USERDATA* physxUserData = (PHYSX_USERDATA*)actor->userData; if (physxUserData->eKind == PHYSX_KIND::BODY_DYNAMIC) { - if (PXOBJECT(physxUserData->iSubKind) == PXOBJECT::SKILL_PROTEGO) + switch (PXOBJECT(physxUserData->iSubKind)) + { + case PXOBJECT::LEG: return PSX::PxQueryHitType::eNONE; + break; + case PXOBJECT::SKILL_PROTEGO: + return PSX::PxQueryHitType::eNONE; + break; + case PXOBJECT::GOBLIN_PROTEGO: + return PSX::PxQueryHitType::eNONE; + break; + case PXOBJECT::JOINT_ROUTE: + return PSX::PxQueryHitType::eNONE; + break; + case PXOBJECT::JOINT_ANCHOR: + return PSX::PxQueryHitType::eNONE; + break; + default: + break; + } } } diff --git a/Jusin154_Team3D/Engine/Public/Character_Controller.h b/Jusin154_Team3D/Engine/Public/Character_Controller.h index 872129d95..08118b0ba 100644 --- a/Jusin154_Team3D/Engine/Public/Character_Controller.h +++ b/Jusin154_Team3D/Engine/Public/Character_Controller.h @@ -14,7 +14,7 @@ class ENGINE_DLL CCharacter_Controller final : /* dev-treadmill.tistory.com/159 */ // 기본적으로 아무 힘도 받지 않는, 주지 않는 놈임 // kinematic 기반임 - static CPhysX_CctQueryFilterCallback s_QueryFilterCallback_IGNORE_Shield; + static CPhysX_CctQueryFilterCallback s_QueryFilterCallback_IGNORE_GLOBAL; public: #pragma region STRUCT typedef struct tagCharacter_ControllerDesc @@ -93,7 +93,7 @@ class ENGINE_DLL CCharacter_Controller final : _float m_fCurrentSlopeDegree = { 0.f }; _int m_iIsOnGround = { 0 }; _float4 m_vAccHeight = { 0.f, 0.16f, 0.f, 0.01f }; - PhsXUserData m_tagData = {}; + PHYSX_USERDATA m_tagData = {}; PSX::PxControllerCollisionFlags m_eBeforeCollisionFlags = {}; _bool m_bActive = { true }; diff --git a/Jusin154_Team3D/Engine/Public/Dynamic_D6Joint.h b/Jusin154_Team3D/Engine/Public/Dynamic_D6Joint.h new file mode 100644 index 000000000..6fbd85016 --- /dev/null +++ b/Jusin154_Team3D/Engine/Public/Dynamic_D6Joint.h @@ -0,0 +1,51 @@ +#pragma once +#include "Component.h" + +NS_BEGIN(Engine) +class CTransform; +class CMesh; + +class ENGINE_DLL CDynamic_D6Joint final : public CComponent +{ +public: + typedef struct tagDynamicJointDesc { + PHYSX_JOINT eType; + PSX::PxRigidDynamic* pActor0; + PSX::PxRigidDynamic* pActor1; + const PSX::PxTransform* pxJointWorldPos; + }DYNAMICJOINT_DESC; +private: + CDynamic_D6Joint(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CDynamic_D6Joint(const CDynamic_D6Joint& rhs); + ~CDynamic_D6Joint() = default; + +public: +#ifdef _DEBUG + virtual HRESULT Render()override; +#endif // _DEBUG + PSX::PxD6Joint* Get_JointPtr() { return m_pJoint; }; +private: + PSX::PxD6Joint* m_pJoint = { nullptr }; + +#ifdef _DEBUG + unique_ptr m_pMainShape = { nullptr }; +#endif // _DEBUG + +private: + HRESULT Initialize_Prototype(); + virtual HRESULT Initialize(void* pArg) override; + +#ifdef _DEBUG + HRESULT Add_DebugShape(); +#endif + +public: + static CDynamic_D6Joint* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CComponent* Clone(void* pArg, class CGameObject* pOwner = nullptr) override; + virtual void Free() override; +#ifdef _DEBUG + virtual void Describe_Entity() override; +#endif // _DEBUG +}; + +NS_END diff --git a/Jusin154_Team3D/Engine/Public/Engine_Enum.h b/Jusin154_Team3D/Engine/Public/Engine_Enum.h index 26262d4fb..9cab65c86 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Enum.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Enum.h @@ -8,7 +8,7 @@ enum class COLLIDER { AABB, OBB, SPHERE, END }; enum class RENDER {PRIORITY, SHADOW_NEAR, NONBLEND, DECAL, BLUR, NONLIGHT, EFFECT ,BLEND, BLOOM, DISTORTION, BULR_MESH ,UI, OCCLUSION, SHADOW_MIDDLE, PRESHADOW, UI_OVERLAY ,END }; enum class RAY { LOCAL, WORLD, END }; enum class ACTOR { BOX, CAPSULE, SPHERE, PLANE, TRIANGLEMESH, HEIGHTFIELD, END }; -enum class BLEND_BONE{SPINE,SHOULDER_L,SHOULDER_R,NECK,SHOULDER_NECK_L, SHOULDER_NECK_R,HEAD,END}; +enum class BLEND_BONE{SPINE,SHOULDER_L,SHOULDER_R,NECK,SHOULDER_NECK_L, SHOULDER_NECK_R,HEAD, HIPS_CLOTH, END}; enum class STAT { NAME, CURRENTHP, MAXHP, TARGETHP, MELEE, MAGIC, DEFENSE, SPEED, AGILITY, LEVEL, EXPERIENCE, MAX_EXPERIENCE, GOLD, END }; //enum class CONDITION { POISON, HPREGENERATION, PANIC, GRAP, END }; enum class SHADOW : _ubyte { @@ -118,9 +118,17 @@ enum class PHYSX_KIND { OBSTACLEActor, }; +enum class PHYSX_JOINT { + D6, + DISTANCE, + REVOLUTE, + END +}; + enum class PXOBJECT : _uint { #pragma region NOT_DEFINE - NOT_DEFINE = 000, + NOT_DEFINE = 0, + LEG, #pragma endregion #pragma region PLAYER PLAYER = 10, @@ -144,13 +152,7 @@ enum class PXOBJECT : _uint { GOBLIN_SHIELD_BREAK_MAGIC, GOBLIN_NORMAL_MAGIC, TROLL_GROUND_STRIKE, - - /* - * _int iKind; - * if (iKind > 100 && iKind < 200){ - * dammage - */ - + GOBLIN_PROTEGO, #pragma endregion #pragma region ALLY_HITBOX ALLY_HITBOX = 200, @@ -216,6 +218,8 @@ enum class PXOBJECT : _uint { #pragma region NOCOLLIDE NOCOLLIDE = 900, GAIL, + JOINT_ROUTE, + JOINT_ANCHOR, #pragma endregion END = 999 @@ -223,7 +227,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/Engine_Function.h b/Jusin154_Team3D/Engine/Public/Engine_Function.h index 64086a61a..345bfeaee 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Function.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Function.h @@ -47,7 +47,7 @@ unsigned long Safe_Release(T& pInstance) return dwRefCnt; } -static PSX::PxTransform XMWorldToPx_NoScale(const _fmatrix& WorldMatrix) +static PSX::PxTransform XMWorldToPx_NoScaleNoFlip(const _fmatrix& WorldMatrix) { _vector vPos, vRotq, vScale; XMMatrixDecompose(&vScale, &vRotq, &vPos, WorldMatrix); @@ -60,6 +60,8 @@ static PSX::PxTransform XMWorldToPx_NoScale(const _fmatrix& WorldMatrix) return out; } + + static void GUIHelpMarker(const char* desc) { GUI::SameLine(); diff --git a/Jusin154_Team3D/Engine/Public/Engine_Struct.h b/Jusin154_Team3D/Engine/Public/Engine_Struct.h index 16e48c4b0..e9528790d 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Struct.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Struct.h @@ -373,9 +373,10 @@ typedef struct tagVertexInstance_UIDesc }VTX_POSTEX_INSTANCE_UI; -typedef struct tagPhsXUserData { +typedef struct tagPHYSX_USERDATA { PHYSX_KIND eKind = PHYSX_KIND::NOT_DEFINED; + _bool bAutoOwnerTranslation = true; class CGameObject* pOwner = { nullptr }; _float4x4 BeforeMatrix = { }; @@ -387,7 +388,11 @@ typedef struct tagPhsXUserData { class CObstacle_Controller* pObstacle = { nullptr }; }; -}PhsXUserData; +}PHYSX_USERDATA; + +typedef struct tagD6JointDesc { + +}PHYSX_JOINT_D6Desc; typedef struct tagOnCollsionInfo { diff --git a/Jusin154_Team3D/Engine/Public/FSM.h b/Jusin154_Team3D/Engine/Public/FSM.h index 0ca39ed21..d9f1b646b 100644 --- a/Jusin154_Team3D/Engine/Public/FSM.h +++ b/Jusin154_Team3D/Engine/Public/FSM.h @@ -53,6 +53,8 @@ enum ESTATE : _u64Flag SWIPE = 1ULL << 46, SLIDE = 1ULL << 47, FALL = 1ULL << 48, + SLASH = 1ULL << 49, + DASH = 1ULL << 50, END }; NS_END diff --git a/Jusin154_Team3D/Engine/Public/GameInstance.h b/Jusin154_Team3D/Engine/Public/GameInstance.h index 7ffe06d36..18535b8c0 100644 --- a/Jusin154_Team3D/Engine/Public/GameInstance.h +++ b/Jusin154_Team3D/Engine/Public/GameInstance.h @@ -212,7 +212,8 @@ class ENGINE_DLL CGameInstance final : public CBase void RegistHeight(const _tchar* pName, PSX::PxHeightFieldDesc& Desc, _uint iLevel); PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody_Dynamic& RigidBody, _uint iLevel); PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel); - PSX::PxRevoluteJoint* Create_PxRevoluteJoint(PSX::PxRigidActor* pActorFrame, PSX::PxTransform& pxLocalWallFrame, PSX::PxRigidActor* pActorObject, PSX::PxTransform& pxLocalActorFrame, _uint iLevel); + PSX::PxJoint* Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1); + PSX::PxD6Joint* Create_PxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos); _bool SphereCast(_float fRadius, _float3 vStartPos, _float3 vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer); _bool SphereCast(_float fRadius, _fvector vStartPos, _gvector vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer); @@ -226,12 +227,13 @@ class ENGINE_DLL CGameInstance final : public CBase void Attach_Actor(PSX::PxActor& Actor, _uint iLevel); void Detach_Actor(PSX::PxActor& pActor, _uint iLevel); void Release_Actor(PSX::PxActor& Actor); + void ApplyFilterData(PSX::PxRigidActor* pRigidActor); HRESULT ConvertToTriMeshes(vector& Meshes, vector& pxTriMeshes, _fmatrix WorldMatrix = XMMatrixIdentity()); #ifdef EDITOR_PROJECT HRESULT SaveTriMeshes(const _char* pPath, vector& TriMeshes); #endif // EDITOR_PROJECT HRESULT LoadTriMeshes(const _char* pPath, vector& TriMeshes); // 모델 불러왔던 경로에 그대로 있음 - void Add_Editor_Plane(PhsXUserData& PlaneData); + void Add_Editor_Plane(PHYSX_USERDATA& PlaneData); #pragma endregion #pragma region THREADHOLDER template diff --git a/Jusin154_Team3D/Engine/Public/Model.h b/Jusin154_Team3D/Engine/Public/Model.h index 6aa29ae45..c8f253b41 100644 --- a/Jusin154_Team3D/Engine/Public/Model.h +++ b/Jusin154_Team3D/Engine/Public/Model.h @@ -24,8 +24,13 @@ class ENGINE_DLL CModel final : public CComponent _int HeadBoneIndex; _float HeadAimWeight; + _int SkipCount; + _int padding0; + _int padding1; + _int padding2; + _float3 TargetDir_Local; - _float padding; + _float padding3; _float4x4 PreTransformMatrix; _float4 RootInitRot; @@ -53,6 +58,7 @@ class ENGINE_DLL CModel final : public CComponent void Play_HeadBone(_bool bPlay) { m_bHeadBone = bPlay; } void Set_HeadAimWeight(_float fWeight) { m_fHeadAimWeight = fWeight; } _bool Get_PlayHeadBone() const { return m_bHeadBone; } + _int Get_SkipBoneIndex(_int Index) { return m_SkipBoneindex[Index]; } #pragma endregion #pragma region Animation _bool Play_Animation(_float fTimeDelta, class CTransform* pTransform = nullptr); // 애니메이션에 델타타임을 넣어줌 @@ -87,19 +93,24 @@ 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); + _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; _matrix Get_BoneMatrix(_uint iBoneIndex); void Combined_BoneMatrix(); + void Combined_BoneMatrix(_int iStartBoneIndex, _uint iBoneCount); _int Find_BoneIndex(const _char* pBoneName); + HRESULT Set_BoneCombinedTransformation(const _char* pBoneName, _fmatrix newTransformation); #pragma endregion #pragma region Material @@ -174,7 +185,7 @@ class ENGINE_DLL CModel final : public CComponent _float m_fRatio = {}; _int m_iCurrSecondAnimIndex = { -1 }; - _int m_iBoneIndex[ENUM_CLASS(BLEND_BONE::END)] = { -1,-1,-1,-1,-1,-1,-1 }; + _int m_iBoneIndex[ENUM_CLASS(BLEND_BONE::END)] = { -1,-1,-1,-1,-1,-1,-1,-1 }; vector> m_BoneMask; vector<_bool> m_CPUBoneMask; @@ -209,6 +220,8 @@ class ENGINE_DLL CModel final : public CComponent _vector m_vHeadPos = XMVectorZero(); _bool m_bHeadBone = { false }; _float m_fHeadAimWeight = { 0.f }; + _int m_iSkipBoneCount = {}; + vector<_int> m_SkipBoneindex = {}; private: @@ -225,6 +238,7 @@ class ENGINE_DLL CModel final : public CComponent HRESULT Create_ComputeShaderLocal(); HRESULT Create_ParentVB(); HRESULT Create_BoneLocalVB(); + HRESULT Create_SkipBoneVB(); HRESULT Create_Temp(); HRESULT Create_BoneMatrixVB(); HRESULT Create_Const(); @@ -235,11 +249,10 @@ class ENGINE_DLL CModel final : public CComponent _uint m_iNumBuffer = {}; - vector<_int> m_Parent = {}; + vector<_int> m_Parent = {}; vector<_float4x4> m_BoneLocal = {}; vector m_AnimRanges; - vector<_float4x4> m_BoneMatrixCPU; class CComputeShader* m_pComputeShader = nullptr; @@ -250,6 +263,7 @@ class ENGINE_DLL CModel final : public CComponent ID3D11Buffer* m_pBoneMatrixBuffer = { nullptr }; ID3D11Buffer* m_pPrevBoneMatrixBuffer = { nullptr }; ID3D11Buffer* m_pBoneLocalBuffer = { nullptr }; + ID3D11Buffer* m_pSkipBoneBuffer = { nullptr }; ID3D11Buffer* m_pLocalMatrixBuffer = { nullptr }; @@ -258,6 +272,7 @@ class ENGINE_DLL CModel final : public CComponent ID3D11ShaderResourceView* m_pBoneMatrixSRV = { nullptr }; ID3D11ShaderResourceView* m_pPrevBoneMatrixSRV = { nullptr }; ID3D11ShaderResourceView* m_pLocalMatrixSRV = { nullptr }; + ID3D11ShaderResourceView* m_pSkipBoneSRV = { nullptr }; ID3D11UnorderedAccessView* m_pBoneMatrixUAV = { nullptr }; ID3D11UnorderedAccessView* m_pLocalMatrixUAV = { nullptr }; diff --git a/Jusin154_Team3D/Engine/Public/MyTools.h b/Jusin154_Team3D/Engine/Public/MyTools.h index f9732bda1..c47ac63bd 100644 --- a/Jusin154_Team3D/Engine/Public/MyTools.h +++ b/Jusin154_Team3D/Engine/Public/MyTools.h @@ -11,35 +11,35 @@ class CMyTools { #pragma region Color // [(255, 255, 255, xx), alpha] -> [(0~1, 0~1, 0~1, alpha)] // 0xRRGGBBxx, alpha -> _float4( 0~1, 0~1, 0~1, alpha ) - static _float4 ColorRGB_A_HEXtoFLOAT4(_uint hexCode, _float alpha) { + inline static _float4 ColorRGB_A_HEXtoFLOAT4(_uint hexCode, _float alpha) { float r, g, b, a; DecodeRGBA(hexCode, r, g, b, a, false); a = alpha; return _float4(r, g, b, a); } // [(255, 255, 255, 255)] -> [(0~1, 0~1, 0~1, 0~1)] // 0xRRGGBBAA -> _float4( 0~1, 0~1, 0~1, 0~1 ) - static _float4 ColorRGBA_HEXtoFLOAT4(_uint hexCode) { + inline static _float4 ColorRGBA_HEXtoFLOAT4(_uint hexCode) { float r, g, b, a; DecodeRGBA(hexCode, r, g, b, a, true); return _float4(r, g, b, a); } // [(255, 255, 255, xx), alpha] -> [(0~1, 0~1, 0~1, alpha)] // 0xRRGGBBxx, alpha -> _vector( 0~1, 0~1, 0~1, alpha ) - static _vector ColorRGB_A_HEXtoVECTOR(_uint hexCode, _float alpha) { + inline static _vector ColorRGB_A_HEXtoVECTOR(_uint hexCode, _float alpha) { float r, g, b, a; DecodeRGBA(hexCode, r, g, b, a, false); a = alpha; return XMVectorSet(r, g, b, a); } // [(255, 255, 255, 255)] -> [(0~1, 0~1, 0~1, 0~1)] // 0xRRGGBBAA -> _vector( 0~1, 0~1, 0~1, 0~1 ) - static _vector ColorRGBA_HEXtoVECTOR(_uint hexCode) { + inline static _vector ColorRGBA_HEXtoVECTOR(_uint hexCode) { float r, g, b, a; DecodeRGBA(hexCode, r, g, b, a, true); return XMVectorSet(r, g, b, a); } #pragma endregion #pragma region String // wstring --> string 변환 - static _string ToString(const _wstring& var) + inline static _string ToString(const _wstring& var) { int size_needed = WideCharToMultiByte(CP_UTF8, 0, var.c_str(), (int)var.size(), nullptr, 0, nullptr, nullptr); @@ -52,7 +52,7 @@ class CMyTools { } // string --> wstring 변환 - static _wstring ToWstring(const _string& var) + inline static _wstring ToWstring(const _string& var) { int size_needed = MultiByteToWideChar(CP_UTF8, 0, var.c_str(), (int)var.size(), nullptr, 0); @@ -65,7 +65,7 @@ class CMyTools { } // source에 keyword가 있는지 검사 - static _bool ContainsString(const char* source, const char* keyword) { + inline static _bool ContainsString(const char* source, const char* keyword) { if (!source || !keyword || *keyword == '\0') { return false; } @@ -75,13 +75,13 @@ class CMyTools { #pragma endregion #pragma region Mathematics // ratio로 현재 value 가져오기 - static _float Lerp_f1D(_float fA, _float fB, _float fRatio) + inline static _float Lerp_f1D(_float fA, _float fB, _float fRatio) { return fA + (fB - fA) * fRatio; } // value로 현재 ratio 가져오기 - static _float InverseLerp_f1D(_float fA, _float fB, _float fValue) + inline static _float InverseLerp_f1D(_float fA, _float fB, _float fValue) { if (fA == fB) { return 0.0f; @@ -101,7 +101,7 @@ class CMyTools { } // dx9에 있던 IntersectTri - static _bool IntersectTri( + inline static _bool IntersectTri( const _fvector& vPos, const _fvector& vDir, const _fvector& vertexA, const _gvector& vertexB, const _hvector& vertexC, _float& t, _float& u, _float& v) @@ -130,17 +130,24 @@ class CMyTools { return t >= 0.f; } - // 매트릭스 럴프 - static void MatrixLerp( _In_ _float4x4* pMatOrigin, // Origin -> 0 + inline static void MatrixLerp( _In_ _float4x4* pMatOrigin, // Origin -> 0 _In_ _float4x4* pMatTarget, // Target -> 1 _Out_ _float4x4& matOut, _float fRatio) { + _matrix matOrigin = XMLoadFloat4x4(pMatOrigin); + _matrix matTarget = XMLoadFloat4x4(pMatTarget); + MatrixLerp(&matOrigin, &matTarget, matOut, fRatio); + } + + inline static void MatrixLerp( _In_ _matrix* pMatOrigin, // Origin -> 0 + _In_ _matrix* pMatTarget, // Target -> 1 + _Out_ _float4x4& matOut, _float fRatio) { fRatio = Saturate(fRatio); _vector vTargetScale{}, vTargetRotq{}, vTargetTrans{}; _vector vOriginScale{}, vOriginRotq{}, vOriginTrans{}; - XMMatrixDecompose(&vTargetScale, &vTargetRotq, &vTargetTrans, XMLoadFloat4x4(pMatTarget)); - XMMatrixDecompose(&vOriginScale, &vOriginRotq, &vOriginTrans, XMLoadFloat4x4(pMatOrigin)); + XMMatrixDecompose(&vTargetScale, &vTargetRotq, &vTargetTrans, *pMatTarget); + XMMatrixDecompose(&vOriginScale, &vOriginRotq, &vOriginTrans, *pMatOrigin); vTargetScale = XMVectorLerp(vOriginScale, vTargetScale, fRatio); vTargetRotq = XMQuaternionSlerp(vOriginRotq, vTargetRotq, fRatio); @@ -150,7 +157,7 @@ class CMyTools { } // 비슷하면 1 직교하면 0 완전 반대방향일수록 -1 - static _float DirectionCompare(_vector a, _vector b) + inline static _float DirectionCompare(_vector a, _vector b) { _vector vNormalA = XMVector3Normalize(a); _vector vNormalB = XMVector3Normalize(b); @@ -158,7 +165,7 @@ class CMyTools { } // hlsl에 있는 Saturate - static _float Saturate(_float fValue) { + inline static _float Saturate(_float fValue) { if (fValue > 1.f) { fValue = 1.f; } @@ -169,7 +176,7 @@ class CMyTools { } // 입력 라디안이 들어오면 -PI ~ +PI로 정규화된 라디안으로 변경 - static _float NormalizeRadian(_float fRadian) + inline static _float NormalizeRadian(_float fRadian) { fRadian = fmodf(fRadian, XM_2PI); if (fRadian <= -XM_PI) { @@ -267,6 +274,40 @@ class CMyTools { vAccumulateRadianPitchYaw.x = -fPitchLimitRadian; } } + static inline _vector MakeQuaternionFromTo(_vector vAOrigin, _vector vBDest) + { + vAOrigin = XMVector3Normalize(vAOrigin); + vBDest = XMVector3Normalize(vBDest); + + _float fDot = XMVectorGetX(XMVector3Dot(vAOrigin, vBDest)); + + if ( 1.f - fDot < FLT_EPSILON) { // 같은 방향 제외 + return XMQuaternionIdentity(); + } + if (fDot < -1.f + FLT_EPSILON) { // 반대방향 제외 + _vector vTempAxis = XMVector3Cross(vAOrigin, XMVectorSet(1.f, 0.f, 0.f, 0.f)); + _float fTempLength = XMVectorGetX(XMVector3Length(vTempAxis)); + + if (fTempLength < FLT_EPSILON5) { + vTempAxis = XMVector3Cross(vAOrigin, XMVectorSet(0.f, 0.f, 1.f, 0.f)); + } + + vTempAxis = XMVector3Normalize(vTempAxis); + return XMQuaternionRotationAxis(vTempAxis, XM_PI); + } + + _vector vRotAxis = XMVector3Cross(vAOrigin, vBDest); + _float fRotLength = XMVectorGetX(XMVector3Length(vRotAxis)); + if (fRotLength < FLT_EPSILON5) { + return XMQuaternionIdentity(); + } + vRotAxis = XMVector3Normalize(vRotAxis); + + _float fRotAngle = acosf(clamp(fDot, -1.f, 1.f)); + _vector vRotQ = XMQuaternionRotationAxis(vRotAxis, fRotAngle); + return XMQuaternionNormalize(vRotQ); + } + inline static void SortHitsByDistance(vector& hits) { @@ -296,6 +337,24 @@ class CMyTools { return (Alphabet - 'A'); } + + inline static PSX::PxTransform MakeJointWorldPoseFromRouteEnd(PSX::PxRigidActor* routeRigidActor, _float3 vCapsuleHalfLengths, bool isHeadEnd) + { + PSX::PxShape* shapeArray[1] = {}; + routeRigidActor->getShapes(shapeArray, 1); + + PSX::PxShape* routeShape = shapeArray[0]; + + const PSX::PxTransform pxRouteWorldTransfom = PSX::PxShapeExt::getGlobalPose(*routeShape, *routeRigidActor); + + const PSX::PxVec3 capsuleAxisWorld = pxRouteWorldTransfom.q.rotate(PSX::PxVec3(1.f, 0.f, 0.f)); + + PSX::PxTransform jointWorldPose; + jointWorldPose.q = pxRouteWorldTransfom.q; + jointWorldPose.p = pxRouteWorldTransfom.p + (isHeadEnd ? 1.f : -1.f) * capsuleAxisWorld * (vCapsuleHalfLengths.y + vCapsuleHalfLengths.x); + + return jointWorldPose; + } #pragma endregion #pragma region FileSystem //static void Folder_Func(/* 재귀적으로 탐색할지 */ _In_ _bool bRecursive, diff --git a/Jusin154_Team3D/Engine/Public/PhysX/PxRigidDynamic.h b/Jusin154_Team3D/Engine/Public/PhysX/PxRigidDynamic.h index 642de486a..c467b573f 100644 --- a/Jusin154_Team3D/Engine/Public/PhysX/PxRigidDynamic.h +++ b/Jusin154_Team3D/Engine/Public/PhysX/PxRigidDynamic.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 diff --git a/Jusin154_Team3D/Engine/Public/PhysX/extensions/PxD6Joint.h b/Jusin154_Team3D/Engine/Public/PhysX/extensions/PxD6Joint.h index 12e7014b5..66e70e1e1 100644 --- a/Jusin154_Team3D/Engine/Public/PhysX/extensions/PxD6Joint.h +++ b/Jusin154_Team3D/Engine/Public/PhysX/extensions/PxD6Joint.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 diff --git a/Jusin154_Team3D/Engine/Public/PhysX/extensions/PxExtensionsAPI.h b/Jusin154_Team3D/Engine/Public/PhysX/extensions/PxExtensionsAPI.h index 99a2a2af1..5516b6855 100644 --- a/Jusin154_Team3D/Engine/Public/PhysX/extensions/PxExtensionsAPI.h +++ b/Jusin154_Team3D/Engine/Public/PhysX/extensions/PxExtensionsAPI.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 diff --git a/Jusin154_Team3D/Engine/Public/PhysX/foundation/PxMath.h b/Jusin154_Team3D/Engine/Public/PhysX/foundation/PxMath.h index b2866f485..e004b2df9 100644 --- a/Jusin154_Team3D/Engine/Public/PhysX/foundation/PxMath.h +++ b/Jusin154_Team3D/Engine/Public/PhysX/foundation/PxMath.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 diff --git a/Jusin154_Team3D/Engine/Public/PhysX_Manager.h b/Jusin154_Team3D/Engine/Public/PhysX_Manager.h index bdfb0cc60..13c86a027 100644 --- a/Jusin154_Team3D/Engine/Public/PhysX_Manager.h +++ b/Jusin154_Team3D/Engine/Public/PhysX_Manager.h @@ -11,6 +11,16 @@ class CMesh; class CPhysX_Manager final : public CBase { +private: + // 주의: 피직스 내부 플래그 전용. 건드리려면 먼저 말하고 건드리기 + // 가장 기본이 되는 필터 플래그 + enum COLLISIONCATERGORY_BIT32 : uint32_t + { + CharacterController = 1u << 0 + , JointedParts = 1u << 1 + , WorldStatic = 1u << 2 + , WorldDynamic = 1u << 3 + }; private: CPhysX_Manager(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual ~CPhysX_Manager() = default; @@ -23,7 +33,10 @@ class CPhysX_Manager final : public CBase PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody_Dynamic& RigidBody, _uint iLevel); PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel); - PSX::PxRevoluteJoint* Create_PxRevoluteJoint(PSX::PxRigidActor* pActorFrame, PSX::PxTransform& pxLocalWallFrame, PSX::PxRigidActor* pActorObject, PSX::PxTransform& pxLocalActorFrame, _uint iLevel); + + // https://documentation.help/nvidia-physx-sdk-guide/Joints.html + PSX::PxJoint* Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1); + PSX::PxD6Joint* Create_PxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos); void RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh, _uint iLevel); void RegistHeight(const _tchar* pName, PSX::PxHeightFieldDesc& Desc, _uint iLevel); @@ -41,7 +54,7 @@ class CPhysX_Manager final : public CBase #ifdef EDITOR_PROJECT HRESULT SaveTriMeshes(const _char* pPath, vector& TriMeshes); - void Add_Editor_Plane(PhsXUserData& PlaneData); + void Add_Editor_Plane(PHYSX_USERDATA& PlaneData); #endif // EDITOR_PROJECT HRESULT LoadTriMeshes(const _char* pPath, vector& TriMeshes); //HRESULT LoadTriMeshes_Binary(const _char* pPath, vector& TriMeshes); @@ -60,6 +73,7 @@ class CPhysX_Manager final : public CBase public: PSX::PxController* Add_CapsuleController(PSX::PxCapsuleControllerDesc& Desc); PSX::PxController* Add_BoxController(PSX::PxBoxControllerDesc& Desc); + void ApplyFilterData(PSX::PxRigidActor* pRigidActor); PSX::PxController* Get_Controller(_uint iControllerIndex); void ReleaseController(_uint iControllerIndex); @@ -102,7 +116,7 @@ class CPhysX_Manager final : public CBase map<_wstring, PSX::PxHeightFieldGeometry*>* m_HeightFieldGeometry = { nullptr }; - PhsXUserData PlaneData = {}; + PHYSX_USERDATA PlaneData = {}; vector m_pMaterials = { }; _uint m_iNumLevel = { UINT_MAX }; @@ -114,7 +128,13 @@ class CPhysX_Manager final : public CBase void Update_Kinematic(); void Update_Dynamic_ActiveActors(); - //void Update_Dynamic_AllActors(); + void FixCapsuleShapeAxisToY(PSX::PxShape* pShape); + uint32_t ConvertPhysxKindToBit(const PHYSX_USERDATA& physxKind); + uint32_t BuildCollisionMaskFromCategoryBit(uint32_t iMyBit); + static PSX::PxFilterFlags SimulationFilterShader(PSX::PxFilterObjectAttributes pxAttributes0, PSX::PxFilterData pxFilterData0, + PSX::PxFilterObjectAttributes pxAttributes1, PSX::PxFilterData pxFilterData1, + PSX::PxPairFlags& pxPairFlags, const void* pConstantBlock, PSX::PxU32 iConstantBlockSize); + public: static CPhysX_Manager* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, _uint iLevel); diff --git a/Jusin154_Team3D/Engine/Public/Prototype_Manager.h b/Jusin154_Team3D/Engine/Public/Prototype_Manager.h index c4386893b..13526382b 100644 --- a/Jusin154_Team3D/Engine/Public/Prototype_Manager.h +++ b/Jusin154_Team3D/Engine/Public/Prototype_Manager.h @@ -7,6 +7,7 @@ #include "Navigation.h" #include "RigidBody_Dynamic.h" #include "RigidBody_Static.h" +#include "Dynamic_D6Joint.h" #include "Texture.h" #include "Cell.h" #include "Model.h" diff --git a/Jusin154_Team3D/Engine/Public/RigidBody.h b/Jusin154_Team3D/Engine/Public/RigidBody.h index 54c5fc3d2..b1028e9dd 100644 --- a/Jusin154_Team3D/Engine/Public/RigidBody.h +++ b/Jusin154_Team3D/Engine/Public/RigidBody.h @@ -39,6 +39,8 @@ class ENGINE_DLL CRigidBody abstract : public CComponent PSX::PxShapeFlags Get_ShapeFlags() const { return m_ePxShapeFlags; } PSX::PxRigidBodyFlags Get_RigidBodyFlags() const { return m_ePxRigidBodyFlags; } + PHYSX_USERDATA* Get_UserDataPtr() { return &m_tagData; }; + protected: ACTOR m_eActorType = ACTOR::END; PSX::PxRigidBodyFlags m_ePxRigidBodyFlags = { }; @@ -49,7 +51,7 @@ class ENGINE_DLL CRigidBody abstract : public CComponent _float3 m_vLocalTranslation = { 0.f, 0.f, 0.f }; CTransform* m_pTransform = { nullptr }; - PhsXUserData m_tagData = {}; + PHYSX_USERDATA m_tagData = {}; protected: virtual HRESULT Initialize(void* pArg); diff --git a/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h b/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h index 29288d8e4..f49664b07 100644 --- a/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h +++ b/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h @@ -19,7 +19,7 @@ class ENGINE_DLL CRigidBody_Dynamic : public CRigidBody typedef struct tagRigidBody_DYNAMIC_Desc : public CRigidBody::RIGIDBODY_DESC { - + _bool bAutoOwnerTranslation = true; }RIGIDBODY_DYNAMIC_DESC; private: @@ -31,18 +31,27 @@ class ENGINE_DLL CRigidBody_Dynamic : public CRigidBody #ifdef _DEBUG _float3 Get_LocalTranslation() {return m_vLocalTranslation; } virtual HRESULT Render()override; + HRESULT Render(function custumState); #endif // _DEBUG virtual PSX::PxRigidDynamic* Get_Actor() override { return m_pRigidBody; }; + void Set_Name(const _char* szName); _float3 Get_HalfGeometryInfo() const { return m_vhalfGeometryInfo; } void Set_HalfGeometryInfo(_float3 vhalfGeometryInfo); - void Move_LocalPos(_float4 vNewRotQ, _float3 vNewTranslation); + + + void Move_LocalPos(_matrix newLocalPos);// 캡슐은 이 함수 쓸 거면 말하고 써야함 + void Move_LocalPos(_fvector vNewRotQ, _gvector vNewTranslation);// 캡슐은 이 함수 쓸 거면 말하고 써야함 + void Move_LocalPos(_float4& vNewRotQ, _float3& vNewTranslation);// 캡슐은 이 함수 쓸 거면 말하고 써야함 _float Get_Density() const { return m_fDensity; } _float Get_Mass(); virtual void Add_Force(_fvector vForce, PSX::PxForceMode::Enum eType = PSX::PxForceMode::Enum::eFORCE); // 속도 + 방향 virtual void Add_Torque(_fvector vDirection, PSX::PxForceMode::Enum eType = PSX::PxForceMode::Enum::eFORCE); // 방향 ( 회전축은 MassCenter ) void Set_Kinematic(_bool bKinematic); + void Move_Kinematic(_fmatrix xmTransform, _bool bTeleport = true); + void Move_Kinematic(_fvector vPos, _gvector vRotq, _bool bTeleport = true); + void Move_Kinematic(PSX::PxTransform& pxDestination, _bool bTeleport = true); HRESULT ConvertToCCT(class CCharacter_Controller& CCTOriginal); void Detach_Actor(_uint iLevel); @@ -50,12 +59,20 @@ class ENGINE_DLL CRigidBody_Dynamic : public CRigidBody void SetActive(_bool bCondition) { m_bActive = bCondition; } _vector Get_Position(); - void Set_Position(_vector vPos); - void Set_Rotation(_vector vRotQ); - void Set_Transform(_vector vPos, _vector vRotQ); - void Set_Transform(PSX::PxTransform pxTransform); + void Set_Position(_vector vPos, _bool bTeleport); + void Set_Rotation(_vector vRotQ, _bool bTeleport); + void Set_AutoOwnerTranlation(_bool bAutoOwnerTranslation) { m_tagData.bAutoOwnerTranslation = bAutoOwnerTranslation; }; + _bool Get_AutoOwnerTranlation() { return m_tagData.bAutoOwnerTranslation; }; + + void Set_Transform(_matrix WorldMatrix, _bool bTeleport); + void Set_Transform(_vector vPos, _vector vRotQ, _bool bTeleport); + void Set_Transform(PSX::PxTransform pxTransform, _bool bTeleport); + + void Set_CenterTransform(_vector vStart, _vector vEnd, _bool bTeleport); _float3 Get_FootPosition(); _float3 Get_HeadPosition(); + PSX::PxTransform Get_GlobalPosition(); + PSX::PxTransform Get_HeadPositionPxTransform(); PSX::PxTransform Get_FootPositionPxTransform(); private: PSX::PxRigidDynamic* m_pRigidBody = { nullptr }; // 실제 시뮬레이션을 도는 본체 @@ -75,6 +92,7 @@ class ENGINE_DLL CRigidBody_Dynamic : public CRigidBody private: HRESULT Initialize_Prototype(RIGIDBODY_PROTOTYPE_DYNAMIC_DESC& Desc); virtual HRESULT Initialize(void* pArg) override; +// void Move(PSX::PxTransform& pxTransform, _bool bTeleport); #ifdef _DEBUG HRESULT Add_DebugShape(); diff --git a/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic_Joint.h b/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic_Joint.h deleted file mode 100644 index def8cb1dc..000000000 --- a/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic_Joint.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once -class CDynamic_Joint -{ - -}; - diff --git a/Jusin154_Team3D/Engine/Public/State.h b/Jusin154_Team3D/Engine/Public/State.h index 06f76f2c0..d62346d41 100644 --- a/Jusin154_Team3D/Engine/Public/State.h +++ b/Jusin154_Team3D/Engine/Public/State.h @@ -26,7 +26,7 @@ enum ESTATE BROOM_IDLE,BROOM_FWD,BROOM_LEFT,BROOM_RIGHT,BROOM_DOWN,BROOM_UP, BROOM_REVELIO, BROOM_HOVER_IDLE, BROOM_HOVER_FWD, BROOM_HOVER_LEFT, BROOM_HOVER_RIGHT, BROOM_HOVER_START, BROOM_HOVER_REVELIO,BROOM_MOUNT, BROOM_MOUNT_END,BROOM_DISMOUNT,BROOM_TURBO_FWD, BROOM_TURBO_DOWN, BROOM_TURBO_UP, BROOM_TURBO_LEFT, BROOM_TURBO_RIGHT, RUSH_START,RUSH_LOOP,RUSH_END, THROW_ROCK_START,THROW_ROCK, - BACKHAND_SWING_JOG,SWING_FWD,SLAM, + BACKHAND_SWING_JOG,SWING_FWD,SLAM,SLASH,DASH, SUSTAIN_START,SUSTAIN_LOOP,SUSTAIN_END, BLINK,BLINK_START, HIT, HIT_FWD, HIT_BWD, HIT_BWD2, HIT_BWD3, HIT_BWD4, HIT_L, HIT_R,HIT_FACE,HIT_FACE_END,HIT_LEVIOSO,INCARCEROUS, diff --git a/Jusin154_Team3D/Engine/Public/pch.h b/Jusin154_Team3D/Engine/Public/pch.h index c226fdfe9..590dbf9ac 100644 --- a/Jusin154_Team3D/Engine/Public/pch.h +++ b/Jusin154_Team3D/Engine/Public/pch.h @@ -79,9 +79,9 @@ using namespace FMOD; #pragma warning(push) #pragma warning(disable: 26495) #pragma warning(disable: 33010) - -#include "PhysX/PxPhysics.h" +#include "PhysX/foundation/PxMath.h" #include "PhysX/PxPhysicsAPI.h" +#include "PhysX/extensions/PxExtensionsAPI.h" #pragma warning(pop) diff --git a/Jusin154_Team3D/Update_Lib.bat b/Jusin154_Team3D/Update_Lib.bat index 61455f141..76d78382e 100644 --- a/Jusin154_Team3D/Update_Lib.bat +++ b/Jusin154_Team3D/Update_Lib.bat @@ -36,8 +36,12 @@ xcopy /y .\Engine\Bin\Assimp\assimp-vc145-mt.dll .\Editor\Bin\Release\ :: fMod는 아쉽게도 pdb가 없기 때문에 안옮김 xcopy /y .\Engine\ThirdPartyLib\Assimp\assimp-vc145-mtd.pdb .\Client\Bin\Debug\ xcopy /y .\Engine\ThirdPartyLib\Assimp\assimp-vc145-mt.pdb .\Client\Bin\Release\ +xcopy /y .\Engine\ThirdPartyLib\PhysX_debug\*.pdb .\Client\Bin\Debug\ +xcopy /y .\Engine\ThirdPartyLib\PhysX_release\*.pdb .\Client\Bin\Release\ xcopy /y .\Engine\ThirdPartyLib\Assimp\assimp-vc145-mtd.pdb .\Editor\Bin\Debug\ xcopy /y .\Engine\ThirdPartyLib\Assimp\assimp-vc145-mt.pdb .\Editor\Bin\Release\ +xcopy /y .\Engine\ThirdPartyLib\PhysX_debug\*.pdb .\Editor\Bin\Debug\ +xcopy /y .\Engine\ThirdPartyLib\PhysX_release\*.pdb .\Editor\Bin\Release\ xcopy /y .\Editor\ThirdPartyLib\ZLib\Debug\zlibd.pdb .\Editor\Bin\Debug\ xcopy /y .\Editor\ThirdPartyLib\ZLib\Release\zlib.pdb .\Editor\Bin\Release\ @@ -55,3 +59,5 @@ xcopy /y .\Engine\ThirdPartyLib\fMod\fmod_vc.lib .\EngineSDK\Lib\Debug\ xcopy /y .\Engine\ThirdPartyLib\fMod\fmod_vc.lib .\EngineSDK\Lib\Release\ xcopy /y .\Engine\ThirdPartyLib\DirectXTK\DirectXTKd.lib .\EngineSDK\Lib\Debug\ +xcopy /y .\Engine\ThirdPartyLib\PhysX\PhysX_debug\*.lib .\EngineSDK\Lib\Debug\ +xcopy /y .\Engine\ThirdPartyLib\PhysX\PhysX_release\*.lib .\EngineSDK\Lib\Release\