Ver código fonte

Code style changes.

Andreas Henne 10 anos atrás
pai
commit
ab7754ab2a
2 arquivos alterados com 15 adições e 9 exclusões
  1. 1 1
      code/Exporter.cpp
  2. 14 8
      code/PlyExporter.cpp

+ 1 - 1
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

+ 14 - 8
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);