Merge pull request #4250 from assimp/kimkulling-fix_division_by_zero_issue4235-1
Update HMPLoader.cpppull/4247/head^2
commit
819d9f7257
|
@ -473,16 +473,22 @@ void HMPImporter::ReadFirstSkin(unsigned int iNumSkins, const unsigned char *szC
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Generate proepr texture coords
|
// Generate proepr texture coords
|
||||||
void HMPImporter::GenerateTextureCoords(
|
void HMPImporter::GenerateTextureCoords(const unsigned int width, const unsigned int height) {
|
||||||
const unsigned int width, const unsigned int height) {
|
|
||||||
ai_assert(nullptr != pScene->mMeshes);
|
ai_assert(nullptr != pScene->mMeshes);
|
||||||
ai_assert(nullptr != pScene->mMeshes[0]);
|
ai_assert(nullptr != pScene->mMeshes[0]);
|
||||||
ai_assert(nullptr != pScene->mMeshes[0]->mTextureCoords[0]);
|
ai_assert(nullptr != pScene->mMeshes[0]->mTextureCoords[0]);
|
||||||
|
|
||||||
aiVector3D *uv = pScene->mMeshes[0]->mTextureCoords[0];
|
aiVector3D *uv = pScene->mMeshes[0]->mTextureCoords[0];
|
||||||
|
if (uv == nullptr) {
|
||||||
const float fY = (1.0f / height) + (1.0f / height) / (height - 1);
|
return;
|
||||||
const float fX = (1.0f / width) + (1.0f / width) / (width - 1);
|
}
|
||||||
|
|
||||||
|
if (height == 0.0f || width == 0.0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const float fY = (1.0f / height) + (1.0f / height) / height;
|
||||||
|
const float fX = (1.0f / width) + (1.0f / width) / width;
|
||||||
|
|
||||||
for (unsigned int y = 0; y < height; ++y) {
|
for (unsigned int y = 0; y < height; ++y) {
|
||||||
for (unsigned int x = 0; x < width; ++x, ++uv) {
|
for (unsigned int x = 0; x < width; ++x, ++uv) {
|
||||||
|
|
Loading…
Reference in New Issue