[merge commit]

This commit is contained in:
kimnuri
2025-12-07 10:19:14 +09:00
38 changed files with 1693 additions and 576 deletions
+88 -9
View File
@@ -269,6 +269,18 @@ _bool CModel::Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform)
}
}
if (m_bIsFinishedAnim)
{
if (m_bIsLoop)
{
m_bLoopRestarted = true;
m_vPrevRootPos = { 0,0,0 };
}
else {
XMStoreFloat3(&m_vPrevRootPos, m_vector[2]);
}
}
if (m_bRatio) {
Update_RootBone(m_fAmount * m_fRatio);
}
@@ -279,14 +291,6 @@ _bool CModel::Play_Dual_Anim(_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;
}
@@ -735,6 +739,75 @@ HRESULT CModel::Ready_Materials_FromFile(const aiScene* pAIScene, const _char* p
return S_OK;
}
HRESULT CModel::Ready_Materials_FromFile_Anim(const aiScene* pAIScene, const _char* pModelFilePath)
{
m_iNumMaterials = pAIScene->mNumMaterials;
m_Materials.reserve(m_iNumMaterials);
_char szDrive[MAX_PATH] = {};
_char szDir[MAX_PATH] = {};
_char szFileName[MAX_PATH] = {};
_char szMeshFilePath[MAX_PATH] = {};
vector<_string> MaterialFilePathes;
string strFolderPath = pModelFilePath;
size_t iFolderPos = strFolderPath.find("MeshTable");
strFolderPath = strFolderPath.substr(0, iFolderPos) + "MeshTable/";
_splitpath_s(pModelFilePath, szDrive, MAX_PATH, szDir, MAX_PATH, szFileName, MAX_PATH, nullptr, 0);
strcpy_s(szMeshFilePath, szDrive);
strcat_s(szMeshFilePath, szDir);
strcat_s(szMeshFilePath, szFileName);
strcat_s(szMeshFilePath, ".props.txt");
ifstream file(szMeshFilePath);
if (!file.is_open())
{
return S_OK;
}
string strText = {};
_uint iNumParameter = {};
getline(file, strText);
getline(file, strText);
for (_uint i = 0; i < m_iNumMaterials; ++i)
{
getline(file, strText);
_int iBeginIndex = (_int)strText.find_first_of("/");
_int iEndIndex = (_int)strText.find('.');
if (-1 == iBeginIndex || -1 == iEndIndex) {
MSG_BOX("Fail Path _ NotExist");
return E_FAIL;
}
if ((_int)strText.size() < iEndIndex - iBeginIndex)
{
MSG_BOX("Fail Path");
return E_FAIL;
}
string strPath = strFolderPath + strText.substr(iBeginIndex + 1, iEndIndex - iBeginIndex - 1);
MaterialFilePathes.push_back(strPath);
}
for (size_t i = 0; i < m_iNumMaterials; ++i) {
CMaterial* pMaterial = CMaterial::Create(m_pDevice, m_pContext, MaterialFilePathes[i].c_str(), strFolderPath.c_str());
if (nullptr == pMaterial) {
return E_FAIL;
}
m_Materials.push_back(pMaterial);
}
m_Materials.shrink_to_fit();
return S_OK;
}
HRESULT CModel::Ready_Materials_Independent(MODEL eType, const aiScene* pAIScene, const _char* pModelFilePath)
{
m_iNumMaterials = pAIScene->mNumMaterials;
@@ -1125,6 +1198,12 @@ HRESULT CModel::Assimp_Model_Load(const _char* pModelFilePath, MODEL eType, _fma
return E_FAIL;
}
}
else if (MODEL::ANIM_LOCAL == eType)
{
if (FAILED(Ready_Materials_FromFile_Anim(m_pAIScene, pModelFilePath))) {
return E_FAIL;
}
}
else if (MODEL::PBR_NONANIM == eType || MODEL::PBR_ANIM == eType) {
if (FAILED(Ready_Materials_Independent(eType, m_pAIScene, pModelFilePath))) {
return E_FAIL;
@@ -1734,7 +1813,7 @@ HRESULT CModel::Initialize(void* pArg)
SAFE_ADDREF(m_pTransform);
if (m_eType == MODEL::ANIM || m_eType == MODEL::PBR_ANIM)
if (m_eType == MODEL::ANIM || m_eType == MODEL::PBR_ANIM || m_eType == MODEL::ANIM_LOCAL)
{
Initialize_RootBone();
InItialize_BoneIndex();