Merge branch 'featureReaderPerformance' into 'master'
Feature reader performance Added minor Performance tweaks to the file Readers. Unittests on Linux work fine. compilation on Linux and Windows (vs2013) works fine. i could not run unittests on Windows, as i have no gtest on my dev machine. See merge request !1
This commit is contained in:
@@ -172,6 +172,8 @@ read_material(std::fstream& _in)
|
||||
std::string keyWrd;
|
||||
std::string textureName;
|
||||
|
||||
std::stringstream stream;
|
||||
|
||||
std::string key;
|
||||
Material mat;
|
||||
float f1,f2,f3;
|
||||
@@ -193,7 +195,8 @@ read_material(std::fstream& _in)
|
||||
if ( line.empty() )
|
||||
continue;
|
||||
|
||||
std::stringstream stream(line);
|
||||
stream.str(line);
|
||||
stream.clear();
|
||||
|
||||
stream >> keyWrd;
|
||||
|
||||
@@ -305,6 +308,8 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt)
|
||||
|
||||
std::string matname;
|
||||
|
||||
std::stringstream stream, lineData, tmp;
|
||||
|
||||
|
||||
// Options supplied by the user
|
||||
Options userOptions = _opt;
|
||||
@@ -329,7 +334,8 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt)
|
||||
continue;
|
||||
}
|
||||
|
||||
std::stringstream stream(line);
|
||||
stream.str(line);
|
||||
stream.clear();
|
||||
|
||||
stream >> keyWrd;
|
||||
|
||||
@@ -463,7 +469,8 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt)
|
||||
// read full line after detecting a face
|
||||
std::string faceLine;
|
||||
std::getline(stream,faceLine);
|
||||
std::stringstream lineData( faceLine );
|
||||
lineData.str( faceLine );
|
||||
lineData.clear();
|
||||
|
||||
FaceHandle fh;
|
||||
BaseImporter::VHandles faceVertices;
|
||||
@@ -484,7 +491,8 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt)
|
||||
if( found != std::string::npos ){
|
||||
|
||||
// read the index value
|
||||
std::stringstream tmp( vertex.substr(0,found) );
|
||||
tmp.str( vertex.substr(0,found) );
|
||||
tmp.clear();
|
||||
|
||||
// If we get an empty string this property is undefined in the file
|
||||
if ( vertex.substr(0,found).empty() ) {
|
||||
@@ -507,7 +515,8 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt)
|
||||
} else {
|
||||
|
||||
// last component of the vertex, read it.
|
||||
std::stringstream tmp( vertex );
|
||||
tmp.str( vertex );
|
||||
tmp.clear();
|
||||
tmp >> value;
|
||||
|
||||
// Clear vertex after finished reading the line
|
||||
|
||||
@@ -182,16 +182,18 @@ _OFFReader_::read_ascii(std::istream& _in, BaseImporter& _bi, Options& _opt) con
|
||||
{
|
||||
|
||||
|
||||
unsigned int i, j, k, l, idx;
|
||||
unsigned int nV, nF, dummy;
|
||||
OpenMesh::Vec3f v, n;
|
||||
OpenMesh::Vec2f t;
|
||||
OpenMesh::Vec3i c3;
|
||||
OpenMesh::Vec3f c3f;
|
||||
OpenMesh::Vec4i c4;
|
||||
OpenMesh::Vec4f c4f;
|
||||
BaseImporter::VHandles vhandles;
|
||||
VertexHandle vh;
|
||||
unsigned int i, j, k, l, idx;
|
||||
unsigned int nV, nF, dummy;
|
||||
OpenMesh::Vec3f v, n;
|
||||
OpenMesh::Vec2f t;
|
||||
OpenMesh::Vec3i c3;
|
||||
OpenMesh::Vec3f c3f;
|
||||
OpenMesh::Vec4i c4;
|
||||
OpenMesh::Vec4f c4f;
|
||||
BaseImporter::VHandles vhandles;
|
||||
VertexHandle vh;
|
||||
std::stringstream stream;
|
||||
std::string trash;
|
||||
|
||||
// read header line
|
||||
std::string header;
|
||||
@@ -227,13 +229,12 @@ _OFFReader_::read_ascii(std::istream& _in, BaseImporter& _bi, Options& _opt) con
|
||||
|
||||
int colorType = getColorType(line, options_.vertex_has_texcoord() );
|
||||
|
||||
std::stringstream stream( line );
|
||||
stream.str(line);
|
||||
stream.clear();
|
||||
|
||||
//perhaps read COLOR
|
||||
if ( options_.vertex_has_color() ){
|
||||
|
||||
std::string trash;
|
||||
|
||||
switch (colorType){
|
||||
case 0 : break; //no color
|
||||
case 1 : stream >> trash; break; //one int (isn't handled atm)
|
||||
@@ -315,9 +316,8 @@ _OFFReader_::read_ascii(std::istream& _in, BaseImporter& _bi, Options& _opt) con
|
||||
|
||||
int colorType = getColorType(line, false );
|
||||
|
||||
std::stringstream stream( line );
|
||||
|
||||
std::string trash;
|
||||
stream.str(line);
|
||||
stream.clear();
|
||||
|
||||
switch (colorType){
|
||||
case 0 : break; //no color
|
||||
|
||||
@@ -249,6 +249,9 @@ read_stla(std::istream& _in, BaseImporter& _bi, Options& _opt) const
|
||||
|
||||
std::string line;
|
||||
|
||||
std::string garbage;
|
||||
std::stringstream strstream;
|
||||
|
||||
bool facet_normal(false);
|
||||
|
||||
while( _in && !_in.eof() ) {
|
||||
@@ -265,9 +268,8 @@ read_stla(std::istream& _in, BaseImporter& _bi, Options& _opt) const
|
||||
|
||||
// Normal found?
|
||||
if (line.find("facet normal") != std::string::npos) {
|
||||
std::stringstream strstream(line);
|
||||
|
||||
std::string garbage;
|
||||
strstream.str(line);
|
||||
strstream.clear();
|
||||
|
||||
// facet
|
||||
strstream >> garbage;
|
||||
@@ -292,9 +294,9 @@ read_stla(std::istream& _in, BaseImporter& _bi, Options& _opt) const
|
||||
std::getline(_in, line);
|
||||
trimStdString(line);
|
||||
|
||||
std::stringstream strstream(line);
|
||||
strstream.str(line);
|
||||
strstream.clear();
|
||||
|
||||
std::string garbage;
|
||||
strstream >> garbage;
|
||||
|
||||
strstream >> v[0];
|
||||
|
||||
Reference in New Issue
Block a user