Merge pull request #86 from SpicyGangjeong/MapTool

[fix] Material
This commit is contained in:
JinhoBa
2025-11-12 15:07:39 +09:00
committed by GitHub
5 changed files with 46 additions and 26 deletions
+2 -2
View File
@@ -708,14 +708,14 @@ HRESULT CLoader::Loading_For_MapViewer()
vector<_wstring> ModelPrototypeTags;
for (const auto& file : filesystem::directory_iterator("C:\\Users\\82103\\Desktop\\MapRe\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Meshes"))
for (const auto& file : filesystem::directory_iterator("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Meshes"))
{
if (file.is_directory())
continue;
string ext = file.path().extension().string();
if (strcmp(ext.c_str(), ".bin"))
if (strcmp(ext.c_str(), ".fbx"))
continue;
_char szFilePath[MAX_PATH] = {};
@@ -639,7 +639,6 @@ HRESULT CMapObject_Manager::Load_ContainerData(const _char* pFileName, const _ch
}
#pragma endregion
SAFE_RELEASE(pContainerObject);
return S_OK;
}
@@ -23,10 +23,6 @@ HRESULT CContainerObject::Initialize(void* pArg)
return E_FAIL;
}
if (FAILED(Ready_Components(pArg))) {
return E_FAIL;
}
return S_OK;
}
+33 -4
View File
@@ -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;
+11 -15
View File
@@ -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,17 +424,19 @@ HRESULT CModel::Ready_Materials_FromFile(const aiScene* pAIScene, const _char* p
{
getline(file, strText);
// value
_uint iBeginIndex = (_uint)strText.find("Environment");
_uint iEndIndex = (_uint)strText.find('.');
if ((_uint)strText.size() < iEndIndex - iBeginIndex)
_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 E_FAIL;
}
if ((_int)strText.size() < iEndIndex - iBeginIndex)
{
MSG_BOX("Fail Path");
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);
}