[fix] HeightMap 터레인, 쿼드트리 적용
This commit is contained in:
@@ -23,7 +23,9 @@ CModel::CModel(const CModel& rhs)
|
||||
m_Materials(rhs.m_Materials),
|
||||
m_iNumMaterials(rhs.m_iNumMaterials),
|
||||
m_iNumAnimations(rhs.m_iNumAnimations),
|
||||
m_pLerpAnim(rhs.m_pLerpAnim)
|
||||
m_pLerpAnim(rhs.m_pLerpAnim),
|
||||
m_fRadius(rhs.m_fRadius),
|
||||
m_vRadiusOffset(rhs.m_vRadiusOffset)
|
||||
{
|
||||
_uint iNumBones = (_uint)(rhs.m_Bones.size());
|
||||
m_Bones.reserve(iNumBones);
|
||||
@@ -479,6 +481,29 @@ HRESULT CModel::Ready_Materials_FromFile(const aiScene* pAIScene, const _char* p
|
||||
m_Materials.push_back(pMaterial);
|
||||
}
|
||||
m_Materials.shrink_to_fit();
|
||||
|
||||
while (true)
|
||||
{
|
||||
getline(file, strText);
|
||||
if (string::npos != strText.find("Origin"))
|
||||
{
|
||||
size_t iXPos = strText.find_first_of("X");
|
||||
size_t iYPos = strText.find_first_of("Y");
|
||||
size_t iZPos = strText.find_first_of("Z");
|
||||
size_t iEndPos = strText.find_first_of("}");
|
||||
|
||||
m_vRadiusOffset.x = stof(strText.substr(iXPos + 2, iYPos - 2)) * 0.01f;
|
||||
m_vRadiusOffset.z = stof(strText.substr(iYPos + 2, iZPos - 2)) * -0.01f;
|
||||
m_vRadiusOffset.y = stof(strText.substr(iZPos + 2, iEndPos)) * 0.01f;
|
||||
}
|
||||
if (string::npos != strText.find("SphereRadius"))
|
||||
{
|
||||
size_t iBeginIndex = strText.find_first_of("=");
|
||||
m_fRadius = stof(strText.substr(iBeginIndex + 1)) / 100.f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -779,6 +804,12 @@ _bool CModel::SaveAssimpModel(const _char* filename)
|
||||
}
|
||||
}
|
||||
|
||||
if (MODEL::ENVIROMENT == m_eType)
|
||||
{
|
||||
fwrite(&m_fRadius, sizeof(_float), 1, fp);
|
||||
fwrite(&m_vRadiusOffset, sizeof(_float3), 1, fp);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return true;
|
||||
@@ -1079,6 +1110,11 @@ _bool CModel::LoadData(const _char* filename)
|
||||
NewModel.Materials.push_back(mat);
|
||||
}
|
||||
|
||||
if (MODEL::ENVIROMENT == m_eType)
|
||||
{
|
||||
fread(&m_fRadius, sizeof(_float), 1, fp);
|
||||
fread(&m_vRadiusOffset, sizeof(_float3), 1, fp);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user