Set primitive_type to point when PLY is a point cloud

pull/1822/head
Alexandre Avenel 2018-03-04 00:12:53 +01:00
parent f053695176
commit 15fa86f100
2 changed files with 6 additions and 0 deletions

View File

@ -244,6 +244,9 @@ 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) {
mGeneratedMesh->mPrimitiveTypes = aiPrimitiveType::aiPrimitiveType_POINT;
}
// now load a list of all materials // now load a list of all materials
std::vector<aiMaterial*> avMaterials; std::vector<aiMaterial*> avMaterials;

View File

@ -97,6 +97,8 @@ TEST_F(utPLYImportExport, importerMultipleTest) {
scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/PLY/cube.ply", aiProcess_ValidateDataStructure); scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/PLY/cube.ply", aiProcess_ValidateDataStructure);
EXPECT_NE(nullptr, scene); EXPECT_NE(nullptr, scene);
EXPECT_NE(nullptr, scene->mMeshes[0]);
EXPECT_EQ(6u, scene->mMeshes[0]->mNumFaces);
} }
TEST_F(utPLYImportExport, importPLYwithUV) { TEST_F(utPLYImportExport, importPLYwithUV) {
@ -145,6 +147,7 @@ TEST_F(utPLYImportExport, pointcloudTest) {
EXPECT_EQ(1u, scene->mNumMeshes); EXPECT_EQ(1u, scene->mNumMeshes);
EXPECT_NE(nullptr, scene->mMeshes[0]); EXPECT_NE(nullptr, scene->mMeshes[0]);
EXPECT_EQ(24u, scene->mMeshes[0]->mNumVertices); EXPECT_EQ(24u, scene->mMeshes[0]->mNumVertices);
EXPECT_EQ(aiPrimitiveType::aiPrimitiveType_POINT, scene->mMeshes[0]->mPrimitiveTypes);
EXPECT_EQ(0u, scene->mMeshes[0]->mNumFaces); EXPECT_EQ(0u, scene->mMeshes[0]->mNumFaces);
} }