|
After Width: | Height: | Size: 85 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 113 KiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 4.2 MiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 8.7 MiB |
|
After Width: | Height: | Size: 3.8 MiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 113 KiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 4.2 MiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 18 MiB |
|
After Width: | Height: | Size: 2.9 MiB |
@@ -304,6 +304,37 @@ PS_OUT PS_MAIN_TEST(PS_IN In)
|
||||
return Out;
|
||||
}
|
||||
|
||||
PS_OUT PS_EYELASH(PS_IN In)
|
||||
{
|
||||
PS_OUT Out;
|
||||
|
||||
vector vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
if (vMtrlDiffuse.a < 0.4f)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
vector vNormalDesc = g_NormalTexture.Sample(MirrorSampler, In.vTexcoord);
|
||||
float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal);
|
||||
|
||||
float3 vNormal = mul(vNormalDesc.xyz * 2.f - 1.f, WorldMatrix);
|
||||
|
||||
if (true == g_bRimLight)
|
||||
{
|
||||
float fRimLight = GetRimLight(g_vCamPosition.xyz, In.vWorldPos.xyz, vNormal, g_fRimPower, g_fRimStrength);
|
||||
vMtrlDiffuse.xyz = (vMtrlDiffuse.xyz * (1 - fRimLight)) + g_vRimColor * fRimLight;
|
||||
}
|
||||
|
||||
|
||||
Out.vDiffuse = float4(vMtrlDiffuse.rgb, vMtrlDiffuse.g);
|
||||
Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f);
|
||||
Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, 0.0f, 1.f);
|
||||
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
|
||||
technique11 DefaultTechnique
|
||||
{
|
||||
pass Default
|
||||
@@ -354,4 +385,14 @@ technique11 DefaultTechnique
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_MAIN_TEST();
|
||||
}
|
||||
|
||||
pass EyeLashPass
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
SetDepthStencilState(DSS_Default, 0);
|
||||
SetBlendState(BS_AlphaBlend, 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_EYELASH();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ void CDummyObject::Priority_Update(_float fTimeDelta)
|
||||
|
||||
void CDummyObject::Update(_float fTimeDelta)
|
||||
{
|
||||
m_pModelCom->Play_Animation(fTimeDelta);
|
||||
m_pModelCom->Play_Animation(fTimeDelta,m_pTransformCom);
|
||||
}
|
||||
|
||||
void CDummyObject::Late_Update(_float fTimeDelta)
|
||||
|
||||
@@ -50,7 +50,78 @@ void CHead::Late_Update(_float fTimeDelta)
|
||||
|
||||
HRESULT CHead::Render()
|
||||
{
|
||||
__super::Render();
|
||||
if(!m_pModelCom)
|
||||
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_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (i == m_HeadIndex)
|
||||
{
|
||||
|
||||
if (FAILED(m_pShaderCom->Begin(5))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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 CHead::Bind_ShaderResources()
|
||||
{
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", &m_CombinedWorldMatrix))) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
GUI::DragFloat4("COLOR", (_float*)&m_vColor, 0.1f);
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_TestColor", &m_vColor, sizeof(_float4)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "DummySkyBox.h"
|
||||
#include "MainLight.h"
|
||||
#include "Terrain.h"
|
||||
|
||||
|
||||
CLevel_ObjectViewer::CLevel_ObjectViewer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID)
|
||||
@@ -265,6 +266,7 @@ void CLevel_ObjectViewer::Show_AnimList()
|
||||
{
|
||||
pModel->Set_AnimationIndex(i);
|
||||
pModel->Set_CurrentTrackPosition(0.f);
|
||||
pModel->Play_Animation(0.f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -301,9 +303,16 @@ void CLevel_ObjectViewer::Dummy_Object_Setting()
|
||||
GUI::Begin("Object_Info");
|
||||
if (!m_Objects.empty())
|
||||
{
|
||||
_float3 Pos;
|
||||
XMStoreFloat3(&Pos, m_Objects[m_iObjectIndex]->Get_Component<CTransform>()->Get_State(STATE::POSITION));
|
||||
GUI::DragFloat3("Pos", (_float*)&Pos);
|
||||
|
||||
Show_ObjectList();
|
||||
|
||||
CModel* pModel = m_Objects[m_iObjectIndex]->Get_Component<CModel>();
|
||||
|
||||
GUI::Button(pModel->Get_AnimList(pModel->Get_AnimIndex()));
|
||||
|
||||
_float AnimTrack = pModel->Get_CurrentTrackPosition();
|
||||
GUI::DragFloat("AnimTrack", &AnimTrack);
|
||||
|
||||
@@ -333,6 +342,18 @@ void CLevel_ObjectViewer::Parts_Object_Setting()
|
||||
CModel* pModel = m_HumanRoot->Get_MainModel();
|
||||
if (pModel)
|
||||
{
|
||||
_float3 Pos;
|
||||
XMStoreFloat3(&Pos, m_HumanRoot->Get_WorldPostion());
|
||||
|
||||
float Pos3[3] = { Pos.x, Pos.y, Pos.z };
|
||||
GUI::DragFloat3("Pos", Pos3);
|
||||
|
||||
Pos.x = Pos3[0];
|
||||
Pos.y = Pos3[1];
|
||||
Pos.z = Pos3[2];
|
||||
|
||||
m_HumanRoot->Get_Component<CTransform>()->Set_State(STATE::POSITION, XMVectorSet(Pos.x, Pos.y, Pos.z, 1.f));
|
||||
|
||||
GUI::Button(pModel->Get_AnimList(pModel->Get_AnimIndex()));
|
||||
|
||||
_float KeyFrame = pModel->Get_CurrentTrackPosition();
|
||||
@@ -496,6 +517,9 @@ HRESULT CLevel_ObjectViewer::Ready_Layer_Dummy(const _wstring& strLayerTag)
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CDummySkyBox>(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CTerrain>(g_iStaticLevel, NEXT_LEVEL, strLayerTag)))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -735,6 +735,14 @@ HRESULT CLoader::Loading_For_ObjectViewer()
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Human/Head/FeMale/T_NPC_F_Head_Eye_Honey.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity()))))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_F_Head_Model"),
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Human/Head/FeMale/F_Head.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity()))))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_M_Head_Model"),
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Human/Head/Male/M_Head.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity()))))
|
||||
return E_FAIL;
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region HAIR
|
||||
@@ -756,6 +764,10 @@ HRESULT CLoader::Loading_For_ObjectViewer()
|
||||
return E_FAIL;
|
||||
#pragma endregion
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_TestHuman_Model"),
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Human/TestHuman.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity()))))
|
||||
return E_FAIL;
|
||||
|
||||
#pragma region MONSTER
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_TombProtector_Model"),
|
||||
@@ -792,10 +804,20 @@ HRESULT CLoader::Loading_For_ObjectViewer()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("TerrainTest"),
|
||||
CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/Cursor/UI_T_CursorRings.dds"), 0)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_strMessage = TEXT("Shader Loading..");
|
||||
|
||||
m_strMessage = TEXT("Prototype Loading..");
|
||||
|
||||
/* For.Prototype_Component_VIBuffer_Terrain */
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Terrain"),
|
||||
CVIBuffer_Terrain::Create(m_pDevice, m_pContext, nullptr, 100, 100))))
|
||||
return E_FAIL;
|
||||
|
||||
/* For.Prototype_GameObject_RootModelPart */
|
||||
if (FAILED(m_pGameInstance->Add_Prototype<CRootModelPart>(g_iStaticLevel, CRootModelPart::Create(m_pDevice, m_pContext))))
|
||||
return E_FAIL;
|
||||
@@ -820,6 +842,10 @@ HRESULT CLoader::Loading_For_ObjectViewer()
|
||||
if (FAILED(m_pGameInstance->Add_Prototype<CDummySkyBox>(g_iStaticLevel, CDummySkyBox::Create(m_pDevice, m_pContext))))
|
||||
return E_FAIL;
|
||||
|
||||
/* For.Prototype_GameObject_Terrain */
|
||||
if (FAILED(m_pGameInstance->Add_Prototype<CTerrain>(g_iStaticLevel, CTerrain::Create(m_pDevice, m_pContext))))
|
||||
return E_FAIL;
|
||||
|
||||
m_strMessage = TEXT("Loading Success!");
|
||||
|
||||
m_isFinished = true;
|
||||
|
||||
@@ -96,7 +96,13 @@ void CModelParts::Change_Model(const _wchar* Prototype)
|
||||
Remove_Component<CModel>();
|
||||
SAFE_RELEASE(m_pModelCom);
|
||||
}
|
||||
|
||||
;
|
||||
if (strstr(CMyTools::ToString(Prototype).c_str(), "_F_"))
|
||||
{
|
||||
m_HeadIndex = 2;
|
||||
}
|
||||
else
|
||||
m_HeadIndex = 1;
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, Prototype,
|
||||
reinterpret_cast<CComponent**>(&m_pModelCom))))
|
||||
return;
|
||||
|
||||
@@ -71,7 +71,7 @@ void CRootModelPart::Update_Anim(_float fTimeDelta)
|
||||
{
|
||||
pModel->Set_PlayAnim(m_pMainModel->Get_PlayAnim());
|
||||
pModel->Set_AnimSpeed(m_pMainModel->Get_AnimSpeed());
|
||||
pModel->Play_Animation(fTimeDelta);
|
||||
pModel->Play_Animation(fTimeDelta,m_pTransformCom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ class CHair final : public CModelParts
|
||||
private:
|
||||
CTexture* m_pTextureCom = { nullptr };
|
||||
_uint iTextureIndex = { 0 };
|
||||
_float4 m_vColor = _float4{1.f,1.f,1.f,1.f};
|
||||
|
||||
public:
|
||||
static CHair* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
@@ -37,4 +36,4 @@ class CHair final : public CModelParts
|
||||
virtual void Describe_Entity() override;
|
||||
};
|
||||
|
||||
NS_END
|
||||
NS_END
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "Editor_Define.h"
|
||||
#include "ModelParts.h"
|
||||
@@ -19,6 +19,7 @@ class CHead final : public CModelParts
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
HRESULT Bind_ShaderResources();
|
||||
private:
|
||||
HRESULT Ready_Components();
|
||||
|
||||
@@ -29,4 +30,4 @@ class CHead final : public CModelParts
|
||||
virtual void Describe_Entity() override;
|
||||
};
|
||||
|
||||
NS_END
|
||||
NS_END
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "Editor_Define.h"
|
||||
#include "PartObject.h"
|
||||
@@ -34,14 +34,15 @@ class CModelParts abstract : public CPartObject
|
||||
_wstring& Get_PrototypeTag() { return m_strModelPrototypeTag; }
|
||||
|
||||
protected:
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
CModel* m_pModelCom = { nullptr };
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
CModel* m_pModelCom = { nullptr };
|
||||
_bool m_bRimLight = { true };
|
||||
_float m_fRimLightPower = { 3.2f };
|
||||
_float m_fRimLightStrength = { 3.04f };
|
||||
_float3 m_vRimLightColor = { 69.f / 255.f, 5.f / 255.f, 10.f / 255.f };
|
||||
|
||||
_uint m_HeadIndex = {};
|
||||
_wstring m_strModelPrototypeTag;
|
||||
_float4 m_vColor = _float4{ 1.f,1.f,1.f,1.f };
|
||||
protected:
|
||||
HRESULT Ready_Components();
|
||||
HRESULT Bind_ShaderResources();
|
||||
@@ -52,4 +53,4 @@ class CModelParts abstract : public CPartObject
|
||||
virtual void Describe_Entity() override;
|
||||
};
|
||||
|
||||
NS_END
|
||||
NS_END
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "Animation.h"
|
||||
#include "Channel.h"
|
||||
#include "Model.h"
|
||||
#include "Transform.h"
|
||||
|
||||
CAnimation::CAnimation()
|
||||
{
|
||||
@@ -29,7 +31,7 @@ CAnimation::CAnimation(const CAnimation& rhs)
|
||||
SAFE_ADDREF(pChannel);
|
||||
}
|
||||
}
|
||||
_bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bones, _bool bIsLoop, _float fTimeDelta)
|
||||
_bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bones, _bool bIsLoop, _float fTimeDelta,CTransform*pTransform)
|
||||
{
|
||||
//m_fCurrentTrackPosition += m_TickPerSeconds[m_bPause] * fTimeDelta;
|
||||
m_fCurrentTrackPosition += m_fTickPerSecond * fTimeDelta * m_fAnimSpeed;
|
||||
@@ -47,12 +49,17 @@ _bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bone
|
||||
|
||||
_uint iIndex = {};
|
||||
for (auto& pChannel : m_Channels) {
|
||||
pChannel->Update_TransformationMatirx(Bones, m_fCurrentTrackPosition, &m_CurrentKeyFrameIndices[iIndex++]);
|
||||
pChannel->Update_TransformationMatirx(Bones, m_fCurrentTrackPosition, &m_CurrentKeyFrameIndices[iIndex++],pTransform);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CAnimation::ResetRootMotion()
|
||||
{
|
||||
for (auto& pChannel : m_Channels)
|
||||
pChannel->ResetRootMotion();
|
||||
}
|
||||
|
||||
void CAnimation::Depart_Animation()
|
||||
{
|
||||
@@ -97,7 +104,25 @@ vector<_int>* CAnimation::Capture_Bones()
|
||||
}
|
||||
return &m_DestBones;
|
||||
}
|
||||
|
||||
void CAnimation::Remap_Channels_By_Name(CModel* TargetModel)
|
||||
{
|
||||
for (auto& channel : m_Channels)
|
||||
{
|
||||
const string& name = channel->Get_Name();
|
||||
|
||||
int idx = TargetModel->Get_BoneIndex(name.c_str());
|
||||
|
||||
if (idx != -1)
|
||||
channel->Set_BoneIndex(idx);
|
||||
else
|
||||
channel->Set_BoneIndex(-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef EDITOR_PROJECT
|
||||
|
||||
HRESULT CAnimation::Initialize(const vector<CBone*>& Bones, const aiAnimation* pAIAnimation)
|
||||
{
|
||||
m_strName = pAIAnimation->mName.data;
|
||||
@@ -272,4 +297,4 @@ void CAnimation::Describe_Entity()
|
||||
//if (GUI::CollapsingHeader(m_strName.c_str())) {
|
||||
//
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "Channel.h"
|
||||
#include "Model.h"
|
||||
#include "Bone.h"
|
||||
#include "Transform.h"
|
||||
|
||||
CChannel::CChannel()
|
||||
{
|
||||
@@ -99,7 +100,7 @@ HRESULT CChannel::Initialize(const vector<CBone*>& Bones, _uint iIndex)
|
||||
}
|
||||
|
||||
|
||||
void CChannel::Update_TransformationMatirx(const vector<CBone*>& Bones, _float fCurrentTrackPosition, _uint* pCurrentKeyFrameIndex)
|
||||
void CChannel::Update_TransformationMatirx(const vector<CBone*>& Bones, _float fCurrentTrackPosition, _uint* pCurrentKeyFrameIndex, CTransform* pTransform)
|
||||
|
||||
{
|
||||
if (0.f == fCurrentTrackPosition) {
|
||||
@@ -142,10 +143,41 @@ void CChannel::Update_TransformationMatirx(const vector<CBone*>& Bones, _float f
|
||||
vRotation = XMQuaternionSlerp(XMLoadFloat4(&vSrcRotation), XMLoadFloat4(&vDstRotation), fRatio);
|
||||
vTranslation = XMVectorSetW(XMVectorLerp(XMLoadFloat3(&vSrcTranslation), XMLoadFloat3(&vDstTranslation), fRatio), 1.f);
|
||||
}
|
||||
|
||||
if (Bones[m_iBoneIndex]->Compare_Name("Reference") && pTransform != nullptr)
|
||||
{
|
||||
_float3 vCurRootPos;
|
||||
XMStoreFloat3(&vCurRootPos, vTranslation);
|
||||
|
||||
_vector vDeltaLocal = XMLoadFloat3(&vCurRootPos) - XMLoadFloat3(&m_vPrevRootPos);
|
||||
|
||||
_vector vDeltaAdjusted = {};
|
||||
|
||||
XMMATRIX pre = XMLoadFloat4x4(&m_PreTransformMatrix);
|
||||
vDeltaAdjusted = XMVector3TransformNormal(vDeltaLocal, pre);
|
||||
|
||||
_vector vRight = pTransform->Get_State(STATE::RIGHT);
|
||||
_vector vUp = pTransform->Get_State(STATE::UP);
|
||||
_vector vLook = pTransform->Get_State(STATE::LOOK);
|
||||
|
||||
_float dx = XMVectorGetX(vDeltaAdjusted);
|
||||
_float dy = XMVectorGetY(vDeltaAdjusted);
|
||||
_float dz = XMVectorGetZ(vDeltaAdjusted);
|
||||
|
||||
_vector vDeltaWorld = vRight * dx + vUp * dz + vLook * dy;
|
||||
|
||||
_vector vCurrentPos = pTransform->Get_State(STATE::POSITION);
|
||||
_vector vTargetPos = vCurrentPos + vDeltaWorld;
|
||||
|
||||
pTransform->Set_State(STATE::POSITION, vTargetPos);
|
||||
|
||||
m_vPrevRootPos = vCurRootPos;
|
||||
vTranslation = XMVectorZero();
|
||||
}
|
||||
|
||||
_matrix BoneTransformationMatrix = XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation);
|
||||
|
||||
if(Bones.size()>m_iBoneIndex)
|
||||
Bones[m_iBoneIndex]->Set_TransformationMatrix(BoneTransformationMatrix);
|
||||
Bones[m_iBoneIndex]->Set_TransformationMatrix(BoneTransformationMatrix);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "Animation.h"
|
||||
#include "LerpAnim.h"
|
||||
#include "GameObject.h"
|
||||
#include "Transform.h"
|
||||
|
||||
CModel::CModel(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CComponent{ pDevice, pContext }
|
||||
@@ -140,7 +141,7 @@ 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)
|
||||
_bool CModel::Play_Animation(_float fTimeDelta,CTransform* pTransform)
|
||||
{
|
||||
if (!m_bPlayAnim)
|
||||
return false;
|
||||
@@ -154,7 +155,7 @@ _bool CModel::Play_Animation(_float fTimeDelta)
|
||||
m_bIsFinishedLerp = m_pLerpAnim->Update_TransformationMatrices(m_Bones, fTimeDelta);
|
||||
}
|
||||
else { // 럴프중이지 않다면 실제 애니메이션 재생을 시작함
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_bIsLoop, fTimeDelta);
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_bIsLoop, fTimeDelta, pTransform);
|
||||
}
|
||||
|
||||
for (_int i = 0; i < m_Bones.size(); ++i)
|
||||
@@ -183,6 +184,9 @@ _bool CModel::Play_Animation(_float fTimeDelta)
|
||||
}
|
||||
}
|
||||
|
||||
if(m_bIsFinishedAnim)
|
||||
m_Animations[m_iCurrentAnimIndex]->ResetRootMotion();
|
||||
|
||||
return m_bIsFinishedAnim;
|
||||
}
|
||||
|
||||
@@ -194,6 +198,7 @@ void CModel::Set_AnimationIndex(_uint iIndex, _bool isLoop)
|
||||
{
|
||||
m_iCurrentAnimIndex = iIndex;
|
||||
m_bIsLoop = isLoop;
|
||||
m_Animations[m_iCurrentAnimIndex]->ResetRootMotion();
|
||||
}
|
||||
else
|
||||
m_iCurrentAnimIndex = -1;
|
||||
@@ -308,6 +313,17 @@ void CModel::Set_AnimSpeed(_float fSpeed)
|
||||
m_Animations[m_iCurrentAnimIndex]->Set_AnimSpeed(fSpeed);
|
||||
}
|
||||
|
||||
void CModel::Set_Anim(CModel* Source)
|
||||
{
|
||||
m_Animations = Source->m_Animations;
|
||||
|
||||
for (auto& anim : m_Animations)
|
||||
anim->Remap_Channels_By_Name(this);
|
||||
|
||||
m_iNumAnimations = (_uint)m_Animations.size();
|
||||
}
|
||||
|
||||
|
||||
HRESULT CModel::Render(_uint iMeshIndex)
|
||||
{
|
||||
m_Meshes[iMeshIndex]->Bind_Resources();
|
||||
|
||||
@@ -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, _bool bIsLoop, _float fTimeDelta);
|
||||
_bool Update_TransformationMatrices(const vector<class CBone*>& Bones, _bool bIsLoop, _float fTimeDelta, class CTransform* pTransform = nullptr);
|
||||
void ResetRootMotion();
|
||||
void Depart_Animation();
|
||||
void Set_AnimPause(_bool bValue) { m_bPause = bValue; }
|
||||
_float Get_AnimProgressRatio();
|
||||
@@ -27,7 +28,8 @@ class ENGINE_DLL CAnimation : public CBase
|
||||
_float Get_CurrentTrackPosition() { return m_fCurrentTrackPosition; }
|
||||
void Set_AnimSpeed(_float fSpeed) { m_fAnimSpeed = fSpeed; }
|
||||
_float Get_AnimSpeed() { return m_fAnimSpeed; }
|
||||
|
||||
void Set_Channel(CAnimation* Animation);
|
||||
void Remap_Channels_By_Name(class CModel* TargetModel);
|
||||
#ifdef EDITOR_PROJECT
|
||||
private:
|
||||
HRESULT Initialize(const vector<class CBone*>& Bones, const aiAnimation* pAIAnimation);
|
||||
@@ -73,4 +75,4 @@ class ENGINE_DLL CAnimation : public CBase
|
||||
void Describe_Entity();
|
||||
};
|
||||
|
||||
NS_END
|
||||
NS_END
|
||||
|
||||
@@ -19,15 +19,17 @@ class ENGINE_DLL CChannel : public CBase
|
||||
#endif // EDITOR_PROJECT
|
||||
|
||||
public:
|
||||
void Update_TransformationMatirx(const vector<class CBone*>& Bones, _float fCurrentTrackPosition, _uint* pCurrentKeyFrameIndex);
|
||||
void Update_TransformationMatirx(const vector<class CBone*>& Bones, _float fCurrentTrackPosition, _uint* pCurrentKeyFrameIndex,class CTransform* pTransform=nullptr);
|
||||
_int Get_BoneIndex() { return { m_iBoneIndex }; }
|
||||
|
||||
void Set_BoneIndex(_int iBoneIndex) { m_iBoneIndex = iBoneIndex; }
|
||||
void ResetRootMotion() { m_vPrevRootPos = { 0.f, 0.f, 0.f }; }
|
||||
|
||||
KEYFRAME* Get_Frame(_uint iIndex);
|
||||
void Set_Frame(_uint iIndex, KEYFRAME& kf);
|
||||
_bool Compare_Name(const _char* pChannelname) const {
|
||||
return !strcmp(pChannelname, m_szName);
|
||||
}
|
||||
_char* Get_Name() { return m_szName; }
|
||||
private:
|
||||
HRESULT Initialize(HANDLE hFile, DWORD& dwByte);
|
||||
// 바이너리
|
||||
@@ -42,7 +44,7 @@ class ENGINE_DLL CChannel : public CBase
|
||||
_uint m_iNumKeyFrames = {}; // Animation의 m_fDuration동안 이 본이 취해야할 키프레임의 갯수
|
||||
_float4x4 m_PreTransformMatrix = {};
|
||||
vector<KEYFRAME> m_KeyFrames; // 키프레임 벡터
|
||||
|
||||
_float3 m_vPrevRootPos = { 0.f, 0.f, 0.f };
|
||||
public:
|
||||
static CChannel* Create(const vector<class CBone*>& Bones, _uint iIndex); // 럴프전용
|
||||
static CChannel* Create(HANDLE hFile, DWORD& dwByte);
|
||||
@@ -52,4 +54,4 @@ class ENGINE_DLL CChannel : public CBase
|
||||
virtual void Free() override;
|
||||
};
|
||||
|
||||
NS_END
|
||||
NS_END
|
||||
|
||||