From c15c549881c8e6c5aaace851a37142d361b4effd Mon Sep 17 00:00:00 2001 From: Virendra Singh Date: Wed, 25 Feb 2015 07:47:00 +0530 Subject: [PATCH] Code formatting --- tools/vhacd/src/VHACDUtil.cpp | 29 ++++++++++------------------- tools/vhacd/src/VHACDUtil.h | 3 +-- tools/vhacd/src/main.cpp | 24 ++++++++---------------- 3 files changed, 19 insertions(+), 37 deletions(-) diff --git a/tools/vhacd/src/VHACDUtil.cpp b/tools/vhacd/src/VHACDUtil.cpp index bfcdb74634..dcfd7e447f 100644 --- a/tools/vhacd/src/VHACDUtil.cpp +++ b/tools/vhacd/src/VHACDUtil.cpp @@ -9,13 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include +#include #include "VHACDUtil.h" //Read all the meshes from provided FBX file -bool vhacd::VHACDUtil::loadFBX(const QString filename, vhacd::LoadFBXResults *results) -{ +bool vhacd::VHACDUtil::loadFBX(const QString filename, vhacd::LoadFBXResults *results){ // open the fbx file QFile fbx(filename); @@ -29,15 +28,13 @@ bool vhacd::VHACDUtil::loadFBX(const QString filename, vhacd::LoadFBXResults *re //results->meshCount = geometry.meshes.count(); int count = 0; - foreach(FBXMesh mesh, geometry.meshes) - { + foreach(FBXMesh mesh, geometry.meshes) { //get vertices for each mesh QVector vertices = mesh.vertices; //get the triangle indices for each mesh QVector triangles; - foreach(FBXMeshPart part, mesh.parts) - { + foreach(FBXMeshPart part, mesh.parts) { QVector indices = part.triangleIndices; triangles += indices; } @@ -54,15 +51,13 @@ bool vhacd::VHACDUtil::loadFBX(const QString filename, vhacd::LoadFBXResults *re return true; } -bool vhacd::VHACDUtil::computeVHACD(vhacd::LoadFBXResults *meshes, VHACD::IVHACD::Parameters params, vhacd::ComputeResults *results)const -{ +bool vhacd::VHACDUtil::computeVHACD(vhacd::LoadFBXResults *meshes, VHACD::IVHACD::Parameters params, vhacd::ComputeResults *results)const{ VHACD::IVHACD * interfaceVHACD = VHACD::CreateVHACD(); int meshCount = meshes->meshCount; int count = 0; std::cout << "Performing V-HACD computation on " << meshCount <<" meshes ..... " << std::endl; - for (int i = 0; i < meshCount; i++) - { + for (int i = 0; i < meshCount; i++){ std::vector vertices = meshes->perMeshVertices.at(i).toStdVector(); std::vector triangles = meshes->perMeshTriangleIndices.at(i).toStdVector(); @@ -71,8 +66,7 @@ bool vhacd::VHACDUtil::computeVHACD(vhacd::LoadFBXResults *meshes, VHACD::IVHACD std::cout << "Mesh " << i + 1 << " : "; // compute approximate convex decomposition bool res = interfaceVHACD->Compute(&vertices[0].x, 3, nPoints, &triangles[0], 3, nTriangles, params); - if (!res) - { + if (!res){ std::cout << "V-HACD computation failed for Mesh : " << i + 1 << std::endl; continue; } @@ -84,8 +78,7 @@ bool vhacd::VHACDUtil::computeVHACD(vhacd::LoadFBXResults *meshes, VHACD::IVHACD //get all the convex hulls for this mesh QVector convexHulls; - for (unsigned int j = 0; j < nConvexHulls; j++) - { + for (unsigned int j = 0; j < nConvexHulls; j++){ VHACD::IVHACD::ConvexHull hull; interfaceVHACD->GetConvexHull(j, hull); convexHulls.append(hull); @@ -105,14 +98,12 @@ bool vhacd::VHACDUtil::computeVHACD(vhacd::LoadFBXResults *meshes, VHACD::IVHACD return false; } -vhacd::VHACDUtil:: ~VHACDUtil() -{ +vhacd::VHACDUtil:: ~VHACDUtil(){ //nothing to be cleaned } //ProgressClaback implementation -void vhacd::ProgressCallback::Update(const double overallProgress, const double stageProgress, const double operationProgress, const char * const stage, const char * const operation) -{ +void vhacd::ProgressCallback::Update(const double overallProgress, const double stageProgress, const double operationProgress, const char * const stage, const char * const operation){ int progress = (int)(overallProgress + 0.5); if (progress < 10) diff --git a/tools/vhacd/src/VHACDUtil.h b/tools/vhacd/src/VHACDUtil.h index a9df5d7f2a..aaabcdf904 100644 --- a/tools/vhacd/src/VHACDUtil.h +++ b/tools/vhacd/src/VHACDUtil.h @@ -42,8 +42,7 @@ namespace vhacd{ ~VHACDUtil(); }; - class ProgressCallback : public VHACD::IVHACD::IUserCallback - { + class ProgressCallback : public VHACD::IVHACD::IUserCallback{ public: ProgressCallback(void); ~ProgressCallback(); diff --git a/tools/vhacd/src/main.cpp b/tools/vhacd/src/main.cpp index 55a152c179..a80a57bb3e 100644 --- a/tools/vhacd/src/main.cpp +++ b/tools/vhacd/src/main.cpp @@ -19,8 +19,7 @@ using namespace std; using namespace VHACD; -int main(int argc, char * argv[]) -{ +int main(int argc, char * argv[]){ vector triangles; // array of indexes vector points; // array of coordinates vhacd::VHACDUtil vUtil; @@ -44,34 +43,29 @@ int main(int argc, char * argv[]) params.m_minVolumePerCH = 0.0001; // controls the adaptive sampling of the generated convex - hulls // load the mesh - if (!vUtil.loadFBX(fname, &fbx)) - { + if (!vUtil.loadFBX(fname, &fbx)){ cout << "Error in opening FBX file...."; return 1; } - if (!vUtil.computeVHACD(&fbx, params, &results)) - { + if (!vUtil.computeVHACD(&fbx, params, &results)){ cout << "Compute Failed..."; return 1; } int totalVertices = 0; - for (int i = 0; i < fbx.meshCount; i++) - { + for (int i = 0; i < fbx.meshCount; i++){ totalVertices += fbx.perMeshVertices.at(i).count(); } int totalTriangles = 0; - for (int i = 0; i < fbx.meshCount; i++) - { + for (int i = 0; i < fbx.meshCount; i++){ totalTriangles += fbx.perMeshTriangleIndices.at(i).count(); } int totalHulls = 0; QVector hullCounts = results.convexHullsCountList; - for (int i = 0; i < results.meshCount; i++) - { + for (int i = 0; i < results.meshCount; i++){ totalHulls += hullCounts.at(i); } cout << endl << "Summary of V-HACD Computation..................." << endl; @@ -82,14 +76,12 @@ int main(int argc, char * argv[]) cout << "Total Triangles : " << totalTriangles << endl; cout << "Total Convex Hulls : " << totalHulls << endl; cout << endl << "Summary per convex hull ........................" << endl < chList = results.convexHullList.at(i); cout << "\t" << "Number Of Hulls : " << chList.count() << endl; - for (int j = 0; j < results.convexHullList.at(i).count(); j++) - { + for (int j = 0; j < results.convexHullList.at(i).count(); j++){ cout << "\tHUll : " << j + 1 << endl; cout << "\t\tNumber Of Points : " << chList.at(j).m_nPoints << endl;