Changeset 14038 for OpenSceneGraph/branches/OpenSceneGraph3.2/src/osgPlugins/3ds/WriterCompareTriangle.cpp
 Timestamp:
 08/28/14 17:11:29 (4 days ago)
 Files:

 1 modified
Legend:
 Unmodified
 Added
 Removed

OpenSceneGraph/branches/OpenSceneGraph3.2/src/osgPlugins/3ds/WriterCompareTriangle.cpp
r13041 r14038 29 29 30 30 void 31 WriterCompareTriangle::setMaxMin( unsignedint & nbVerticesX,32 unsignedint & nbVerticesY,33 unsignedint & nbVerticesZ) const31 WriterCompareTriangle::setMaxMin(int & nbVerticesX, 32 int & nbVerticesY, 33 int & nbVerticesZ) const 34 34 { 35 static const unsignedint min = 1;36 static const unsignedint max = 5; // Number of blocks used to divide the scene (arbitrary but seems ok)37 nbVerticesX = osg::clampBetween< unsignedint>(nbVerticesX, min, max);38 nbVerticesY = osg::clampBetween< unsignedint>(nbVerticesY, min, max);39 nbVerticesZ = osg::clampBetween< unsignedint>(nbVerticesZ, min, max);35 static const int min = 1; 36 static const int max = 5; // Number of blocks used to divide the scene (arbitrary but seems ok) 37 nbVerticesX = osg::clampBetween<int>(nbVerticesX, min, max); 38 nbVerticesY = osg::clampBetween<int>(nbVerticesY, min, max); 39 nbVerticesZ = osg::clampBetween<int>(nbVerticesZ, min, max); 40 40 } 41 41 … … 46 46 static const float k = 1.3f; // Arbitrary constant multiplier for density computation ("simulates" nonuniform point distributions) 47 47 // Computes "density" of points, and thus the number of blocks to divide the mesh into 48 unsigned int nbVerticesX = static_cast<unsignedint>( (nbVertices * k) / (length.z() * length.y()) );49 unsigned int nbVerticesY = static_cast<unsignedint>( (nbVertices * k) / (length.z() * length.x()) );50 unsigned int nbVerticesZ = static_cast<unsignedint>( (nbVertices * k) / (length.x() * length.y()) );48 int nbVerticesX = static_cast<int>( (nbVertices * k) / (length.z() * length.y()) ); 49 int nbVerticesY = static_cast<int>( (nbVertices * k) / (length.z() * length.x()) ); 50 int nbVerticesZ = static_cast<int>( (nbVertices * k) / (length.x() * length.y()) ); 51 51 52 52 setMaxMin (nbVerticesX, nbVerticesY, nbVerticesZ); // This function prevent from cutting the scene in too many blocs … … 64 64 short yinc = 1; 65 65 short xinc = 1; 66 unsignedint y = 0;67 unsignedint x = 0;68 for ( unsignedint z = 0; z < nbVerticesZ; ++z)66 int y = 0; 67 int x = 0; 68 for (int z = 0; z < nbVerticesZ; ++z) 69 69 { 70 70 while (x < nbVerticesX && x >= 0)