[add] 피직스 기능 추가

[add] CCT Lapping
[fix] 매크로 수정
This commit is contained in:
kimnuri
2025-11-14 17:55:39 +09:00
parent d9128bffa9
commit 9f797261a2
34 changed files with 301 additions and 222 deletions
+14 -14
View File
@@ -1,4 +1,4 @@
#include "pch.h"
#include "pch.h"
#include "Material.h"
#include "GameInstance.h"
#include "Shader.h"
@@ -60,9 +60,9 @@ HRESULT CMaterial::Initialize(const _char* pModelFilePath, const aiMaterial* pAI
strcat_s(szTextureFilePath, szTextureFileName);
strcat_s(szTextureFilePath, ".dds");
hr = CreateDDSTextureFromFile(m_pDevice, CMyTools::ToWstring(szTextureFilePath).c_str(), nullptr, &pSRV); // 일단 dds로 시도하고
hr = CreateDDSTextureFromFile(m_pDevice, CMyTools::ToWstring(szTextureFilePath).c_str(), nullptr, &pSRV); // 일단 dds로 시도하고
if (FAILED(hr)) {
memset(szTextureFilePath, 0, sizeof(_char) * MAX_PATH); // 실패하면 원래 확장자로 다시 시도
memset(szTextureFilePath, 0, sizeof(_char) * MAX_PATH); // 실패하면 원래 확장자로 다시 시도
strcat_s(szTextureFilePath, szTextureFileName);
strcat_s(szTextureFilePath, szEXT);
@@ -327,13 +327,13 @@ HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType
{
size_t startPos = mapRePos + strSearchString.length();
// 'MapRe' 뒤에 오는 경로 건너뛰기
// 'MapRe' 뒤에 오는 경로 건너뛰기
if (startPos < strTexturePath.length() &&
(strTexturePath[startPos] == '\\' || strTexturePath[startPos] == '/')) {
startPos++;
}
// 'MapRe' 이후의 나머지 경로를 추출
// 'MapRe' 이후의 나머지 경로를 추출
strResultPath = strPrefix + strTexturePath.substr(startPos);
}
else
@@ -350,19 +350,19 @@ HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType
}
HRESULT CMaterial::SaveAsBinary(HANDLE hFile, DWORD& dwByte)
{
// 실제 값을 저장하지 않고 파일이름.확장자명의 문자열을 저장해서 수정하기 편하게 만들기
// 대신 리소스를 공유해야함
// 텍스쳐를 저장하지 않고
// 텍스쳐 경로만 ( "이름.확장자" ) 만 저장함
// 실제 값을 저장하지 않고 파일이름.확장자명의 문자열을 저장해서 수정하기 편하게 만들기
// 대신 리소스를 공유해야함
// 텍스쳐를 저장하지 않고
// 텍스쳐 경로만 ( "이름.확장자" ) 만 저장함
for (int i = 0; i < AI_TEXTURE_TYPE_MAX; ++i) {
_uint iNumSrv = (_uint)m_strPath[i].size();
WriteFile(hFile, &i, sizeof(_uint), &dwByte, nullptr); // 종류 저장
WriteFile(hFile, &iNumSrv, sizeof(_uint), &dwByte, nullptr); // 종류의 갯수 저장
WriteFile(hFile, &i, sizeof(_uint), &dwByte, nullptr); // 종류 저장
WriteFile(hFile, &iNumSrv, sizeof(_uint), &dwByte, nullptr); // 종류의 갯수 저장
for (_uint j = 0; j < iNumSrv; ++j) {
m_strPath[i][j].shrink_to_fit();
_uint strLength = (_uint)(sizeof(_char) * m_strPath[i][j].length());
WriteFile(hFile, &strLength, sizeof(_uint), &dwByte, nullptr); // 사이즈 저장
WriteFile(hFile, m_strPath[i][j].data(), strLength, &dwByte, nullptr); // 실제 값 저장
WriteFile(hFile, &strLength, sizeof(_uint), &dwByte, nullptr); // 사이즈 저장
WriteFile(hFile, m_strPath[i][j].data(), strLength, &dwByte, nullptr); // 실제 값 저장
}
}
return S_OK;
@@ -452,7 +452,7 @@ CMaterial* CMaterial::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContex
if (FAILED(pInstance->Initialize(pModelFilePath, _SaveMaterial)))
{
MSG_BOX("Failed to Created : CMaterial");
Safe_Release(pInstance);
SAFE_RELEASE(pInstance);
}
return pInstance;