@@ -29,6 +29,7 @@ Texture2D g_ShadowTexture;
|
||||
Texture2D g_PreShadowTexture;
|
||||
Texture2D g_BlurTexture;
|
||||
Texture2D g_BlurXTexture;
|
||||
Texture2D g_ColorTexture;
|
||||
|
||||
|
||||
vector g_vLightDiffuse;
|
||||
@@ -229,10 +230,12 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
PS_OUT_BACKBUFFER Out;
|
||||
|
||||
vector vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
if (0.f == vDiffuse.a)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
vector vShade = g_ShadeTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
vector vSpecular = g_SpecularTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
@@ -240,8 +243,11 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
Out.vBackBuffer = vDiffuse * vShade + vSpecular;
|
||||
|
||||
vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
|
||||
float fViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
|
||||
vector vPosition, vPreShadowPosition;
|
||||
|
||||
/* (로컬위치 * 월드 * 뷰 * 투영 / w) -> (로컬위치 * 월드) */
|
||||
@@ -267,9 +273,11 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
vTexcoord.y = (vPosition.y / vPosition.w) * -0.5f + 0.5f;
|
||||
vPreShadowTexcoord.x = (vPreShadowPosition.x / vPreShadowPosition.w) * 0.5f + 0.5f;
|
||||
vPreShadowTexcoord.y = (vPreShadowPosition.y / vPreShadowPosition.w) * -0.5f + 0.5f;
|
||||
|
||||
/* 광원의 NDC에서 샘플링 */
|
||||
float fVisibility_Dynamic = ShadowVisibility_hwPCF(g_ShadowTexture, vPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), 0.0005f);
|
||||
float fVisibility_Static = ShadowVisibility_hwPCF(g_PreShadowTexture, vPreShadowPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), 0.0005f);
|
||||
|
||||
Out.vBackBuffer.rgb *= lerp(0.5f, 1.f, min(fVisibility_Dynamic, fVisibility_Static));
|
||||
//float fShadowDepth = g_ShadowTexture.Sample(DefaultSampler, vTexcoord).x;
|
||||
//float fPreShadowDepth = g_PreShadowTexture.Sample(DefaultSampler, vPreShadowTexcoord).x;
|
||||
@@ -292,13 +300,44 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
for (int i = -6; i < 7; ++i)
|
||||
{
|
||||
vTexcoord.x = In.vTexcoord.x;
|
||||
vTexcoord.y = In.vTexcoord.y + i / g_vResolution.y;
|
||||
vTexcoord.y = In.vTexcoord.y + (float)i / g_vResolution.y;
|
||||
|
||||
vColor += g_fWeights[i + 6] * g_BlurXTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
}
|
||||
|
||||
Out.vBackBuffer += vColor;
|
||||
|
||||
/* Color_Target */
|
||||
|
||||
vector ColorTexture = g_ColorTexture.Sample(DefaultSampler, vTexcoord);
|
||||
|
||||
int iOption = ColorTexture.a * 10;
|
||||
|
||||
if (iOption == 0) // 0이면 수행하지 않음
|
||||
return Out;
|
||||
|
||||
switch (iOption)
|
||||
{
|
||||
case 1:
|
||||
Out.vBackBuffer.rgb += ColorTexture.rgb;
|
||||
break;
|
||||
case 2:
|
||||
Out.vBackBuffer.rgb *= ColorTexture.rgb;
|
||||
break;
|
||||
case 3:
|
||||
Out.vBackBuffer.rgb -= ColorTexture.rgb;
|
||||
break;
|
||||
case 4:
|
||||
Out.vBackBuffer.rgb /= ColorTexture.rgb;
|
||||
break;
|
||||
case 5:
|
||||
Out.vBackBuffer.rgb = ColorTexture.rgb;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -323,7 +362,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X(PS_IN In)
|
||||
vColor += g_fWeights[i + 6] * g_BlurTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
}
|
||||
|
||||
Out.vBlurX = vColor;
|
||||
Out.vBlurX = vColor;
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -370,6 +409,7 @@ technique11 DefaultTechnique
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_MAIN_COMBINED();
|
||||
}
|
||||
|
||||
pass BlurPass
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
|
||||
@@ -270,6 +270,7 @@
|
||||
<ClCompile Include="..\Private\VIBuffer_Cube.cpp" />
|
||||
<ClCompile Include="..\Private\Instance_Model.cpp" />
|
||||
<ClCompile Include="..\Private\VIBuffer_Rect.cpp" />
|
||||
<ClCompile Include="..\Private\VIBuffer_Terrain.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Public\Animation.h" />
|
||||
@@ -473,6 +474,7 @@
|
||||
<ClInclude Include="..\Public\VIBuffer_Cube.h" />
|
||||
<ClInclude Include="..\Public\Instance_Model.h" />
|
||||
<ClInclude Include="..\Public\VIBuffer_Rect.h" />
|
||||
<ClInclude Include="..\Public\VIBuffer_Terrain.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\Bin\Resources\ShaderFiles\Engine_Shader_Defines.hlsli" />
|
||||
|
||||
@@ -423,7 +423,7 @@
|
||||
<ClCompile Include="..\Private\ComputeShader.cpp">
|
||||
<Filter>01.Utility\06.ComputeShader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\VIBuffer_Terrain.cpp">
|
||||
<ClCompile Include="..\Private\VIBuffer_Terrain.cpp">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Terrain</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
@@ -986,7 +986,7 @@
|
||||
<ClInclude Include="..\public\Picking.h">
|
||||
<Filter>01.Utility\06. Picking</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\VIBuffer_Terrain.h">
|
||||
<ClInclude Include="..\Public\VIBuffer_Terrain.h">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Terrain</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -43,22 +43,14 @@ HRESULT CComputeShader::Dispatch(_uint iSRVIndex, _uint iUAVIndex, _float3 vGrou
|
||||
//따라서 스테이징 버퍼를 따로 선언하여 값을 복사받는다.
|
||||
|
||||
|
||||
|
||||
for (_uint i = 0; i < m_iNumInputBuffer; i++)
|
||||
{
|
||||
D3D11_MAPPED_SUBRESOURCE PreSubResource = {};
|
||||
|
||||
m_pContext->CopyResource(m_pStagingBuffer[i], ppBuffers[i]);
|
||||
|
||||
m_pContext->CopyResource(m_pInputBuffer[i], m_pStagingBuffer[i]);
|
||||
|
||||
if (SUCCEEDED(m_pContext->Map(m_pStagingBuffer[i], 0, D3D11_MAP_READ, 0, &PreSubResource)))
|
||||
{
|
||||
// 디폴트 버퍼는 UpdateSubresource 함수를 통해서만 내부 값에 접근이 가능하다.
|
||||
|
||||
m_pContext->UpdateSubresource(m_pInputBuffer[i], 0, nullptr, PreSubResource.pData, 0, 0);
|
||||
m_pContext->Unmap(m_pStagingBuffer[i], 0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -507,16 +507,18 @@ _bool CGameInstance::isPicking(_float3* pOut)
|
||||
{
|
||||
return m_pPicking->isPicking(pOut);
|
||||
}
|
||||
SaveModel* CGameInstance::Load_SaveModel(const _char* filePath)
|
||||
{
|
||||
auto iter = m_sModelMap.find(filePath);
|
||||
return &iter->second;
|
||||
}
|
||||
#ifdef EDITOR_PROJECT
|
||||
_bool CGameInstance::SaveAssimpModel(const _char* filename)
|
||||
{
|
||||
auto iter = m_ModelMap.find(filename);
|
||||
return iter->second->SaveAssimpModel(filename);
|
||||
}
|
||||
#endif
|
||||
SaveModel* CGameInstance::Load_SaveModel(const _char* filePath)
|
||||
{
|
||||
auto iter = m_sModelMap.find(filePath);
|
||||
return &iter->second;
|
||||
}
|
||||
bool CGameInstance::Key_Pressing(int _iKey)
|
||||
{
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
|
||||
@@ -354,7 +354,7 @@ void CInstance_Model::Free()
|
||||
|
||||
void CInstance_Model::Describe_Entity()
|
||||
{
|
||||
if (ImGui::TreeNode("Instance_Model"))
|
||||
if (ImGui::TreeNode("Model Option"))
|
||||
{
|
||||
ImGui::Separator(); ImGui::Spacing();
|
||||
|
||||
|
||||
@@ -90,6 +90,233 @@ HRESULT CMaterial::Initialize(const _char* pModelFilePath, const aiMaterial* pAI
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CMaterial::Initialize(const _char* pMaterialFilePath, const _char* pTextureFilePath)
|
||||
{
|
||||
_char szTextureFilePath[MAX_PATH] = {};
|
||||
_char szMaterialFilePath[MAX_PATH] = {};
|
||||
|
||||
strcpy_s(szTextureFilePath, pTextureFilePath);
|
||||
|
||||
strcpy_s(szMaterialFilePath, pMaterialFilePath);
|
||||
strcat_s(szMaterialFilePath, ".props.txt");
|
||||
|
||||
if (FAILED(Read_MaterialFile(szMaterialFilePath, szTextureFilePath)))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CMaterial::Read_MaterialFile(const _char* pMaterialFilePath, const _char* pTextureFolderPath)
|
||||
{
|
||||
/* Read MaterialFile to Read TextureFilePath */
|
||||
|
||||
ifstream file(pMaterialFilePath);
|
||||
|
||||
if (!file.is_open())
|
||||
{
|
||||
MSG_BOX("Failed to Open Materail File");
|
||||
//return E_FAIL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
_char szTextureFilePath[MAX_PATH] = {};
|
||||
|
||||
string strText = {};
|
||||
|
||||
string Value = {};
|
||||
string Type = {};
|
||||
|
||||
_uint iDataIndex = {};
|
||||
_uint iNumParameter = {};
|
||||
|
||||
_uint iBeginIndex = {};
|
||||
_uint iEndIndex = {};
|
||||
|
||||
_bool bParent = { false };
|
||||
|
||||
getline(file, strText);
|
||||
|
||||
if (!strcmp(strText.c_str(), "none"))
|
||||
return S_OK;
|
||||
|
||||
while (file)
|
||||
{
|
||||
if (2 < iDataIndex)
|
||||
break;
|
||||
|
||||
if (false == bParent)
|
||||
{
|
||||
getline(file, strText);
|
||||
auto index = strText.find_first_of("[");
|
||||
auto iBackindex = strText.find_first_of("]");
|
||||
|
||||
if (index == string::npos || iBackindex == string::npos)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (index + 1 != iBackindex - 1)
|
||||
iNumParameter = (strText[iBackindex - 1] - '0') + 10;
|
||||
else
|
||||
iNumParameter = strText[index + 1] - '0';
|
||||
|
||||
getline(file, strText);
|
||||
bParent = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0 == iNumParameter)
|
||||
{
|
||||
++iDataIndex;
|
||||
auto index = strText.find_first_of("[");
|
||||
|
||||
iNumParameter = strText[index + 1] - '0';
|
||||
getline(file, strText);
|
||||
}
|
||||
for (_uint i = 0; i < iNumParameter; ++i)
|
||||
{
|
||||
for (_uint j = 0; j < 3; ++j)
|
||||
getline(file, strText);
|
||||
|
||||
getline(file, strText);
|
||||
|
||||
switch (iDataIndex)
|
||||
{
|
||||
/* Scala */
|
||||
case 0:
|
||||
// value
|
||||
Value = strText.substr(iBeginIndex + 2);
|
||||
|
||||
getline(file, strText);
|
||||
// name
|
||||
iBeginIndex = (_uint)strText.find_first_of('=');
|
||||
|
||||
Type = strText.substr(iBeginIndex + 2);
|
||||
break;
|
||||
|
||||
/* Texture */
|
||||
case 1:
|
||||
// value
|
||||
iBeginIndex = (_uint)strText.find("Environment");
|
||||
iEndIndex = (_uint)strText.find('.');
|
||||
|
||||
if (256 < iBeginIndex || 256 < iEndIndex)
|
||||
Value = "none";
|
||||
else
|
||||
Value = strText.substr(iBeginIndex, iEndIndex - iBeginIndex);
|
||||
|
||||
strcpy_s(szTextureFilePath, pTextureFolderPath);
|
||||
strcat_s(szTextureFilePath, Value.c_str());
|
||||
|
||||
// name
|
||||
iBeginIndex = (_uint)strText.find_last_of('_');
|
||||
iEndIndex = (_uint)strText.rfind('\'');
|
||||
|
||||
Type = strText.substr(iBeginIndex + 1, iEndIndex - iBeginIndex - 1);
|
||||
|
||||
|
||||
getline(file, strText);
|
||||
|
||||
// Add Texture
|
||||
if (FAILED(Add_Texture(szTextureFilePath, Type)))
|
||||
return E_FAIL;
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
getline(file, strText);
|
||||
}
|
||||
++iDataIndex;
|
||||
bParent = false;
|
||||
getline(file, strText);
|
||||
}
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType)
|
||||
{
|
||||
ID3D11ShaderResourceView* pSRV = {};
|
||||
|
||||
aiTextureType eTexture = {};
|
||||
|
||||
/* Find type */
|
||||
if (!strcmp(FileType.c_str(), "D"))
|
||||
eTexture = aiTextureType::aiTextureType_DIFFUSE;
|
||||
else if (!strcmp(FileType.c_str(), "N"))
|
||||
eTexture = aiTextureType::aiTextureType_NORMALS;
|
||||
else if (!strcmp(FileType.c_str(), "normal"))
|
||||
eTexture = aiTextureType::aiTextureType_NORMALS;
|
||||
else if (!strcmp(FileType.c_str(), "MRO"))
|
||||
eTexture = aiTextureType::aiTextureType_METALNESS;
|
||||
else if (!strcmp(FileType.c_str(), "MROH"))
|
||||
eTexture = aiTextureType::aiTextureType_METALNESS;
|
||||
else if (!strcmp(FileType.c_str(), "MROA"))
|
||||
eTexture = aiTextureType::aiTextureType_DIFFUSE_ROUGHNESS;
|
||||
else if (!strcmp(FileType.c_str(), "SRO"))
|
||||
eTexture = aiTextureType::aiTextureType_SPECULAR;
|
||||
else if (!strcmp(FileType.c_str(), "SROH"))
|
||||
eTexture = aiTextureType::aiTextureType_SPECULAR;
|
||||
else if (!strcmp(FileType.c_str(), "SROA"))
|
||||
eTexture = aiTextureType::aiTextureType_SPECULAR;
|
||||
else if (!strcmp(FileType.c_str(), "HDR"))
|
||||
return S_OK;
|
||||
else if (!strcmp(FileType.c_str(), "MSK"))
|
||||
eTexture = aiTextureType::aiTextureType_MAYA_BASE;
|
||||
else if (!strcmp(FileType.c_str(), "basecolor"))
|
||||
eTexture = aiTextureType::aiTextureType_DIFFUSE;
|
||||
else if (!strcmp(FileType.c_str(), "E"))
|
||||
eTexture = aiTextureType::aiTextureType_EMISSIVE;
|
||||
else
|
||||
{
|
||||
MSG_BOX("Failed to Path Material Texture Type");
|
||||
return S_OK;
|
||||
}
|
||||
_char TexturePath[MAX_PATH] = {};
|
||||
|
||||
strcpy_s(TexturePath, pTextureFolderPath);
|
||||
strcat_s(TexturePath, ".dds");
|
||||
|
||||
_tchar szTextureFilePath[MAX_PATH] = {};
|
||||
|
||||
string strTexturePath;
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, TexturePath, (_int)strlen(TexturePath), szTextureFilePath, MAX_PATH);
|
||||
|
||||
if (FAILED(CreateDDSTextureFromFile(m_pDevice, szTextureFilePath, nullptr, &pSRV)))
|
||||
{
|
||||
_char TexturePath_Png[MAX_PATH] = {};
|
||||
|
||||
strcpy_s(TexturePath_Png, pTextureFolderPath);
|
||||
strcat_s(TexturePath_Png, ".png");
|
||||
|
||||
_tchar szTextureFilePath_Png[MAX_PATH] = {};
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, TexturePath_Png, (_int)strlen(TexturePath_Png), szTextureFilePath_Png, MAX_PATH);
|
||||
|
||||
if (FAILED(CreateWICTextureFromFile(m_pDevice, szTextureFilePath_Png, nullptr, &pSRV)))
|
||||
{
|
||||
MSG_BOX("Failed to Load TextureFile");
|
||||
return E_FAIL;
|
||||
}
|
||||
strTexturePath = CMyTools::ToString(szTextureFilePath_Png);
|
||||
}
|
||||
else
|
||||
{
|
||||
strTexturePath = CMyTools::ToString(szTextureFilePath);
|
||||
}
|
||||
|
||||
m_SaveMaterial.Path[ENUM_CLASS(eTexture)].push_back(strTexturePath);
|
||||
m_SRVs[ENUM_CLASS(eTexture)].push_back(pSRV);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CMaterial::SaveAsBinary(HANDLE hFile, DWORD& dwByte)
|
||||
{
|
||||
// 실제 값을 저장하지 않고 파일이름.확장자명의 문자열을 저장해서 수정하기 편하게 만들기
|
||||
@@ -121,6 +348,19 @@ CMaterial* CMaterial::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContex
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
CMaterial* CMaterial::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pMaterialFilePath, const _char* pTextureFilePath)
|
||||
{
|
||||
CMaterial* pInstance = new CMaterial(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize(pMaterialFilePath, pTextureFilePath)))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CMaterial");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
#endif
|
||||
|
||||
HRESULT CMaterial::Bind_SRV(CShader* pShader, const _char* pConstantName, _uint iType, _uint iTextureIndex)
|
||||
|
||||
@@ -328,6 +328,78 @@ HRESULT CModel::Ready_Materials(const aiScene* pAIScene, const _char* pModelFile
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Ready_Materials_FromFile(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("Environment");
|
||||
|
||||
strFolderPath = strFolderPath.substr(0, iFolderPos);
|
||||
|
||||
_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, ".props.txt");
|
||||
|
||||
ifstream file(szMeshFilePath);
|
||||
|
||||
if (!file.is_open())
|
||||
{
|
||||
MSG_BOX("Failed to Open Mesh File");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
string strText = {};
|
||||
_uint iNumParameter = {};
|
||||
|
||||
getline(file, strText);
|
||||
getline(file, strText);
|
||||
|
||||
for (_uint i = 0; i < m_iNumMaterials; ++i)
|
||||
{
|
||||
getline(file, strText);
|
||||
|
||||
// value
|
||||
_uint iBeginIndex = (_uint)strText.find("Environment");
|
||||
_uint iEndIndex = (_uint)strText.find('.');
|
||||
|
||||
if ((_uint)strText.size() < iEndIndex - iBeginIndex)
|
||||
{
|
||||
MSG_BOX("Fail Path");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
string strPath = strFolderPath + strText.substr(iBeginIndex, iEndIndex - iBeginIndex);
|
||||
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_Animations(const aiScene* pAIScene)
|
||||
{
|
||||
m_iNumAnimations = pAIScene->mNumAnimations;
|
||||
@@ -652,6 +724,75 @@ _int CModel::SaveNodeRecursive(const aiNode* pAINode, std::vector<SaveNode>& out
|
||||
|
||||
return currentIndex;
|
||||
}
|
||||
CModel* CModel::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex)
|
||||
{
|
||||
CModel* pInstance = new CModel(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize_Prototype(pModelFilePath, eType, PreTransformMatrix, iRootBoneIndex)))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CModel");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
HRESULT CModel::Assimp_Model_Load(const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex)
|
||||
{
|
||||
_uint iFlag = {};
|
||||
iFlag = aiProcess_ConvertToLeftHanded | aiProcessPreset_TargetRealtime_Fast;
|
||||
|
||||
if (MODEL::NONANIM == eType || MODEL::ENVIROMENT == eType) {
|
||||
iFlag |= aiProcess_PreTransformVertices;
|
||||
}
|
||||
m_iRootBoneIndex = iRootBoneIndex;
|
||||
|
||||
m_pAIScene = m_Importer.ReadFile(pModelFilePath, iFlag);
|
||||
if (nullptr == m_pAIScene)
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
#pragma region Bone
|
||||
if (FAILED(Ready_Bones(m_pAIScene->mRootNode, -1))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma region Mesh
|
||||
if (FAILED(Ready_Meshes(eType, m_pAIScene, PreTransformMatrix))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma region Material
|
||||
if (MODEL::ENVIROMENT == eType)
|
||||
{
|
||||
if (FAILED(Ready_Materials_FromFile(m_pAIScene, pModelFilePath))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FAILED(Ready_Materials(m_pAIScene, pModelFilePath))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma region Animation
|
||||
if (FAILED(Ready_Animations(m_pAIScene))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
m_pGameInstance->Save_ModelFilePath(pModelFilePath);
|
||||
|
||||
m_pGameInstance->Add_ModelToMap(pModelFilePath, this);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Initialize_Prototype(const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex)
|
||||
{
|
||||
return Assimp_Model_Load(pModelFilePath, eType, PreTransformMatrix, iRootBoneIndex);
|
||||
}
|
||||
#endif // EDITOR_PROJECT
|
||||
|
||||
HRESULT CModel::Initialize_Prototype()
|
||||
@@ -684,10 +825,6 @@ HRESULT CModel::Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _
|
||||
}
|
||||
|
||||
|
||||
HRESULT CModel::Initialize_Prototype(const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex)
|
||||
{
|
||||
return Assimp_Model_Load(pModelFilePath, eType, PreTransformMatrix, iRootBoneIndex);
|
||||
}
|
||||
|
||||
bool CModel::LoadData(const _char* filename)
|
||||
{
|
||||
@@ -848,62 +985,6 @@ bool CModel::LoadData(const _char* filename)
|
||||
return true;
|
||||
}
|
||||
|
||||
CModel* CModel::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex)
|
||||
{
|
||||
CModel* pInstance = new CModel(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize_Prototype(pModelFilePath, eType, PreTransformMatrix, iRootBoneIndex)))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CModel");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
HRESULT CModel::Assimp_Model_Load(const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex)
|
||||
{
|
||||
_uint iFlag = {};
|
||||
iFlag = aiProcess_ConvertToLeftHanded | aiProcessPreset_TargetRealtime_Fast;
|
||||
|
||||
if (MODEL::NONANIM == eType) {
|
||||
iFlag |= aiProcess_PreTransformVertices;
|
||||
}
|
||||
m_iRootBoneIndex = iRootBoneIndex;
|
||||
|
||||
m_pAIScene = m_Importer.ReadFile(pModelFilePath, iFlag);
|
||||
if (nullptr == m_pAIScene)
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
#pragma region Bone
|
||||
if (FAILED(Ready_Bones(m_pAIScene->mRootNode, -1))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma region Mesh
|
||||
if (FAILED(Ready_Meshes(eType, m_pAIScene, PreTransformMatrix))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma region Material
|
||||
if (FAILED(Ready_Materials(m_pAIScene, pModelFilePath))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma region Animation
|
||||
if (FAILED(Ready_Animations(m_pAIScene))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
m_pGameInstance->Save_ModelFilePath(pModelFilePath);
|
||||
|
||||
m_pGameInstance->Add_ModelToMap(pModelFilePath, this);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Initialize(void* pArg)
|
||||
{
|
||||
m_pLerpAnim = CLerpAnim::Create((_uint)m_Bones.size(), 1.f, m_Bones);
|
||||
|
||||
@@ -99,6 +99,7 @@ void CRenderer::Render()
|
||||
D3D11_VIEWPORT vp = {};
|
||||
m_pContext->RSGetViewports(&iNumViewPort, &vp);
|
||||
_float2 vResolution = { vp.Width, vp.Height };
|
||||
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_vResolution", &vResolution, sizeof(_float2)))) {
|
||||
assert(false);
|
||||
}
|
||||
@@ -113,9 +114,10 @@ void CRenderer::Render()
|
||||
Render_Blend();
|
||||
Render_UI();
|
||||
|
||||
//#ifdef _DEBUG
|
||||
// Render_Debug();
|
||||
//#endif
|
||||
#ifdef _DEBUG
|
||||
if(m_pGameInstance->Key_Pressing(DIK_F10))
|
||||
Render_Debug();
|
||||
#endif
|
||||
}
|
||||
|
||||
void CRenderer::Render_Priority()
|
||||
@@ -236,7 +238,9 @@ void CRenderer::Render_LightAcc()
|
||||
|
||||
void CRenderer::Render_Combined()
|
||||
{
|
||||
{ // Bind_Resorces
|
||||
{
|
||||
// Bind_Resorces
|
||||
|
||||
m_pShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix);
|
||||
@@ -253,6 +257,7 @@ void CRenderer::Render_Combined()
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShader, "g_LightViewMatrix", D3DTS::VIEW))) {
|
||||
return;
|
||||
}
|
||||
@@ -270,7 +275,9 @@ void CRenderer::Render_Combined()
|
||||
}
|
||||
}
|
||||
|
||||
{ // Bind_Targets
|
||||
{
|
||||
// Bind_Targets
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Diffuse"), m_pShader, "g_DiffuseTexture"))) {
|
||||
return;
|
||||
}
|
||||
@@ -292,6 +299,10 @@ void CRenderer::Render_Combined()
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Blur_X"), m_pShader, "g_BlurXTexture"))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Color"), m_pShader, "g_ColorTexture"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::COMBINED));
|
||||
@@ -479,9 +490,9 @@ void CRenderer::Render_Debug()
|
||||
if (FAILED(m_pGameInstance->Render_RenderTarget_Debug(TEXT("MRT_Blur"), m_pShader, m_pVIBuffer))) {
|
||||
return;
|
||||
}
|
||||
//if (FAILED(m_pGameInstance->Render_RenderTarget_Debug(TEXT("MRT_Blur_X"), m_pShader, m_pVIBuffer))){
|
||||
// return;
|
||||
//}
|
||||
if (FAILED(m_pGameInstance->Render_RenderTarget_Debug(TEXT("MRT_Blur_X"), m_pShader, m_pVIBuffer))){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -527,6 +538,7 @@ HRESULT CRenderer::Initialize()
|
||||
DXGI_FORMAT_R32G32B32A32_FLOAT, _float4(1.f, 1.f, 1.f, 1.f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* Target_Shadow */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_PreShadow"), (_uint)g_iMaxShadowWidth, (_uint)g_iMaxShadowHeight,
|
||||
DXGI_FORMAT_R32G32B32A32_FLOAT, _float4(1.f, 1.f, 1.f, 1.f)))) {
|
||||
@@ -545,6 +557,13 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* Target_Color*/
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Color"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
DXGI_FORMAT_R32G32B32A32_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (FAILED(Ready_DepthStencilView(g_iMaxShadowWidth, g_iMaxShadowHeight))) {
|
||||
return E_FAIL;
|
||||
@@ -562,6 +581,9 @@ HRESULT CRenderer::Initialize()
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_GameObjects"), TEXT("Target_Depth")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_GameObjects"), TEXT("Target_Color")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* MRT_LightAcc */
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_LightAcc"), TEXT("Target_Shade")))) {
|
||||
@@ -617,20 +639,29 @@ HRESULT CRenderer::Initialize()
|
||||
if (FAILED(m_pGameInstance->Ready_RenderTarget_Debug(TEXT("Target_Specular"), 225.f, 225.f, 150.0f, 150.0f))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Ready_RenderTarget_Debug(TEXT("Target_Color"), 375.f, 75.f, 150.0f, 150.0f))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Ready_RenderTarget_Debug(TEXT("Target_Shadow"), Viewport.Width - 150.0f, 150.0f, 300.f, 300.f))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Ready_RenderTarget_Debug(TEXT("Target_PreShadow"), Viewport.Width - 150.0f, Viewport.Height - 150.0f, 300.f, 300.f))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Ready_RenderTarget_Debug(TEXT("Target_Blur"), 150.0f, Viewport.Height - 150.0f, 300.f, 300.f))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Ready_RenderTarget_Debug(TEXT("Target_Blur_X"), Viewport.Width * 0.75f, Viewport.Height * 0.75f, Viewport.Width * 0.5f, Viewport.Height * 0.5f))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
return S_OK;
|
||||
|
||||
@@ -192,7 +192,7 @@ _bool CVIBuffer_Terrain::Picking(CTransform* pTransform, _float3& pOut)
|
||||
|
||||
return false;
|
||||
}
|
||||
/
|
||||
|
||||
|
||||
CVIBuffer_Terrain * CVIBuffer_Terrain::Create(ID3D11Device * pDevice, ID3D11DeviceContext * pContext, const _char * pFilePath, _uint iSizeX, _uint iSizeZ)
|
||||
{
|
||||
|
||||
@@ -46,13 +46,13 @@ class ENGINE_DLL CBone final : public CBase
|
||||
CBone* Clone();
|
||||
virtual void Free() override;
|
||||
|
||||
// 바이너리
|
||||
static CBone* Create(const SaveNode& _SaveNode, _int iParentIndex);
|
||||
//
|
||||
#ifdef EDITOR_PROJECT
|
||||
public:
|
||||
HRESULT SaveAsBinary(HANDLE hFile, DWORD& dwByte);
|
||||
static CBone* Create(const aiNode* pAINode, _int iParentIndex);
|
||||
// 바이너리
|
||||
static CBone* Create(const SaveNode& _SaveNode, _int iParentIndex);
|
||||
//
|
||||
private:
|
||||
HRESULT Initialize(const aiNode* pAINode, _int iParentIndex);
|
||||
#endif // EDITOR_PROJECT
|
||||
|
||||
@@ -21,7 +21,7 @@ enum class TEXTURE_LOAD_TYPE {
|
||||
enum class MOUSEKEYSTATE { LBUTTON, RBUTTON, WBUTTON, XBUTTON };
|
||||
enum class MOUSEMOVESTATE { X, Y, W };
|
||||
enum class D3DTS { VIEW, PROJ, VIEW_INV, PROJ_INV, END };
|
||||
enum class MODEL { ANIM, NONANIM };
|
||||
enum class MODEL { ANIM, NONANIM, ENVIROMENT };
|
||||
|
||||
enum class NAVI_POINT { A, B, C, END };
|
||||
enum class NAVI_LINE { AB, BC, CA, END };
|
||||
@@ -33,34 +33,34 @@ enum class QUESTYPE {MAIN, SUB, END};
|
||||
|
||||
#ifndef EDITOR_PROJECT
|
||||
enum aiTextureType {
|
||||
aiTextureType_NONE = 0,
|
||||
aiTextureType_DIFFUSE = 1,
|
||||
aiTextureType_SPECULAR = 2,
|
||||
aiTextureType_AMBIENT = 3,
|
||||
aiTextureType_EMISSIVE = 4,
|
||||
aiTextureType_HEIGHT = 5,
|
||||
aiTextureType_NORMALS = 6,
|
||||
aiTextureType_SHININESS = 7,
|
||||
aiTextureType_OPACITY = 8,
|
||||
aiTextureType_DISPLACEMENT = 9,
|
||||
aiTextureType_LIGHTMAP = 10,
|
||||
aiTextureType_REFLECTION = 11,
|
||||
aiTextureType_BASE_COLOR = 12,
|
||||
aiTextureType_NORMAL_CAMERA = 13,
|
||||
aiTextureType_EMISSION_COLOR = 14,
|
||||
aiTextureType_METALNESS = 15,
|
||||
aiTextureType_DIFFUSE_ROUGHNESS = 16,
|
||||
aiTextureType_AMBIENT_OCCLUSION = 17,
|
||||
aiTextureType_UNKNOWN = 18,
|
||||
aiTextureType_SHEEN = 19,
|
||||
aiTextureType_CLEARCOAT = 20,
|
||||
aiTextureType_TRANSMISSION = 21,
|
||||
aiTextureType_MAYA_BASE = 22,
|
||||
aiTextureType_MAYA_SPECULAR = 23,
|
||||
aiTextureType_MAYA_SPECULAR_COLOR = 24,
|
||||
aiTextureType_MAYA_SPECULAR_ROUGHNESS = 25,
|
||||
aiTextureType_ANISOTROPY = 26,
|
||||
aiTextureType_GLTF_METALLIC_ROUGHNESS = 27,
|
||||
aiTextureType_NONE = 0,
|
||||
aiTextureType_DIFFUSE = 1,
|
||||
aiTextureType_SPECULAR = 2,
|
||||
aiTextureType_AMBIENT = 3,
|
||||
aiTextureType_EMISSIVE = 4,
|
||||
aiTextureType_HEIGHT = 5,
|
||||
aiTextureType_NORMALS = 6,
|
||||
aiTextureType_SHININESS = 7,
|
||||
aiTextureType_OPACITY = 8,
|
||||
aiTextureType_DISPLACEMENT = 9,
|
||||
aiTextureType_LIGHTMAP = 10,
|
||||
aiTextureType_REFLECTION = 11,
|
||||
aiTextureType_BASE_COLOR = 12,
|
||||
aiTextureType_NORMAL_CAMERA = 13,
|
||||
aiTextureType_EMISSION_COLOR = 14,
|
||||
aiTextureType_METALNESS = 15,
|
||||
aiTextureType_DIFFUSE_ROUGHNESS = 16,
|
||||
aiTextureType_AMBIENT_OCCLUSION = 17,
|
||||
aiTextureType_UNKNOWN = 18,
|
||||
aiTextureType_SHEEN = 19,
|
||||
aiTextureType_CLEARCOAT = 20,
|
||||
aiTextureType_TRANSMISSION = 21,
|
||||
aiTextureType_MAYA_BASE = 22,
|
||||
aiTextureType_MAYA_SPECULAR = 23,
|
||||
aiTextureType_MAYA_SPECULAR_COLOR = 24,
|
||||
aiTextureType_MAYA_SPECULAR_ROUGHNESS = 25,
|
||||
aiTextureType_ANISOTROPY = 26,
|
||||
aiTextureType_GLTF_METALLIC_ROUGHNESS = 27,
|
||||
|
||||
#ifndef SWIG
|
||||
_aiTextureType_Force32Bit = INT_MAX
|
||||
|
||||
@@ -129,10 +129,10 @@ struct SaveKeyFrameRotation
|
||||
|
||||
struct SaveChannel
|
||||
{
|
||||
char Name[64];
|
||||
unsigned int ScalingKeyCount;
|
||||
unsigned int RotationKeyCount;
|
||||
unsigned int PositionKeyCount;
|
||||
char Name[64] = { };
|
||||
unsigned int ScalingKeyCount = { };
|
||||
unsigned int RotationKeyCount = { };
|
||||
unsigned int PositionKeyCount = { };
|
||||
|
||||
vector<SaveKeyFrameVec> ScalingKeys;
|
||||
vector<SaveKeyFrameRotation> RotationKeys;
|
||||
|
||||
@@ -188,8 +188,11 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
m_sModelMap[filePath] = sModel;
|
||||
}
|
||||
|
||||
SaveModel* Load_SaveModel(const _char* filePath);
|
||||
#ifdef EDITOR_PROJECT
|
||||
_bool SaveAssimpModel(const _char* filename);
|
||||
#endif
|
||||
|
||||
SaveModel* Load_SaveModel(const _char* filePath);
|
||||
void Save_ModelFilePath(const _char* FilePath);
|
||||
const _char* Load_ModelFilePath(_uint iIndex);
|
||||
const _char* Load_BinaryModelFilePath(_uint iIndex);
|
||||
|
||||
@@ -24,10 +24,14 @@ class ENGINE_DLL CMaterial final : public CBase
|
||||
#ifdef EDITOR_PROJECT
|
||||
public:
|
||||
static CMaterial* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pModelFilePath, const aiMaterial* pAIMaterial);
|
||||
static CMaterial* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pMaterialFilePath, const _char* pTextureFilePath);
|
||||
HRESULT SaveAsBinary(HANDLE hFile, DWORD& dwByte);
|
||||
private:
|
||||
vector<string> m_strPath[AI_TEXTURE_TYPE_MAX];
|
||||
HRESULT Initialize(const _char* pModelFilePath, const aiMaterial* pAIMaterial);
|
||||
HRESULT Initialize(const _char* pMaterialFilePath, const _char* pTextureFilePath);
|
||||
HRESULT Read_MaterialFile(const _char* pMaterialFilePath, const _char* pTextureFolderPath);
|
||||
HRESULT Add_Texture(const _char* pTextureFolderPath, string& FileType);
|
||||
#endif // EDITOR_PROJECT
|
||||
|
||||
virtual HRESULT Initialize(const _char* pModelFilePath, HANDLE hFile, DWORD& dwByte);
|
||||
|
||||
@@ -51,6 +51,7 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
HRESULT Assimp_Model_Load(const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex);
|
||||
HRESULT Ready_Meshes(MODEL eType, const aiScene* pAIScene, _fmatrix& PreTransformMatrix);
|
||||
HRESULT Ready_Materials(const aiScene* pAIScene, const _char* pModelFilePath);
|
||||
HRESULT Ready_Materials_FromFile(const aiScene* pAIScene, const _char* pModelFilePath);
|
||||
HRESULT Ready_Animations(const aiScene* pAIScene);
|
||||
HRESULT Ready_Bones(const aiNode* pAINode, _int iParentIndex);
|
||||
// ¹ÙÀ̳ʸ®
|
||||
@@ -61,9 +62,10 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
|
||||
|
||||
private:
|
||||
#ifdef EDITOR_PROJECT
|
||||
const aiScene* m_pAIScene = { nullptr };
|
||||
Assimp::Importer m_Importer;
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
MODEL m_eType = {}; // ¸ðµ¨ÀÇ Å¸ÀÔ
|
||||
|
||||
@@ -67,31 +67,67 @@ class CPrototype_Manager final : public CBase
|
||||
public:
|
||||
//특정 타입의 컴포넌트들의 이름을 통한 콤보박스 , 이미지는 이미지 클립을
|
||||
//만들고 선택할 시에 내 ppOut에 클론하는 기능을 담당
|
||||
|
||||
template<typename T>
|
||||
void Asset_Description(_uint iLevel , const _char* pComponentName , CComponent** ppOut , void* pDesc , class CGameObject* pOwner = nullptr)
|
||||
{
|
||||
vector<const _char*> pComponentNames = {};
|
||||
|
||||
vector<_string> strNames = {};
|
||||
|
||||
for (auto& Pair : m_pAssets[iLevel])
|
||||
{
|
||||
|
||||
if (typeid(*Pair.second) == typeid(T)) // 같은 타입의 컴포넌트 였다면
|
||||
{
|
||||
_string strName = CMyTools::ToString(Pair.first);
|
||||
strNames.push_back(CMyTools::ToString(Pair.first));
|
||||
|
||||
pComponentNames.push_back(strNames.back().c_str());
|
||||
|
||||
pComponentNames.push_back(strName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
_int iCurrentItem = 0;
|
||||
if (typeid(CTexture) == typeid(T)) // 텍스쳐일 경우 이미지로 띄우기
|
||||
{
|
||||
_int iIndex = {};
|
||||
|
||||
if (GUI::Combo("pComponentName", &iCurrentItem, pComponentNames.data(), (_int)pComponentNames.size()))
|
||||
for (auto& strName : strNames)
|
||||
{
|
||||
_wstring wstrComponentName = CMyTools::ToWstring(strName);
|
||||
|
||||
auto iter = m_pAssets[iLevel].find(wstrComponentName);
|
||||
|
||||
if (iter == m_pAssets[iLevel].end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (GUI::ImageButton(strName.c_str(), dynamic_cast<CTexture*>(iter->second)->Get_SRV(0), ImVec2(48, 48)))
|
||||
{
|
||||
if (*ppOut != nullptr)
|
||||
Safe_Release(*ppOut);
|
||||
|
||||
|
||||
*ppOut = iter->second->Clone(pDesc, pOwner);
|
||||
}
|
||||
|
||||
if ((iIndex++ + 1) % 4 != 0)
|
||||
GUI::SameLine(); // 같은 줄에 이어서
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static _int s_iCurrentItem = -1;
|
||||
|
||||
// 다른 어셋일 경우 콤보로 띄우기
|
||||
|
||||
if (GUI::Combo(pComponentName, &s_iCurrentItem, pComponentNames.data(), (_int)pComponentNames.size()))
|
||||
{
|
||||
if (*ppOut != nullptr)
|
||||
Safe_Release(*ppOut);
|
||||
|
||||
_string strComponentName = pComponentNames[iCurrentItem];
|
||||
_string strComponentName = pComponentNames[s_iCurrentItem];
|
||||
_wstring wstrComponentName = CMyTools::ToWstring(strComponentName);
|
||||
|
||||
auto iter = m_pAssets[iLevel].find(wstrComponentName);
|
||||
|
||||
Reference in New Issue
Block a user