@@ -170,8 +170,8 @@ HRESULT CCamPosition_Shoulder::Ready_SubParts()
|
||||
CameraDesc.iPriority = 51;
|
||||
CameraDesc.pCameraKey = CAMERA_SHOULDER;
|
||||
CameraDesc.bEnableTransitionLerp = true;
|
||||
CameraDesc.bEnableFollowLerp = true;
|
||||
CameraDesc.bEnableLookLerp = true;
|
||||
CameraDesc.bEnableFollowLerp = false;
|
||||
CameraDesc.bEnableLookLerp = false;
|
||||
CameraDesc.vTransitionTime = { 0.f, 1.f };
|
||||
CameraDesc.vFollowLerpTime = { 0.f, 0.16f };
|
||||
CameraDesc.vLookLerpTime = { 0.f, 0.16f };
|
||||
|
||||
@@ -78,7 +78,7 @@ void CGoblin::Late_Update(_float fTimeDelta)
|
||||
|
||||
m_pTransformCom->LookAt(m_pPlayerTransform->Get_State(STATE::POSITION));
|
||||
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
}
|
||||
|
||||
HRESULT CGoblin::Render()
|
||||
|
||||
@@ -49,7 +49,7 @@ void CGoblin::Behavior_MoveEnter()
|
||||
|
||||
HRESULT CGoblin::Behavior_MoveExitCheck()
|
||||
{
|
||||
if (m_fTargetDistance <= 3.f)
|
||||
if (m_fTargetDistance <= 7.f &&m_fTargetDistance !=0.f)
|
||||
m_pFSM->Change_State(FSMSTATE::COMBAT);
|
||||
|
||||
return E_FAIL;
|
||||
@@ -66,9 +66,9 @@ void CGoblin::Behavior_CombatEnter()
|
||||
|
||||
m_pFSM->Enable_State(FSMSTATE::COMBAT);
|
||||
|
||||
m_pFSM->Enable_State(FSMSTATE::SKILL);
|
||||
m_pFSM->Enable_State(FSMSTATE::SKILL2);
|
||||
|
||||
pairAnimInfo = m_Animation[STATEANIM::SKILL];
|
||||
pairAnimInfo = m_Animation[STATEANIM::SKILL2];
|
||||
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
|
||||
@@ -165,8 +165,6 @@ HRESULT CPlayer::Render()
|
||||
|
||||
void CPlayer::Render_CameraCoordinateSystem()
|
||||
{
|
||||
|
||||
|
||||
m_Batch->Begin();
|
||||
|
||||
const _float fArrowLength = 2.0f;
|
||||
@@ -188,7 +186,10 @@ void CPlayer::Render_CameraCoordinateSystem()
|
||||
GUI::Button("##6", {100.f, 100.f}); GUI::SameLine();
|
||||
GUI::Button(("S : " + to_string(XMConvertToDegrees(CMyTools::Get_Direction2D(vLook, { -m_vCameraLookDir.x , -m_vCameraLookDir.z })))).c_str(), { 100.f, 100.f }); GUI::SameLine();
|
||||
GUI::Button("##8", {100.f, 100.f});
|
||||
|
||||
//W CMyTools::Get_Direction2D(vLook, { m_vCameraLookDir.x , m_vCameraLookDir.z })
|
||||
//A CMyTools::Get_Direction2D(vLook, { -m_vCameraRightDir.x , - m_vCameraRightDir.z })
|
||||
//S CMyTools::Get_Direction2D(vLook, { m_vCameraRightDir.x , m_vCameraRightDir.z })
|
||||
//D CMyTools::Get_Direction2D(vLook, { -m_vCameraLookDir.x , - m_vCameraLookDir.z })
|
||||
m_Batch->DrawLine( // W
|
||||
VertexPositionColor(fArrowLength * -XMLoadFloat3(&m_vCameraLookDir), DirectX::Colors::GhostWhite),
|
||||
VertexPositionColor(fArrowLength * XMLoadFloat3(&m_vCameraLookDir), DirectX::Colors::Blue)
|
||||
@@ -279,7 +280,7 @@ HRESULT CPlayer::Ready_Parts()
|
||||
{
|
||||
CCamPosition_Shoulder::CAMERA_SHOULDER_DESC Desc;
|
||||
Desc.pParentTransform = m_pTransformCom;
|
||||
Desc.fMouseSensor = 0.5f;
|
||||
Desc.fMouseSensor = 0.1f;
|
||||
Desc.fShoulderDistance = 2.f;
|
||||
Desc.fBackFrontRatio = 0.9f;
|
||||
Desc.fCameraFocalLength = 10.f;
|
||||
|
||||
@@ -101,19 +101,6 @@ void CPlayer::Behavior_IdleEnter() {
|
||||
m_pFSM->Enable_State(FSMSTATE::IDLE);
|
||||
pair<_uint, _bool> pairAnimInfo = m_Animation[STATEANIM::IDLE];
|
||||
|
||||
if (m_pFSM->IsEnable_Previous(FSMSTATE::JOG | FSMSTATE::WALK | FSMSTATE::SPRINT)) {
|
||||
|
||||
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::JOG_STOP];
|
||||
}
|
||||
|
||||
else if (m_pFSM->IsEnable_Previous(FSMSTATE::JOG)) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::JOG_STOP];
|
||||
}
|
||||
}
|
||||
m_bSprintToggle = false;
|
||||
m_bWalkToggle = false;
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
@@ -151,10 +138,40 @@ HRESULT CPlayer::Behavior_IdleExitCheck()
|
||||
|
||||
if (SUCCEEDED(InputMove())) {
|
||||
|
||||
m_pFSM->Change_State(FSMSTATE::MOVE);
|
||||
if (m_pGameInstance->Key_Pressing(DIK_W))
|
||||
{
|
||||
m_pFSM->Change_State(FSMSTATE::MOVE);
|
||||
return E_FAIL;
|
||||
}
|
||||
/*if (m_pGameInstance->Key_Pressing(DIK_S))
|
||||
{
|
||||
m_pFSM->Change_State(FSMSTATE::MOVE);
|
||||
return E_FAIL;
|
||||
}*/
|
||||
}
|
||||
|
||||
if (m_pGameInstance->Key_Down(DIK_D))
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::IDLE_TURN_R];
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (m_pGameInstance->Key_Down(DIK_A))
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::IDLE_TURN_L];
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (m_pGameInstance->Key_Down(DIK_S))
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::IDLE_TURN_BWD];
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
if (m_pModelCom->IsFinishedAnim())
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::IDLE];
|
||||
@@ -208,7 +225,6 @@ void CPlayer::Behavior_MoveEnter()
|
||||
pairAnimInfo = m_Animation[STATEANIM::JOG_BWD];
|
||||
m_fAmount = 0.2f;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else { // While Moving
|
||||
@@ -246,6 +262,10 @@ void CPlayer::Behavior_MoveEnter()
|
||||
HRESULT CPlayer::Behavior_MoveExitCheck()
|
||||
{
|
||||
pair<_uint, _bool> pairAnimInfo;
|
||||
_vector xmvLook = XMVector4Normalize(XMVectorSetY(m_pTransformCom->Get_State(STATE::LOOK), 0.f));
|
||||
_vector xmvRight = XMVector4Normalize(XMVectorSetY(m_pTransformCom->Get_State(STATE::RIGHT), 0.f));
|
||||
_uint iCurrentAnimIndex = m_pModelCom->Get_AnimIndex();
|
||||
|
||||
if (SUCCEEDED(InputAction()) || SUCCEEDED(InputSpell())) {
|
||||
if (m_pGameInstance->Key_Down(DIK_SPACE)) {
|
||||
m_pFSM->Change_State(FSMSTATE::JUMP);
|
||||
@@ -304,16 +324,109 @@ HRESULT CPlayer::Behavior_MoveExitCheck()
|
||||
}
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (SUCCEEDED(InputMove())) {
|
||||
if (m_pModelCom->IsFinishedAnim() && m_pFSM->IsEnable(FSMSTATE::JOG))
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::JOG_FWD];
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
_vector xmvPlayerDir = { };
|
||||
|
||||
{ // 이동방향 누적
|
||||
if (m_pGameInstance->Key_Pressing(DIK_W)) {
|
||||
xmvPlayerDir += xmvLook;
|
||||
}
|
||||
if (m_pGameInstance->Key_Pressing(DIK_A)) {
|
||||
xmvPlayerDir -= xmvRight;
|
||||
}
|
||||
if (m_pGameInstance->Key_Pressing(DIK_S)) {
|
||||
xmvPlayerDir -= xmvLook;
|
||||
}
|
||||
if (m_pGameInstance->Key_Pressing(DIK_D)) {
|
||||
xmvPlayerDir += xmvRight;
|
||||
}
|
||||
}
|
||||
|
||||
xmvPlayerDir = XMVectorSetW(XMVector3Normalize(xmvPlayerDir), 0.f);
|
||||
|
||||
_float2 vPlayerDir = { XMVectorGetX(xmvPlayerDir), XMVectorGetZ(xmvPlayerDir) };
|
||||
_float2 vCameraLookDir = { m_vCameraLookDir.x, m_vCameraLookDir.z };
|
||||
|
||||
_float vDir = CMyTools::Get_Direction2D(vCameraLookDir, vPlayerDir);
|
||||
_bool bSkipAngleCheck = { false };
|
||||
if (m_pFSM->IsEnable(FSMSTATE::JOG)) {
|
||||
if (iCurrentAnimIndex != m_Animation[STATEANIM::JOG_FWD].first) {
|
||||
bSkipAngleCheck = true;
|
||||
if (m_pModelCom->IsFinishedAnim()||
|
||||
m_pFSM->IsEnable(FSMSTATE::STOP)) {
|
||||
m_pFSM->Disable_State(FSMSTATE::STOP);
|
||||
bSkipAngleCheck = false;
|
||||
}
|
||||
}
|
||||
if (!bSkipAngleCheck) {
|
||||
_bool bLeft = { true };
|
||||
if (vDir < 0.f)
|
||||
{
|
||||
// + left
|
||||
}
|
||||
else
|
||||
{
|
||||
// - Right
|
||||
}
|
||||
|
||||
_float absDir = fabsf(vDir);
|
||||
if (absDir < XMConvertToRadians(160.f)) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::JOG_FWD];
|
||||
}
|
||||
else if (absDir < XMConvertToRadians(90.f)) {
|
||||
// pairAnimInfo = m_Animation[STATEANIM::]
|
||||
}
|
||||
else if (absDir < XMConvertToRadians(112.f)) {
|
||||
// pairAnimInfo = m_Animation[STATEANIM::]
|
||||
}
|
||||
else if (absDir < XMConvertToRadians(135.f)) {
|
||||
// pairAnimInfo = m_Animation[STATEANIM::]
|
||||
}
|
||||
else if (absDir < XMConvertToRadians(180.f)) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::JOG_BWD];
|
||||
|
||||
}
|
||||
|
||||
{ // left Right
|
||||
|
||||
}
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
m_pFSM->Change_State(FSMSTATE::IDLE);
|
||||
if (m_pFSM->IsEnable(FSMSTATE::JOG | FSMSTATE::WALK | FSMSTATE::SPRINT)||
|
||||
!SUCCEEDED(InputMove())) {
|
||||
|
||||
if (!m_pFSM->IsEnable(FSMSTATE::STOP))
|
||||
{
|
||||
m_pFSM->Enable_State(FSMSTATE::STOP);
|
||||
if (m_pFSM->IsEnable(FSMSTATE::WALK)) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::WALK_STOP];
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
else if (m_pFSM->IsEnable(FSMSTATE::SPRINT)) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::JOG_STOP];
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
else if (m_pFSM->IsEnable(FSMSTATE::JOG)) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::JOG_STOP];
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
}
|
||||
else if (IsCurrentKeyFrame("Dodge"))
|
||||
|
||||
{
|
||||
m_pFSM->Change_State(FSMSTATE::IDLE);
|
||||
m_pFSM->Disable_State(FSMSTATE::STOP);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -590,9 +703,35 @@ void CPlayer::Add_FSM()
|
||||
Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_MoveExitCheck(); };
|
||||
Desc.funcExitEvent = [this]() { Behavior_MoveExit(); };
|
||||
Desc.funcPriorityUpdate = [this](_float fTimeDelta) {
|
||||
if (m_pGameInstance->Key_Pressing(DIK_A)) { m_pTransformCom->Turn(-m_pTransformCom->Get_State(STATE::UP), fTimeDelta); }
|
||||
if (m_pGameInstance->Key_Pressing(DIK_D)) { m_pTransformCom->Turn(m_pTransformCom->Get_State(STATE::UP), fTimeDelta); };
|
||||
};
|
||||
_vector xmvRight = XMVector4Normalize(XMVectorSetY(m_pTransformCom->Get_State(STATE::RIGHT), 0.f));
|
||||
_vector xmvPlayerDir = { };
|
||||
|
||||
{
|
||||
_float3 fMove = m_pGameInstance->Get_MouseMove();
|
||||
m_pTransformCom->Turn(m_pTransformCom->Get_State(STATE::UP), fTimeDelta * fMove.x* 0.1f);
|
||||
m_pTransformCom->Turn(-m_pTransformCom->Get_State(STATE::UP), fTimeDelta * fMove.y * 0.1f);
|
||||
|
||||
if (m_pGameInstance->Key_Pressing(DIK_A)) {
|
||||
xmvPlayerDir -= xmvRight;
|
||||
}
|
||||
if (m_pGameInstance->Key_Pressing(DIK_D)) {
|
||||
xmvPlayerDir += xmvRight;
|
||||
}
|
||||
}
|
||||
|
||||
xmvPlayerDir = XMVectorSetW(XMVector3Normalize(xmvPlayerDir), 0.f);
|
||||
_float2 vPlayerDir = { XMVectorGetX(xmvPlayerDir), XMVectorGetZ(xmvPlayerDir) };
|
||||
_float2 vCameraLookDir = { m_vCameraLookDir.x, m_vCameraLookDir.z };
|
||||
|
||||
_float vDir = CMyTools::Get_Direction2D(vCameraLookDir, vPlayerDir);
|
||||
_float absDir = fabsf(vDir);
|
||||
if (m_pGameInstance->Key_Pressing(DIK_A)&& vDir < XMConvertToRadians(140.f) ) {
|
||||
m_pTransformCom->Turn(-m_pTransformCom->Get_State(STATE::UP), fTimeDelta); }
|
||||
if (m_pGameInstance->Key_Pressing(DIK_D)&& vDir > XMConvertToRadians(-140.f) ) {
|
||||
m_pTransformCom->Turn(m_pTransformCom->Get_State(STATE::UP), fTimeDelta); };
|
||||
|
||||
};
|
||||
|
||||
Desc.funcLateUpdate = nullptr;
|
||||
m_States.emplace(FSMSTATE::MOVE, CState_Move::Create(&Desc));
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -423,45 +423,42 @@ void CLevel_ObjectViewer::Dummy_Object_Setting()
|
||||
_float fKeyFrame = pModel->Get_CurrentTrackPosition();
|
||||
m_KeyFrames.emplace(EventName, fKeyFrame);
|
||||
|
||||
_char szDir[MAX_PATH] = {};
|
||||
|
||||
_splitpath_s(m_DummyPath, nullptr, 0, szDir, MAX_PATH, nullptr, 0, nullptr, 0);
|
||||
|
||||
_string szFile = "KeyFrame.bin";
|
||||
_string Path = szDir + szFile;
|
||||
|
||||
FILE* fp = nullptr;
|
||||
fopen_s(&fp, Path.c_str(), "wb");
|
||||
if (!fp) return;
|
||||
|
||||
_uint KeyFrameSize = (_uint)m_KeyFrames.size();
|
||||
|
||||
fwrite(&KeyFrameSize, sizeof(_uint), 1, fp);
|
||||
|
||||
for (auto& iter : m_KeyFrames)
|
||||
{
|
||||
_uint EventSize = (_uint)iter.first.size();
|
||||
fwrite(&iter.second, sizeof(_float), 1, fp);
|
||||
fwrite(&EventSize, sizeof(_uint), 1, fp);
|
||||
fwrite(iter.first.c_str(), sizeof(_char), EventSize, fp);
|
||||
}
|
||||
|
||||
|
||||
fclose(fp);
|
||||
Save_KeyFrame();
|
||||
|
||||
EventName[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (auto& iter : m_KeyFrames)
|
||||
{
|
||||
ImDrawList* draw = ImGui::GetForegroundDrawList();
|
||||
ImVec2 center = ImGui::GetMainViewport()->GetCenter();
|
||||
float scale = 50.f;
|
||||
string keyName = iter.first;
|
||||
|
||||
GUI::DragFloat(iter.first.c_str(), &iter.second);
|
||||
_bool isSelected = (m_SelectedKey == keyName);
|
||||
|
||||
if (ImGui::Selectable(keyName.c_str(), isSelected))
|
||||
{
|
||||
m_SelectedKey = keyName;
|
||||
}
|
||||
|
||||
if (isSelected)
|
||||
{
|
||||
ImGui::Indent();
|
||||
|
||||
ImGui::DragFloat("KeyFrame", &iter.second, 0.01f);
|
||||
|
||||
if (ImGui::Button("Delete KeyFrame"))
|
||||
{
|
||||
m_KeyFrames.erase(keyName);
|
||||
m_SelectedKey.clear();
|
||||
break;
|
||||
}
|
||||
|
||||
ImGui::Unindent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (GUI::Button("Delete"))
|
||||
{
|
||||
m_pGameInstance->Get_Layer(NEXT_LEVEL, m_wszPreLayer)->Clear_Layer();
|
||||
@@ -653,6 +650,35 @@ void CLevel_ObjectViewer::Find_Anim()
|
||||
}
|
||||
}
|
||||
|
||||
void CLevel_ObjectViewer::Save_KeyFrame()
|
||||
{
|
||||
_char szDir[MAX_PATH] = {};
|
||||
|
||||
_splitpath_s(m_DummyPath, nullptr, 0, szDir, MAX_PATH, nullptr, 0, nullptr, 0);
|
||||
|
||||
_string szFile = "KeyFrame.bin";
|
||||
_string Path = szDir + szFile;
|
||||
|
||||
FILE* fp = nullptr;
|
||||
fopen_s(&fp, Path.c_str(), "wb");
|
||||
if (!fp) return;
|
||||
|
||||
_uint KeyFrameSize = (_uint)m_KeyFrames.size();
|
||||
|
||||
fwrite(&KeyFrameSize, sizeof(_uint), 1, fp);
|
||||
|
||||
for (auto& iter : m_KeyFrames)
|
||||
{
|
||||
_uint EventSize = (_uint)iter.first.size();
|
||||
fwrite(&iter.second, sizeof(_float), 1, fp);
|
||||
fwrite(&EventSize, sizeof(_uint), 1, fp);
|
||||
fwrite(iter.first.c_str(), sizeof(_char), EventSize, fp);
|
||||
}
|
||||
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
|
||||
HRESULT CLevel_ObjectViewer::Ready_Layer_Camera(const _wstring& strLayerTag)
|
||||
{
|
||||
@@ -708,8 +734,8 @@ HRESULT CLevel_ObjectViewer::Ready_Layer_Dummy(const _wstring& strLayerTag)
|
||||
|
||||
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CGoblin>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, m_Test)))
|
||||
return E_FAIL;
|
||||
//if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CGoblin>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, m_Test)))
|
||||
// return E_FAIL;
|
||||
|
||||
/*if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CBroom>(g_iStaticLevel, NEXT_LEVEL, strLayerTag)))
|
||||
return E_FAIL;*/
|
||||
|
||||
@@ -40,6 +40,7 @@ class CLevel_ObjectViewer final : public CLevel
|
||||
_wchar* Save_ModelName(const _char* Category);
|
||||
void Load_KeyFrame(const _char* Name);
|
||||
void Find_Anim();
|
||||
void Save_KeyFrame();
|
||||
|
||||
private:
|
||||
vector<CGameObject*> m_Objects;
|
||||
@@ -55,6 +56,8 @@ class CLevel_ObjectViewer final : public CLevel
|
||||
_wchar m_wszPreLayer[MAX_PATH];
|
||||
_char m_DummyPath[MAX_PATH];
|
||||
_char m_FindAnimName[256] = {};
|
||||
string m_SelectedKey;
|
||||
|
||||
class CPlayer* m_Test = { nullptr };
|
||||
public:
|
||||
static CLevel_ObjectViewer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID);
|
||||
|
||||
@@ -35,8 +35,8 @@ CAnimation::CAnimation(const CAnimation& rhs)
|
||||
}
|
||||
_bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _bool bIsLoop, _float fTimeDelta,CTransform*pTransform, _float m_fAmount)
|
||||
{
|
||||
_float fProgress = m_fTickPerSecond * fTimeDelta * m_fAnimSpeed;
|
||||
m_fCurrentTrackPosition += fProgress;
|
||||
m_fProgress = m_fTickPerSecond * fTimeDelta * m_fAnimSpeed;
|
||||
m_fCurrentTrackPosition += m_fProgress;
|
||||
|
||||
if (m_fCurrentTrackPosition >= m_fDuration) {
|
||||
if (false == bIsLoop) {
|
||||
@@ -46,7 +46,7 @@ _bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bone
|
||||
}
|
||||
else {
|
||||
Depart_Animation();
|
||||
m_fCurrentTrackPosition = fProgress;
|
||||
m_fCurrentTrackPosition = m_fProgress;
|
||||
ResetRootMotion();
|
||||
ProgressAnimation(Bones, pLocalPosArray, pTransform, m_fAmount);
|
||||
return true;
|
||||
@@ -195,6 +195,7 @@ void CAnimation::InterpAnim(CAnimation* pPreAnim, vector<CBone*>& Bones, _float
|
||||
if (boneName == "Reference")
|
||||
{
|
||||
finalT = XMVectorZero();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +208,6 @@ void CAnimation::InterpAnim(CAnimation* pPreAnim, vector<CBone*>& Bones, _float
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CAnimation::CreateGPUData(ID3D11Device* pDevice)
|
||||
{
|
||||
vector<CHANNEL_DESC> channels;
|
||||
|
||||
@@ -171,7 +171,7 @@ void CChannel::Update_TransformationMatirx(
|
||||
|
||||
if (Bones[m_iBoneIndex]->Compare_Name("Reference") && pTransform != nullptr)
|
||||
{
|
||||
GUI::Text("fCurrentTrackPosition : %f", fCurrentTrackPosition);
|
||||
|
||||
_float3 vCurRootPos;
|
||||
XMStoreFloat3(&vCurRootPos, vTranslation);
|
||||
|
||||
|
||||
@@ -105,27 +105,32 @@ HRESULT CModel::Bind_BoneMatrices(_uint iMeshIndex, CShader* pShader, const _cha
|
||||
return m_Meshes[iMeshIndex]->Bind_BoneMatrices(m_Bones, pShader, pConstantName);
|
||||
}
|
||||
|
||||
_bool CModel::Play_Animation(_float fTimeDelta,CTransform* pTransform)
|
||||
_bool CModel::Play_Animation(_float fTimeDelta, CTransform* pTransform)
|
||||
{
|
||||
if (!m_bPlayAnim){
|
||||
if (!m_bPlayAnim)
|
||||
return false;
|
||||
|
||||
if (m_iCurrentAnimIndex < 0 || m_iCurrentAnimIndex >= (_int)m_iNumAnimations)
|
||||
return false;
|
||||
}
|
||||
if (-1 == m_iCurrentAnimIndex // 정지 혹은 시작을 안시켜준 애님
|
||||
|| m_iCurrentAnimIndex >= (_int)m_iNumAnimations) // 애님 인덱스 초과됨
|
||||
{
|
||||
return false; // 잘못된 초기화
|
||||
}
|
||||
|
||||
ComputeAnimation();
|
||||
|
||||
if (m_iPreAnimIndex != m_iCurrentAnimIndex && m_iPreAnimIndex != 0)
|
||||
if (m_iPreAnimIndex >= 0 && m_iPreAnimIndex != m_iCurrentAnimIndex)
|
||||
{
|
||||
m_fBlendTime += fTimeDelta;
|
||||
_float fRatio = (m_fBlendTime / m_fBlendDuration);
|
||||
fRatio = min(fRatio, 1.f);
|
||||
if (fRatio > 1.f) fRatio = 1.f;
|
||||
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, pTransform, m_fAmount);
|
||||
m_Animations[m_iCurrentAnimIndex]->InterpAnim(m_Animations[m_iPreAnimIndex], m_Bones, fRatio);
|
||||
CAnimation* pCurAnim = m_Animations[m_iCurrentAnimIndex];
|
||||
CAnimation* pPreAnim = m_Animations[m_iPreAnimIndex];
|
||||
|
||||
_bool bPreFinished = pPreAnim->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, pTransform, m_fAmount * (1.f - fRatio));
|
||||
|
||||
_bool bCurFinished = pCurAnim->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, pTransform, m_fAmount * fRatio);
|
||||
|
||||
pCurAnim->InterpAnim(pPreAnim, m_Bones, fRatio);
|
||||
|
||||
m_bIsFinishedAnim = bCurFinished;
|
||||
|
||||
if (fRatio >= 1.f)
|
||||
{
|
||||
@@ -136,6 +141,7 @@ _bool CModel::Play_Animation(_float fTimeDelta,CTransform* pTransform)
|
||||
else
|
||||
{
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, pTransform, m_fAmount);
|
||||
|
||||
m_iPreAnimIndex = m_iCurrentAnimIndex;
|
||||
}
|
||||
|
||||
@@ -144,12 +150,6 @@ _bool CModel::Play_Animation(_float fTimeDelta,CTransform* pTransform)
|
||||
pBone->Update_CombinedTransformationMatrix(m_Bones, XMLoadFloat4x4(&m_PreTransformMatrix));
|
||||
}
|
||||
|
||||
if (m_bIsFinishedAnim)
|
||||
{
|
||||
m_Animations[m_iCurrentAnimIndex]->ResetRootMotion();
|
||||
m_Animations[m_iCurrentAnimIndex]->Depart_Animation();
|
||||
}
|
||||
|
||||
return m_bIsFinishedAnim;
|
||||
}
|
||||
|
||||
@@ -163,8 +163,8 @@ void CModel::Set_AnimationIndex(_uint iIndex, _bool isLoop,_float fAmount)
|
||||
m_iCurrentAnimIndex = iIndex;
|
||||
m_bIsLoop = isLoop;
|
||||
m_fAmount = fAmount;
|
||||
m_Animations[m_iCurrentAnimIndex]->ResetRootMotion();
|
||||
m_Animations[m_iCurrentAnimIndex]->Depart_Animation();
|
||||
m_Animations[m_iCurrentAnimIndex]->ResetRootMotion();
|
||||
}
|
||||
else {
|
||||
m_iCurrentAnimIndex = -1;
|
||||
|
||||
@@ -46,6 +46,8 @@ class ENGINE_DLL CAnimation : public CBase
|
||||
ID3D11Buffer* Get_ChannelBuffer() { return m_pChannelBuffer; }
|
||||
ID3D11ShaderResourceView* Get_KeyFrameSrv() { return m_pKeyFrameSrv; }
|
||||
ID3D11ShaderResourceView* Get_ChannelSrv() { return m_pChannelSrv; }
|
||||
|
||||
_float Get_Progress() { return m_fProgress; }
|
||||
#ifdef EDITOR_PROJECT
|
||||
private:
|
||||
HRESULT Initialize(const vector<class CBone*>& Bones, const aiAnimation* pAIAnimation);
|
||||
@@ -84,6 +86,7 @@ class ENGINE_DLL CAnimation : public CBase
|
||||
vector<_int> m_DestBones; // 이 애니메이션에서 영향을 받는 본들의 집합
|
||||
vector<LERPDESC> m_StartKeyFrames; // 이 애니메이션의 영향을 받는 본들의 초기값
|
||||
vector<_matrix> m_vBoneTransformationMatrix = {};
|
||||
_float m_fProgress = {};
|
||||
|
||||
_uint m_iChannelCount;
|
||||
_uint m_iKeyframeCount;
|
||||
|
||||
@@ -18,6 +18,7 @@ enum ESTATE : _u64Flag
|
||||
SKILL = 1ULL << 11,
|
||||
SKILL2 = 1ULL << 12,
|
||||
MAPHELP = 1ULL << 13,
|
||||
STOP = 1ULL << 14,
|
||||
END
|
||||
};
|
||||
NS_END
|
||||
|
||||
@@ -35,6 +35,7 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
_bool Play_Animation(_float fTimeDelta, class CTransform* pTransform = nullptr); // 애니메이션에 델타타임을 넣어줌
|
||||
void Set_AnimationIndex(_uint iIndex, _bool isLoop = true, _float fAmount = 1.f);
|
||||
_bool IsFinishedAnim() const { return m_bIsFinishedAnim; }
|
||||
_bool IsLoopAnim() const { return m_bIsLoop; }
|
||||
void Set_CurrentTrackPosition(_float TrackPosition);
|
||||
const _char* Get_AnimList(_uint iIndex);
|
||||
_float Get_CurrentTrackPosition();
|
||||
|
||||
Reference in New Issue
Block a user