Fix issue #623 PLY importer should not create faces
When the PLY file contains no faces, we should not create them.pull/1822/head
parent
ecb64c5949
commit
f053695176
|
@ -244,30 +244,6 @@ void PLYImporter::InternReadFile(const std::string& pFile, aiScene* pScene, IOSy
|
||||||
// if no face list is existing we assume that the vertex
|
// if no face list is existing we assume that the vertex
|
||||||
// list is containing a list of points
|
// list is containing a list of points
|
||||||
bool pointsOnly = mGeneratedMesh->mFaces == NULL ? true : false;
|
bool pointsOnly = mGeneratedMesh->mFaces == NULL ? true : false;
|
||||||
if (pointsOnly) {
|
|
||||||
if (mGeneratedMesh->mNumVertices < 3) {
|
|
||||||
if (mGeneratedMesh != NULL) {
|
|
||||||
delete(mGeneratedMesh);
|
|
||||||
mGeneratedMesh = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
streamedBuffer.close();
|
|
||||||
throw DeadlyImportError("Invalid .ply file: Not enough "
|
|
||||||
"vertices to build a proper face list. ");
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned int iNum = (unsigned int)mGeneratedMesh->mNumVertices / 3;
|
|
||||||
mGeneratedMesh->mNumFaces = iNum;
|
|
||||||
mGeneratedMesh->mFaces = new aiFace[mGeneratedMesh->mNumFaces];
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < iNum; ++i) {
|
|
||||||
mGeneratedMesh->mFaces[i].mNumIndices = 3;
|
|
||||||
mGeneratedMesh->mFaces[i].mIndices = new unsigned int[3];
|
|
||||||
mGeneratedMesh->mFaces[i].mIndices[0] = (i * 3);
|
|
||||||
mGeneratedMesh->mFaces[i].mIndices[1] = (i * 3) + 1;
|
|
||||||
mGeneratedMesh->mFaces[i].mIndices[2] = (i * 3) + 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// now load a list of all materials
|
// now load a list of all materials
|
||||||
std::vector<aiMaterial*> avMaterials;
|
std::vector<aiMaterial*> avMaterials;
|
||||||
|
|
Loading…
Reference in New Issue