[Add] 컴쉐 적용

[Add] 플레이어 에임 상태 추가
This commit is contained in:
hyunbin14
2025-11-29 13:31:13 +09:00
parent cc67f17bdf
commit 8b34ff8866
13 changed files with 217 additions and 205 deletions
@@ -88,6 +88,9 @@ void CCamPosition_Shoulder::Priority_Update(_float fTimeDelta)
void CCamPosition_Shoulder::Update(_float fTimeDelta)
{
GUI::DragFloat3("Camera Shoulder Position",(_float*)&m_vShoulderPosRatio,0.01f);
GUI::DragFloat("Camera Shoulder Length",&m_fCameraFocalLength, 0.01f);
if (m_pGameInstance->Key_Up(DIK_O)) {
m_pBinded_Camera->Toggle_Priority();
}
@@ -110,6 +113,14 @@ void CCamPosition_Shoulder::Update(_float fTimeDelta)
m_bLerp = true;
m_vLerpTimer.x = 0.f;
}
if (m_pGameInstance->Mouse_Pressing(DIM_RBUTTON)) {
m_pBinded_Camera->ZoomIn(fTimeDelta);
m_bZoomIn = true;
}
else if(m_bZoomIn)
{
m_pBinded_Camera->Set_Fov(XMConvertToRadians(60.f),fTimeDelta, m_bZoomIn);
}
}
void CCamPosition_Shoulder::Late_Update(_float fTimeDelta)
+4 -2
View File
@@ -297,8 +297,8 @@ HRESULT CPlayer::Ready_Parts()
Desc.fMouseSensor = 0.1f;
Desc.fShoulderDistance = 2.f;
Desc.fBackFrontRatio = 0.9f;
Desc.fCameraFocalLength = 10.f;
Desc.vInitialLook = { 1.f, 2.f, -1.f };
Desc.fCameraFocalLength = 13.4f;
Desc.vInitialLook = { 0.77f, 1.35f, -1.f };
if (FAILED(Add_PartObject<CCamPosition_Shoulder>("Cam_Shoulder_Part", g_iStaticLevel, &m_pCamPosition_ShoulderPart, &Desc))) {
return E_FAIL;
@@ -450,6 +450,8 @@ void CPlayer::Describe_Entity()
GUI::Checkbox("Render", &m_bVisible);
GUI::Text("%d", m_iStateMask);
}
#endif // _DEBUG
@@ -66,6 +66,7 @@ HRESULT CPlayer::InputAction()
|| m_pGameInstance->Key_Down(DIK_C)
|| m_pGameInstance->Key_Down(DIK_V)
|| m_pGameInstance->Key_Down(DIK_Z)
|| m_pGameInstance->Key_Down(DIK_G)
)
{
return S_OK;
@@ -114,7 +115,8 @@ HRESULT CPlayer::InputSpell()
HRESULT CPlayer::InputAim()
{
if (m_pGameInstance->Mouse_Pressing(DIM_RBUTTON))
if (m_pGameInstance->Mouse_Pressing(DIM_RBUTTON)||
m_pGameInstance->Mouse_Pressing(DIM_LBUTTON))
{
return S_OK;
}
@@ -127,7 +129,9 @@ void CPlayer::Behavior_IdleEnter() {
if (SUCCEEDED(InputAim()))
{
pairAnimInfo = m_Animation[STATEANIM::IDLE_AIM];
if (m_pGameInstance->Mouse_Pressing(DIM_LBUTTON)) {
pairAnimInfo = m_Animation[STATEANIM::IDLE_AIM];
}
}
else
{
@@ -169,6 +173,9 @@ HRESULT CPlayer::Behavior_IdleExitCheck(_float fTimeDelta)
else if (m_pGameInstance->Key_Down(DIK_V)) {
m_pFSM->Change_State(FSMSTATE::COMBAT);
}
else if (m_pGameInstance->Key_Down(DIK_G)) {
m_pFSM->Change_State(FSMSTATE::COMBAT);
}
return E_FAIL;
}
@@ -292,7 +299,6 @@ void CPlayer::Behavior_MoveEnter()
if (SUCCEEDED(InputMove()))
{
pairAnimInfo = m_Animation[STATEANIM::JOG_FWD];
m_bRatio = true;
}
}
}
@@ -353,6 +359,9 @@ HRESULT CPlayer::Behavior_MoveExitCheck(_float fTimeDelta)
else if (m_pGameInstance->Key_Down(DIK_Z)) {
m_pFSM->Change_State(FSMSTATE::COMBAT);
}
else if (m_pGameInstance->Key_Down(DIK_G)) {
m_pFSM->Change_State(FSMSTATE::COMBAT);
}
else if (m_pGameInstance->Key_Down(DIK_LSHIFT)) {
m_bSprintToggle = !m_bSprintToggle;
m_bWalkToggle = false;
@@ -387,7 +396,7 @@ HRESULT CPlayer::Behavior_MoveExitCheck(_float fTimeDelta)
}
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
}
return E_FAIL;
return S_OK;
}
if (SUCCEEDED(InputMove())) {
@@ -395,7 +404,7 @@ HRESULT CPlayer::Behavior_MoveExitCheck(_float fTimeDelta)
_vector xmvCamLook = XMVector4Normalize(XMVectorSet(m_vCameraLookDir.x, 0.f, m_vCameraLookDir.z, 0.f));
_vector xmvCamRight = XMVector4Normalize(XMVectorSet(m_vCameraRightDir.x, 0.f, m_vCameraRightDir.z, 0.f));
if (m_pGameInstance->Key_Pressing(DIK_W))
xmvInputDir += xmvCamLook;
if (m_pGameInstance->Key_Pressing(DIK_S))
@@ -411,7 +420,7 @@ HRESULT CPlayer::Behavior_MoveExitCheck(_float fTimeDelta)
xmvInputDir = XMVector3Normalize(xmvInputDir);
_float2 vInputDir = { XMVectorGetX(xmvInputDir),XMVectorGetZ(xmvInputDir) };
GUI::Text("%.1f, %.1f", vInputDir.x, vInputDir.y);
_vector xmvCurLook = XMVector4Normalize(
XMVectorSetY(m_pTransformCom->Get_State(STATE::LOOK), 0.f));
_float2 vCurLook = { XMVectorGetX(xmvCurLook),XMVectorGetZ(xmvCurLook) };
@@ -422,35 +431,77 @@ HRESULT CPlayer::Behavior_MoveExitCheck(_float fTimeDelta)
_float cross = vCurLook.x * vInputDir.y - vCurLook.y * vInputDir.x;
_bool bSkipAngleCheck = { false };
if (m_pFSM->IsEnable(FSMSTATE::JOG)) {
if (iCurrentAnimIndex != m_Animation[STATEANIM::JOG_FWD].first) {
if (m_pFSM->IsEnable(FSMSTATE::JOG | FSMSTATE::WALK)) {
if (iCurrentAnimIndex != m_Animation[STATEANIM::JOG_FWD].first &&
iCurrentAnimIndex != m_Animation[STATEANIM::WALK_FWD].first) {
bSkipAngleCheck = true;
if (m_pModelCom->IsFinishedAnim()||
m_pFSM->IsEnable(FSMSTATE::STOP)) {
if (m_pModelCom->IsFinishedAnim() || m_pFSM->IsEnable(FSMSTATE::STOP)|| SUCCEEDED(InputAim())) {
m_pFSM->Disable_State(FSMSTATE::STOP);
bSkipAngleCheck = false;
}
}
if (!bSkipAngleCheck) {
_float absDir = fabsf(vDir);
if (absDir <= XMConvertToRadians(60.f)) {
pairAnimInfo = m_Animation[STATEANIM::JOG_FWD];
if (absDir <= XMConvertToRadians(70.f)) {
if (m_pFSM->IsEnable(FSMSTATE::JOG))
{
pairAnimInfo = m_Animation[STATEANIM::JOG_FWD];
}
if (m_pFSM->IsEnable(FSMSTATE::WALK))
{
pairAnimInfo = m_Animation[STATEANIM::WALK_FWD];
}
}
else if (absDir < XMConvertToRadians(160.f)) {
if (cross > 0)
{
pairAnimInfo = m_Animation[STATEANIM::JOG_LEFT];
if (SUCCEEDED(InputAim()))
{
pairAnimInfo = m_Animation[STATEANIM::JOG_AIM_LEFT];
}
else if (m_pFSM->IsEnable(FSMSTATE::JOG))
{
pairAnimInfo = m_Animation[STATEANIM::JOG_LEFT];
}
/*if (m_pFSM->IsEnable(FSMSTATE::WALK))
{
pairAnimInfo = m_Animation[STATEANIM::WALK_LEFT];
}*/
m_fAmount = 0.5f;
m_bRatio = true;
}
else {
pairAnimInfo = m_Animation[STATEANIM::JOG_RIGHT];
if (SUCCEEDED(InputAim()))
{
pairAnimInfo = m_Animation[STATEANIM::JOG_AIM_RIGHT];
}
else if (m_pFSM->IsEnable(FSMSTATE::JOG))
{
pairAnimInfo = m_Animation[STATEANIM::JOG_RIGHT];
}
/*if (m_pFSM->IsEnable(FSMSTATE::WALK))
{
pairAnimInfo = m_Animation[STATEANIM::WALK_RIGHT];
}*/
m_fAmount = 0.5f;
m_bRatio = true;
}
}
else {
pairAnimInfo = m_Animation[STATEANIM::JOG_BWD];
if (SUCCEEDED(InputAim()))
{
pairAnimInfo = m_Animation[STATEANIM::JOG_AIM_BWD];
}
else if (m_pFSM->IsEnable(FSMSTATE::JOG))
{
pairAnimInfo = m_Animation[STATEANIM::JOG_BWD];
}
else if (m_pFSM->IsEnable(FSMSTATE::WALK))
{
pairAnimInfo = m_Animation[STATEANIM::WALK_BWD];
}
m_fAmount = 0.5f;
m_bRatio = true;
}
@@ -462,7 +513,7 @@ HRESULT CPlayer::Behavior_MoveExitCheck(_float fTimeDelta)
Player_InterpTurn(fTimeDelta);
return E_FAIL;
return S_OK;
}
if (m_pFSM->IsEnable(FSMSTATE::JOG | FSMSTATE::WALK | FSMSTATE::SPRINT)||
@@ -580,7 +631,7 @@ HRESULT CPlayer::Behavior_DodgeExitCheck()
return E_FAIL;
}
if (SUCCEEDED(InputMove()) && IsCurrentKeyFrame("Dodge")) {
if (SUCCEEDED(InputMove()) && IsCurrentKeyFrame("Throw")) {
m_pFSM->Change_State(FSMSTATE::MOVE);
return E_FAIL;
}
@@ -654,6 +705,10 @@ void CPlayer::Behavior_CombatEnter()
m_pFSM->Enable_State(FSMSTATE::ANCIENT_THROW);
pairAnimInfo = m_Animation[STATEANIM::ANCIENT_THROW];
}
else if (m_pGameInstance->Key_Down(DIK_G)) {
m_pFSM->Enable_State(FSMSTATE::POTION);
pairAnimInfo = m_Animation[STATEANIM::POTION];
}
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
}
@@ -712,6 +767,11 @@ HRESULT CPlayer::Behavior_CombatExitCheck()
pairAnimInfo = m_Animation[STATEANIM::ANCIENT_THROW];
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
}
else if (m_pGameInstance->Key_Down(DIK_G)) {
m_pFSM->Enable_State(FSMSTATE::POTION);
pairAnimInfo = m_Animation[STATEANIM::POTION];
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
}
}
if (m_pFSM->IsEnable(FSMSTATE::SPELL) && IsCurrentKeyFrame("Combat"))
@@ -781,12 +841,16 @@ HRESULT CPlayer::Behavior_CombatExitCheck()
void CPlayer::Behavior_CombatExit()
{
m_pFSM->Disable_State(FSMSTATE::COMBAT | FSMSTATE::LIGHT_ATTACK | FSMSTATE::SPELL | FSMSTATE::SKILL | FSMSTATE::SKILL2 | FSMSTATE::MAPHELP | FSMSTATE::ANCIENT_THROW);
m_pFSM->Disable_State(FSMSTATE::COMBAT | FSMSTATE::LIGHT_ATTACK | FSMSTATE::SPELL | FSMSTATE::SKILL |
FSMSTATE::SKILL2 | FSMSTATE::MAPHELP | FSMSTATE::ANCIENT_THROW | FSMSTATE::POTION);
}
void CPlayer::Player_InterpTurn(_float fTimeDelta)
{
if (m_pModelCom->Get_AnimIndex() != m_Animation[STATEANIM::JOG_FWD].first)
_uint iCurrIndex = m_pModelCom->Get_AnimIndex();
if (iCurrIndex != m_Animation[STATEANIM::JOG_FWD].first&&
iCurrIndex != m_Animation[STATEANIM::WALK_FWD].first&&
iCurrIndex != m_Animation[STATEANIM::SPRINT].first)
return;
_vector xmvCurLook = XMVector4Normalize(
@@ -873,6 +937,8 @@ void CPlayer::Add_FSM()
m_pTransformCom->Turn(-m_pTransformCom->Get_State(STATE::UP), fTimeDelta * fMove.y * 0.05f);
}
}
};
Desc.funcLateUpdate = nullptr;
@@ -949,6 +1015,10 @@ void CPlayer::Set_Anim()
m_Animation[STATEANIM::JOG_BWD] = { 154,false }; // Turn
m_Animation[STATEANIM::JOG_STOP] = { 289,false };
m_Animation[STATEANIM::JOG_AIM_LEFT] = { 171,true };
m_Animation[STATEANIM::JOG_AIM_RIGHT] = { 175,true };
m_Animation[STATEANIM::JOG_AIM_BWD] = { 166,true };
m_Animation[STATEANIM::JUMP] = { 205,false };
m_Animation[STATEANIM::JUMP_JOG] = { 203,false };
m_Animation[STATEANIM::JUMP_SPRINT] = { 207,false };
@@ -965,6 +1035,7 @@ void CPlayer::Set_Anim()
m_Animation[STATEANIM::LIGHT_ATTACK] = { 413,false };
m_Animation[STATEANIM::SPELL] = { 696,false };
m_Animation[STATEANIM::MAPHELP] = { 122,false };
m_Animation[STATEANIM::POTION] = { 114,false };
m_Animation[STATEANIM::ACCIO] = { 417,false };
m_Animation[STATEANIM::DESCENDO] = { 418,false };
m_Animation[STATEANIM::DEPULSO] = { 782,false };
@@ -49,6 +49,8 @@ class CCamPosition_Shoulder final : public CCamPosition
_bool m_bLerp = { false };
_float2 m_vLerpTimer = { 0.f, 1.f };
_bool m_bZoomIn = { false };
CCamPosition_Target* m_pTarget_LookPart = { nullptr };
CCamPosition_Target* m_pTarget_FollowPart = { nullptr };
@@ -72,80 +72,49 @@ void CS_LocalSRT(uint3 DTID : SV_DispatchThreadID)
uint boneIndex = DTID.x;
if (boneIndex >= (uint) BoneCount)
return;
float time = CurrentTime;
if (Duration > 0)
time = min(time, Duration);
Channel channel = g_ChannelBuffer[boneIndex];
LocalPos result;
if (channel.KeyCount == 0)
{
result.Scale = float3(1, 1, 1);
result.Rotation = float4(0, 0, 0, 1);
result.Translation = float3(0, 0, 0);
result.pad0 = result.pad1 = 0.0f;
g_LocalPosOutput[boneIndex] = result;
return;
}
uint firstIndex = channel.StartIndex;
uint lastIndex = channel.StartIndex + channel.KeyCount - 1;
uint keyCount = channel.KeyCount;
uint lastIndex = firstIndex + keyCount - 1;
KeyFrame keyframe1 = g_KeyFrameBuffer[firstIndex];
KeyFrame keyframe2 = g_KeyFrameBuffer[lastIndex];
KeyFrame keyLast = g_KeyFrameBuffer[lastIndex];
if (time <= keyframe1.fTrackPosition)
if (time >= keyLast.fTrackPosition)
{
result.Scale = keyframe1.vScale;
result.Rotation = keyframe1.vRotation;
result.Translation = keyframe1.vTranslation;
result.Scale = keyLast.vScale;
result.Rotation = keyLast.vRotation;
result.Translation = keyLast.vTranslation;
result.pad0 = result.pad1 = 0.0f;
g_LocalPosOutput[boneIndex] = result;
return;
}
if (time >= keyframe2.fTrackPosition)
else
{
result.Scale = keyframe2.vScale;
result.Rotation = keyframe2.vRotation;
result.Translation = keyframe2.vTranslation;
result.pad0 = result.pad1 = 0.0f;
g_LocalPosOutput[boneIndex] = result;
return;
}
for (uint i = 0; i < channel.KeyCount - 1; ++i)
{
uint A = channel.StartIndex + i;
uint B = channel.StartIndex + i + 1;
KeyFrame ka = g_KeyFrameBuffer[A];
KeyFrame kb = g_KeyFrameBuffer[B];
if (time >= ka.fTrackPosition && time <= kb.fTrackPosition)
for (uint i = 0; i < keyCount - 1; ++i)
{
float t = (time - ka.fTrackPosition) / (kb.fTrackPosition - ka.fTrackPosition);
KeyFrame Sour = g_KeyFrameBuffer[firstIndex + i];
KeyFrame Dest = g_KeyFrameBuffer[firstIndex + i + 1];
result.Scale = lerp(ka.vScale, kb.vScale, t);
result.Rotation = quatSlerp(ka.vRotation, kb.vRotation, t);
result.Translation = lerp(ka.vTranslation, kb.vTranslation, t);
result.pad0 = result.pad1 = 0.0f;
if (time >= Sour.fTrackPosition && time <= Dest.fTrackPosition)
{
float ratio = (time - Sour.fTrackPosition) /
(Dest.fTrackPosition - Sour.fTrackPosition);
g_LocalPosOutput[boneIndex] = result;
return;
result.Scale = lerp(Sour.vScale, Dest.vScale, ratio);
result.Rotation = quatSlerp(Sour.vRotation, Dest.vRotation, ratio);
result.Translation = lerp(Sour.vTranslation, Dest.vTranslation, ratio);
result.pad0 = result.pad1 = 0.0f;
break;
}
}
}
result.Scale = keyframe2.vScale;
result.Rotation = keyframe2.vRotation;
result.Translation = keyframe2.vTranslation;
result.pad0 = result.pad1 = 0.0f;
g_LocalPosOutput[channel.BoneIndex] = result;
return;
g_LocalPosOutput[boneIndex] = result;
}
@@ -72,80 +72,49 @@ void CS_LocalSRT(uint3 DTID : SV_DispatchThreadID)
uint boneIndex = DTID.x;
if (boneIndex >= (uint) BoneCount)
return;
float time = CurrentTime;
if (Duration > 0)
time = min(time, Duration);
Channel channel = g_ChannelBuffer[boneIndex];
LocalPos result;
if (channel.KeyCount == 0)
{
result.Scale = float3(1, 1, 1);
result.Rotation = float4(0, 0, 0, 1);
result.Translation = float3(0, 0, 0);
result.pad0 = result.pad1 = 0.0f;
g_LocalPosOutput[boneIndex] = result;
return;
}
uint firstIndex = channel.StartIndex;
uint lastIndex = channel.StartIndex + channel.KeyCount - 1;
uint keyCount = channel.KeyCount;
uint lastIndex = firstIndex + keyCount - 1;
KeyFrame keyframe1 = g_KeyFrameBuffer[firstIndex];
KeyFrame keyframe2 = g_KeyFrameBuffer[lastIndex];
KeyFrame keyLast = g_KeyFrameBuffer[lastIndex];
if (time <= keyframe1.fTrackPosition)
if (time >= keyLast.fTrackPosition)
{
result.Scale = keyframe1.vScale;
result.Rotation = keyframe1.vRotation;
result.Translation = keyframe1.vTranslation;
result.Scale = keyLast.vScale;
result.Rotation = keyLast.vRotation;
result.Translation = keyLast.vTranslation;
result.pad0 = result.pad1 = 0.0f;
g_LocalPosOutput[boneIndex] = result;
return;
}
if (time >= keyframe2.fTrackPosition)
else
{
result.Scale = keyframe2.vScale;
result.Rotation = keyframe2.vRotation;
result.Translation = keyframe2.vTranslation;
result.pad0 = result.pad1 = 0.0f;
g_LocalPosOutput[boneIndex] = result;
return;
}
for (uint i = 0; i < channel.KeyCount - 1; ++i)
{
uint A = channel.StartIndex + i;
uint B = channel.StartIndex + i + 1;
KeyFrame ka = g_KeyFrameBuffer[A];
KeyFrame kb = g_KeyFrameBuffer[B];
if (time >= ka.fTrackPosition && time <= kb.fTrackPosition)
for (uint i = 0; i < keyCount - 1; ++i)
{
float t = (time - ka.fTrackPosition) / (kb.fTrackPosition - ka.fTrackPosition);
KeyFrame Sour = g_KeyFrameBuffer[firstIndex + i];
KeyFrame Dest = g_KeyFrameBuffer[firstIndex + i + 1];
result.Scale = lerp(ka.vScale, kb.vScale, t);
result.Rotation = quatSlerp(ka.vRotation, kb.vRotation, t);
result.Translation = lerp(ka.vTranslation, kb.vTranslation, t);
result.pad0 = result.pad1 = 0.0f;
if (time >= Sour.fTrackPosition && time <= Dest.fTrackPosition)
{
float ratio = (time - Sour.fTrackPosition) /
(Dest.fTrackPosition - Sour.fTrackPosition);
g_LocalPosOutput[boneIndex] = result;
return;
result.Scale = lerp(Sour.vScale, Dest.vScale, ratio);
result.Rotation = quatSlerp(Sour.vRotation, Dest.vRotation, ratio);
result.Translation = lerp(Sour.vTranslation, Dest.vTranslation, ratio);
result.pad0 = result.pad1 = 0.0f;
break;
}
}
}
result.Scale = keyframe2.vScale;
result.Rotation = keyframe2.vRotation;
result.Translation = keyframe2.vTranslation;
result.pad0 = result.pad1 = 0.0f;
g_LocalPosOutput[channel.BoneIndex] = result;
return;
g_LocalPosOutput[boneIndex] = result;
}
+26
View File
@@ -168,6 +168,32 @@ HRESULT CCamera::Ready_Shadow()
return S_OK;
}
void CCamera::ZoomIn(_float fTimeDelta)
{
if (m_fFovy > XMConvertToRadians(40.f))
{
m_fFovy -= (fTimeDelta * 1.2f);
}
}
void CCamera::Set_Fov(_float fFovy, _float fTimeDelta,_bool& bZoomIn)
{
if (fFovy > m_fFovy)
{
m_fFovy += (fTimeDelta * 0.6f);
}
else if(fFovy < m_fFovy)
{
m_fFovy -= (fTimeDelta * 0.6f);
}
if (fFovy == m_fFovy)
{
bZoomIn = false;
}
}
void CCamera::Free()
{
__super::Free();
+8 -55
View File
@@ -118,62 +118,15 @@ void CChannel::Update_TransformationMatirx(
_uint* pCurrentKeyFrameIndex,
_vector vector[3],_float m_fAmount)
{
const LOCALPOS_DESC& LocalPos = pLocalPosArray[m_iBoneIndex];
if (0.f == fCurrentTrackPosition)
*pCurrentKeyFrameIndex = 0;
KEYFRAME LastKeyFrame = m_KeyFrames.back();
_vector vScale{};
_vector vRotation{};
_vector vTranslation{};
if (fCurrentTrackPosition >= LastKeyFrame.fTrackPosition)
{
vScale = XMLoadFloat3(&LastKeyFrame.vScale);
vRotation = XMLoadFloat4(&LastKeyFrame.vRotation);
vTranslation = XMVectorSetW(XMLoadFloat3(&LastKeyFrame.vTranslation), 1.f);
}
else
{
while (fCurrentTrackPosition >= m_KeyFrames[*pCurrentKeyFrameIndex + 1].fTrackPosition){
++*pCurrentKeyFrameIndex;
}
_float3 vSourScale{}, vDestScale{};
_float4 vSourRotation{}, vDestRotation{};
_float3 vSourTranslation{}, vDestTranslation{};
vSourScale = m_KeyFrames[*pCurrentKeyFrameIndex].vScale;
vDestScale = m_KeyFrames[*pCurrentKeyFrameIndex + 1].vScale;
vSourRotation = m_KeyFrames[*pCurrentKeyFrameIndex].vRotation;
vDestRotation = m_KeyFrames[*pCurrentKeyFrameIndex + 1].vRotation;
vSourTranslation = m_KeyFrames[*pCurrentKeyFrameIndex].vTranslation;
vDestTranslation = m_KeyFrames[*pCurrentKeyFrameIndex + 1].vTranslation;
_float fRatio = (fCurrentTrackPosition - m_KeyFrames[*pCurrentKeyFrameIndex].fTrackPosition) /
(m_KeyFrames[*pCurrentKeyFrameIndex + 1].fTrackPosition - m_KeyFrames[*pCurrentKeyFrameIndex].fTrackPosition);
vScale = XMVectorLerp(XMLoadFloat3(&vSourScale), XMLoadFloat3(&vDestScale), fRatio);
vRotation = XMQuaternionSlerp(XMLoadFloat4(&vSourRotation), XMLoadFloat4(&vDestRotation), fRatio);
vTranslation = XMVectorSetW(XMVectorLerp(XMLoadFloat3(&vSourTranslation), XMLoadFloat3(&vDestTranslation), fRatio), 1.f);
}
//const LOCALPOS_DESC& LocalPos = pLocalPosArray[m_iBoneIndex];
//_vector vScale = XMLoadFloat3(&LocalPos.Scale);
//_vector vRotation = XMLoadFloat4(&LocalPos.Rotation);
//_vector vTranslation = XMVectorSet(
// LocalPos.Translation.x,
// LocalPos.Translation.y,
// LocalPos.Translation.z,
// 1.f);
_vector vScale = XMLoadFloat3(&LocalPos.Scale);
_vector vRotation = XMLoadFloat4(&LocalPos.Rotation);
_vector vTranslation = XMVectorSet(
LocalPos.Translation.x,
LocalPos.Translation.y,
LocalPos.Translation.z,
1.f);
if (Bones[m_iBoneIndex]->Compare_Name("Reference"))
{
+14 -10
View File
@@ -113,6 +113,12 @@ _bool CModel::Play_Animation(_float fTimeDelta, CTransform* pTransform)
if (m_iCurrentAnimIndex < 0 || m_iCurrentAnimIndex >= (_int)m_iNumAnimations)
return false;
if (m_bLoopRestarted)
{
m_vPrevRootPos = { 0,0,0 };
m_bLoopRestarted = false;
}
ComputeAnimation();
if (m_iPreAnimIndex >= 0 && m_iPreAnimIndex != m_iCurrentAnimIndex)
@@ -142,16 +148,6 @@ _bool CModel::Play_Animation(_float fTimeDelta, CTransform* pTransform)
m_iPreAnimIndex = m_iCurrentAnimIndex;
}
if (m_bIsFinishedAnim)
{
if (m_bIsLoop)
{
m_vPrevRootPos = { 0.f, 0.f, 0.f };
}
else
XMStoreFloat3(&m_vPrevRootPos, m_vector[2]);
}
if (m_bRatio) {
Update_RootBone(m_fAmount * m_fRatio);
}
@@ -162,10 +158,18 @@ _bool CModel::Play_Animation(_float fTimeDelta, CTransform* pTransform)
if (m_bIsFinishedAnim)
{
if (m_bIsLoop)
{
m_bLoopRestarted = true;
}
else
XMStoreFloat3(&m_vPrevRootPos, m_vector[2]);
m_vPrevRootRot = { 0.f,0.f,0.f,0.f };
m_bInitialRootRotSaved = false;
}
for (auto& pBone : m_Bones)
{
pBone->Update_CombinedTransformationMatrix(m_Bones, XMLoadFloat4x4(&m_PreTransformMatrix));
+2
View File
@@ -44,6 +44,8 @@ class ENGINE_DLL CCamera abstract : public CGameObject
_bool IsImportantThan(CCamera* pOther) const;
const _float* Get_CurrentFar();
HRESULT Ready_Shadow();
void ZoomIn(_float fTimeDelta);
void Set_Fov(_float fFovy,_float fTimeDelta, _bool& bZoomIn);
protected:
_float m_fFovy = {};
+2 -1
View File
@@ -20,7 +20,8 @@ enum ESTATE : _u64Flag
SKILL2 = 1ULL << 13,
ANCIENT_THROW = 1ULL << 14,
MAPHELP = 1ULL << 15,
STOP = 1ULL << 16,
POTION = 1ULL << 16,
STOP = 1ULL << 17,
END
};
NS_END
+2
View File
@@ -151,6 +151,8 @@ void Combined_BoneMatrix();
_float4 m_vInitialRootRot = {};
_vector m_vector[3];
_bool m_bLoopRestarted = false;
#pragma region Compute
+2 -2
View File
@@ -7,13 +7,13 @@ enum ESTATE
IDLE,IDLE_AIM, IDLE_TURN_L, IDLE_TURN_R, IDLE_TURN_BWD,
MOVE,
WALK, WALK_FWD,WALK_RIGHT,WALK_LEFT, WALK_BWD,WALK_STOP,
JOG,JOG_FWD,JOG_RIGHT,JOG_LEFT, JOG_BWD,JOG_STOP,
JOG, JOG_FWD, JOG_RIGHT, JOG_LEFT, JOG_BWD, JOG_STOP, JOG_AIM_LEFT, JOG_AIM_RIGHT,JOG_AIM_BWD,
SPRINT,
JUMP,JUMP_JOG,JUMP_SPRINT,
LAND,
DODGE,DODGE_BLINK, DODGE_LEFT, DODGE_RIGHT,
COMBAT, LIGHT_ATTACK, SPELL, SKILL, SKILL2,
MAPHELP,
MAPHELP,POTION,
ACCIO,DESCENDO,DIFFINDO,DEPULSO,LUMOS,DISILLUSION_ENTER,DISILLUSION_EXIT, ANCIENT_THROW,
HIT, HIT_FWD, HIT_BWD, HIT_BWD2, HIT_BWD3, HIT_BWD4, HIT_L, HIT_R,
KNOCKDOWN, KNOCKDOWN_FWD, KNOCKDOWN_FWD_SPLT, KNOCKDOWN_FWD_SPLT_HOLD, KNOCKDOWN_BWD, KNOCKDOWN_BWD_SPLT, KNOCKDOWN_BWD_SPLT_HOLD,