Merge branch 'Develope' into Effect_1124_Follow
This commit is contained in:
@@ -556,4 +556,14 @@ technique11 DefaultTechnique
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_MAIN_SPOT();
|
||||
}
|
||||
|
||||
pass RefitPass // 6
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
SetDepthStencilState(DSS_None, 0);
|
||||
SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
|
||||
VertexShader = compile vs_5_0 VS_MAIN();
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_MAIN_SPOT();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ CAnimation::CAnimation(const CAnimation& rhs)
|
||||
SAFE_ADDREF(pChannel);
|
||||
}
|
||||
}
|
||||
_bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _bool bIsLoop, _float fTimeDelta,CTransform*pTransform)
|
||||
_bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _bool bIsLoop, _float fTimeDelta,CTransform*pTransform, _float m_fAmount)
|
||||
{
|
||||
//m_fCurrentTrackPosition += m_TickPerSeconds[m_bPause] * fTimeDelta;
|
||||
m_fCurrentTrackPosition += m_fTickPerSecond * fTimeDelta * m_fAnimSpeed;
|
||||
@@ -53,7 +53,7 @@ _bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bone
|
||||
if (m_vBoneTransformationMatrix.size() > 0)
|
||||
m_vBoneTransformationMatrix.clear();
|
||||
for (auto& pChannel : m_Channels) {
|
||||
pChannel->Update_TransformationMatirx(Bones, pLocalPosArray, m_fCurrentTrackPosition, &m_CurrentKeyFrameIndices[iIndex++],pTransform);
|
||||
pChannel->Update_TransformationMatirx(Bones, pLocalPosArray, m_fCurrentTrackPosition, &m_CurrentKeyFrameIndices[iIndex++],pTransform, m_fAmount);
|
||||
m_vBoneTransformationMatrix.push_back(pChannel->Get_BoneTransformationMatrix());
|
||||
}
|
||||
|
||||
@@ -110,79 +110,102 @@ vector<_int>* CAnimation::Capture_Bones()
|
||||
return &m_DestBones;
|
||||
}
|
||||
|
||||
|
||||
void CAnimation::InterpAnim(CAnimation* pPreAnim, vector<CBone*>& Bones, float fRatio)
|
||||
void CAnimation::InterpAnim(CAnimation* pPreAnim, vector<CBone*>& Bones, _float fRatio)
|
||||
{
|
||||
if (!pPreAnim) return;
|
||||
if (m_Channels.empty() || pPreAnim->m_Channels.empty()) return;
|
||||
|
||||
size_t CurCount = m_vBoneTransformationMatrix.size();
|
||||
size_t PreCount = pPreAnim->m_vBoneTransformationMatrix.size();
|
||||
|
||||
if (CurCount == 0 || PreCount == 0)
|
||||
if (!pPreAnim)
|
||||
return;
|
||||
|
||||
if (CurCount > PreCount)
|
||||
if (m_Channels.empty() || pPreAnim->m_Channels.empty())
|
||||
return;
|
||||
|
||||
if (Bones.empty())
|
||||
return;
|
||||
|
||||
if (fRatio <= 0.f)
|
||||
fRatio = 0.f;
|
||||
else if (fRatio >= 1.f)
|
||||
fRatio = 1.f;
|
||||
|
||||
_uint boneCount = (_uint)Bones.size();
|
||||
|
||||
vector<_matrix> preBoneMats(boneCount);
|
||||
vector<_bool> preHasBone(boneCount, false);
|
||||
|
||||
_uint preChannelCount =(_uint)pPreAnim->m_Channels.size();
|
||||
_uint preMatCount =(_uint)pPreAnim->m_vBoneTransformationMatrix.size();
|
||||
|
||||
for (_uint i = 0; i < preChannelCount; ++i)
|
||||
{
|
||||
pPreAnim->m_vBoneTransformationMatrix.resize(CurCount, XMMatrixIdentity());
|
||||
}
|
||||
else if (CurCount < PreCount)
|
||||
{
|
||||
m_vBoneTransformationMatrix.resize(PreCount, XMMatrixIdentity());
|
||||
_uint boneIndex = pPreAnim->m_Channels[i]->Get_BoneIndex();
|
||||
if (boneIndex < 0 || boneIndex >= boneCount)
|
||||
continue;
|
||||
|
||||
if (i >= preMatCount)
|
||||
continue;
|
||||
|
||||
preBoneMats[boneIndex] = pPreAnim->m_vBoneTransformationMatrix[i];
|
||||
preHasBone[boneIndex] = true;
|
||||
}
|
||||
|
||||
size_t Count = m_vBoneTransformationMatrix.size();
|
||||
if (m_vBoneTransformationMatrix.size() < m_Channels.size())
|
||||
m_vBoneTransformationMatrix.resize(m_Channels.size(), XMMatrixIdentity());
|
||||
|
||||
unordered_map<_string, int> PreBoneMap;
|
||||
PreBoneMap.reserve(pPreAnim->m_Channels.size());
|
||||
_bool hasSaveAnim = (m_pSaveAnim != nullptr);
|
||||
|
||||
for (size_t j = 0; j < pPreAnim->m_Channels.size(); j++)
|
||||
_uint curChannelCount =(_uint)m_Channels.size();
|
||||
_uint curMatCount = (_uint)m_vBoneTransformationMatrix.size();
|
||||
|
||||
for (_uint i = 0; i < curChannelCount; ++i)
|
||||
{
|
||||
PreBoneMap[pPreAnim->m_pSaveAnim->Channels[j].ChannelName] = (int)j;
|
||||
}
|
||||
_uint boneIndex = m_Channels[i]->Get_BoneIndex();
|
||||
if (boneIndex < 0 || boneIndex >= (boneCount))
|
||||
continue;
|
||||
|
||||
for (size_t i = 0; i < m_Channels.size(); i++)
|
||||
{
|
||||
const _string& BoneName = m_pSaveAnim->Channels[i].ChannelName;
|
||||
if (i >= curMatCount)
|
||||
continue;
|
||||
|
||||
auto iter = PreBoneMap.find(BoneName);
|
||||
if (iter == PreBoneMap.end())
|
||||
_matrix curMat = m_vBoneTransformationMatrix[i];
|
||||
|
||||
if (!preHasBone[boneIndex] || fRatio <= 0.f)
|
||||
{
|
||||
_int BoneIndex = m_Channels[i]->Get_BoneIndex();
|
||||
if (BoneIndex < Bones.size())
|
||||
Bones[BoneIndex]->Set_TransformationMatrix(m_vBoneTransformationMatrix[i]);
|
||||
Bones[boneIndex]->Set_TransformationMatrix(curMat);
|
||||
continue;
|
||||
}
|
||||
|
||||
int PreIndex = iter->second;
|
||||
|
||||
_matrix CurMat = m_vBoneTransformationMatrix[i];
|
||||
_matrix PreMat = pPreAnim->m_vBoneTransformationMatrix[PreIndex];
|
||||
|
||||
_vector CurScale, CurRot, CurPos;
|
||||
_vector PreScale, PreRot, PrePos;
|
||||
XMMatrixDecompose(&CurScale, &CurRot, &CurPos, CurMat);
|
||||
XMMatrixDecompose(&PreScale, &PreRot, &PrePos, PreMat);
|
||||
|
||||
_vector FinalScale = XMVectorLerp(PreScale, CurScale, fRatio);
|
||||
_vector FinalRot = XMQuaternionSlerp(PreRot, CurRot, fRatio);
|
||||
_vector FinalPos = XMVectorLerp(PrePos, CurPos, fRatio);
|
||||
|
||||
if (BoneName == "Reference")
|
||||
if (fRatio >= 1.f)
|
||||
{
|
||||
//FinalPos = XMVectorZero();
|
||||
Bones[boneIndex]->Set_TransformationMatrix(curMat);
|
||||
continue;
|
||||
}
|
||||
|
||||
_matrix FinalMat = XMMatrixAffineTransformation(FinalScale, XMVectorZero(), FinalRot, FinalPos);
|
||||
_matrix preMat = preBoneMats[boneIndex];
|
||||
|
||||
int BoneIndex = m_Channels[i]->Get_BoneIndex();
|
||||
if (BoneIndex < Bones.size())
|
||||
_vector curS, curR, curT;
|
||||
_vector preS, preR, preT;
|
||||
|
||||
XMMatrixDecompose(&curS, &curR, &curT, curMat);
|
||||
XMMatrixDecompose(&preS, &preR, &preT, preMat);
|
||||
|
||||
_vector finalS = XMVectorLerp(preS, curS, fRatio);
|
||||
_vector finalR = XMQuaternionSlerp(preR, curR, fRatio);
|
||||
_vector finalT = XMVectorLerp(preT, curT, fRatio);
|
||||
|
||||
if (hasSaveAnim)
|
||||
{
|
||||
Bones[BoneIndex]->Set_TransformationMatrix(FinalMat);
|
||||
_string& boneName = m_pSaveAnim->Channels[i].ChannelName;
|
||||
if (boneName == "Reference")
|
||||
{
|
||||
finalT = XMVectorZero();
|
||||
}
|
||||
}
|
||||
|
||||
m_vBoneTransformationMatrix[i] = FinalMat;
|
||||
_matrix finalMat = XMMatrixAffineTransformation(finalS, XMVectorZero(), finalR, finalT);
|
||||
|
||||
Bones[boneIndex]->Set_TransformationMatrix(finalMat);
|
||||
|
||||
m_vBoneTransformationMatrix[i] = finalMat;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CAnimation::CreateGPUData(ID3D11Device* pDevice)
|
||||
|
||||
@@ -112,50 +112,54 @@ HRESULT CChannel::Initialize(const vector<CBone*>& Bones, _uint iIndex)
|
||||
}
|
||||
|
||||
|
||||
void CChannel::Update_TransformationMatirx(const vector<CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _float fCurrentTrackPosition, _uint* pCurrentKeyFrameIndex, CTransform* pTransform)
|
||||
void CChannel::Update_TransformationMatirx(
|
||||
const vector<CBone*>& Bones,
|
||||
const LOCALPOS_DESC* pLocalPosArray,
|
||||
_float fCurrentTrackPosition,
|
||||
_uint* pCurrentKeyFrameIndex,
|
||||
CTransform* pTransform,_float m_fAmount)
|
||||
{
|
||||
|
||||
//if (0.f == fCurrentTrackPosition) {
|
||||
// *pCurrentKeyFrameIndex = 0;
|
||||
//}
|
||||
//KEYFRAME LastKeyFrame = m_KeyFrames.back();
|
||||
/*if (0.f == fCurrentTrackPosition)
|
||||
*pCurrentKeyFrameIndex = 0;
|
||||
|
||||
//_vector vScale = {};
|
||||
//_vector vRotation = {};
|
||||
//_vector vTranslation = {};
|
||||
KEYFRAME LastKeyFrame = m_KeyFrames.back();
|
||||
|
||||
//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;
|
||||
// }
|
||||
_vector vScale{};
|
||||
_vector vRotation{};
|
||||
_vector vTranslation{};
|
||||
|
||||
// _float3 vSrcScale = {}, vDstScale = {};
|
||||
// _float4 vSrcRotation = {}, vDstRotation = {};
|
||||
// _float3 vSrcTranslation = {}, vDstTranslation = {};
|
||||
if (fCurrentTrackPosition >= LastKeyFrame.fTrackPosition)
|
||||
{
|
||||
vScale = XMLoadFloat3(&LastKeyFrame.vScale);
|
||||
vRotation = XMLoadFloat4(&LastKeyFrame.vRotation);
|
||||
vTranslation = XMVectorSetW(XMLoadFloat3(&LastKeyFrame.vTranslation), 1.f);
|
||||
}
|
||||
|
||||
// vSrcScale = m_KeyFrames[*pCurrentKeyFrameIndex].vScale;
|
||||
// vDstScale = m_KeyFrames[*pCurrentKeyFrameIndex + 1].vScale;
|
||||
else
|
||||
{
|
||||
while (fCurrentTrackPosition >= m_KeyFrames[*pCurrentKeyFrameIndex + 1].fTrackPosition)
|
||||
++*pCurrentKeyFrameIndex;
|
||||
|
||||
// vSrcRotation = m_KeyFrames[*pCurrentKeyFrameIndex].vRotation;
|
||||
// vDstRotation = m_KeyFrames[*pCurrentKeyFrameIndex + 1].vRotation;
|
||||
_float3 vSourScale{}, vDestScale{};
|
||||
_float4 vSourRotation{}, vDestRotation{};
|
||||
_float3 vSourTranslation{}, vDestTranslation{};
|
||||
|
||||
// vSrcTranslation = m_KeyFrames[*pCurrentKeyFrameIndex].vTranslation;
|
||||
// vDstTranslation = m_KeyFrames[*pCurrentKeyFrameIndex + 1].vTranslation;
|
||||
vSourScale = m_KeyFrames[*pCurrentKeyFrameIndex].vScale;
|
||||
vDestScale = m_KeyFrames[*pCurrentKeyFrameIndex + 1].vScale;
|
||||
|
||||
// _float fRatio = (fCurrentTrackPosition - m_KeyFrames[*pCurrentKeyFrameIndex].fTrackPosition) /
|
||||
// (m_KeyFrames[*pCurrentKeyFrameIndex + 1].fTrackPosition - m_KeyFrames[*pCurrentKeyFrameIndex].fTrackPosition);
|
||||
vSourRotation = m_KeyFrames[*pCurrentKeyFrameIndex].vRotation;
|
||||
vDestRotation = m_KeyFrames[*pCurrentKeyFrameIndex + 1].vRotation;
|
||||
|
||||
// vScale = XMVectorLerp(XMLoadFloat3(&vSrcScale), XMLoadFloat3(&vDstScale), fRatio);
|
||||
// vRotation = XMQuaternionSlerp(XMLoadFloat4(&vSrcRotation), XMLoadFloat4(&vDstRotation), fRatio);
|
||||
// vTranslation = XMVectorSetW(XMVectorLerp(XMLoadFloat3(&vSrcTranslation), XMLoadFloat3(&vDstTranslation), fRatio), 1.f);
|
||||
//}
|
||||
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];
|
||||
@@ -174,19 +178,17 @@ void CChannel::Update_TransformationMatirx(const vector<CBone*>& Bones, const LO
|
||||
XMStoreFloat3(&vCurRootPos, vTranslation);
|
||||
|
||||
_matrix pre = XMLoadFloat4x4(&m_PreTransformMatrix);
|
||||
/*
|
||||
|
||||
if (!m_bInitialRootPos)
|
||||
{
|
||||
m_bInitialRootPos = true;
|
||||
m_vPrevRootPos = vCurRootPos;
|
||||
vTranslation = XMVectorZero();
|
||||
}
|
||||
else
|
||||
{*/
|
||||
else
|
||||
{
|
||||
_vector vDeltaLocal = XMLoadFloat3(&vCurRootPos) - XMLoadFloat3(&m_vPrevRootPos);
|
||||
|
||||
_vector vDeltaAdjusted = {};
|
||||
|
||||
vDeltaAdjusted = XMVector3TransformNormal(vDeltaLocal, pre);
|
||||
_vector vDeltaAdjusted = XMVector3TransformNormal(vDeltaLocal, pre);
|
||||
|
||||
_vector vRight = pTransform->Get_State(STATE::RIGHT);
|
||||
_vector vUp = pTransform->Get_State(STATE::UP);
|
||||
@@ -199,16 +201,15 @@ void CChannel::Update_TransformationMatirx(const vector<CBone*>& Bones, const LO
|
||||
_vector vDeltaWorld = vRight * dx + (vUp * dz) + (-vLook * dy);
|
||||
|
||||
vDeltaWorld *= 0.01f;
|
||||
vDeltaWorld *= m_fAmount;
|
||||
|
||||
_vector vCurrentPos = pTransform->Get_State(STATE::POSITION);
|
||||
_vector vTargetPos = vCurrentPos + vDeltaWorld;
|
||||
|
||||
vDeltaWorld = XMVectorSetW(vDeltaWorld, 1.f);
|
||||
//pTransform->Set_State(STATE::POSITION,vDeltaWorld);
|
||||
pTransform->AccumulateMomentum(vDeltaWorld);
|
||||
|
||||
m_vPrevRootPos = vCurRootPos;
|
||||
vTranslation = XMVectorZero();
|
||||
//}
|
||||
///////////////////////////////////
|
||||
}
|
||||
|
||||
_float4 curRotF4;
|
||||
XMStoreFloat4(&curRotF4, vRotation);
|
||||
@@ -223,12 +224,11 @@ void CChannel::Update_TransformationMatirx(const vector<CBone*>& Bones, const LO
|
||||
else
|
||||
{
|
||||
_vector qPrev = XMLoadFloat4(&m_vPrevRootRot);
|
||||
|
||||
_vector qInvPrev = XMQuaternionInverse(qPrev);
|
||||
_vector qDelta = XMQuaternionMultiply(qInvPrev, qCur);
|
||||
|
||||
_vector axisLocal;
|
||||
_float angle = 0.f;
|
||||
_float angle = 0.f;
|
||||
XMQuaternionToAxisAngle(&axisLocal, &angle, qDelta);
|
||||
|
||||
_vector axisWorld = XMVector3TransformNormal(axisLocal, pre);
|
||||
@@ -244,15 +244,18 @@ void CChannel::Update_TransformationMatirx(const vector<CBone*>& Bones, const LO
|
||||
}
|
||||
|
||||
XMStoreFloat4(&m_vPrevRootRot, qCur);
|
||||
|
||||
vRotation = XMLoadFloat4(&m_vInitialRootRot);
|
||||
}
|
||||
|
||||
m_BoneTransformationMatrix = XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation);
|
||||
m_BoneTransformationMatrix =
|
||||
XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation);
|
||||
|
||||
Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
KEYFRAME* CChannel::Get_Frame(_uint iIndex)
|
||||
{
|
||||
return &m_KeyFrames[iIndex];
|
||||
|
||||
@@ -541,6 +541,10 @@ HRESULT CGameInstance::Copy_RenderTarget(const _wstring& strTargetTag, ID3D11Tex
|
||||
{
|
||||
return m_pRenderTarget_Manager->Copy_RenderTarget(strTargetTag, pTexture2D);
|
||||
}
|
||||
HRESULT CGameInstance::Refit_RenderTarget(CShader* pShader, const _wstring& wstrRenderTargetInput, const _wstring& wstrRenderTargetOutput)
|
||||
{
|
||||
return m_pRenderTarget_Manager->Refit_RenderTarget(pShader, wstrRenderTargetInput, wstrRenderTargetOutput);
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
void CGameInstance::RenderTarget_Debuger()
|
||||
{
|
||||
|
||||
@@ -123,7 +123,7 @@ _bool CModel::Play_Animation(_float fTimeDelta,CTransform* pTransform)
|
||||
_float fRatio = m_fBlendTime / m_fBlendDuration;
|
||||
fRatio = min(fRatio, 1.f);
|
||||
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, pTransform);
|
||||
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);
|
||||
|
||||
if (fRatio >= 1.f)
|
||||
@@ -134,7 +134,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_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, pTransform, m_fAmount);
|
||||
m_iPreAnimIndex = m_iCurrentAnimIndex;
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ _bool CModel::Play_Animation(_float fTimeDelta,CTransform* pTransform)
|
||||
return m_bIsFinishedAnim;
|
||||
}
|
||||
|
||||
void CModel::Set_AnimationIndex(_uint iIndex, _bool isLoop)
|
||||
void CModel::Set_AnimationIndex(_uint iIndex, _bool isLoop,_float fAmount)
|
||||
{
|
||||
if (m_iCurrentAnimIndex == iIndex)
|
||||
return;
|
||||
@@ -160,6 +160,7 @@ void CModel::Set_AnimationIndex(_uint iIndex, _bool isLoop)
|
||||
{
|
||||
m_iCurrentAnimIndex = iIndex;
|
||||
m_bIsLoop = isLoop;
|
||||
m_fAmount = fAmount;
|
||||
m_Animations[m_iCurrentAnimIndex]->ResetRootMotion();
|
||||
m_Animations[m_iCurrentAnimIndex]->Depart_Animation();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "RenderTarget.h"
|
||||
|
||||
#include "Shader.h"
|
||||
@@ -73,12 +73,16 @@ void CRenderTarget::Copy_Resource(ID3D11Texture2D* pTexture2D)
|
||||
{
|
||||
m_pContext->CopyResource(pTexture2D, m_pTexture2D);
|
||||
}
|
||||
void CRenderTarget::Get_TextureDesc(D3D11_TEXTURE2D_DESC& Desc)
|
||||
{
|
||||
m_pTexture2D->GetDesc(&Desc);
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
|
||||
void CRenderTarget::Ready_Debug()
|
||||
{
|
||||
|
||||
XMStoreFloat4x4(&m_WorldMatrix, XMMatrixIdentity()); // 디버그 월드 메트릭스 초기화
|
||||
XMStoreFloat4x4(&m_WorldMatrix, XMMatrixIdentity()); // 디버그 월드 메트릭스 초기화
|
||||
|
||||
_uint iNumViewports = { 1 };
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "pch.h"
|
||||
#include "RenderTarget_Manager.h"
|
||||
#include "RenderTarget.h"
|
||||
#include "Shader.h"
|
||||
|
||||
CRenderTarget_Manager::CRenderTarget_Manager(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
:CBase(),
|
||||
@@ -153,6 +154,59 @@ HRESULT CRenderTarget_Manager::Copy_RenderTarget(const _wstring& strTargetTag, I
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CRenderTarget_Manager::Refit_RenderTarget(class CShader* pShader, const _wstring& wstrRenderTargetInput, const _wstring& wstrRenderTargetOutput)
|
||||
{
|
||||
CRenderTarget* pInput = Find_RenderTarget(wstrRenderTargetInput);
|
||||
CRenderTarget* pOutput = Find_RenderTarget(wstrRenderTargetOutput);
|
||||
if (nullptr == pInput || nullptr == pOutput) { return E_FAIL; }
|
||||
|
||||
_uint iNumViewPort = 1;
|
||||
D3D11_VIEWPORT vp = {};
|
||||
m_pContext->RSGetViewports(&iNumViewPort, &vp);
|
||||
|
||||
D3D11_TEXTURE2D_DESC OutputDesc = {};
|
||||
pOutput->Get_TextureDesc(OutputDesc);
|
||||
vp.Width = (_float)OutputDesc.Width;
|
||||
vp.Height = (_float)OutputDesc.Height;
|
||||
|
||||
pOutput->Clear();
|
||||
|
||||
|
||||
{ // Bind RTVs
|
||||
_uint iNumRenderTargets = { 1 };
|
||||
ID3D11RenderTargetView* pRenderTargetViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = { pOutput->Get_RTV(), };
|
||||
m_pContext->OMSetRenderTargets(0, nullptr, nullptr);
|
||||
m_pContext->OMSetRenderTargets(1, pRenderTargetViews, nullptr);
|
||||
}
|
||||
|
||||
m_pContext->RSSetViewports(iNumViewPort, &vp);
|
||||
|
||||
{ // Bind const
|
||||
_float4x4 matIdentity = {};
|
||||
XMStoreFloat4x4(&matIdentity, XMMatrixIdentity());
|
||||
if (FAILED(pShader->Bind_Matrix("g_WorldMatrix", &matIdentity))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(pShader->Bind_Matrix("g_ViewMatrix", &matIdentity))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(pShader->Bind_Matrix("g_ProjMatrix", &matIdentity))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(pInput->Bind_ShaderResource(pShader, "g_DiffuseTexture"))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
if (FAILED(pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::REFIT)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
ID3D11ShaderResourceView* const pNullSRV[1] = { nullptr };
|
||||
m_pContext->PSSetShaderResources(0, 1, pNullSRV);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CRenderTarget_Manager::End_MRT()
|
||||
{
|
||||
|
||||
@@ -327,6 +327,14 @@ void CTransform::LookAt(_fvector vAt)
|
||||
Set_State(STATE::LOOK, XMVector3Normalize(vLook) * vScale.z);
|
||||
}
|
||||
|
||||
_float CTransform::TargetDis(_fvector vTarget)
|
||||
{
|
||||
_vector vTargetDis = vTarget - Get_State(STATE::POSITION);
|
||||
_float dist = XMVectorGetX(
|
||||
XMVector3Length(vTargetDis));
|
||||
return dist;
|
||||
}
|
||||
|
||||
CTransform* CTransform::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CTransform* pInstance = new CTransform(pDevice, pContext);
|
||||
|
||||
@@ -11,7 +11,8 @@ class ENGINE_DLL CAnimation : public CBase
|
||||
CAnimation(const CAnimation& rhs);
|
||||
virtual ~CAnimation() = default;
|
||||
public:
|
||||
_bool Update_TransformationMatrices(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _bool bIsLoop, _float fTimeDelta, class CTransform* pTransform = nullptr);
|
||||
_bool Update_TransformationMatrices(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _bool bIsLoop, _float fTimeDelta, class CTransform* pTransform = nullptr, _float m_fAmount = 1.f);
|
||||
void Reset();
|
||||
void ResetRootMotion();
|
||||
void Depart_Animation();
|
||||
void Set_AnimPause(_bool bValue) { m_bPause = bValue; }
|
||||
|
||||
@@ -21,13 +21,14 @@ class ENGINE_DLL CChannel : public CBase
|
||||
#endif // EDITOR_PROJECT
|
||||
|
||||
public:
|
||||
void Update_TransformationMatirx(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _float fCurrentTrackPosition, _uint* pCurrentKeyFrameIndex,class CTransform* pTransform=nullptr);
|
||||
void Update_TransformationMatirx(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _float fCurrentTrackPosition, _uint* pCurrentKeyFrameIndex,class CTransform* pTransform=nullptr,_float m_fAmount = 1.f);
|
||||
_int Get_BoneIndex() { return { m_iBoneIndex }; }
|
||||
void Set_BoneIndex(_int iBoneIndex) { m_iBoneIndex = iBoneIndex; }
|
||||
void ResetRootMotion() {
|
||||
m_vPrevRootPos = { 0.f, 0.f, 0.f };
|
||||
m_vPrevRootRot = { 0.f,0.f,0.f,0.f };
|
||||
m_bInitialRootRotSaved = false;
|
||||
m_bInitialRootPos = false;
|
||||
}
|
||||
_matrix Get_BoneTransformationMatrix() { return m_BoneTransformationMatrix; }
|
||||
|
||||
@@ -53,6 +54,7 @@ class ENGINE_DLL CChannel : public CBase
|
||||
_float3 m_vPrevRootPos = { 0.f, 0.f, 0.f };
|
||||
_float4 m_vPrevRootRot = { 0.f, 0.f, 0.f,0.f };
|
||||
_matrix m_BoneTransformationMatrix = {};
|
||||
_bool m_bInitialRootPos = { false };
|
||||
_bool m_bInitialRootRotSaved = {false};
|
||||
_float4 m_vInitialRootRot = {};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ enum class NAVI_POINT { A, B, C, END };
|
||||
enum class NAVI_LINE { AB, BC, CA, END };
|
||||
enum class SHADER_PASS_CELL { DEBUG, END };
|
||||
|
||||
enum class SHADER_PASS_DEFERRED { DEBUG, DIRECTIONAL, POINT, COMBINED, BLUR, SPOT, END };
|
||||
enum class SHADER_PASS_DEFERRED { DEBUG, DIRECTIONAL, POINT, COMBINED, BLUR, SPOT, REFIT, END };
|
||||
|
||||
enum class QUESTYPE {MAIN, SUB, END};
|
||||
enum class TEXTURE_MOUNT_SLOT0 { NOT_DEFINED, METALLIC, SPECULAR, HEIGHT, END };
|
||||
|
||||
@@ -157,6 +157,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
HRESULT End_MRT();
|
||||
HRESULT Bind_RenderTarget(const _wstring& strTargetTag, class CShader* pShader, const _char* pConstantName);
|
||||
HRESULT Copy_RenderTarget(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D);
|
||||
HRESULT Refit_RenderTarget(class CShader* pShader, const _wstring& wstrRenderTargetInput, const _wstring& wstrRenderTargetOutput);
|
||||
#ifdef _DEBUG
|
||||
void RenderTarget_Debuger();
|
||||
HRESULT Render_RenderTarget_Debug(class CShader* pShader, class CVIBuffer_Rect* pVIBuffer);
|
||||
|
||||
@@ -33,7 +33,7 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
#pragma endregion
|
||||
#pragma region Animation
|
||||
_bool Play_Animation(_float fTimeDelta, class CTransform* pTransform = nullptr); // 애니메이션에 델타타임을 넣어줌
|
||||
void Set_AnimationIndex(_uint iIndex, _bool isLoop = true);
|
||||
void Set_AnimationIndex(_uint iIndex, _bool isLoop = true, _float fAmount = 1.f);
|
||||
_bool IsFinishedAnim() const { return m_bIsFinishedAnim; }
|
||||
void Set_CurrentTrackPosition(_float TrackPosition);
|
||||
const _char* Get_AnimList(_uint iIndex);
|
||||
@@ -109,6 +109,7 @@ static _int Get_BoneIndex(const _char* pBoneName, vector<class CBone*> Bones); /
|
||||
_bool m_bIsFinishedAnim = { false }; // 대상 애니메이션이 끝났는지
|
||||
_bool m_bIsFinishedLerp = { false }; // 럴프 애니메이션이 끝났는지
|
||||
_bool m_bPlayAnim = { true };
|
||||
_float m_fAmount = { 1.f };
|
||||
|
||||
_int m_iPreAnimIndex = { 0 };
|
||||
_float m_fBlendTime = { 0.f };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "Base.h"
|
||||
|
||||
@@ -18,6 +18,8 @@ class CRenderTarget final : public CBase
|
||||
HRESULT Bind_ShaderResource(class CShader* pShader, const _char* pConstantName);
|
||||
void Clear();
|
||||
void Copy_Resource(ID3D11Texture2D* pTexture2D);
|
||||
void Get_TextureDesc(D3D11_TEXTURE2D_DESC& Desc);
|
||||
ID3D11ShaderResourceView* Get_SRV() const { return m_pSRV; }
|
||||
|
||||
#ifdef _DEBUG
|
||||
public:
|
||||
@@ -47,4 +49,4 @@ class CRenderTarget final : public CBase
|
||||
virtual void Free() override;
|
||||
};
|
||||
|
||||
NS_END
|
||||
NS_END
|
||||
|
||||
@@ -19,6 +19,8 @@ class CRenderTarget_Manager final : public CBase
|
||||
HRESULT Bind_RenderTarget(const _wstring& strTargetTag, class CShader* pShader, const _char* pConstantName);
|
||||
HRESULT Copy_RenderTarget(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D);
|
||||
|
||||
HRESULT Refit_RenderTarget(class CShader* pShader, const _wstring& wstrRenderTargetInput, const _wstring& wstrRenderTargetOutput);
|
||||
|
||||
#ifdef _DEBUG
|
||||
public:
|
||||
HRESULT Render_RenderTarget_Debug(class CShader* pShader, class CVIBuffer_Rect* pVIBuffer);
|
||||
|
||||
@@ -7,11 +7,11 @@ enum ESTATE
|
||||
IDLE, IDLE_TURN_L, IDLE_TURN_R, IDLE_TURN_BWD,
|
||||
MOVE,
|
||||
WALK, WALK_FWD, WALK_BWD,WALK_STOP,
|
||||
JOG,JOG_FWD, JOG_STOP,
|
||||
JOG,JOG_FWD, JOG_BWD,JOG_STOP,
|
||||
SPRINT,
|
||||
JUMP,JUMP_JOG,JUMP_SPRINT,
|
||||
LAND,
|
||||
DODGE,
|
||||
DODGE,DODGE_BLINK,
|
||||
COMBAT, LIGHT_ATTACK, SPELL, SKILL, SKILL2,
|
||||
ACCIO,DESCENDO,DIFFINDO,DEPULSO,LUMOS,DISILLUSION_ENTER,DISILLUSION_EXIT,
|
||||
MAPHELP,
|
||||
|
||||
@@ -33,7 +33,9 @@ class ENGINE_DLL CTransform final :
|
||||
_float3 Get_Scale() const;
|
||||
_vector Get_QuarternionVector() const; // 현재 회전정보를 담고 있는 쿼터니언 벡터를 out
|
||||
_vector Get_RollPitchYawVector() const;
|
||||
_vector Get_State(STATE eState) const { return XMLoadFloat4(reinterpret_cast<const _float4*>(&m_WorldMatrix.m[ENUM_CLASS(eState)])); }
|
||||
_vector Get_State(STATE eState) const {
|
||||
return XMLoadFloat4(reinterpret_cast<const _float4*>(&m_WorldMatrix.m[ENUM_CLASS(eState)]));
|
||||
}
|
||||
const _float4* Get_StatePtr(STATE eState) { return reinterpret_cast<_float4*>(&m_WorldMatrix.m[ENUM_CLASS(eState)]); }
|
||||
const _float4x4* Get_WorldMatrixPtr() const { return &m_WorldMatrix; }
|
||||
const _matrix Get_XMWorldMatrix() const { return XMLoadFloat4x4(&m_WorldMatrix); }
|
||||
@@ -66,6 +68,8 @@ class ENGINE_DLL CTransform final :
|
||||
// Up, Down 벡터를 바라보게 하면 터짐
|
||||
void LookAt(_fvector vAt);
|
||||
|
||||
_float TargetDis(_fvector vTarget);
|
||||
|
||||
private:
|
||||
_float m_fSpeedPerSec = {};
|
||||
_float m_fRotationPerSec = {};
|
||||
|
||||
@@ -37,6 +37,7 @@ class ENGINE_DLL CUnit abstract : public CContainerObject
|
||||
void Set_LightCombo(_uint LightCombo) { m_iLightCombo = LightCombo; }
|
||||
_float Get_KeyFrame(_string FrameName);
|
||||
_bool IsCurrentKeyFrame(_string FrameName);
|
||||
|
||||
virtual void Reset_Sprint() {};
|
||||
virtual void Reset_Walk() {};
|
||||
#pragma endregion
|
||||
@@ -56,6 +57,10 @@ class ENGINE_DLL CUnit abstract : public CContainerObject
|
||||
|
||||
vector<pair<_uint, _bool>> m_Animation;
|
||||
|
||||
unordered_map<size_t, CState*> m_States = { };
|
||||
size_t m_iStateMask = { 0 };
|
||||
|
||||
STATEANIM::ESTATE m_eSpell = { STATEANIM::END };
|
||||
|
||||
private:
|
||||
virtual void Add_FSM() {};
|
||||
|
||||
Reference in New Issue
Block a user