From 393cbe33091078b6eab27d4e2020cdf5c134d96b Mon Sep 17 00:00:00 2001 From: Ewen Cheslack-Postava Date: Tue, 7 Aug 2012 20:48:45 -0700 Subject: [PATCH] Warnings cleanup. --- externals/liboauthcpp | 2 +- .../common-filters/DeduplicationFilter.cpp | 36 +++++----- libmesh/plugins/ply/PlyModelSystem.cpp | 68 +++++++++---------- test/unit/libcore/StrandTest.hpp | 2 +- test/unit/libmesh/ColladaLoaderTest.hpp | 56 +++++++-------- test/unit/libmesh/DeduplicationTest.hpp | 20 +++--- test/unit/libmesh/PlyLoaderTest.hpp | 36 +++++----- 7 files changed, 110 insertions(+), 110 deletions(-) diff --git a/externals/liboauthcpp b/externals/liboauthcpp index 45836f7e8..327792ddf 160000 --- a/externals/liboauthcpp +++ b/externals/liboauthcpp @@ -1 +1 @@ -Subproject commit 45836f7e860c08f6e8e88f86faf9b856706996f9 +Subproject commit 327792ddf21561fd0d26e690ce84ac26a029aeba diff --git a/libmesh/plugins/common-filters/DeduplicationFilter.cpp b/libmesh/plugins/common-filters/DeduplicationFilter.cpp index bf2504501..3d46b4ec7 100644 --- a/libmesh/plugins/common-filters/DeduplicationFilter.cpp +++ b/libmesh/plugins/common-filters/DeduplicationFilter.cpp @@ -52,7 +52,7 @@ bool comp(Vector3f point1, Vector3f point2) { FilterDataPtr DeduplicationFilter::apply(FilterDataPtr input) { for(FilterData::const_iterator md_it = input->begin(); md_it != input->end(); md_it++) { VisualPtr vis = *md_it; - + MeshdataPtr mesh( std::tr1::dynamic_pointer_cast(vis) ); if (mesh) { //normals are necessary, the filter might break without them.... @@ -62,7 +62,7 @@ FilterDataPtr DeduplicationFilter::apply(FilterDataPtr input) { if(mesh->geometry.size() >= 2) { //we sort the positions before hand so they're easier to use... but this may be unnecessary. std::vector > sortedPositions; - for(int i = 0; i < mesh->geometry.size(); i++) { + for(uint32 i = 0; i < mesh->geometry.size(); i++) { std::vector v = mesh->geometry[i].positions; std::sort(v.begin(), v.begin() + v.size(), comp); sortedPositions.push_back(v); @@ -70,14 +70,14 @@ FilterDataPtr DeduplicationFilter::apply(FilterDataPtr input) { //test if all of the points are exactly the same //a better way (possibly) is to put it with the other major loop //and just note whether every single point is the same as the loop runs - for(int i = 0; i < mesh->geometry.size(); i++) { - for(int j = i + 1; j < mesh->geometry.size(); j++) { + for(uint32 i = 0; i < mesh->geometry.size(); i++) { + for(uint32 j = i + 1; j < mesh->geometry.size(); j++) { bool same = true; //should switch to unordered_set if(mesh->instances[i].materialBindingMap[mesh->geometry[i].primitives[0].materialId] != mesh->instances[j].materialBindingMap[mesh->geometry[j].primitives[0].materialId] && sortedPositions[i].size() == sortedPositions[j].size()) { - for(int k = 0; k < sortedPositions[i].size(); k++) { + for(uint32 k = 0; k < sortedPositions[i].size(); k++) { if(sortedPositions[i][k] != sortedPositions[j][k]) same = false; } } else same = false; @@ -89,41 +89,41 @@ FilterDataPtr DeduplicationFilter::apply(FilterDataPtr input) { p.primitiveType = mesh->geometry[i].primitives[0].primitiveType; mesh->geometry[i].primitives.push_back(p); - for(int k = 0; k < mesh->geometry[j].primitives[0].indices.size(); k++) + for(uint32 k = 0; k < mesh->geometry[j].primitives[0].indices.size(); k++) mesh->geometry[i].primitives[mesh->geometry[i].primitives.size() - 1].indices.push_back(mesh->geometry[j].primitives[0].indices[k] + add); - for(int k = 0; k < mesh->geometry[j].positions.size(); k++) + for(uint32 k = 0; k < mesh->geometry[j].positions.size(); k++) mesh->geometry[i].positions.push_back(mesh->geometry[j].positions[k]); - //materials + //materials mesh->geometry[i].primitives[mesh->geometry[i].primitives.size() - 1].materialId = mesh->instances[i].materialBindingMap.size() + 1; //submeshgeometry mesh->geometry.erase(mesh->geometry.begin() + j); - + //geometryinstance mesh->instances[i].materialBindingMap[mesh->instances[i].materialBindingMap.size() + 1] = mesh->instances[j].materialBindingMap[1]; mesh->instances.erase(mesh->instances.begin() + j); - for(int k = j; k < mesh->instances.size(); k++) + for(uint32 k = j; k < mesh->instances.size(); k++) mesh->instances[k].geometryIndex = k; //sortedPositions sortedPositions.erase(sortedPositions.begin() + j); - + } } } //then, we see if the geometries have similar points: if they do, they should be mixed - for(int i = 0; i < mesh->geometry.size(); i++) { - for(int j = i + 1; j < mesh->geometry.size(); j++) { + for(uint32 i = 0; i < mesh->geometry.size(); i++) { + for(uint32 j = i + 1; j < mesh->geometry.size(); j++) { bool combine = false; //we compare two of the geometries: //but we do not proceed unless their materials are the same (we can assume only one primitive for now) if(mesh->instances[i].materialBindingMap[mesh->geometry[i].primitives[0].materialId] == mesh->instances[j].materialBindingMap[mesh->geometry[j].primitives[0].materialId]) { - for(int k = 0; k < mesh->geometry[i].positions.size(); k++) { - for(int l = 0; l < mesh->geometry[j].positions.size(); l++) { + for(uint32 k = 0; k < mesh->geometry[i].positions.size(); k++) { + for(uint32 l = 0; l < mesh->geometry[j].positions.size(); l++) { //positions have to be the same if(mesh->geometry[i].positions[k] == mesh->geometry[j].positions[l]) combine = true; @@ -131,10 +131,10 @@ FilterDataPtr DeduplicationFilter::apply(FilterDataPtr input) { } //and mix them (if necessary) here if(combine) { - for(int l = 0; l < mesh->geometry[j].primitives[0].indices.size(); l++) { + for(uint32 l = 0; l < mesh->geometry[j].primitives[0].indices.size(); l++) { bool addPoint = true; int pos = -1; - for(int k = 0; k < mesh->geometry[i].primitives[0].indices.size() && addPoint; k++) { + for(uint32 k = 0; k < mesh->geometry[i].primitives[0].indices.size() && addPoint; k++) { if(mesh->geometry[i].positions[mesh->geometry[i].primitives[0].indices[k]] == mesh->geometry[j].positions[mesh->geometry[j].primitives[0].indices[l]] && mesh->geometry[i].normals[mesh->geometry[i].primitives[0].indices[k]] == @@ -156,7 +156,7 @@ FilterDataPtr DeduplicationFilter::apply(FilterDataPtr input) { //proper clean up mesh->geometry.erase(mesh->geometry.begin() + j); mesh->instances.erase(mesh->instances.begin() + j); - for(int k = j; k < mesh->instances.size(); k++) + for(uint32 k = j; k < mesh->instances.size(); k++) mesh->instances[k].geometryIndex = k; j--; diff --git a/libmesh/plugins/ply/PlyModelSystem.cpp b/libmesh/plugins/ply/PlyModelSystem.cpp index 799daf591..0f055cd86 100644 --- a/libmesh/plugins/ply/PlyModelSystem.cpp +++ b/libmesh/plugins/ply/PlyModelSystem.cpp @@ -71,11 +71,11 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat ss >> s; Mesh::MeshdataPtr mdp(new Mesh::Meshdata); - + int state = FILLER; int vertexNum = 0, faceNum = 0, edgeNum = 0; std::vector propV, propF, propE; - + bool loop = true; std::vector file; while(ss && loop) { @@ -157,7 +157,7 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat int numTexCoords; //obtain vertex data for(int i = 0; i < vertexNum; i++) { - for(int j = 0; j < propV.size(); j++) { + for(uint32 j = 0; j < propV.size(); j++) { ss >> temp; switch(propV[j]) { case X: vert[i][0] = temp; break; @@ -174,7 +174,7 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat } //obtain face data for(int i = 0; i < faceNum; i++) { - for(int j = 0; j < propF.size(); j++) { + for(uint32 j = 0; j < propF.size(); j++) { switch(propF[j]) { case VI: ss >> numIndices; @@ -195,7 +195,7 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat ss >> tc[face[i][k]][0]; temp2 = tc[face[i][k]][1]; ss >> tc[face[i][k]][1]; - + if(file.size() == 1) { if((tc[face[i][k]][0] != temp1 && temp1 != -1) && (tc[face[i][k]][1] != temp2 && temp2 != -1)) @@ -203,7 +203,7 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat else tc[face[i][k]][2] = 0; } - + } if(file.size() > 1) { int numTex; @@ -228,7 +228,7 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat nod.parent = Mesh::NullNodeIndex; mdp->nodes.push_back(nod); mdp->rootNodes.push_back(0); - + Mesh::SubMeshGeometry smg; //make a primitive @@ -241,7 +241,7 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat Mesh::GeometryInstance gi; gi.geometryIndex = 0; gi.parentNode = 0; - + //color: currently just takes the average of the colors and sets //the color of the figure to this average color int sumRed = 0, sumGreen = 0, sumBlue = 0, sumAlpha = 0; @@ -269,7 +269,7 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat mdp->geometry[0].primitives[0].indices.push_back(face[i][j]); } else { //for each next set of indices, we first see - //if a previous primitive has either shared an + //if a previous primitive has either shared an //index or shared a point. If yes, we may add //to the same primitive, or we may make a new //submeshgeometry. @@ -281,30 +281,30 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat int counterSMG = 0; std::vector hitSMG; bool sameSMG = false; - while(counterSMG < mdp->geometry.size()) { + while(counterSMG < (int)mdp->geometry.size()) { for(int j = 0; j < 3; j++) { //iterate through the indices - for(int k = 0; k < mdp->geometry[counterSMG].primitives.size(); k++) { - for(int l = 0; l < mdp->geometry[counterSMG].primitives[k].indices.size(); l++) { + for(uint32 k = 0; k < mdp->geometry[counterSMG].primitives.size(); k++) { + for(uint32 l = 0; l < mdp->geometry[counterSMG].primitives[k].indices.size(); l++) { //we must check if the index is the same and also if the texture is the same //something is wrong here! reverseMap is creating new entries (and that shouldn't happen!) if(reverseMap[counterSMG][mdp->geometry[counterSMG].primitives[k].indices[l]] == face[i][j] && ((col[reverseMap[counterSMG][mdp->geometry[counterSMG].primitives[k].indices[l]]][1] == col[face[i][j]][1] && col[reverseMap[counterSMG][mdp->geometry[counterSMG].primitives[k].indices[l]]][2] == col[face[i][j]][2] && col[reverseMap[counterSMG][mdp->geometry[counterSMG].primitives[k].indices[l]]][3] == col[face[i][j]][3]) || - (abs(tc[reverseMap[counterSMG][mdp->geometry[counterSMG].primitives[k].indices[l]]][2]) > file.size() && - abs(tc[face[i][j]][2]) > file.size() && file.size() > 0))) { + (abs(tc[reverseMap[counterSMG][mdp->geometry[counterSMG].primitives[k].indices[l]]][2]) > (int)file.size() && + abs(tc[face[i][j]][2]) > (int)file.size() && file.size() > 0))) { sameSMG = true; bool isThere = false; - for(int m = 0; m < hitSMG.size(); m++) + for(uint32 m = 0; m < hitSMG.size(); m++) if(hitSMG[m] == counterSMG) isThere = true; //is there a better way of doing this? if(!isThere) hitSMG.push_back(counterSMG); - + } } } - + } counterSMG++; } @@ -313,13 +313,13 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat //if the point hit multiple SMG's, we will have to merge them before adding a point while(hitSMG.size() > 1) { //First, submeshgeometry - for(int j = 0; j < mdp->geometry[hitSMG[1]].primitives[0].indices.size(); j++) {//we loop through the indices of the smg to be destroyed + for(uint32 j = 0; j < mdp->geometry[hitSMG[1]].primitives[0].indices.size(); j++) {//we loop through the indices of the smg to be destroyed int ind = reverseMap[hitSMG[0]].size(); //index for increasing the reverseMap size... Vector3f point = Vector3f(vert[reverseMap[hitSMG[1]][mdp->geometry[hitSMG[1]].primitives[0].indices[j]]][0], //here's a point from the smg to be transferred, at location j vert[reverseMap[hitSMG[1]][mdp->geometry[hitSMG[1]].primitives[0].indices[j]]][1], vert[reverseMap[hitSMG[1]][mdp->geometry[hitSMG[1]].primitives[0].indices[j]]][2]); bool addPoint = true; - for(int k = 0; k < mdp->geometry[hitSMG[0]].positions.size() && addPoint; k++) { //we loop through the other points in the smg to be stuffed + for(uint32 k = 0; k < mdp->geometry[hitSMG[0]].positions.size() && addPoint; k++) { //we loop through the other points in the smg to be stuffed if(point.x == mdp->geometry[hitSMG[0]].positions[k].x && //and try to see if there is a clone. if there is a clone, point.y == mdp->geometry[hitSMG[0]].positions[k].y && //we don't add a point? but if there is, we do add a point? point.z == mdp->geometry[hitSMG[0]].positions[k].z) @@ -329,20 +329,20 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat mdp->geometry[hitSMG[0]].positions.push_back(point); //since we need to add a point, we store the point in the smg... indexMap[reverseMap[hitSMG[1]][mdp->geometry[hitSMG[1]].primitives[0].indices[j]]] = ind; //we map the old point to the new point... reverseMap[hitSMG[0]][ind] = reverseMap[hitSMG[1]][mdp->geometry[hitSMG[1]].primitives[0].indices[j]]; //and map the new point in reverse to the old! - } + } mdp->geometry[hitSMG[0]].primitives[0].indices.push_back(indexMap[reverseMap[hitSMG[1]][mdp->geometry[hitSMG[1]].primitives[0].indices[j]]]); } //proper deletions mdp->geometry.erase(mdp->geometry.begin() + hitSMG[1]); //then, geometryInstance mdp->instances.erase(mdp->instances.begin() + hitSMG[1]); - for(int j = hitSMG[1]; j < mdp->instances.size(); j++) + for(uint32 j = hitSMG[1]; j < mdp->instances.size(); j++) mdp->instances[j].geometryIndex = j; //also, reverseMap reverseMap.erase(reverseMap.begin() + hitSMG[1]); //finally, hitSMG hitSMG.erase(hitSMG.begin() + 1); - for(int i = 1; i < hitSMG.size(); i++) hitSMG[i]--;//since we removed a hitSMG we have to lower the index of the other hits by one + for(uint32 i = 1; i < hitSMG.size(); i++) hitSMG[i]--;//since we removed a hitSMG we have to lower the index of the other hits by one } for(int j = 0; j < 3; j++) { //we put the point in @@ -356,7 +356,7 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat } mdp->geometry[hitSMG[0]].primitives[0].indices.push_back(indexMap[face[i][j]]); - + } } else { //otherwise, we'll make a new submeshgeometry/geometry set @@ -378,18 +378,18 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat } } } - + } //int fileCounter = 0; int mapCounter = 0; - for(int i = 0; i < mdp->geometry.size(); i++) { + for(uint32 i = 0; i < mdp->geometry.size(); i++) { //one texture set for the geometry if(tc[0][0] > 0) { Mesh::SubMeshGeometry::TextureSet ts; ts.stride = 2; - for(int j = 0; j < mdp->geometry[i].positions.size(); j++) { + for(uint32 j = 0; j < mdp->geometry[i].positions.size(); j++) { for(int k = 0; k < 2; k++) { ts.uvs.push_back(tc[reverseMap[i][j]][k]); } @@ -400,7 +400,7 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat if(faceNum > 0) { Mesh::MaterialEffectInfo::Texture t; bool hasTexture = false; - for(int j = 0; j < mdp->geometry[i].primitives[0].indices.size() && !hasTexture; j++) { + for(uint32 j = 0; j < mdp->geometry[i].primitives[0].indices.size() && !hasTexture; j++) { if((abs(tc[reverseMap[i][mdp->geometry[i].primitives[0].indices[j]]][0]) > .001 && abs(tc[reverseMap[i][mdp->geometry[i].primitives[0].indices[j]]][0]) < INT_MAX) || (abs(tc[reverseMap[i][mdp->geometry[i].primitives[0].indices[j]]][1]) > .001 && @@ -410,13 +410,13 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat //if the texCoords are all almost zero (or are infinite), then this is not a truly texturized geometry if(hasTexture && tc[reverseMap[i][mdp->geometry[i].primitives[0].indices[0]]][2] >= 0 - && tc[reverseMap[i][mdp->geometry[i].primitives[0].indices[0]]][2] < file.size()) { + && tc[reverseMap[i][mdp->geometry[i].primitives[0].indices[0]]][2] < file.size()) { //we add the texture and typical values mei.shininess = -128; mei.reflectivity = -1; bool newFile = true; - for(int l = 0; l < mdp->textures.size(); l++) + for(uint32 l = 0; l < mdp->textures.size(); l++) if(mdp->textures[l] == file[tc[reverseMap[i][mdp->geometry[i].primitives[0].indices[0]]][2]]) newFile = false; if(newFile) @@ -438,7 +438,7 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat } else { //we add a color Vector4f c; - if(mdp->geometry[i].primitives[0].primitiveType == Mesh::SubMeshGeometry::Primitive::TRIANGLES && + if(mdp->geometry[i].primitives[0].primitiveType == Mesh::SubMeshGeometry::Primitive::TRIANGLES && col[reverseMap[i][mdp->geometry[i].primitives[0].indices[0]]][0] >= 0) { //we might need a better check here if we get certain files c = Vector4f(col[reverseMap[i][mdp->geometry[i].primitives[0].indices[0]]][0] / 255.0, col[reverseMap[i][mdp->geometry[i].primitives[0].indices[0]]][1] / 255.0, @@ -454,14 +454,14 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat mei.textures.push_back(t); bool addMat = true; int matPos = -1; - for(int j = 0; j < mdp->materials.size(); j++) + for(uint32 j = 0; j < mdp->materials.size(); j++) if(mdp->materials[j] == mei) { addMat = false; matPos = j; } mdp->geometry[i].primitives[0].materialId = 1; //if there is not, we add it, otherwise we do not - if(addMat) { + if(addMat) { mdp->instances[i].materialBindingMap[mdp->geometry[i].primitives[0].materialId] = mapCounter; mapCounter++; mdp->materials.push_back(mei); @@ -470,7 +470,7 @@ Mesh::VisualPtr PlyModelSystem::load(const Transfer::RemoteFileMetadata& metadat } else mdp->materials.push_back(mei); } - + delete vert; delete col; delete face; @@ -496,4 +496,4 @@ bool PlyModelSystem::convertVisual(const Mesh::VisualPtr& visual, const String& NOT_IMPLEMENTED(mesh-ply); return false; } -} // namespace Sirikata \ No newline at end of file +} // namespace Sirikata diff --git a/test/unit/libcore/StrandTest.hpp b/test/unit/libcore/StrandTest.hpp index bcd68a13d..02cf51d0f 100644 --- a/test/unit/libcore/StrandTest.hpp +++ b/test/unit/libcore/StrandTest.hpp @@ -35,7 +35,7 @@ class StrandTest : public CxxTest::TestSuite { if (work != NULL) { delete work; work = NULL; } - for(int i = 0; i < threads.size(); i++) { + for(uint32 i = 0; i < threads.size(); i++) { threads[i]->join(); } threads.clear(); diff --git a/test/unit/libmesh/ColladaLoaderTest.hpp b/test/unit/libmesh/ColladaLoaderTest.hpp index 877635264..fce598047 100644 --- a/test/unit/libmesh/ColladaLoaderTest.hpp +++ b/test/unit/libmesh/ColladaLoaderTest.hpp @@ -90,7 +90,7 @@ class ColladaLoaderTest : public CxxTest::TestSuite //collada file with only a single line String line = getString("line"); MeshdataPtr mdp = loadMDP(line); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 1); @@ -114,7 +114,7 @@ class ColladaLoaderTest : public CxxTest::TestSuite //collada file with square (actually rectangle) String square = getString("square"); MeshdataPtr mdp = loadMDP(square); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 1); @@ -138,7 +138,7 @@ class ColladaLoaderTest : public CxxTest::TestSuite //collada file with square with two sides, one of which is specially texturized String square2s = getString("square2s"); MeshdataPtr mdp = loadMDP(square2s); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 1); @@ -152,7 +152,7 @@ class ColladaLoaderTest : public CxxTest::TestSuite TS_ASSERT_EQUALS(mdp->lights.size(), 0); TS_ASSERT_EQUALS(mdp->textures.size(), 1); TS_ASSERT_EQUALS(mdp->materials.size(), 2); - for(int i = 0; i < mdp->materials.size(); i++) + for(uint32 i = 0; i < mdp->materials.size(); i++) TS_ASSERT_EQUALS(mdp->materials[i].textures.size(), 1); TS_ASSERT_EQUALS(mdp->nodes.size(), 1); TS_ASSERT_EQUALS(mdp->nodes[0].transform, Matrix4x4f::identity()); @@ -163,7 +163,7 @@ class ColladaLoaderTest : public CxxTest::TestSuite //collada file with two-sided hexagon String hex2s = getString("hex2s"); MeshdataPtr mdp = loadMDP(hex2s); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 1); @@ -177,7 +177,7 @@ class ColladaLoaderTest : public CxxTest::TestSuite TS_ASSERT_EQUALS(mdp->lights.size(), 0); TS_ASSERT_EQUALS(mdp->textures.size(), 0); TS_ASSERT_EQUALS(mdp->materials.size(), 2); - for(int i = 0; i < mdp->materials.size(); i++) + for(uint32 i = 0; i < mdp->materials.size(); i++) TS_ASSERT_EQUALS(mdp->materials[i].textures.size(), 1); TS_ASSERT_EQUALS(mdp->nodes.size(), 1); TS_ASSERT_EQUALS(mdp->nodes[0].transform, Matrix4x4f::identity()); @@ -188,7 +188,7 @@ class ColladaLoaderTest : public CxxTest::TestSuite //collada file with cube (actually a rectangular prism) String cube = getString("cube"); MeshdataPtr mdp = loadMDP(cube); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 1); @@ -212,14 +212,14 @@ class ColladaLoaderTest : public CxxTest::TestSuite //collada file with three textured cubes of different rotations String cubes = getString("cubes"); MeshdataPtr mdp = loadMDP(cubes); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 3); TS_ASSERT_EQUALS(mdp->getInstancedLightCount(), 0); TS_ASSERT_EQUALS(mdp->getJointCount(), 0); TS_ASSERT_EQUALS(mdp->geometry.size(), 3); - for(int i = 0; i < mdp->geometry.size(); i++) { + for(uint32 i = 0; i < mdp->geometry.size(); i++) { TS_ASSERT_EQUALS(mdp->geometry[i].positions.size(), 24); TS_ASSERT_EQUALS(mdp->geometry[i].skinControllers.size(), 0); TS_ASSERT_EQUALS(mdp->geometry[i].primitives.size(), 1); @@ -237,14 +237,14 @@ class ColladaLoaderTest : public CxxTest::TestSuite //collada file with partially textured hexagonal prism String prism = getString("prism"); MeshdataPtr mdp = loadMDP(prism); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 3); TS_ASSERT_EQUALS(mdp->getInstancedLightCount(), 0); TS_ASSERT_EQUALS(mdp->getJointCount(), 0); TS_ASSERT_EQUALS(mdp->geometry.size(), 3); - for(int i = 0; i < mdp->geometry.size(); i++) { + for(uint32 i = 0; i < mdp->geometry.size(); i++) { TS_ASSERT_EQUALS(mdp->geometry[i].skinControllers.size(), 0); TS_ASSERT_EQUALS(mdp->geometry[i].primitives.size(), 1); } @@ -261,14 +261,14 @@ class ColladaLoaderTest : public CxxTest::TestSuite //collada file with two distinct texturized triangles String triangles = getString("triangles"); MeshdataPtr mdp = loadMDP(triangles); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 2); TS_ASSERT_EQUALS(mdp->getInstancedLightCount(), 0); TS_ASSERT_EQUALS(mdp->getJointCount(), 0); TS_ASSERT_EQUALS(mdp->geometry.size(), 2); - for(int i = 0; i < mdp->geometry.size(); i++) { + for(uint32 i = 0; i < mdp->geometry.size(); i++) { TS_ASSERT_EQUALS(mdp->geometry[i].positions.size(), 6); TS_ASSERT_EQUALS(mdp->geometry[i].skinControllers.size(), 0); TS_ASSERT_EQUALS(mdp->geometry[i].primitives.size(), 2); @@ -287,7 +287,7 @@ class ColladaLoaderTest : public CxxTest::TestSuite //collada file with two connected disjoint triangles in 3d String triangles3d = getString("triangles3d"); MeshdataPtr mdp = loadMDP(triangles3d); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 1); @@ -311,7 +311,7 @@ class ColladaLoaderTest : public CxxTest::TestSuite //collada file with one circle String circle = getString("circle"); MeshdataPtr mdp = loadMDP(circle); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 1); @@ -335,7 +335,7 @@ class ColladaLoaderTest : public CxxTest::TestSuite //collada file with one texturized circle String circleT = getString("circleT"); MeshdataPtr mdp = loadMDP(circleT); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 1); @@ -359,14 +359,14 @@ class ColladaLoaderTest : public CxxTest::TestSuite //collada file with two distinct circles String circles = getString("circles"); MeshdataPtr mdp = loadMDP(circles); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 2); TS_ASSERT_EQUALS(mdp->getInstancedLightCount(), 0); TS_ASSERT_EQUALS(mdp->getJointCount(), 0); TS_ASSERT_EQUALS(mdp->geometry.size(), 2); - for(int i = 0; i < mdp->geometry.size(); i++) { + for(uint32 i = 0; i < mdp->geometry.size(); i++) { TS_ASSERT_EQUALS(mdp->geometry[i].positions.size(), 24); TS_ASSERT_EQUALS(mdp->geometry[i].skinControllers.size(), 0); TS_ASSERT_EQUALS(mdp->geometry[i].primitives.size(), 1); @@ -385,14 +385,14 @@ class ColladaLoaderTest : public CxxTest::TestSuite //collada file with two distinct cylinders String cylinders = getString("cylinders"); MeshdataPtr mdp = loadMDP(cylinders); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 2); TS_ASSERT_EQUALS(mdp->getInstancedLightCount(), 0); TS_ASSERT_EQUALS(mdp->getJointCount(), 0); TS_ASSERT_EQUALS(mdp->geometry.size(), 2); - for(int i = 0; i < mdp->geometry.size(); i++) { + for(uint32 i = 0; i < mdp->geometry.size(); i++) { TS_ASSERT_EQUALS(mdp->geometry[i].positions.size(), 96); TS_ASSERT_EQUALS(mdp->geometry[i].skinControllers.size(), 0); TS_ASSERT_EQUALS(mdp->geometry[i].primitives.size(), 1); @@ -411,21 +411,21 @@ class ColladaLoaderTest : public CxxTest::TestSuite //collada file with pikachu String pikachu = getString("pikachu/pikachu"); MeshdataPtr mdp = loadMDP(pikachu); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 7); TS_ASSERT_EQUALS(mdp->getInstancedLightCount(), 0); TS_ASSERT_EQUALS(mdp->getJointCount(), 0); TS_ASSERT_EQUALS(mdp->geometry.size(), 7); - for(int i = 0; i < mdp->geometry.size(); i++) + for(uint32 i = 0; i < mdp->geometry.size(); i++) TS_ASSERT_EQUALS(mdp->geometry[i].skinControllers.size(), 0); TS_ASSERT_EQUALS(mdp->lights.size(), 0); TS_ASSERT_EQUALS(mdp->textures.size(), 1); TS_ASSERT_EQUALS(mdp->materials.size(), 1); TS_ASSERT_EQUALS(mdp->materials[0].textures.size(), 1); TS_ASSERT_EQUALS(mdp->nodes.size(), 3); - for(int i = 0; i < mdp->nodes.size(); i++) + for(uint32 i = 0; i < mdp->nodes.size(); i++) TS_ASSERT_EQUALS(mdp->nodes[i].transform, Matrix4x4f::identity()); } @@ -433,7 +433,7 @@ class ColladaLoaderTest : public CxxTest::TestSuite //collada file with drill String drill = getString("drill"); MeshdataPtr mdp = loadMDP(drill); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 1); @@ -455,7 +455,7 @@ class ColladaLoaderTest : public CxxTest::TestSuite //collada file with stanford bunny String bunny = getString("bunny"); MeshdataPtr mdp = loadMDP(bunny); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 1); @@ -485,8 +485,8 @@ class ColladaLoaderTest : public CxxTest::TestSuite MeshdataPtr mdp(std::tr1::dynamic_pointer_cast(parsed)); TS_ASSERT_EQUALS(mdp, MeshdataPtr()); } - - + + String getString(String name) { String result; //obtains string of information from the collada file rather than @@ -514,7 +514,7 @@ class ColladaLoaderTest : public CxxTest::TestSuite }while(fin && temp != ""); return result; } - + MeshdataPtr loadMDP(String thing) { //loads the MeshdataPtr from the collada string Transfer::DenseData *dd = new Transfer::DenseData(thing); diff --git a/test/unit/libmesh/DeduplicationTest.hpp b/test/unit/libmesh/DeduplicationTest.hpp index a08213bda..f262aa311 100644 --- a/test/unit/libmesh/DeduplicationTest.hpp +++ b/test/unit/libmesh/DeduplicationTest.hpp @@ -46,13 +46,13 @@ class DeduplicationTest : public CxxTest::TestSuite { protected: int _initialized; - String _plugin; + String _plugin; PluginManager _pmgr; ModelsSystem *msys; public: - void setUp( void ) + void setUp( void ) { //initialize plugin if (!_initialized) { @@ -78,14 +78,14 @@ class DeduplicationTest : public CxxTest::TestSuite string triangles = getString("triangles"); //before filtering MeshdataPtr mdp = loadMDP(triangles); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 4); TS_ASSERT_EQUALS(mdp->getInstancedLightCount(), 0); TS_ASSERT_EQUALS(mdp->getJointCount(), 0); TS_ASSERT_EQUALS(mdp->geometry.size(), 4); - for(int i = 0; i < mdp->geometry.size(); i++) { + for(uint32 i = 0; i < mdp->geometry.size(); i++) { TS_ASSERT_EQUALS(mdp->geometry[i].positions.size(), 3); TS_ASSERT_EQUALS(mdp->geometry[i].skinControllers.size(), 0); TS_ASSERT_EQUALS(mdp->geometry[i].primitives.size(), 1); @@ -101,14 +101,14 @@ class DeduplicationTest : public CxxTest::TestSuite //after filtering mdp = loadFilteredMDP(triangles); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 2); TS_ASSERT_EQUALS(mdp->getInstancedLightCount(), 0); TS_ASSERT_EQUALS(mdp->getJointCount(), 0); TS_ASSERT_EQUALS(mdp->geometry.size(), 2); - for(int i = 0; i < mdp->geometry.size(); i++) { + for(uint32 i = 0; i < mdp->geometry.size(); i++) { TS_ASSERT_EQUALS(mdp->geometry[i].positions.size(), 6); TS_ASSERT_EQUALS(mdp->geometry[i].skinControllers.size(), 0); TS_ASSERT_EQUALS(mdp->geometry[i].primitives.size(), 2); @@ -135,7 +135,7 @@ class DeduplicationTest : public CxxTest::TestSuite TS_ASSERT_EQUALS(mdp->getInstancedLightCount(), 0); TS_ASSERT_EQUALS(mdp->getJointCount(), 0); TS_ASSERT_EQUALS(mdp->geometry.size(), 2); - for(int i = 0; i < mdp->geometry.size(); i++) { + for(uint32 i = 0; i < mdp->geometry.size(); i++) { TS_ASSERT_EQUALS(mdp->geometry[i].positions.size(), 6); TS_ASSERT_EQUALS(mdp->geometry[i].skinControllers.size(), 0); TS_ASSERT_EQUALS(mdp->geometry[i].primitives.size(), 1); @@ -144,7 +144,7 @@ class DeduplicationTest : public CxxTest::TestSuite TS_ASSERT_EQUALS(mdp->lights.size(), 0); TS_ASSERT_EQUALS(mdp->textures.size(), 0); TS_ASSERT_EQUALS(mdp->materials.size(), 2); - for(int i = 0; i < mdp->materials.size(); i++) + for(uint32 i = 0; i < mdp->materials.size(); i++) TS_ASSERT_EQUALS(mdp->materials[i].textures.size(), 1); TS_ASSERT_EQUALS(mdp->nodes.size(), 1); TS_ASSERT_EQUALS(mdp->nodes[0].transform, Matrix4x4f::identity()); @@ -166,7 +166,7 @@ class DeduplicationTest : public CxxTest::TestSuite TS_ASSERT_EQUALS(mdp->lights.size(), 0); TS_ASSERT_EQUALS(mdp->textures.size(), 0); TS_ASSERT_EQUALS(mdp->materials.size(), 2); - for(int i = 0; i < mdp->materials.size(); i++) + for(uint32 i = 0; i < mdp->materials.size(); i++) TS_ASSERT_EQUALS(mdp->materials[i].textures.size(), 1); TS_ASSERT_EQUALS(mdp->nodes.size(), 1); TS_ASSERT_EQUALS(mdp->nodes[0].transform, Matrix4x4f::identity()); @@ -201,7 +201,7 @@ class DeduplicationTest : public CxxTest::TestSuite }while(fin); return result; } - + MeshdataPtr loadMDP(string thing) { //loads the MeshdataPtr from the ply string Transfer::DenseData *dd = new Transfer::DenseData(thing); diff --git a/test/unit/libmesh/PlyLoaderTest.hpp b/test/unit/libmesh/PlyLoaderTest.hpp index f2733a2a5..f1d8cd3f5 100644 --- a/test/unit/libmesh/PlyLoaderTest.hpp +++ b/test/unit/libmesh/PlyLoaderTest.hpp @@ -46,13 +46,13 @@ class PlyLoaderTest : public CxxTest::TestSuite { protected: int _initialized; - String _plugin; + String _plugin; PluginManager _pmgr; ModelsSystem *msys; public: - void setUp( void ) + void setUp( void ) { //initialize plugin if (!_initialized) { @@ -93,14 +93,14 @@ class PlyLoaderTest : public CxxTest::TestSuite //ply file with a line string line = getString("line"); MeshdataPtr mdp = loadMDP(line); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 1); TS_ASSERT_EQUALS(mdp->getInstancedLightCount(), 0); TS_ASSERT_EQUALS(mdp->getJointCount(), 0); TS_ASSERT_EQUALS(mdp->geometry.size(), 1); - TS_ASSERT_EQUALS(mdp->geometry[0].skinControllers.size(), 0); + TS_ASSERT_EQUALS(mdp->geometry[0].skinControllers.size(), 0); TS_ASSERT_EQUALS(mdp->geometry[0].primitives.size(), 1); TS_ASSERT_EQUALS(mdp->geometry[0].primitives[0].indices.size(), 2); TS_ASSERT_EQUALS(mdp->lights.size(), 0); @@ -111,7 +111,7 @@ class PlyLoaderTest : public CxxTest::TestSuite TS_ASSERT_EQUALS(mdp->nodes[0].transform, Matrix4x4f::identity()); TS_ASSERT_EQUALS(mdp->globalTransform, Matrix4x4f::identity()); } - + void testPlyLoaderSquare( void ) { //ply file with a square (actually a rectangle) string square = getString("square"); @@ -140,7 +140,7 @@ class PlyLoaderTest : public CxxTest::TestSuite //ply file with square with two sides, one of which is specially texturized string square2s = getString("square2s"); MeshdataPtr mdp = loadMDP(square2s); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 1); @@ -154,7 +154,7 @@ class PlyLoaderTest : public CxxTest::TestSuite TS_ASSERT_EQUALS(mdp->lights.size(), 0); TS_ASSERT_EQUALS(mdp->textures.size(), 1); TS_ASSERT_EQUALS(mdp->materials.size(), 2); - for(int i = 0; i < mdp->materials.size(); i++) + for(uint32 i = 0; i < mdp->materials.size(); i++) TS_ASSERT_EQUALS(mdp->materials[i].textures.size(), 1); TS_ASSERT_EQUALS(mdp->nodes.size(), 1); TS_ASSERT_EQUALS(mdp->nodes[0].transform, Matrix4x4f::identity()); @@ -165,14 +165,14 @@ class PlyLoaderTest : public CxxTest::TestSuite //ply file with three textured cubes of different rotations string cubes = getString("cubes"); MeshdataPtr mdp = loadMDP(cubes); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 3); TS_ASSERT_EQUALS(mdp->getInstancedLightCount(), 0); TS_ASSERT_EQUALS(mdp->getJointCount(), 0); TS_ASSERT_EQUALS(mdp->geometry.size(), 3); - for(int i = 0; i < mdp->geometry.size(); i++) { + for(uint32 i = 0; i < mdp->geometry.size(); i++) { TS_ASSERT_EQUALS(mdp->geometry[i].positions.size(), 24); TS_ASSERT_EQUALS(mdp->geometry[i].skinControllers.size(), 0); TS_ASSERT_EQUALS(mdp->geometry[i].primitives.size(), 1); @@ -190,14 +190,14 @@ class PlyLoaderTest : public CxxTest::TestSuite //ply file with partially textured hexagonal prism string prism = getString("prism"); MeshdataPtr mdp = loadMDP(prism); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 3); TS_ASSERT_EQUALS(mdp->getInstancedLightCount(), 0); TS_ASSERT_EQUALS(mdp->getJointCount(), 0); TS_ASSERT_EQUALS(mdp->geometry.size(), 3); - for(int i = 0; i < mdp->geometry.size(); i++) { + for(uint32 i = 0; i < mdp->geometry.size(); i++) { TS_ASSERT_EQUALS(mdp->geometry[i].skinControllers.size(), 0); TS_ASSERT_EQUALS(mdp->geometry[i].primitives.size(), 1); } @@ -214,7 +214,7 @@ class PlyLoaderTest : public CxxTest::TestSuite //ply file with one texturized circle string circleT = getString("circleT"); MeshdataPtr mdp = loadMDP(circleT); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 1); @@ -238,14 +238,14 @@ class PlyLoaderTest : public CxxTest::TestSuite //ply file with two distinct circles string circles = getString("circles"); MeshdataPtr mdp = loadMDP(circles); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 2); TS_ASSERT_EQUALS(mdp->getInstancedLightCount(), 0); TS_ASSERT_EQUALS(mdp->getJointCount(), 0); TS_ASSERT_EQUALS(mdp->geometry.size(), 2); - for(int i = 0; i < mdp->geometry.size(); i++) { + for(uint32 i = 0; i < mdp->geometry.size(); i++) { TS_ASSERT_EQUALS(mdp->geometry[i].positions.size(), 24); TS_ASSERT_EQUALS(mdp->geometry[i].skinControllers.size(), 0); TS_ASSERT_EQUALS(mdp->geometry[i].primitives.size(), 1); @@ -271,7 +271,7 @@ class PlyLoaderTest : public CxxTest::TestSuite TS_ASSERT_EQUALS(mdp->getInstancedLightCount(), 0); TS_ASSERT_EQUALS(mdp->getJointCount(), 0); TS_ASSERT_EQUALS(mdp->geometry.size(), 2); - for(int i = 0; i < mdp->geometry.size(); i++) { + for(uint32 i = 0; i < mdp->geometry.size(); i++) { TS_ASSERT_EQUALS(mdp->geometry[i].positions.size(), 96); TS_ASSERT_EQUALS(mdp->geometry[i].skinControllers.size(), 0); TS_ASSERT_EQUALS(mdp->geometry[i].primitives.size(), 1); @@ -293,7 +293,7 @@ class PlyLoaderTest : public CxxTest::TestSuite //also, this loads *very* slowly, showing the inefficiency of the ply plugin string drill = getString("drill/reconstruction/drill_shaft_zip"); MeshdataPtr mdp = loadMDP(drill); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 7); @@ -315,7 +315,7 @@ class PlyLoaderTest : public CxxTest::TestSuite //ply file with bunny string bunny = getString("bunny/reconstruction/bun_zipper_res4"); MeshdataPtr mdp = loadMDP(bunny); - + //asserts TS_ASSERT_DIFFERS(mdp, MeshdataPtr()); TS_ASSERT_EQUALS(mdp->getInstancedGeometryCount(), 1); @@ -374,7 +374,7 @@ class PlyLoaderTest : public CxxTest::TestSuite }while(fin); return result; } - + //MeshdataPtr loadMDP(string thing) { // //loads the MeshdataPtr from the ply string // Transfer::DenseData *dd = new Transfer::DenseData(thing);