diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp index d9fd2fbe5..eeac3dcd7 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp @@ -646,7 +646,6 @@ HRESULT CMapObject_Manager::Load_ContainerData(const _char* pFileName, const _ch } #pragma endregion - SAFE_RELEASE(pContainerObject); return S_OK; } diff --git a/Jusin154_Team3D/Engine/Private/ContainerObject.cpp b/Jusin154_Team3D/Engine/Private/ContainerObject.cpp index d5af513a5..58fb462d2 100644 --- a/Jusin154_Team3D/Engine/Private/ContainerObject.cpp +++ b/Jusin154_Team3D/Engine/Private/ContainerObject.cpp @@ -23,10 +23,6 @@ HRESULT CContainerObject::Initialize(void* pArg) return E_FAIL; } - if (FAILED(Ready_Components(pArg))) { - return E_FAIL; - } - return S_OK; } diff --git a/Jusin154_Team3D/Engine/Private/Material.cpp b/Jusin154_Team3D/Engine/Private/Material.cpp index 6971c8a06..8ccb5fe54 100644 --- a/Jusin154_Team3D/Engine/Private/Material.cpp +++ b/Jusin154_Team3D/Engine/Private/Material.cpp @@ -196,11 +196,14 @@ HRESULT CMaterial::Read_MaterialFile(const _char* pMaterialFilePath, const _char /* Texture */ case 1: // value - iBeginIndex = (_uint)strText.find("Environment"); + iBeginIndex = (_uint)strText.find("/"); iEndIndex = (_uint)strText.find('.'); if (256 < iBeginIndex || 256 < iEndIndex) + { Value = "none"; + return S_OK; + } else Value = strText.substr(iBeginIndex, iEndIndex - iBeginIndex); @@ -258,7 +261,7 @@ HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType else if (!strcmp(FileType.c_str(), "MROH")) eTexture = aiTextureType::aiTextureType_METALNESS; else if (!strcmp(FileType.c_str(), "MROA")) - eTexture = aiTextureType::aiTextureType_DIFFUSE_ROUGHNESS; + eTexture = aiTextureType::aiTextureType_SPECULAR; else if (!strcmp(FileType.c_str(), "SRO")) eTexture = aiTextureType::aiTextureType_SPECULAR; else if (!strcmp(FileType.c_str(), "SROH")) @@ -268,7 +271,7 @@ HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType else if (!strcmp(FileType.c_str(), "HDR")) return S_OK; else if (!strcmp(FileType.c_str(), "MSK")) - eTexture = aiTextureType::aiTextureType_MAYA_BASE; + eTexture = aiTextureType::aiTextureType_AMBIENT_OCCLUSION; else if (!strcmp(FileType.c_str(), "basecolor")) eTexture = aiTextureType::aiTextureType_DIFFUSE; else if (!strcmp(FileType.c_str(), "E")) @@ -312,7 +315,33 @@ HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType strTexturePath = CMyTools::ToString(szTextureFilePath); } - m_SaveMaterial.Path[ENUM_CLASS(eTexture)].push_back(strTexturePath); + _string strPrefix = "../Bin/Resources/Models/MapMesh/"; + _string strSearchString = "MeshTable"; + _string strResultPath = {}; + + size_t mapRePos = strTexturePath.find(strSearchString); + + if (mapRePos != std::string::npos) + { + size_t startPos = mapRePos + strSearchString.length(); + + // 'MapRe' 뒤에 오는 경로 건너뛰기 + if (startPos < strTexturePath.length() && + (strTexturePath[startPos] == '\\' || strTexturePath[startPos] == '/')) { + startPos++; + } + + // 'MapRe' 이후의 나머지 경로를 추출 + strResultPath = strPrefix + strTexturePath.substr(startPos); + } + else + { + MSG_BOX("FAILED to Find Path"); + } + + replace(strResultPath.begin(), strResultPath.end(), '\\', '/'); + + m_SaveMaterial.Path[ENUM_CLASS(eTexture)].push_back(strResultPath); m_SRVs[ENUM_CLASS(eTexture)].push_back(pSRV); return S_OK; diff --git a/Jusin154_Team3D/Engine/Private/Model.cpp b/Jusin154_Team3D/Engine/Private/Model.cpp index ed8123b63..eb690b3bc 100644 --- a/Jusin154_Team3D/Engine/Private/Model.cpp +++ b/Jusin154_Team3D/Engine/Private/Model.cpp @@ -394,21 +394,15 @@ HRESULT CModel::Ready_Materials_FromFile(const aiScene* pAIScene, const _char* p vector<_string> MaterialFilePathes; string strFolderPath = pModelFilePath; - size_t iFolderPos = strFolderPath.find("Environment"); + size_t iFolderPos = strFolderPath.find("MeshTable"); - strFolderPath = strFolderPath.substr(0, iFolderPos); + strFolderPath = strFolderPath.substr(0, iFolderPos) + "MeshTable/"; _splitpath_s(pModelFilePath, szDrive, MAX_PATH, szDir, MAX_PATH, szFileName, MAX_PATH, nullptr, 0); - string FileName = szFileName; - - auto iPos = FileName.find_last_of('.'); - - FileName = FileName.substr(0, iPos); - strcpy_s(szMeshFilePath, szDrive); strcat_s(szMeshFilePath, szDir); - strcat_s(szMeshFilePath, FileName.c_str()); + strcat_s(szMeshFilePath, szFileName); strcat_s(szMeshFilePath, ".props.txt"); ifstream file(szMeshFilePath); @@ -430,12 +424,11 @@ HRESULT CModel::Ready_Materials_FromFile(const aiScene* pAIScene, const _char* p { getline(file, strText); - // value - _int iBeginIndex = (_int)strText.find("Environment"); + _int iBeginIndex = (_int)strText.find_first_of("/"); _int iEndIndex = (_int)strText.find('.'); if (-1 == iBeginIndex || -1 == iEndIndex) { MSG_BOX("Fail Path _ NotExist"); // Not Exsist - return S_OK; + return E_FAIL; } if ((_int)strText.size() < iEndIndex - iBeginIndex) { @@ -443,7 +436,7 @@ HRESULT CModel::Ready_Materials_FromFile(const aiScene* pAIScene, const _char* p return E_FAIL; } - string strPath = strFolderPath + strText.substr(iBeginIndex, iEndIndex - iBeginIndex); + string strPath = strFolderPath + strText.substr(iBeginIndex + 1, iEndIndex - iBeginIndex - 1); MaterialFilePathes.push_back(strPath); } @@ -501,7 +494,7 @@ _bool CModel::SaveAssimpModel(const _char* filename) _splitpath_s(filename, nullptr, 0, nullptr, 0, nullptr, 0, szExt, MAX_PATH); strcat_s(szModel, sizeof(_char) * MAX_PATH, szExt); - _string savePath = filename; + _string savePath = filename; SaveModel modelData; modelData.MeshCount = m_pAIScene->mNumMeshes; @@ -511,8 +504,8 @@ _bool CModel::SaveAssimpModel(const _char* filename) { aiMesh* mesh = m_pAIScene->mMeshes[i]; SaveMesh saveMesh{}; - - saveMesh.MeshName = mesh->mName.C_Str(); + + saveMesh.MeshName = mesh->mName.C_Str(); saveMesh.MeshNameSize = (_int)saveMesh.MeshName.size() + 1; saveMesh.VertexCount = mesh->mNumVertices; saveMesh.IndexCount = mesh->mNumFaces * 3; @@ -720,7 +713,7 @@ _bool CModel::SaveAssimpModel(const _char* filename) for (auto& Anim : modelData.Animations) { fwrite(&Anim.AnimNameSize, sizeof(_uint), 1, fp); - fwrite(Anim.AnimName.data(), 1,Anim.AnimNameSize, fp); + fwrite(Anim.AnimName.data(), 1, Anim.AnimNameSize, fp); fwrite(&Anim.mDuration, sizeof(_float), 1, fp); fwrite(&Anim.mTicksPerSecond, sizeof(_float), 1, fp); fwrite(&Anim.ChannelCount, sizeof(_uint), 1, fp); @@ -763,7 +756,7 @@ _int CModel::SaveNodeRecursive(const aiNode* pAINode, std::vector& out { SaveNode node{}; node.NodeName = pAINode->mName.C_Str(); - node.NodeNameSize =(_uint)node.NodeName.size() + 1; + node.NodeNameSize = (_uint)node.NodeName.size() + 1; node.ParentIndex = parentIndex; const aiMatrix4x4& m = pAINode->mTransformation; @@ -869,21 +862,21 @@ HRESULT CModel::Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _ return S_OK; } m_pSaveModel = m_pGameInstance->Load_SaveModel(pModelFilePath); - + XMStoreFloat4x4(&m_PreTransformMatrix, PreTransformMatrix); Ready_Bones(m_pSaveModel->Nodes, 0, -1); - if (FAILED(Ready_Meshes())){ + if (FAILED(Ready_Meshes())) { return E_FAIL; } - if (FAILED(Ready_Materials(pModelFilePath))){ + if (FAILED(Ready_Materials(pModelFilePath))) { return E_FAIL; } - if (FAILED(Ready_Animations())){ + if (FAILED(Ready_Animations())) { return E_FAIL; } @@ -941,7 +934,7 @@ _bool CModel::LoadData(const _char* filename) fread(&mesh.Bones[i].OffsetMatrix, sizeof(XMFLOAT4X4), 1, fp); fread(&mesh.Bones[i].WeightsCount, sizeof(_uint), 1, fp); mesh.Bones[i].Weights.resize(mesh.Bones[i].WeightsCount); - for (size_t j = 0;j < mesh.Bones[i].WeightsCount; j++) + for (size_t j = 0; j < mesh.Bones[i].WeightsCount; j++) { fread(&mesh.Bones[i].Weights[j].VertexId, sizeof(_uint), 1, fp); fread(&mesh.Bones[i].Weights[j].Weight, sizeof(_float), 1, fp); @@ -1018,7 +1011,7 @@ _bool CModel::LoadData(const _char* filename) mat.Path[k][j] = temp; } } - + NewModel.Materials.push_back(mat); } @@ -1111,7 +1104,7 @@ HRESULT CModel::Ready_Animations() return S_OK; } -CModel* CModel::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL eType, const _char* pModelFilePath,_fmatrix PreTransformMatrix) +CModel* CModel::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL eType, const _char* pModelFilePath, _fmatrix PreTransformMatrix) { CModel* pInstance = new CModel(pDevice, pContext); diff --git a/Jusin154_Team3D/Engine/Public/GameInstance.h b/Jusin154_Team3D/Engine/Public/GameInstance.h index b84177e4e..d6b39de17 100644 --- a/Jusin154_Team3D/Engine/Public/GameInstance.h +++ b/Jusin154_Team3D/Engine/Public/GameInstance.h @@ -191,7 +191,7 @@ class ENGINE_DLL CGameInstance final : public CBase HRESULT ConvertToTriMeshes(vector& Meshes, vector& pxTriMeshes, _fmatrix WorldMatrix); HRESULT SaveTriMeshes(const _char* pPath, vector& TriMeshes); - HRESULT LoadTriMeshes(const _char* pPath, vector& TriMeshes); + HRESULT LoadTriMeshes(const _char* pPath, vector& TriMeshes); // 모델 불러왔던 경로에 그대로 있음 #pragma endregion