From ab7754ab2a912d3b6b777cc6b1506b476cc70411 Mon Sep 17 00:00:00 2001 From: Andreas Henne Date: Thu, 11 Dec 2014 23:05:09 +0100 Subject: [PATCH] Code style changes. --- code/Exporter.cpp | 2 +- code/PlyExporter.cpp | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/code/Exporter.cpp b/code/Exporter.cpp index 9cc96e452..238430fa6 100644 --- a/code/Exporter.cpp +++ b/code/Exporter.cpp @@ -114,7 +114,7 @@ Exporter::ExportFormatEntry gExporters[] = Exporter::ExportFormatEntry( "ply", "Stanford Polygon Library", "ply" , &ExportScenePly, aiProcess_PreTransformVertices ), - Exporter::ExportFormatEntry( "plyb", "Stanford Polygon Library Binary", "ply", &ExportScenePlyBinary, + Exporter::ExportFormatEntry( "plyb", "Stanford Polygon Library (binary)", "ply", &ExportScenePlyBinary, aiProcess_PreTransformVertices ), #endif diff --git a/code/PlyExporter.cpp b/code/PlyExporter.cpp index bab523f23..a214d1371 100644 --- a/code/PlyExporter.cpp +++ b/code/PlyExporter.cpp @@ -116,16 +116,14 @@ PlyExporter::PlyExporter(const char* _filename, const aiScene* pScene, bool bina } mOutput << "ply" << endl; - if (binary) - { + if (binary) { #if (defined AI_BUILD_BIG_ENDIAN) mOutput << "format binary_big_endian 1.0" << endl; #else mOutput << "format binary_little_endian 1.0" << endl; #endif } - else - { + else { mOutput << "format ascii 1.0" << endl; } mOutput << "comment Created by Open Asset Import Library - http://assimp.sf.net (v" @@ -188,16 +186,20 @@ PlyExporter::PlyExporter(const char* _filename, const aiScene* pScene, bool bina mOutput << "end_header" << endl; for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) { - if (binary) + if (binary) { WriteMeshVertsBinary(pScene->mMeshes[i], components); - else + } + else { WriteMeshVerts(pScene->mMeshes[i], components); + } } for (unsigned int i = 0, ofs = 0; i < pScene->mNumMeshes; ++i) { - if (binary) + if (binary) { WriteMeshIndicesBinary(pScene->mMeshes[i], ofs); - else + } + else { WriteMeshIndices(pScene->mMeshes[i], ofs); + } ofs += pScene->mMeshes[i]->mNumVertices; } } @@ -205,6 +207,8 @@ PlyExporter::PlyExporter(const char* _filename, const aiScene* pScene, bool bina // ------------------------------------------------------------------------------------------------ void PlyExporter::WriteMeshVerts(const aiMesh* m, unsigned int components) { + // If a component (for instance normal vectors) is present in at least one mesh in the scene, + // then default values are written for meshes that do not contain this component. for (unsigned int i = 0; i < m->mNumVertices; ++i) { mOutput << m->mVertices[i].x << " " << @@ -270,6 +274,8 @@ void PlyExporter::WriteMeshVerts(const aiMesh* m, unsigned int components) // ------------------------------------------------------------------------------------------------ void PlyExporter::WriteMeshVertsBinary(const aiMesh* m, unsigned int components) { + // If a component (for instance normal vectors) is present in at least one mesh in the scene, + // then default values are written for meshes that do not contain this component. aiVector3D defaultNormal(0, 0, 0); aiVector2D defaultUV(-1, -1); aiColor4D defaultColor(-1, -1, -1, -1);