diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl index e0fd8e188..06f94131b 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl @@ -1,15 +1,6 @@ #include "Engine_Shader_Defines.hlsli" -struct SkinngMesh -{ - float3 vPosition; - float3 vNormal; - float3 vTangent; - float3 vBinormal; - float2 vTexcoord; -}; - matrix g_WorldMatrix, g_ViewMatrix, g_ProjMatrix; @@ -31,7 +22,6 @@ Texture2D g_DAOTexture : register(t2); Texture2D g_THVTexture : register(t3); Texture2D g_SurfaceParamsTexture : register(t4); -StructuredBuffer g_SkinngMesh : register(t5); float3 g_RootColor; float3 g_TipColor; @@ -67,31 +57,23 @@ struct VS_OUT float4 vWorldPos : TEXCOORD1; float4 vProjPos : TEXCOORD2; }; -VS_OUT VS_MAIN(VS_IN In, uint vertexID : SV_VertexID) +VS_OUT VS_MAIN(VS_IN In) { VS_OUT Out; - //float fWeightW = 1.f - (In.vBlendWeight.x + In.vBlendWeight.y + In.vBlendWeight.z); - - //matrix BoneMatrix = - // mul(g_BoneMatrices[In.vBlendIndex.x], In.vBlendWeight.x) + - // mul(g_BoneMatrices[In.vBlendIndex.y], In.vBlendWeight.y) + - // mul(g_BoneMatrices[In.vBlendIndex.z], In.vBlendWeight.z) + - // mul(g_BoneMatrices[In.vBlendIndex.w], fWeightW); - - //vector vPosition = mul(vector(In.vPosition, 1.f), BoneMatrix); - //vector vNormal = mul(vector(In.vNormal, 0.f), BoneMatrix); - //vector vBinormal = mul(vector(In.vBinormal, 0.f), BoneMatrix); - //vector vTangent = mul(vector(In.vTangent, 0.f), BoneMatrix); + float fWeightW = 1.f - (In.vBlendWeight.x + In.vBlendWeight.y + In.vBlendWeight.z); + matrix BoneMatrix = + mul(g_BoneMatrices[In.vBlendIndex.x], In.vBlendWeight.x) + + mul(g_BoneMatrices[In.vBlendIndex.y], In.vBlendWeight.y) + + mul(g_BoneMatrices[In.vBlendIndex.z], In.vBlendWeight.z) + + mul(g_BoneMatrices[In.vBlendIndex.w], fWeightW); + vector vPosition = mul(vector(In.vPosition, 1.f), BoneMatrix); + vector vNormal = mul(vector(In.vNormal, 0.f), BoneMatrix); + vector vBinormal = mul(vector(In.vBinormal, 0.f), BoneMatrix); + vector vTangent = mul(vector(In.vTangent, 0.f), BoneMatrix); matrix matWV, matWVP; - vector vPosition = float4(g_SkinngMesh[vertexID].vPosition, 1.f); - - vector vNormal = float4(g_SkinngMesh[vertexID].vNormal, 0.f); - vector vBinormal = float4(g_SkinngMesh[vertexID].vBinormal, 0.f); - vector vTangent = float4(g_SkinngMesh[vertexID].vTangent, 0.f); - matWV = mul(g_WorldMatrix, g_ViewMatrix); matWVP = mul(matWV, g_ProjMatrix); @@ -99,7 +81,7 @@ VS_OUT VS_MAIN(VS_IN In, uint vertexID : SV_VertexID) Out.vNormal = normalize(mul(vNormal, g_WorldMatrix)).xyz; Out.vBinormal = normalize(mul(vBinormal, g_WorldMatrix)).xyz; Out.vTangent = normalize(mul(vTangent, g_WorldMatrix)).xyz; - Out.vTexcoord = g_SkinngMesh[vertexID].vTexcoord; + Out.vTexcoord = In.vTexcoord; //In.vTexcoord; Out.vWorldPos = mul(vPosition, g_WorldMatrix); Out.vProjPos = Out.vPosition; diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index ac7982b2b..196e7b62e 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -300,7 +300,7 @@ {7e8b7123-11fb-4946-99fe-3265932d0536} - + {072a4e85-ba07-4ffd-bdb1-ddac02558242} @@ -340,9 +340,6 @@ {0b8cac41-419f-48ce-87bc-805b8962b4df} - - {37f63815-c3b1-4e85-8b38-a502635d43e6} - @@ -650,7 +647,7 @@ 50.UI\GamePlay_Canvas\Action_Panel\HPBarBG - + 02.GameObjects\Camera\Camera_Gaze @@ -969,7 +966,7 @@ 50.UI\GamePlay_Canvas\Action_Panel\HPBarBG - + 02.GameObjects\Camera\Camera_Gaze diff --git a/Jusin154_Team3D/Editor/Private/Goblin.cpp b/Jusin154_Team3D/Editor/Private/Goblin.cpp index 35a0f34eb..5756bd09d 100644 --- a/Jusin154_Team3D/Editor/Private/Goblin.cpp +++ b/Jusin154_Team3D/Editor/Private/Goblin.cpp @@ -41,7 +41,7 @@ void CGoblin::Update(_float fTimeDelta) { m_pModelCom->Play_Animation(fTimeDelta, m_pTransformCom); - m_pModelCom->ComputeSkinning(); + //m_pModelCom->ComputeSkinning(); } void CGoblin::Late_Update(_float fTimeDelta) @@ -71,8 +71,8 @@ HRESULT CGoblin::Render() return E_FAIL; } - if (FAILED(m_pModelCom->Bind_CS_Output(5, 0))) - return E_FAIL; + //if (FAILED(m_pModelCom->Bind_CS_Output(5, 0))) + // return E_FAIL; if (FAILED(m_pModelCom->Render(i))) { return E_FAIL; diff --git a/Jusin154_Team3D/Editor/Private/Player.cpp b/Jusin154_Team3D/Editor/Private/Player.cpp index a37223681..09f1428d1 100644 --- a/Jusin154_Team3D/Editor/Private/Player.cpp +++ b/Jusin154_Team3D/Editor/Private/Player.cpp @@ -69,7 +69,7 @@ void CPlayer::Priority_Update(_float fTimeDelta) void CPlayer::Update(_float fTimeDelta) { - m_pModelCom->ComputeSkinning(); + //m_pModelCom->ComputeSkinning(); IsSprint(); IsWalk(); @@ -109,8 +109,8 @@ HRESULT CPlayer::Render() return E_FAIL; } - if (FAILED(m_pModelCom->Bind_CS_Output(5, i))) - return E_FAIL; + //if (FAILED(m_pModelCom->Bind_CS_Output(5, i))) + // return E_FAIL; if (FAILED(m_pModelCom->Render(i))) { return E_FAIL; @@ -237,18 +237,20 @@ HRESULT CPlayer::InputSystem() HRESULT CPlayer::InputSkill() { - if (m_pGameInstance->Key_Down(DIK_SPACE) - || m_pGameInstance->Key_Down(DIK_Q) + if ( + m_pGameInstance->Key_Down(DIK_SPACE) + || m_pGameInstance->Key_Down(DIK_LCONTROL) || m_pGameInstance->Key_Down(DIK_E) || m_pGameInstance->Key_Down(DIK_R) - || m_pGameInstance->Key_Down(DIK_F) - || m_pGameInstance->Key_Down(DIK_Z) - || m_pGameInstance->Key_Down(DIK_X) - || m_pGameInstance->Key_Down(DIK_C) - || m_pGameInstance->Key_Down(DIK_V) - || m_pGameInstance->Key_Down(DIK_T) - || m_pGameInstance->Key_Down(DIK_G) - || m_pGameInstance->Key_Down(DIK_B)) + || m_pGameInstance->Key_Down(DIK_Q) + || m_pGameInstance->Mouse_Up(DIM_LBUTTON) + || m_pGameInstance->Key_Down(DIK_1) + //|| m_pGameInstance->Key_Down(DIK_C) + //|| m_pGameInstance->Key_Down(DIK_V) + //|| m_pGameInstance->Key_Down(DIK_T) + //|| m_pGameInstance->Key_Down(DIK_G) + //|| m_pGameInstance->Key_Down(DIK_B) + ) { return S_OK; } @@ -257,10 +259,10 @@ HRESULT CPlayer::InputSkill() HRESULT CPlayer::InputMove() { - if (m_pGameInstance->Key_Pressing(DIK_UP) - || m_pGameInstance->Key_Pressing(DIK_LEFT) - || m_pGameInstance->Key_Pressing(DIK_DOWN) - || m_pGameInstance->Key_Pressing(DIK_RIGHT)) + if (m_pGameInstance->Key_Pressing(DIK_W) + || m_pGameInstance->Key_Pressing(DIK_A) + || m_pGameInstance->Key_Pressing(DIK_S) + || m_pGameInstance->Key_Pressing(DIK_D)) { return S_OK; } @@ -277,6 +279,9 @@ void CPlayer::Behavior_IdleEnter() { else if (m_pFSM->IsEnable_Previous(FSMSTATE::WALK)) { pairAnimInfo = m_Animation[STATEANIM::WALK_STOP]; } + else if (m_pFSM->IsEnable_Previous(FSMSTATE::SPRINT)) { + // pairAnimInfo = m_Animation[STATEANIM::spr] + } } m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); @@ -291,7 +296,27 @@ HRESULT CPlayer::Behavior_IdleExitCheck() return S_OK; } if (SUCCEEDED(InputSkill())) { - // Action + if (m_pGameInstance->Key_Down(DIK_SPACE)) { + m_pFSM->Change_State(FSMSTATE::JUMP); + } + else if (m_pGameInstance->Key_Down(DIK_LCONTROL)) { + m_pFSM->Change_State(FSMSTATE::DODGE); + } + else if (m_pGameInstance->Key_Down(DIK_E)) { + //m_pFSM->Change_State(FSMSTATE::AAA); + } + else if (m_pGameInstance->Key_Down(DIK_R)) { + //m_pFSM->Change_State(FSMSTATE::SKILL); + } + else if (m_pGameInstance->Key_Down(DIK_Q)) { + //m_pFSM->Change_State(FSMSTATE::SKILL2); + } + else if (m_pGameInstance->Mouse_Up(DIM_LBUTTON)) { + //m_pFSM->Change_State(FSMSTATE::LIGHT_ATTACK); + } + else if (m_pGameInstance->Key_Down(DIK_1)) { + //m_pFSM->Change_State(FSMSTATE::CAST); + } return E_FAIL; } if (SUCCEEDED(InputMove())) { @@ -301,27 +326,39 @@ HRESULT CPlayer::Behavior_IdleExitCheck() return S_OK; } +void CPlayer::Behavior_IdleExit() +{ + m_pFSM->Disable_State(FSMSTATE::IDLE); +} + void CPlayer::Behavior_MoveEnter() { pair<_uint, _bool> pairAnimInfo = m_Animation[STATEANIM::SPRINT]; - _bool bFoward = m_pGameInstance->Key_Pressing(DIK_UP); - _bool bLeft = m_pGameInstance->Key_Pressing(DIK_LEFT); - _bool bRight = m_pGameInstance->Key_Pressing(DIK_RIGHT); - _bool bBackward = m_pGameInstance->Key_Pressing(DIK_DOWN); + _bool bFoward = m_pGameInstance->Key_Pressing(DIK_W); + _bool bLeft = m_pGameInstance->Key_Pressing(DIK_A); + _bool bRight = m_pGameInstance->Key_Pressing(DIK_D); + _bool bBackward = m_pGameInstance->Key_Pressing(DIK_S); if (m_pFSM->IsEnable_Previous(FSMSTATE::IDLE | FSMSTATE::DODGE | FSMSTATE::LAND | FSMSTATE::COMBAT)) { if (m_pFSM->IsEnable_Previous(FSMSTATE::IDLE)) { // Idle -> Move if (true == m_bSprintToggle) { + m_pFSM->Enable_State(FSMSTATE::SPRINT); + if (true == bFoward) { pairAnimInfo = m_Animation[STATEANIM::SPRINT]; } + else { + // ? + } } else if (true == m_bWalkToggle) { + m_pFSM->Enable_State(FSMSTATE::WALK); + if (true == bFoward) { pairAnimInfo = m_Animation[STATEANIM::WALK_FWD]; } - else { + else if (true == bBackward) { pairAnimInfo = m_Animation[STATEANIM::WALK_BWD]; } } @@ -337,16 +374,24 @@ void CPlayer::Behavior_MoveEnter() } else { // While Moving if (true == m_bSprintToggle) { + m_pFSM->Enable_State(FSMSTATE::SPRINT); pairAnimInfo = m_Animation[STATEANIM::SPRINT]; } else if (true == m_bWalkToggle) { + m_pFSM->Enable_State(FSMSTATE::WALK); if (true == bFoward) { pairAnimInfo = m_Animation[STATEANIM::WALK_FWD]; - } - else { + } + else if (true == bBackward){ pairAnimInfo = m_Animation[STATEANIM::WALK_BWD]; } + //else if (true == bLeft){ + // pairAnimInfo = m_Animation[STATEANIM::WALK_STOP]; + //} + //else if (true == bRight){ + // pairAnimInfo = m_Animation[STATEANIM::WALK_BWD]; + //} } } @@ -360,7 +405,27 @@ HRESULT CPlayer::Behavior_MoveExitCheck() return S_OK; } if (SUCCEEDED(InputSkill())) { - // Action + if (m_pGameInstance->Key_Down(DIK_SPACE)) { + m_pFSM->Change_State(FSMSTATE::JUMP); + } + else if (m_pGameInstance->Key_Down(DIK_LCONTROL)) { + m_pFSM->Change_State(FSMSTATE::DODGE); + } + else if (m_pGameInstance->Key_Down(DIK_E)) { + //m_pFSM->Change_State(FSMSTATE::AAA); + } + else if (m_pGameInstance->Key_Down(DIK_R)) { + //m_pFSM->Change_State(FSMSTATE::SKILL); + } + else if (m_pGameInstance->Key_Down(DIK_Q)) { + //m_pFSM->Change_State(FSMSTATE::SKILL2); + } + else if (m_pGameInstance->Mouse_Up(DIM_LBUTTON)) { + //m_pFSM->Change_State(FSMSTATE::LIGHT_ATTACK); + } + else if (m_pGameInstance->Key_Down(DIK_1)) { + //m_pFSM->Change_State(FSMSTATE::CAST); + } return E_FAIL; } if (SUCCEEDED(InputMove())) { @@ -370,9 +435,15 @@ HRESULT CPlayer::Behavior_MoveExitCheck() return E_FAIL; } +void CPlayer::Behavior_MoveExit() +{ + m_pFSM->Disable_State(FSMSTATE::MOVE|FSMSTATE::SPRINT|FSMSTATE::JOG|FSMSTATE::WALK); +} + void CPlayer::Behavior_JumpEnter() { pair<_uint, _bool> pairAnimInfo = m_Animation[STATEANIM::JUMP_SPRINT]; + m_pFSM->Enable_State(FSMSTATE::JUMP); if (m_pFSM->IsEnable_Previous(FSMSTATE::IDLE|FSMSTATE::JOG|FSMSTATE::WALK)) { if (m_pFSM->IsEnable_Previous(FSMSTATE::IDLE)) { // Idle -> Jump @@ -404,6 +475,11 @@ HRESULT CPlayer::Behavior_JumpExitCheck() return S_OK; } +void CPlayer::Behavior_JumpExit() +{ + m_pFSM->Disable_State(FSMSTATE::JUMP); +} + void CPlayer::Behavior_LandEnter() { pair<_uint, _bool> pairAnimInfo = Get_AnimInfo(STATEANIM::LAND); @@ -423,6 +499,11 @@ HRESULT CPlayer::Behavior_LandExitCheck() return S_OK; } +void CPlayer::Behavior_LandExit() +{ + m_pFSM->Disable_State(FSMSTATE::LAND); +} + void CPlayer::Behavior_DodgeEnter() { // 혹시 @@ to Dodge 있으면 여기에 @@ -443,6 +524,11 @@ HRESULT CPlayer::Behavior_DodgeExitCheck() return S_OK; } +void CPlayer::Behavior_DodgeExit() +{ + m_pFSM->Disable_State(FSMSTATE::DODGE); +} + void CPlayer::Add_FSM() { #pragma region Behavior_Movement_NotFocus @@ -451,7 +537,7 @@ void CPlayer::Add_FSM() Desc.pOwner = this; Desc.funcEnterEvent = [this]() { Behavior_IdleEnter(); }; Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_IdleExitCheck(); }; - Desc.funcExitEvent = nullptr; + Desc.funcExitEvent = [this]() { Behavior_IdleExit(); }; Desc.funcPriorityUpdate = nullptr; Desc.funcLateUpdate = nullptr; m_States.emplace(FSMSTATE::IDLE, CState_Idle::Create(&Desc)); @@ -461,7 +547,7 @@ void CPlayer::Add_FSM() Desc.pOwner = this; Desc.funcEnterEvent = [this]() { Behavior_MoveEnter(); }; Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_MoveExitCheck(); }; - Desc.funcExitEvent = nullptr; + Desc.funcExitEvent = [this]() { Behavior_MoveExit(); }; Desc.funcPriorityUpdate = nullptr; Desc.funcLateUpdate = nullptr; m_States.emplace(FSMSTATE::MOVE, CState_Move::Create(&Desc)); @@ -473,7 +559,7 @@ void CPlayer::Add_FSM() Desc.pOwner = this; Desc.funcEnterEvent = [this]() { Behavior_JumpEnter(); }; Desc.funcExitCheck = [this](_float fTimeDelta) { return Behavior_JumpExitCheck(); }; - Desc.funcExitEvent = nullptr; + Desc.funcExitEvent = [this]() { Behavior_JumpExit(); }; m_States.emplace(FSMSTATE::JUMP, CState_Jump::Create(&Desc)); } { @@ -481,7 +567,7 @@ void CPlayer::Add_FSM() Desc.pOwner = this; Desc.funcEnterEvent = [this]() { Behavior_LandEnter(); }; Desc.funcExitCheck = [this](_float fTimeDelta) { return Behavior_LandExitCheck(); }; - Desc.funcExitEvent = nullptr; + Desc.funcExitEvent = [this]() { Behavior_LandExit(); }; m_States.emplace(FSMSTATE::LAND, CState_Land::Create(&Desc)); } { @@ -489,7 +575,7 @@ void CPlayer::Add_FSM() Desc.pOwner = this; Desc.funcEnterEvent = [this]() { Behavior_DodgeEnter(); }; Desc.funcExitCheck = [this](_float fTimeDelta) { return Behavior_DodgeExitCheck(); }; - Desc.funcExitEvent = nullptr; + Desc.funcExitEvent = [this]() { Behavior_DodgeExit(); }; Desc.funcPriorityUpdate = nullptr; Desc.funcLateUpdate = nullptr; m_States.emplace(FSMSTATE::DODGE, CState_Dodge::Create(&Desc)); @@ -611,3 +697,4 @@ _bool CPlayer::IsWalk() } return false; } +//////////////////// diff --git a/Jusin154_Team3D/Editor/Public/Player.h b/Jusin154_Team3D/Editor/Public/Player.h index 90f3abed9..1358244b0 100644 --- a/Jusin154_Team3D/Editor/Public/Player.h +++ b/Jusin154_Team3D/Editor/Public/Player.h @@ -50,18 +50,23 @@ class CPlayer final : public CUnit void Behavior_IdleEnter(); HRESULT Behavior_IdleExitCheck(); + void Behavior_IdleExit(); void Behavior_MoveEnter(); HRESULT Behavior_MoveExitCheck(); + void Behavior_MoveExit(); void Behavior_JumpEnter(); HRESULT Behavior_JumpExitCheck(); + void Behavior_JumpExit(); void Behavior_LandEnter(); HRESULT Behavior_LandExitCheck(); + void Behavior_LandExit(); void Behavior_DodgeEnter(); HRESULT Behavior_DodgeExitCheck(); + void Behavior_DodgeExit(); public: diff --git a/Jusin154_Team3D/Engine/Public/FSM.h b/Jusin154_Team3D/Engine/Public/FSM.h index 99e902385..1b3dea2a4 100644 --- a/Jusin154_Team3D/Engine/Public/FSM.h +++ b/Jusin154_Team3D/Engine/Public/FSM.h @@ -41,9 +41,9 @@ class ENGINE_DLL CFSM final : public CComponent CState* Get_PrevState() { return m_pPreviousState; } size_t Get_PrevStateMask() { return m_iPreviousStateMask; } - //inline void Enable_State(size_t stateMask) { *m_pStateMask |= stateMask; } - //inline void Set_State(size_t initialStateMask) { *m_pStateMask = initialStateMask; } - //inline void Disable_State(size_t stateMask) { *m_pStateMask &= ~stateMask; } + inline void Enable_State(size_t stateMask) { *m_pStateMask |= stateMask; } + inline void Set_State(size_t initialStateMask) { *m_pStateMask = initialStateMask; } + inline void Disable_State(size_t stateMask) { *m_pStateMask &= ~stateMask; } inline _bool IsEnable(size_t stateMask) const { return (*m_pStateMask & stateMask) != 0; } inline _bool IsEnable_Previous(size_t stateMask) const { return (m_iPreviousStateMask & stateMask) != 0; }